-
Notifications
You must be signed in to change notification settings - Fork 0
Class SclDirectory
Full name: \SKien\Sepa\SclDirectory
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)
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. |
Create SCL directory.
public SclDirectory::__construct(string $strDataPath = '')
Parameters:
Parameter | Type | Description |
---|---|---|
strDataPath |
string | path to the XML data file |
Return last error occured.
public SclDirectory::getError() : string
Return Type: string
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 $bToUCWords
parameter 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
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 $bToUCWords
parameter 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[]
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
Check, if the requested BIC exists.
public SclDirectory::isValidBIC(string $strBIC) : bool
Parameters:
Parameter | Type | Description |
---|---|---|
strBIC |
string |
Return Type: bool
Get the date the data has been updated last.
public SclDirectory::lastUpdated() : int
Return Type: int
date as unix timestamp
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:
build with phpDocumentor 3 using template phpdoc2githubwiki / (2021-08-31)