Ejemplo n.º 1
0
 }
 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";
 $nationalchecksum = iban_get_nationalchecksum_part($iban);
 print " - natcksum " . $nationalchecksum . "\n";
 # if a national checksum was present, validate it
 $supposed_checksum = iban_find_nationalchecksum($iban);
 if ($supposed_checksum != '') {
     if ($supposed_checksum != $nationalchecksum) {
         print "    (INVALID! Should be '" . $supposed_checksum . "'!)\n";
         exit(1);
     } else {
         print "    (National checksum manually validated.)\n";
     }
 }
 # also check 'verify' codepath
 $result = iban_verify_nationalchecksum($iban);
 if ($result != '') {
     if ($result != true) {
         print "    (ERROR: iban_verify_nationalchecksum({$iban}) did not validate!)\n";
         exit(1);
     } else {
Ejemplo n.º 2
0
                            print ', or ';
                        }
                        print "'" . $suggestion . "'";
                        $done++;
                    }
                    print "?)";
                }
            }
        } else {
            print "ok";
            $result = iban_verify_nationalchecksum($iban);
            if ($result === '') {
                print " (no national checksum)";
            } elseif ($result != true) {
                print " (but national checksum FAILED! ";
                print "expected '" . iban_find_nationalchecksum($iban) . "', contains '" . iban_get_nationalchecksum_part($iban) . "'. bank code is '" . iban_get_bank_part($iban) . "')";
                $errors++;
            }
            #$parts = iban_get_parts($iban);
            #foreach($parts as $name=>$value) {
            # print "    $name: $value\n";
            #}
        }
        print "\n";
    }
}
if ($errors == 0) {
    exit(0);
}
exit(10 + $errors);
function usage()
Ejemplo n.º 3
0
 public function FindNationalChecksum()
 {
     return iban_find_nationalchecksum($this->iban);
 }