Skip to content

Commit

Permalink
fix issue dfridrich#2
Browse files Browse the repository at this point in the history
  • Loading branch information
czPechy committed Apr 7, 2018
1 parent e7a5bb8 commit f294787
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions Tests/IBANTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/*
* This file is part of the library "QRPlatba".
*
* (c) Dennis Fridrich <[email protected]>
*
* 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
);
}

}
4 changes: 2 additions & 2 deletions src/QRPlatba.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
}
Expand Down

0 comments on commit f294787

Please sign in to comment.