diff --git a/CHANGELOG.md b/CHANGELOG.md index e10de41..25d893f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.1.5] - 2024-07-24 + +### Fixed +- The length of the Bolivian account was changed from 22 to between 10-22 digits. + ## [1.1.4] - 2024-07-17 ### Added diff --git a/src/Bo/BoBankAccount.php b/src/Bo/BoBankAccount.php index 30cc042..5d15b54 100644 --- a/src/Bo/BoBankAccount.php +++ b/src/Bo/BoBankAccount.php @@ -25,7 +25,7 @@ public function getAccountTile(): string public function isValid(): bool { - if (preg_match('/^([a-zA-Z]{3})\+([0-9]{22})$/', $this->bank_account_number) !== 1) { + if (preg_match('/^([a-zA-Z]{3})\+([0-9]{10,22})$/', $this->bank_account_number) !== 1) { return false; } diff --git a/tests/Bo/BoBankAccountTest.php b/tests/Bo/BoBankAccountTest.php index e0ce65a..3b0778e 100644 --- a/tests/Bo/BoBankAccountTest.php +++ b/tests/Bo/BoBankAccountTest.php @@ -21,22 +21,23 @@ final class BoBankAccountTest extends TestCase public function testIsValid(): void { static::assertFalse((new BoBankAccount(''))->isValid()); - static::assertFalse((new BoBankAccount('111111111'))->isValid()); + static::assertFalse((new BoBankAccount('WQE+111111111'))->isValid()); static::assertFalse((new BoBankAccount('AAAAA0000'))->isValid()); - static::assertFalse((new BoBankAccount('01340946340001361695'))->isValid()); - static::assertFalse((new BoBankAccount('AAAAA0000'))->isValid()); - static::assertFalse((new BoBankAccount('01050194651194-079423'))->isValid()); - static::assertFalse((new BoBankAccount('01050194651194079423 More text?'))->isValid()); - static::assertTrue((new BoBankAccount('ASD+1234567891234567891234'))->isValid()); + static::assertFalse((new BoBankAccount('ASD+013409'))->isValid()); + static::assertFalse((new BoBankAccount('ASD+0105019465114-07'))->isValid()); + static::assertFalse((new BoBankAccount('ASD+0105019465119407 More text?'))->isValid()); + static::assertFalse((new BoBankAccount('ASD+12345678913423511616123'))->isValid()); + static::assertTrue((new BoBankAccount('ASD+1234567891342351161612'))->isValid()); + static::assertTrue((new BoBankAccount('ASD+2345678912'))->isValid()); } public function testBankName(): void { - static::assertNull((new BoBankAccount('00050194697194012294'))->getBankName()); + static::assertNull((new BoBankAccount('00050194697194'))->getBankName()); } public function testAccountTile(): void { - static::assertSame('CCI', (new BoBankAccount('01050194697194012294'))->getAccountTile()); + static::assertSame('CCI', (new BoBankAccount('01050194697194'))->getAccountTile()); } }