-
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.
- Loading branch information
1 parent
104ed03
commit 0de14ae
Showing
5 changed files
with
100 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
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,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; | ||
} | ||
} |
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,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.