|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Genkgo\TestCamt\Unit; |
|
4
|
|
|
|
|
5
|
|
|
use Genkgo\TestCamt\AbstractTestCase; |
|
6
|
|
|
use Genkgo\Camt\Camt053\MessageFormat; |
|
7
|
|
|
use Genkgo\Camt\DTO; |
|
8
|
|
|
|
|
9
|
|
|
class EntryIteratorTest extends AbstractTestCase |
|
10
|
|
|
{ |
|
11
|
|
|
protected function getDefaultMessage() |
|
12
|
|
|
{ |
|
13
|
|
|
$dom = new \DOMDocument('1.0', 'UTF-8'); |
|
14
|
|
|
$dom->load(__DIR__.'/Camt053/Stubs/camt053.v2.multi.statement.xml'); |
|
15
|
|
|
return (new MessageFormat\V02)->getDecoder()->decode($dom); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function testMultipleStatements() |
|
19
|
|
|
{ |
|
20
|
|
|
$message = $this->getDefaultMessage(); |
|
21
|
|
|
$entries = $message->getEntries(); |
|
22
|
|
|
|
|
23
|
|
|
$item = 0; |
|
24
|
|
|
foreach ($entries as $entry) { |
|
25
|
|
|
/* @var DTO\Entry $entry */ |
|
26
|
|
|
if ($item === 0) { |
|
27
|
|
|
$this->assertEquals(885, $entry->getAmount()->getAmount()); |
|
28
|
|
|
$this->assertEquals( |
|
29
|
|
|
'Transaction Description 1', |
|
30
|
|
|
$entry->getTransactionDetail()->getRemittanceInformation()->getMessage() |
|
|
|
|
|
|
31
|
|
|
); |
|
32
|
|
|
$this->assertEquals( |
|
33
|
|
|
'Company Name 1', |
|
34
|
|
|
$entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getName() |
|
35
|
|
|
); |
|
36
|
|
|
$this->assertEquals( |
|
37
|
|
|
'NL', |
|
38
|
|
|
$entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getAddress()->getCountry() |
|
39
|
|
|
); |
|
40
|
|
|
$this->assertEquals( |
|
41
|
|
|
'000000001', |
|
42
|
|
|
$entry->getTransactionDetail()->getReference()->getEndToEndId() |
|
43
|
|
|
); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
if ($item === 1) { |
|
47
|
|
|
$this->assertEquals(-700, $entry->getAmount()->getAmount()); |
|
48
|
|
|
$this->assertEquals( |
|
49
|
|
|
'Transaction Description 2', |
|
50
|
|
|
$entry->getTransactionDetail()->getRemittanceInformation()->getMessage() |
|
|
|
|
|
|
51
|
|
|
); |
|
52
|
|
|
$this->assertEquals( |
|
53
|
|
|
'Company Name 2', |
|
54
|
|
|
$entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getName() |
|
55
|
|
|
); |
|
56
|
|
|
$this->assertEquals( |
|
57
|
|
|
'FR', |
|
58
|
|
|
$entry->getTransactionDetail()->getRelatedParty()->getRelatedPartyType()->getAddress()->getCountry() |
|
59
|
|
|
); |
|
60
|
|
|
$this->assertEquals( |
|
61
|
|
|
'000000002', |
|
62
|
|
|
$entry->getTransactionDetail()->getReference()->getEndToEndId() |
|
63
|
|
|
); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
$item++; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.