FindNationalChecksum() public method

Ejemplo n.º 1
0
 }
 print "\n";
 # get example iban
 $myIban = new IBAN($myCountry->IBANExample());
 # output example iban properties one by one
 print "Example IBAN: " . $myIban->HumanFormat() . "\n";
 print " - country  " . $myIban->Country() . "\n";
 print " - checksum " . $myIban->Checksum() . "\n";
 print " - bban     " . $myIban->BBAN() . "\n";
 print " - bank     " . $myIban->Bank() . "\n";
 print " - branch   " . $myIban->Branch() . "\n";
 print " - account  " . $myIban->Account() . "\n";
 $nationalchecksum = $myIban->NationalChecksum();
 print " - natcksum " . $nationalchecksum . "\n";
 # if a national checksum was present, validate it
 $supposed_checksum = $myIban->FindNationalChecksum();
 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
     if (!$myIban->VerifyNationalChecksum()) {
         print "    (ERROR: VerifyNationalChecksum({$iban}) did not validate!)\n";
         exit(1);
     } else {
         print "    (National checksum automatically validated.)\n";
     }
     # also check 'set' codepath