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 $localInstrument; |
||
43 | |||
44 | /** |
||
45 | * @var string|null |
||
46 | */ |
||
47 | protected $serviceLevel; |
||
48 | |||
49 | /** |
||
50 | * @var PurposeCode|null |
||
51 | */ |
||
52 | protected $purpose; |
||
53 | |||
54 | /** |
||
55 | * @var string|null |
||
56 | */ |
||
57 | protected $remittanceInformation; |
||
58 | |||
59 | /** |
||
60 | * Constructor |
||
61 | * |
||
62 | * @param string $instructionId Identifier of the instruction (should be unique within the message) |
||
63 | * @param string $endToEndId End-To-End Identifier of the instruction (passed unchanged along the complete processing chain) |
||
64 | * @param Money $amount Amount of money to be transferred |
||
65 | * @param string $creditorName Name of the creditor |
||
66 | * @param PostalAddressInterface $creditorAddress Address of the creditor |
||
67 | */ |
||
68 | 2 | public function __construct($instructionId, $endToEndId, Money $amount, $creditorName, PostalAddressInterface $creditorAddress) |
|
76 | |||
77 | /** |
||
78 | * Gets the local instrument |
||
79 | * |
||
80 | * @return string|null The local instrument |
||
81 | */ |
||
82 | 2 | public function getLocalInstrument() |
|
86 | |||
87 | /** |
||
88 | * Gets the service level |
||
89 | * |
||
90 | * @return string|null The service level |
||
91 | */ |
||
92 | 2 | public function getServiceLevel() |
|
96 | |||
97 | /** |
||
98 | * Sets the purpose of the payment |
||
99 | * |
||
100 | * @param PurposeCode $purpose The purpose |
||
101 | * |
||
102 | * @return CreditTransfer This credit transfer |
||
103 | */ |
||
104 | 2 | public function setPurpose(PurposeCode $purpose) |
|
110 | |||
111 | /** |
||
112 | * Sets the unstructured remittance information |
||
113 | * |
||
114 | * @param string|null $remittanceInformation |
||
115 | * |
||
116 | * @return CreditTransfer This credit transfer |
||
117 | */ |
||
118 | public function setRemittanceInformation($remittanceInformation) |
||
124 | |||
125 | /** |
||
126 | * Gets the instructed amount of this transaction |
||
127 | * |
||
128 | * @return Money The instructed amount |
||
129 | */ |
||
130 | 2 | public function getAmount() |
|
134 | |||
135 | /** |
||
136 | * Builds a DOM tree of this transaction |
||
137 | * |
||
138 | * @param \DOMDocument $doc |
||
139 | * @param PaymentInformation $paymentInformation Information on B-level |
||
140 | * |
||
141 | * @return \DOMElement The built DOM tree |
||
142 | */ |
||
143 | abstract public function asDom(\DOMDocument $doc, PaymentInformation $paymentInformation); |
||
144 | |||
145 | /** |
||
146 | * Builds a DOM tree of this transaction and adds header nodes |
||
147 | * |
||
148 | * @param \DOMDocument $doc |
||
149 | * @param PaymentInformation $paymentInformation The corresponding B-level element |
||
150 | * |
||
151 | * @return \DOMNode The built DOM node |
||
152 | */ |
||
153 | 2 | protected function buildHeader(\DOMDocument $doc, PaymentInformation $paymentInformation) |
|
185 | |||
186 | /** |
||
187 | * Builds a DOM node of the Creditor field |
||
188 | * |
||
189 | * @param \DOMDocument $doc |
||
190 | * |
||
191 | * @return \DOMNode The built DOM node |
||
192 | */ |
||
193 | 2 | protected function buildCreditor(\DOMDocument $doc) |
|
201 | |||
202 | /** |
||
203 | * Appends the purpose to the transaction |
||
204 | * |
||
205 | * @param \DOMDocument $doc |
||
206 | * @param \DOMElement $transaction |
||
207 | */ |
||
208 | 2 | protected function appendPurpose(\DOMDocument $doc, \DOMElement $transaction) |
|
216 | |||
217 | /** |
||
218 | * Appends the remittance information to the transaction |
||
219 | * |
||
220 | * @param \DOMDocument $doc |
||
221 | * @param \DOMElement $transaction |
||
222 | */ |
||
223 | 2 | protected function appendRemittanceInformation(\DOMDocument $doc, \DOMElement $transaction) |
|
231 | } |
||
232 |