The validate_creditor_identifier Function

Purpose:Plausibility check for Creditor Identifier, as well as decomposition of the number into country code, Creditor Business Code, and National ID. Possible tests: the incorporated checksum, country designation (SEPA country), and the length.

result: 'passed' or 'failed' - for a formally valid or invalide Creditor Identifier.

return_code: the results of the checks performed, expressed as a single number. Not all possible checks are necessarily performed (see the other fields). The "return_code" is "0" if all the tests implemented for the county in question were performed and passed. Otherwise, the number is the sum of one or more of the following numbers: 512=incorrect length of the Creditor Identifier; 1024=invalid country code (not a SEPA country); 2048=ID checksum error (positions 3 and 4). If the return_code is 65536, then this means it is undefined. This should not happen, and we would be grateful for notification if 65536 is indeed returned.

checks: an array containing names of the checks performed (can contain elements such as "length" or "checksum").

country: the ISO country code (the first two digits of the identification number).

creditor_business_code: 3 digits specified by the creditor, for example a branch number.

national_id: the national ID number that identifies the creditor.

length_check: 'passed' or 'failed' - depending on if the length matches that expected for the specified country.

checksum_check: 'passed' or 'failed' (Correctness of the two digit checksum directly after the country code in the Creditor Identifier).