Exemplo n.º 1
0
 print "[{$countrycode}: " . iban_country_get_country_name($countrycode) . "]\n";
 # output remaining country properties
 print "Is a SEPA member? ";
 if (iban_country_is_sepa($countrycode)) {
     print "Yes";
 } else {
     print "No";
 }
 print ".\n";
 # get example iban
 $iban = $country['iban_example'];
 # output example iban properties one by one
 print "Example IBAN: " . iban_to_human_format($iban) . "\n";
 print " - country  " . iban_get_country_part($iban) . "\n";
 print " - checksum " . iban_get_checksum_part($iban) . "\n";
 print " - bban     " . iban_get_bban_part($iban) . "\n";
 print " - bank     " . iban_get_bank_part($iban) . "\n";
 print " - branch   " . iban_get_branch_part($iban) . "\n";
 print " - account  " . iban_get_account_part($iban) . "\n";
 # output all properties
 #$parts = iban_get_parts($iban);
 #print_r($parts);
 # verify
 print "\nChecking validity... ";
 if (verify_iban($iban)) {
     print "IBAN {$iban} is valid.\n";
 } else {
     print "ERROR: IBAN {$iban} is invalid.\n";
     $errors++;
 }
 print "\n";
Exemplo n.º 2
0
function iban_get_account_part($iban)
{
    $iban = iban_to_machine_format($iban);
    $country = iban_get_country_part($iban);
    $start = iban_country_get_branchid_stop_offset($country);
    if ($start == '') {
        $start = iban_country_get_bankid_stop_offset($country);
    }
    if ($start != '') {
        $bban = iban_get_bban_part($iban);
        return substr($bban, $start + 1);
    }
    return '';
}
Exemplo n.º 3
0
function iban_get_nationalchecksum_part($iban)
{
    $iban = iban_to_machine_format($iban);
    $country = iban_get_country_part($iban);
    $start = iban_country_get_nationalchecksum_start_offset($country);
    if ($start == '') {
        return '';
    }
    $stop = iban_country_get_nationalchecksum_stop_offset($country);
    if ($stop == '') {
        return '';
    }
    $bban = iban_get_bban_part($iban);
    return substr($bban, $start, $stop - $start + 1);
}
Exemplo n.º 4
0
 public function BBAN()
 {
     return iban_get_bban_part($this->iban);
 }
Exemplo n.º 5
0
function _iban_nationalchecksum_implementation_tl($iban, $mode)
{
    if ($mode != 'set' && $mode != 'find' && $mode != 'verify') {
        return '';
    }
    # blank value on return to distinguish from correct execution
    $nationalchecksum = iban_get_nationalchecksum_part($iban);
    $bban = iban_get_bban_part($iban);
    $bban_less_checksum = substr($bban, 0, strlen($bban) - 2);
    $expected_nationalchecksum = _iso7064_mod97_10_generated($bban_less_checksum);
    if ($mode == 'find') {
        return $expected_nationalchecksum;
    } elseif ($mode == 'set') {
        return _iban_nationalchecksum_set($iban, $expected_nationalchecksum);
    } elseif ($mode == 'verify') {
        return $nationalchecksum == $expected_nationalchecksum;
    }
}