We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 75fc0a70 authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #147 from Adyen/develop-rik

#146 fallback if bcmod is not installed
parents f1a42d48 5b598e20
...@@ -86,11 +86,26 @@ class SepaValidator extends AbstractValidator ...@@ -86,11 +86,26 @@ class SepaValidator extends AbstractValidator
$newString .= $movedCharArray[$key]; $newString .= $movedCharArray[$key];
} }
if (bcmod($newString, '97') == 1) { if (function_exists("bcmod")) {
return true; return bcmod($newString, '97') == 1;
} else {
return false;
} }
/**
* if server does not support bcmoc then do this manually:
* http://au2.php.net/manual/en/function.bcmod.php#38474
*/
$x = $newString;
$y = "97";
$take = 5;
$mod = "";
do {
$a = (int)$mod . substr($x, 0, $take);
$x = substr($x, $take);
$mod = $a % $y;
} while (strlen($x));
return (int)$mod == 1;
} else { } else {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment