Skip to content

Class SclDirectory

Stefan Kientzler edited this page Aug 25, 2021 · 1 revision

Full name:     \SKien\Sepa\SclDirectory


This class represents the SCL directory provided by the 'Deutsche Bundesbank'.

The SCL directory contains all business identifier codes (BICs) that can be reached within the SEPA payment area. (https://www.bundesbank.de/en/tasks/payment-systems/rps/sepa-clearer/scl-directory/scl-directory-626672)

With this class, the data made available as a CSV file can be loaded from the Internet and saved in a XML file on the own server. The XML file contains a timestamp of the latest download that can be retrieved - so its on the user to decide, in which timespan he will update the informations. Optionally, this update process can be automated by specifying a time period.

The clas contains functionality to:

  • check, if a given BIC is valid
  • get the service provider name (bankname) to a given BIC
  • get a list of the payment service providers (all or filtered by country)

Overview

Method Description
__construct Create SCL directory.
getError Return last error occured.
getNameFromBIC Get the name of the provider to the given BIC.
getProviderList Get the list of provider names.
init Init the object.
isValidBIC Check, if the requested BIC exists.
lastUpdated Get the date the data has been updated last.
loadFromInternet Load the actual list from the internet.

Methods

__construct

Create SCL directory.

public SclDirectory::__construct(string $strDataPath = '')

Parameters:

Parameter Type Description
strDataPath string path to the XML data file

[go to top]


getError

Return last error occured.

public SclDirectory::getError() : string

Return Type: string

[go to top]


getNameFromBIC

Get the name of the provider to the given BIC.

public SclDirectory::getNameFromBIC(string $strBIC, bool $bToUCWords = false) : string

Since the provider names in the supported directory all in uppercase, this can be converted to upper case words by setting the $bToUCWordsparameter to true.

Parameters:

Parameter Type Description
strBIC string BIC to get the name for
bToUCWords bool convert the provider names to Uppercase Words

Return Type: string

name or empty string, if not exist

[go to top]


getProviderList

Get the list of provider names.

public SclDirectory::getProviderList(string $strCC = '', bool $bToUCWords = false) : string[]

Since the provider names in the supported directory all in uppercase, this can be converted to upper case words by setting the $bToUCWordsparameter to true.

Parameters:

Parameter Type Description
strCC string country code the list should be generated for (leave empty for full list)
bToUCWords bool convert the provider names to Uppercase Words

Return Type: string[]

[go to top]


init

Init the object.

public SclDirectory::init() : bool

If the XML data file already exist, it is checked if writable. If not, the datapath is checked if writable

Return Type: bool

false, if any error occur

[go to top]


isValidBIC

Check, if the requested BIC exists.

public SclDirectory::isValidBIC(string $strBIC) : bool

Parameters:

Parameter Type Description
strBIC string

Return Type: bool

[go to top]


lastUpdated

Get the date the data has been updated last.

public SclDirectory::lastUpdated() : int

Return Type: int

date as unix timestamp

[go to top]


loadFromInternet

Load the actual list from the internet.

public SclDirectory::loadFromInternet(int|string|null $interval = null) : bool

Since downloading and saving the data takes a certain amount of time and this list does not change constantly, an interval can be specified so that the data only is downloaded again after it has expired. The intervall can be specified as integer in seconds (according to a unix timestamp) or as string representing any `dateinterval´.

recommended values are 1..4 weeks (e.g. 'P2W' for 2 weeks).

Parameters:

Parameter Type Description
interval int | string | null

Return Type: bool

See Also:

[go to top]


Clone this wiki locally