Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAL-1088-account-bank-names-bol #15

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.4] - 2024-07-17

### Added
- Bolivia bank accounts and bank names

## [1.1.3] - 2022-07-12

### Fixed
Expand Down
86 changes: 86 additions & 0 deletions src/Bo/BankNamesRepository.php
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',
];
}
52 changes: 52 additions & 0 deletions src/Bo/BoBankAccount.php
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;
}
}
42 changes: 42 additions & 0 deletions tests/Bo/BoBankAccountTest.php
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());
}
}
Loading