1 | <?php |
||
12 | abstract class CreditTransfer |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $instructionId; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $endToEndId; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $creditorName; |
||
28 | |||
29 | /** |
||
30 | * @var PostalAddressInterface |
||
31 | */ |
||
32 | protected $creditorAddress; |
||
33 | |||
34 | /** |
||
35 | * @var Money |
||
36 | */ |
||
37 | protected $amount; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $remittanceInformation; |
||
43 | |||
44 | /** |
||
45 | * Constructor |
||
46 | * |
||
47 | * @param string $instructionId Identifier of the instruction (should be unique within the message) |
||
48 | * @param string $endToEndId End-To-End Identifier of the instruction (passed unchanged along the complete processing chain) |
||
49 | * @param Money $amount Amount of money to be transferred |
||
50 | * @param string $creditorName Name of the creditor |
||
51 | * @param PostalAddressInterface $creditorAddress Address of the creditor |
||
52 | */ |
||
53 | 2 | public function __construct($instructionId, $endToEndId, Money $amount, $creditorName, PostalAddressInterface $creditorAddress) |
|
62 | |||
63 | /** |
||
64 | * Sets the unstructured remittance information |
||
65 | * |
||
66 | * @param string|null $remittanceInformation |
||
67 | * |
||
68 | * @return CreditTransfer This credit transfer |
||
69 | */ |
||
70 | public function setRemittanceInformation($remittanceInformation) |
||
76 | |||
77 | /** |
||
78 | * Gets the instructed amount of this transaction |
||
79 | * |
||
80 | * @return Money The instructed amount |
||
81 | */ |
||
82 | 2 | public function getAmount() |
|
86 | |||
87 | /** |
||
88 | * Builds a DOM tree of this transaction |
||
89 | * |
||
90 | * @param \DOMDocument $doc |
||
91 | * @param PaymentInformation $paymentInformation Information on B-level |
||
92 | * |
||
93 | * @return \DOMElement The built DOM tree |
||
94 | */ |
||
95 | abstract public function asDom(\DOMDocument $doc, PaymentInformation $paymentInformation); |
||
96 | |||
97 | /** |
||
98 | * Builds a DOM tree of this transaction and adds header nodes |
||
99 | * |
||
100 | * @param \DOMDocument $doc |
||
101 | * @param PaymentInformation $paymentInformation The corresponding B-level element |
||
102 | * @param string|null $localInstrument Local instrument |
||
103 | * @param string|null $serviceLevel Service level |
||
104 | * |
||
105 | * @return \DOMNode The built DOM node |
||
106 | */ |
||
107 | 2 | protected function buildHeader(\DOMDocument $doc, PaymentInformation $paymentInformation, $localInstrument = null, $serviceLevel = null) |
|
146 | |||
147 | /** |
||
148 | * Builds a DOM node of the Creditor field |
||
149 | * |
||
150 | * @param \DOMDocument $doc |
||
151 | * |
||
152 | * @return \DOMNode The built DOM node |
||
153 | */ |
||
154 | 2 | protected function buildCreditor(\DOMDocument $doc) |
|
162 | |||
163 | /** |
||
164 | * Indicates whether remittance information is set |
||
165 | * |
||
166 | * @return bool true if remittance information is set |
||
167 | */ |
||
168 | 2 | protected function hasRemittanceInformation() |
|
172 | |||
173 | /** |
||
174 | * Builds a DOM node of the Remittance Information field |
||
175 | * |
||
176 | * @param \DOMDocument $doc |
||
177 | * |
||
178 | * @return \DOMNode The built DOM node |
||
179 | * |
||
180 | * @throws \LogicException When no remittance information is set |
||
181 | */ |
||
182 | protected function buildRemittanceInformation(\DOMDocument $doc) |
||
193 | } |
||
194 |