-
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.
corrected regex for svwz. delimiter are now svwz+ and ?30
- Loading branch information
Showing
5 changed files
with
127 additions
and
23 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
10 changes: 10 additions & 0 deletions
10
tests/Jejik/Tests/MT940/Fixture/document/K4262927_20200905-080000-952.txt
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,10 @@ | ||
:20:STARTUMS TA | ||
:25:28020050/1426292700 | ||
:28C:172/1 | ||
:60F:C200904EUR0, | ||
:61:2009040904C230,00N051NONREF | ||
:86:166?00GUTSCHRIFT?100004772?20EREF+SCP 100 / 0082002528?21SVWZ+D 8 | ||
03020001000145464 +?221000145463 Manthey,August?30OLBODEH2XXX?31D | ||
E59280200501422112100?32EWE VERTRIEB GmbH?35EWE VERTRIEB powerclo | ||
ud | ||
:65F:Dnullnull7414,3 |
28 changes: 14 additions & 14 deletions
28
tests/Jejik/Tests/MT940/Fixture/document/deutschebank.txt
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
:20:DEUTDEMMXXX | ||
:25:20070000/0123456601 | ||
:28C:00143/1 | ||
:60F:C200605EUR0,00 | ||
:61:2006080608D12,35 NRTIKREF+//2016021783252833 | ||
/OCMT/EUR11,85//CHGS/EUR0,50/ | ||
:86:109?00SEPA-LASTSCHR. RETOURE CORE?109075/629?20EREF+A1.200080779. | ||
400143254?21.4961336 KREF+SEPA-DA202006?2201221740-34972000-P1 MR | ||
EF+2?230852HW2723821 CRED+DE41EON0?240000129793 OAMT+11,85 SVWZ+? | ||
25SONSTIGE GRUENDE ENDABRECHN?26UNG NR. 500106875 ZU VERTRA?2d40 | ||
0143254, KUNDENNUM MER 2?2802227779?30CSDBDE71XXX?31DE50712345600 | ||
200691329?32TESTER?33EL | ||
:62F:C200608EUR0,00 | ||
- | ||
:20:DEUTDEMMXXX | ||
:25:20070000/0123456601 | ||
:28C:00143/1 | ||
:60F:C200605EUR0,00 | ||
:61:2006080608D12,35 NRTIKREF+//2016021783252833 | ||
/OCMT/EUR11,85//CHGS/EUR0,50/ | ||
:86:109?00SEPA-LASTSCHR. RETOURE CORE?109075/629?20EREF+A1.200080779. | ||
400143254?21.4961336 KREF+SEPA-DA202006?2201221740-34972000-P1 MR | ||
EF+2?230852HW2723821 CRED+DE41EON0?240000129793 OAMT+11,85 SVWZ+? | ||
25SONSTIGE GRUENDE ENDABRECHN?26UNG NR. 500106875 ZU VERTRA?2740 | ||
0143254, KUNDENNUM MER 2?2802227779?30CSDBDE71XXX?31DE50712345600 | ||
200691329?32TESTER?33EL | ||
:62F:C200608EUR0,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
96 changes: 96 additions & 0 deletions
96
tests/Jejik/Tests/MT940/Parser/OldenburgischeLandesbankTxTest.php
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,96 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Jejik\MT940 library | ||
* | ||
* Copyright (c) 2020 Powercloud GmbH <[email protected]> | ||
* Licensed under the MIT license | ||
* | ||
* For the full copyright and license information, please see the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Jejik\Tests\MT940\Parser; | ||
|
||
use Jejik\MT940\Reader; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Tests for Jejik\MT940\Parser\OldenburgischeLandesbank | ||
* | ||
* @author Dominic Richter <[email protected]> | ||
*/ | ||
class OldenburgischeLandesbankTxTest extends TestCase | ||
{ | ||
public $statements = []; | ||
|
||
/** | ||
* @throws \Jejik\MT940\Exception\NoParserFoundException | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$reader = new Reader(); | ||
$reader->addParser('OldenburgischeLandesbank', \Jejik\MT940\Parser\OldenburgischeLandesbank::class); | ||
$this->statements = $reader->getStatements(file_get_contents(__DIR__ . '/../Fixture/document/K4262927_20200905-080000-952.txt')); | ||
} | ||
|
||
public function testStatement() | ||
{ | ||
$this->assertCount(1, $this->statements, 'Assert counting statements.'); | ||
$statement = $this->statements[0]; | ||
|
||
$this->assertEquals('172/1', $statement->getNumber()); | ||
$this->assertEquals('28020050/1426292700', $statement->getAccount()->getNumber()); | ||
} | ||
|
||
public function testBalance() | ||
{ | ||
$balance = $this->statements[0]->getOpeningBalance(); | ||
$this->assertInstanceOf(\Jejik\MT940\Balance::class, $balance); | ||
$this->assertEquals('2020-09-04 00:00:00', $balance->getDate()->format('Y-m-d H:i:s')); | ||
$this->assertEquals('EUR', $balance->getCurrency()); | ||
$this->assertEquals(0, $balance->getAmount()); | ||
} | ||
|
||
public function testTransaction() | ||
{ | ||
$transactions = $this->statements[0]->getTransactions(); | ||
|
||
$this->assertCount(1, $transactions); | ||
|
||
$this->assertNull($transactions[0]->getContraAccount()); | ||
|
||
$this->assertEquals(230, $transactions[0]->getAmount()); | ||
$expectedDescription = "166?00GUTSCHRIFT?100004772?20EREF+SCP 100 / 0082002528?21SVWZ+D 8\r | ||
03020001000145464 +?221000145463 Manthey,August?30OLBODEH2XXX?31D\r | ||
E59280200501422112100?32EWE VERTRIEB GmbH?35EWE VERTRIEB powerclo\r | ||
ud"; | ||
$this->assertEquals($expectedDescription, $transactions[0]->getDescription()); | ||
$this->assertEquals('2020-09-04 00:00:00', $transactions[0]->getValueDate()->format('Y-m-d H:i:s'), 'Assert Value Date'); | ||
$this->assertEquals('2020-09-04 00:00:00', $transactions[0]->getBookDate()->format('Y-m-d H:i:s'), 'Assert Book Date'); | ||
|
||
$this->assertEquals("051", $transactions[0]->getCode()); | ||
$this->assertEquals("NONREF", $transactions[0]->getRef()); | ||
$this->assertEquals("NONREF", $transactions[0]->getBankRef()); | ||
|
||
$this->assertEquals('166', $transactions[0]->getGVC()); | ||
$this->assertEquals('GUTSCHRIFT', $transactions[0]->getTxText()); | ||
$this->assertEquals('0004772', $transactions[0]->getPrimanota()); | ||
$this->assertNull($transactions[0]->getExtCode()); | ||
|
||
$this->assertEquals('SCP 100 / 0082002528', $transactions[0]->getEref()); | ||
|
||
$this->assertEquals('OLBODEH2XXX', $transactions[0]->getBIC()); | ||
$this->assertEquals('DE59280200501422112100', $transactions[0]->getIBAN()); | ||
$this->assertEquals('EWE VERTRIEB GmbH', $transactions[0]->getAccountHolder()); | ||
|
||
$this->assertNull($transactions[0]->getKref()); | ||
$this->assertNull($transactions[0]->getMref()); | ||
$this->assertNull($transactions[0]->getCred()); | ||
$this->assertEquals('D 803020001000145464 +1000145463 Manthey,August', $transactions[0]->getSvwz()); | ||
//$this->assertEquals('DE12345678901234567890', $transactions[0]->getContraAccount()->getNumber()); | ||
//$this->assertEquals('Max Mustermann', $transactions[0]->getContraAccount()->getName()); | ||
} | ||
} |