Overboekingen
Je kan een soort van een overboeking doen
This commit is contained in:
@ -21,12 +21,55 @@ class IBAN
|
||||
$newword = "";
|
||||
$wordarray = str_split($word);
|
||||
foreach ($wordarray as $v) {
|
||||
$newword .= ord(strtolower($v)) - 87;
|
||||
if(ctype_alpha($v)){
|
||||
$newword .= ord(strtolower($v)) - 87;
|
||||
}else{
|
||||
$newword .= $v;
|
||||
}
|
||||
}
|
||||
return $newword;
|
||||
}
|
||||
|
||||
|
||||
private function getCheckDigits($bignum){
|
||||
//Modulo staartdeling
|
||||
$modulo97 = (int)substr($bignum, 0, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 6, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 12, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 18, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$checkdigits = 98 - $modulo97;
|
||||
if (strlen($checkdigits) < 2) {
|
||||
$checkdigits = '0' . $checkdigits;
|
||||
}
|
||||
return $checkdigits;
|
||||
}
|
||||
|
||||
public function isValidIBAN($iban){
|
||||
$iban = str_replace(" ", "", $iban);
|
||||
$landcode = substr($iban, 0, 2);
|
||||
$controle = substr($iban, 2, 2);
|
||||
$identificatie = substr($iban, 4);
|
||||
$identificatie .= $landcode;
|
||||
$identificatie .= "00";
|
||||
$nummer = $this->wordToNumbers($identificatie);
|
||||
return $controle == $this->getCheckDigits($nummer);
|
||||
}
|
||||
|
||||
public function getRekeningNummer($iban){
|
||||
return substr(str_replace(" ", "", $iban), 8);
|
||||
}
|
||||
|
||||
public function getBank($iban){
|
||||
return substr(str_replace(" ", "", $iban), 4, 4);
|
||||
}
|
||||
|
||||
public function getLand($iban){
|
||||
return substr(str_replace(" ", "", $iban), 0, 2);
|
||||
}
|
||||
|
||||
public function getIBAN($rekeningnr)
|
||||
{
|
||||
$landcode = "NL"; // NL in vertaling
|
||||
@ -39,24 +82,7 @@ class IBAN
|
||||
$rekeningnr = str_pad($rekeningnr, 10, 0, STR_PAD_LEFT);
|
||||
|
||||
$bignum = $banknumber . $rekeningnr . $landnumber . "00";
|
||||
|
||||
$modulo97 = '';
|
||||
$checkdigits = '00';
|
||||
|
||||
// begin modulo staartdeling
|
||||
$modulo97 = (int)substr($bignum, 0, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 6, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 12, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 18, 6);
|
||||
$modulo97 = $modulo97 % 97;
|
||||
$checkdigits = 98 - $modulo97;
|
||||
// einde modulo staartdeling
|
||||
if (strlen($checkdigits) < 2) {
|
||||
$checkdigits = '0' . $checkdigits;
|
||||
}
|
||||
$checkdigits = $this->getCheckDigits($bignum);
|
||||
|
||||
$rekeningnrarr = str_split($rekeningnr, 4);
|
||||
return $landcode.$checkdigits." ".$bankcode." ".$rekeningnrarr[0]." ".$rekeningnrarr[1]." ".$rekeningnrarr[2];
|
||||
|
Reference in New Issue
Block a user