Skip to content

Commit

Permalink
BE-155-agregar-col-bank-account
Browse files Browse the repository at this point in the history
  • Loading branch information
ahumadamatias authored Jun 4, 2021
1 parent 104ed03 commit 0de14ae
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
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.0] - 2021-06-04

### Added
- Colombia bank accounts

### Changed
- README example.
- `composer test`
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Based on [ISO alpha 2 characters](https://www.nationsonline.org/oneworld/country
* Argentina (AR)
* México (MX)
* Venezuela (VE)
* Colombia (CO)

## Development

Expand Down
54 changes: 54 additions & 0 deletions src/Co/CoBankAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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\Co;

use BankAccounts\BankAccount;
use BankAccounts\BankAccountInterface;

/**
* @author Pablo Gabriel Reyes
*
* @see https://pabloreyes.com.ar/ Blog
*/
class CoBankAccount extends BankAccount implements BankAccountInterface
{
public function __construct(string $bank_account_number)
{
$this->bank_account_number = $bank_account_number;
}

public function getAccountTile(): string
{
return 'Cuenta';
}

public function isValid(): bool
{
if (!preg_match('/^[0-9]{11,12}$/', $this->bank_account_number)) {
return false;
}

return true;
}

public function getBankId(): ?string
{
return '';
}

public function getBankName(): ?string
{
return null;
}

public function getInternalBankAccountNumber(): ?string
{
return null;
}
}
40 changes: 40 additions & 0 deletions tests/Co/CoBankAccountTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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\Ar;

use BankAccounts\Co\CoBankAccount;
use PHPUnit\Framework\TestCase;

/**
* @author Pablo Gabriel Reyes
*
* @see https://pabloreyes.com.ar/ Blog
* @see https://github.com/pablorsk/cbu-validator-php CBU validator on GitHub
*
* @covers \BankAccounts\Co\CoBankAccount
*
* @internal
*/
final class CoBankAccountTest extends TestCase
{
public function testIsValid()
{
static::assertFalse((new CoBankAccount('alias'))->isValid());
static::assertFalse((new CoBankAccount('48841394'))->isValid());
static::assertFalse((new CoBankAccount('48841394alias'))->isValid());
static::assertFalse((new CoBankAccount('4884139412681121'))->isValid());
static::assertTrue((new CoBankAccount('488413941268'))->isValid());
static::assertTrue((new CoBankAccount('81681291890'))->isValid());
}

public function testGetAccountTitle()
{
static::assertSame('Cuenta', (new CoBankAccount('488413941268'))->getAccountTile());
}
}
File renamed without changes.

0 comments on commit 0de14ae

Please sign in to comment.