|
11 | 11 |
|
12 | 12 | class PaymentMandate implements XmlSerializable, XmlDeserializable |
13 | 13 | { |
14 | | - public $xmlTagName = 'PaymentMandate'; |
15 | | - |
16 | 14 | private $id; |
17 | | - private $payeeFinancialAccount; |
| 15 | + private $payerFinancialAccount; |
18 | 16 |
|
19 | | - /** |
20 | | - * @return string |
21 | | - */ |
22 | 17 | public function getId(): ?string |
23 | 18 | { |
24 | 19 | return $this->id; |
25 | 20 | } |
26 | 21 |
|
27 | | - /** |
28 | | - * @param string $id |
29 | | - * @return static |
30 | | - */ |
31 | | - public function setId(?string $id) |
| 22 | + public function setId(?string $id): self |
32 | 23 | { |
33 | 24 | $this->id = $id; |
34 | 25 | return $this; |
35 | 26 | } |
36 | 27 |
|
37 | | - /** |
38 | | - * @return PayeeFinancialAccount |
39 | | - */ |
40 | | - public function getPayeeFinancialAccount(): ?PayeeFinancialAccount |
| 28 | + public function xmlSerialize(Writer $writer): void |
41 | 29 | { |
42 | | - return $this->payeeFinancialAccount; |
| 30 | + if ($this->id !== null) { |
| 31 | + $writer->write([ |
| 32 | + Schema::CBC . 'ID' => $this->id, |
| 33 | + ]); |
| 34 | + } |
| 35 | + |
| 36 | + if ($this->getPayerFinancialAccount() !== null) { |
| 37 | + $writer->write([ |
| 38 | + Schema::CAC . $this->payerFinancialAccount->xmlTagName => $this->getPayerFinancialAccount(), |
| 39 | + ]); |
| 40 | + } |
43 | 41 | } |
44 | 42 |
|
45 | | - /** |
46 | | - * @param PayeeFinancialAccount $payeeFinancialAccount |
47 | | - * @return static |
48 | | - */ |
49 | | - public function setPayeeFinancialAccount(?PayeeFinancialAccount $payeeFinancialAccount) |
| 43 | + public function getPayerFinancialAccount(): ?PayerFinancialAccount |
50 | 44 | { |
51 | | - $this->payeeFinancialAccount = $payeeFinancialAccount; |
52 | | - return $this; |
| 45 | + return $this->payerFinancialAccount; |
53 | 46 | } |
54 | 47 |
|
55 | | - public function xmlSerialize(Writer $writer): void |
| 48 | + public function setPayerFinancialAccount(?PayerFinancialAccount $payerFinancialAccount): self |
56 | 49 | { |
57 | | - $writer->write([ |
58 | | - Schema::CBC . 'ID' => $this->id |
59 | | - ]); |
60 | | - |
61 | | - if ($this->getPayeeFinancialAccount() !== null) { |
62 | | - $writer->write([ |
63 | | - Schema::CAC . 'PayeeFinancialAccount' => $this->getPayeeFinancialAccount() |
64 | | - ]); |
65 | | - } |
| 50 | + $this->payerFinancialAccount = $payerFinancialAccount; |
| 51 | + return $this; |
66 | 52 | } |
67 | 53 |
|
68 | | - /** |
69 | | - * The xmlDeserialize method is called during xml reading. |
70 | | - * @param Reader $reader |
71 | | - * @return static |
72 | | - */ |
73 | 54 | public static function xmlDeserialize(Reader $reader) |
74 | 55 | { |
75 | 56 | $keyValues = keyValue($reader); |
76 | 57 |
|
77 | 58 | return (new static()) |
78 | 59 | ->setId($keyValues[Schema::CBC . 'ID'] ?? null) |
79 | | - ->setPayeeFinancialAccount($keyValues[Schema::CAC . 'PayeeFinancialAccount'] ?? null); |
| 60 | + ->setPayerFinancialAccount($keyValues[Schema::CAC . 'PayerFinancialAccount'] ?? null); |
80 | 61 | } |
81 | 62 | } |
0 commit comments