-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adjust eref information for the ING bank. This bank gives the payment information in both the /EREF/ field and the /REMI/USTD// field. * Add BNP Paribas bank
- Loading branch information
Showing
4 changed files
with
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jejik\MT940\Parser; | ||
|
||
/** | ||
* Class Paribas | ||
* @package Jejik\MT940\Parser | ||
*/ | ||
class Paribas extends GermanBank | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getAllowedBLZ(): array | ||
{ | ||
return [51210600]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function accept(string $text): bool | ||
{ | ||
$allowedUniqueIdentifiers = [ | ||
':20:TELEREPORTING' | ||
]; | ||
|
||
$mt940Identifier = substr($text, 0, 17); | ||
if (in_array($mt940Identifier, $allowedUniqueIdentifiers)) { | ||
return true; | ||
} | ||
|
||
return $this->isBLZAllowed($text); | ||
} | ||
} |
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,22 @@ | ||
:20:TELEREPORTING | ||
:21:TELEREPORTING | ||
:25:12345678/0123456789EUR | ||
:28C:00001/00001 | ||
:60F:C240731EUR0,00 | ||
:61:2408010801D10,00NCOMNONREF//TB-CA-TB001ZQ0 | ||
BNPP Fees - 202408DE00292772 | ||
:86:808?00ENTGELTE / FEES?20BNPP Fees - 202408DE1234567?212 - 07/2024 | ||
/?32INVOICE | ||
:62F:D240801EUR10,00 | ||
- | ||
:20:TELEREPORTING | ||
:21:TELEREPORTING | ||
:25:51210600/3023166036EUR | ||
:28C:00001/00001 | ||
:60F:C240731EUR0,00 | ||
:61:2408010801D10,00NCOMNONREF//TB-CA-TB001ZQ0 | ||
BNPP Fees - 202408DE00292772 | ||
:86:808?00ENTGELTE / FEES?20BNPP Fees - 202408DE1234567?212 - 07/2024 | ||
/?32INVOICE | ||
:62F:D240801EUR10,00 | ||
- |
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,79 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jejik\Tests\MT940\Parser; | ||
|
||
use Jejik\MT940\Reader; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class ParibasTest | ||
* @package Jejik\Tests\MT940\Parser | ||
*/ | ||
class ParibasTest extends TestCase | ||
{ | ||
public $statements = []; | ||
|
||
/** | ||
* @throws \Jejik\MT940\Exception\NoParserFoundException | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$reader = new Reader(); | ||
$reader->addParser('Paribas', \Jejik\MT940\Parser\Paribas::class); | ||
$this->statements = $reader->getStatements(file_get_contents(__DIR__ . '/../Fixture/document/paribas.txt')); | ||
} | ||
|
||
public function testStatement() | ||
{ | ||
$this->assertCount(2, $this->statements); | ||
$statement = $this->statements[0]; | ||
|
||
$this->assertEquals('00001/00001', $statement->getNumber()); | ||
$this->assertNotNull($statement->getAccount()); | ||
$this->assertEquals('12345678/0123456789EUR', $statement->getAccount()->getNumber()); | ||
} | ||
|
||
public function testBalance() | ||
{ | ||
$balance = $this->statements[0]->getOpeningBalance(); | ||
$this->assertInstanceOf(\Jejik\MT940\Balance::class, $balance); | ||
$this->assertEquals('2024-07-31 00:00:00', $balance->getDate()->format('Y-m-d H:i:s')); | ||
$this->assertEquals('EUR', $balance->getCurrency()); | ||
$this->assertEquals(0, $balance->getAmount()); | ||
|
||
$closingBalance = $this->statements[0]->getClosingBalance(); | ||
$this->assertInstanceOf(\Jejik\MT940\Balance::class, $closingBalance); | ||
$this->assertEquals('2024-08-01 00:00:00', $closingBalance->getDate()->format('Y-m-d H:i:s')); | ||
$this->assertEquals('EUR', $closingBalance->getCurrency()); | ||
$this->assertEquals(-10, $closingBalance->getAmount()); | ||
} | ||
|
||
public function testTransaction() | ||
{ | ||
$transactions = $this->statements[0]->getTransactions(); | ||
$this->assertCount(1, $transactions); | ||
|
||
$this->assertNull($transactions[0]->getContraAccount()); | ||
$this->assertEquals(-10.00, $transactions[0]->getAmount()); | ||
$expected = "808?00ENTGELTE / FEES?20BNPP Fees - 202408DE1234567?212 - 07/2024\r\n/?32INVOICE"; | ||
$this->assertEquals($expected, $transactions[0]->getDescription()); | ||
$this->assertEquals('2024-08-01 00:00:00', $transactions[0]->getValueDate()->format('Y-m-d H:i:s'), 'Assert Value Date'); | ||
$this->assertEquals('2024-08-01 00:00:00', $transactions[0]->getBookDate()->format('Y-m-d H:i:s'), 'Assert Book Date'); | ||
$this->assertEquals('COM', $transactions[0]->getCode()); | ||
$this->assertEquals('NONREF', $transactions[0]->getRef()); | ||
$this->assertEquals('TB', $transactions[0]->getBankRef()); | ||
$this->assertEquals('808', $transactions[0]->getGVC()); | ||
$this->assertEquals('ENTGELTE', $transactions[0]->getTxText()); | ||
$this->assertEquals( | ||
null, | ||
$transactions[0]->getEref() | ||
); | ||
$this->assertNull($transactions[0]->getExtCode()); | ||
$this->assertEquals(null, $transactions[0]->getBIC()); | ||
$this->assertEquals(null, $transactions[0]->getIBAN()); | ||
$this->assertEquals(INVOICE, $transactions[0]->getAccountHolder()); | ||
$this->assertEquals('BNPP Fees - 202408DE12345672 - 07/2024/', $transactions[0]->getRawSubfieldsData()); | ||
} | ||
} |