-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAL-1088-account-bank-names-bol (#15)
- Loading branch information
1 parent
b000c1d
commit 83c0dce
Showing
4 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 1997-2020 Reyesoft <[email protected]>. | ||
* | ||
* This file is part of Saldo.com.ar. Saldo.com.ar can not be copied and/or | ||
* distributed without the express permission of Reyesoft | ||
*/ | ||
|
||
namespace BankAccounts\Bo; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class BankNamesRepository | ||
{ | ||
public const NAMES = [ | ||
'BNB' => 'Banco Nacional de Bolivia S.A.', | ||
'BME' => 'Banco Mercantil Santa Cruz S.A.', | ||
'BIS' => 'Banco Bisa S.A.', | ||
'BCR' => 'Banco de Crédito de Bolivia S.A.', | ||
'BEC' => 'Banco Económico S.A.', | ||
'BGA' => 'Banco Ganadero S.A.', | ||
'BSO' => 'Banco Solidario S.A.', | ||
'BNA' => 'Banco de la Nación Argentina', | ||
'BIE' => 'Banco para el Fomento a Iniciativas Económicas S.A.', | ||
'BFO' => 'Banco Fortaleza S.A.', | ||
'BPR' => 'Banco Prodem S.A.', | ||
'BPY' => 'Bancos PYME', | ||
'PCO' => 'Banco PYME de la Comunidad S.A.', | ||
'PEF' => 'Banco PYME Ecofuturo S.A.', | ||
'BDR' => 'Banco de Desarrollo Productivo S.A.M.', | ||
'BUN' => 'Banco Unión S.A.', | ||
'VL1' => 'La Primera Entidad Financiera de Vivienda', | ||
'VPR' => 'La Promotora Entidad Financiera de Vivienda', | ||
'VPG' => 'El Progreso Entidad Financiera de Vivienda', | ||
'CJN' => 'Coop. “Jesús Nazareno” R.L.', | ||
'CFA' => 'Coop. “Fátima” R.L.', | ||
'CSM' => 'Coop. “San Martín de Porres” R.L.', | ||
'CSA' => 'Coop. “San Antonio” R.L.', | ||
'CIH' => 'Coop. “Inca Huasi” R.L.', | ||
'CQC' => 'Coop. “Quillacollo” R.L.', | ||
'CJP' => 'Coop. “San José de Punata” R.L.', | ||
'CMM' => 'Coop. “Madre y Maestra” R.L.', | ||
'CLY' => 'Coop. “Loyola” R.L.', | ||
'CPX' => 'Coop. “Pío” X R.L.', | ||
'CCR' => 'Coop. “El Chorolque” R.L.', | ||
'CSP' => 'Coop. “San Pedro” R.L.', | ||
'CCP' => 'Coop. “Catedral" R.L.', | ||
'CCM' => 'Coop. “Comarapa” R.L.', | ||
'CTR' => 'Coop. “Trinidad” R.L.', | ||
'CEC' => 'Coop. “Educadores Gran Chaco” R.L.', | ||
'CST' => 'Coop. “San Mateo” R.L.', | ||
'CMG' => 'Coop. “Monseñor Félix Gainza” R.L.', | ||
'CMR' => 'Coop. “Magisterio Rural” R.L.', | ||
'CJB' => 'Coop. “San José de Bermejo” R.L.', | ||
'CJO' => 'Coop. “San Joaquín” R.L.', | ||
'CSR' => 'Coop. “San Roque” R.L.', | ||
'CAS' => 'Coop. “Asunción” R.L.', | ||
'CCA' => 'Coop. “Catedral de Tarija” R.L.', | ||
'CME' => 'Coop. “La Merced” R.L.', | ||
'CCB' => 'Coop. “San Carlos Borromeo” R.L.', | ||
'CCF' => 'Coop. “CACEF” R.L.', | ||
'CPG' => 'Coop. “Progreso” R.L.', | ||
'CLS' => 'Coop. “La Sagrada Familia” R.L.', | ||
'CMD' => 'Coop. “Magisterio Rural de Chuquisaca” R.L.', | ||
'CSN' => 'Coop. “San Martín” R.L.', | ||
'CSQ' => 'Coop. “San Pedro de Aiquile” R.L.', | ||
'CVE' => 'Coop. “Virgen de los Remedios” R.L.', | ||
'CLO' => 'Coop. “San Francisco Solano” R.L.', | ||
'CLC' => 'Coop. “Solucredit San Silvestre” R.L.', | ||
'COO' => 'Coop. “COOPROLE” R.L.', | ||
'CEY' => 'Coop. “Cristo Rey Cochabamba” R.L.', | ||
'CPS' => 'Coop. “Paulo VI” R.L.', | ||
'CUM' => 'Coop. “Unión Santiago de Machaca USAMA” R.L.', | ||
'CAE' => 'Coop. “Cantera” R.L.', | ||
'CHO' => 'Coop. “Hospicio” R.L.', | ||
'ICI' => 'Institución Financiera de Desarrollo CIDRE IFD', | ||
'ICR' => 'Institución Financiera de Desarrollo CRECER IFD', | ||
'IDI' => 'Institución Financiera de Desarrollo DIACONÍA FRID - IFD', | ||
'IFO' => 'Institución Financiera de Desarrollo FONDECO IFD', | ||
'IFU' => 'Institución Financiera de Desarrollo FUBODE IFD', | ||
'IID' => 'Institución Financiera de Desarrollo IDEPRO IFD', | ||
'IIM' => 'Institución Financiera de Desarrollo IMPRO IFD', | ||
'IPM' => 'Institución Financiera de Desarrollo Fundación PRO MUJER IFD', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 1997-2020 Reyesoft <[email protected]>. | ||
* | ||
* This file is part of Saldo.com.ar. Saldo.com.ar can not be copied and/or | ||
* distributed without the express permission of Reyesoft | ||
*/ | ||
|
||
namespace BankAccounts\Bo; | ||
|
||
use BankAccounts\BankAccount; | ||
use BankAccounts\BankAccountInterface; | ||
|
||
class BoBankAccount extends BankAccount implements BankAccountInterface | ||
{ | ||
public function __construct(string $cci) | ||
{ | ||
$this->bank_account_number = $cci; | ||
} | ||
|
||
public function getAccountTile(): string | ||
{ | ||
return 'CCI'; | ||
} | ||
|
||
public function isValid(): bool | ||
{ | ||
if (preg_match('/^([a-zA-Z]{3})\+([0-9]{22})$/', $this->bank_account_number) !== 1) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public function getBankId(): ?string | ||
{ | ||
return substr($this->bank_account_number, 0, 3); | ||
} | ||
|
||
public function getBankName(): ?string | ||
{ | ||
$id = self::getBankId(); | ||
|
||
return BankNamesRepository::NAMES[$id] ?? null; | ||
} | ||
|
||
/** @codeCoverageIgnore */ | ||
public function getInternalBankAccountNumber(): ?string | ||
{ | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 1997-2020 Reyesoft <[email protected]>. | ||
* | ||
* This file is part of Saldo.com.ar. Saldo.com.ar can not be copied and/or | ||
* distributed without the express permission of Reyesoft | ||
*/ | ||
|
||
namespace Tests\Bo; | ||
|
||
use BankAccounts\Bo\BoBankAccount; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \BankAccounts\Bo\BoBankAccount | ||
* | ||
* @internal | ||
*/ | ||
final class BoBankAccountTest extends TestCase | ||
{ | ||
public function testIsValid(): void | ||
{ | ||
static::assertFalse((new BoBankAccount(''))->isValid()); | ||
static::assertFalse((new BoBankAccount('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()); | ||
} | ||
|
||
public function testBankName(): void | ||
{ | ||
static::assertNull((new BoBankAccount('00050194697194012294'))->getBankName()); | ||
} | ||
|
||
public function testAccountTile(): void | ||
{ | ||
static::assertSame('CCI', (new BoBankAccount('01050194697194012294'))->getAccountTile()); | ||
} | ||
} |