diff --git a/Tests/IBANTest.php b/Tests/IBANTest.php new file mode 100644 index 0000000..d0b6e0b --- /dev/null +++ b/Tests/IBANTest.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, + * please view LICENSE. + */ + +use Defr\QRPlatba\QRPlatba; + +/** + * Class QRPlatbaTest. + */ +class IBANTest extends PHPUnit_Framework_TestCase +{ + + public function testAccountHigherThanMaxInt() + { + $string = QRPlatba::accountToIban('2501301193/2010'); + + $this->assertSame( + 'CZ3620100000002501301193', + $string + ); + } + +} diff --git a/src/QRPlatba.php b/src/QRPlatba.php index d838702..9507f62 100644 --- a/src/QRPlatba.php +++ b/src/QRPlatba.php @@ -346,7 +346,7 @@ public static function accountToIban($accountNumber) list($pre, $acc) = explode('-', $accountNumber[0]); } - $accountPart = sprintf('%06d%010d', $pre, $acc); + $accountPart = sprintf('%06d%010s', $pre, $acc); $iban = 'CZ00'.$bank.$accountPart; $alfa = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'; @@ -360,7 +360,7 @@ public static function accountToIban($accountNumber) mb_substr($iban, 4, mb_strlen($iban) - 4).mb_substr($iban, 0, 2).'00' ); $controlegetal = 98 - (int) bcmod($controlegetal, 97); - $iban = sprintf('CZ%02d%04d%06d%010d', $controlegetal, $bank, $pre, $acc); + $iban = sprintf('CZ%02d%04d%06d%010s', $controlegetal, $bank, $pre, $acc); return $iban; }