1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | |
10: | |
11: | |
12: | |
13: | class PaymentOutput extends OrderOutput |
14: | { |
15: | |
16: | |
17: | |
18: | public $amountPaid = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $amountReversed = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $bankTransferPaymentMethodSpecificOutput = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $cardPaymentMethodSpecificOutput = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $cashPaymentMethodSpecificOutput = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $directDebitPaymentMethodSpecificOutput = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $eInvoicePaymentMethodSpecificOutput = null; |
49: | |
50: | |
51: | |
52: | |
53: | public $invoicePaymentMethodSpecificOutput = null; |
54: | |
55: | |
56: | |
57: | |
58: | public $mobilePaymentMethodSpecificOutput = null; |
59: | |
60: | |
61: | |
62: | |
63: | public $paymentMethod = null; |
64: | |
65: | |
66: | |
67: | |
68: | public $redirectPaymentMethodSpecificOutput = null; |
69: | |
70: | |
71: | |
72: | |
73: | public $reversalReason = null; |
74: | |
75: | |
76: | |
77: | |
78: | public $sepaDirectDebitPaymentMethodSpecificOutput = null; |
79: | |
80: | |
81: | |
82: | |
83: | public function toObject() |
84: | { |
85: | $object = parent::toObject(); |
86: | if (!is_null($this->amountPaid)) { |
87: | $object->amountPaid = $this->amountPaid; |
88: | } |
89: | if (!is_null($this->amountReversed)) { |
90: | $object->amountReversed = $this->amountReversed; |
91: | } |
92: | if (!is_null($this->bankTransferPaymentMethodSpecificOutput)) { |
93: | $object->bankTransferPaymentMethodSpecificOutput = $this->bankTransferPaymentMethodSpecificOutput->toObject(); |
94: | } |
95: | if (!is_null($this->cardPaymentMethodSpecificOutput)) { |
96: | $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); |
97: | } |
98: | if (!is_null($this->cashPaymentMethodSpecificOutput)) { |
99: | $object->cashPaymentMethodSpecificOutput = $this->cashPaymentMethodSpecificOutput->toObject(); |
100: | } |
101: | if (!is_null($this->directDebitPaymentMethodSpecificOutput)) { |
102: | $object->directDebitPaymentMethodSpecificOutput = $this->directDebitPaymentMethodSpecificOutput->toObject(); |
103: | } |
104: | if (!is_null($this->eInvoicePaymentMethodSpecificOutput)) { |
105: | $object->eInvoicePaymentMethodSpecificOutput = $this->eInvoicePaymentMethodSpecificOutput->toObject(); |
106: | } |
107: | if (!is_null($this->invoicePaymentMethodSpecificOutput)) { |
108: | $object->invoicePaymentMethodSpecificOutput = $this->invoicePaymentMethodSpecificOutput->toObject(); |
109: | } |
110: | if (!is_null($this->mobilePaymentMethodSpecificOutput)) { |
111: | $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); |
112: | } |
113: | if (!is_null($this->paymentMethod)) { |
114: | $object->paymentMethod = $this->paymentMethod; |
115: | } |
116: | if (!is_null($this->redirectPaymentMethodSpecificOutput)) { |
117: | $object->redirectPaymentMethodSpecificOutput = $this->redirectPaymentMethodSpecificOutput->toObject(); |
118: | } |
119: | if (!is_null($this->reversalReason)) { |
120: | $object->reversalReason = $this->reversalReason; |
121: | } |
122: | if (!is_null($this->sepaDirectDebitPaymentMethodSpecificOutput)) { |
123: | $object->sepaDirectDebitPaymentMethodSpecificOutput = $this->sepaDirectDebitPaymentMethodSpecificOutput->toObject(); |
124: | } |
125: | return $object; |
126: | } |
127: | |
128: | |
129: | |
130: | |
131: | |
132: | |
133: | public function fromObject($object) |
134: | { |
135: | parent::fromObject($object); |
136: | if (property_exists($object, 'amountPaid')) { |
137: | $this->amountPaid = $object->amountPaid; |
138: | } |
139: | if (property_exists($object, 'amountReversed')) { |
140: | $this->amountReversed = $object->amountReversed; |
141: | } |
142: | if (property_exists($object, 'bankTransferPaymentMethodSpecificOutput')) { |
143: | if (!is_object($object->bankTransferPaymentMethodSpecificOutput)) { |
144: | throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificOutput, true) . '\' is not an object'); |
145: | } |
146: | $value = new BankTransferPaymentMethodSpecificOutput(); |
147: | $this->bankTransferPaymentMethodSpecificOutput = $value->fromObject($object->bankTransferPaymentMethodSpecificOutput); |
148: | } |
149: | if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { |
150: | if (!is_object($object->cardPaymentMethodSpecificOutput)) { |
151: | throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); |
152: | } |
153: | $value = new CardPaymentMethodSpecificOutput(); |
154: | $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); |
155: | } |
156: | if (property_exists($object, 'cashPaymentMethodSpecificOutput')) { |
157: | if (!is_object($object->cashPaymentMethodSpecificOutput)) { |
158: | throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificOutput, true) . '\' is not an object'); |
159: | } |
160: | $value = new CashPaymentMethodSpecificOutput(); |
161: | $this->cashPaymentMethodSpecificOutput = $value->fromObject($object->cashPaymentMethodSpecificOutput); |
162: | } |
163: | if (property_exists($object, 'directDebitPaymentMethodSpecificOutput')) { |
164: | if (!is_object($object->directDebitPaymentMethodSpecificOutput)) { |
165: | throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); |
166: | } |
167: | $value = new NonSepaDirectDebitPaymentMethodSpecificOutput(); |
168: | $this->directDebitPaymentMethodSpecificOutput = $value->fromObject($object->directDebitPaymentMethodSpecificOutput); |
169: | } |
170: | if (property_exists($object, 'eInvoicePaymentMethodSpecificOutput')) { |
171: | if (!is_object($object->eInvoicePaymentMethodSpecificOutput)) { |
172: | throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificOutput, true) . '\' is not an object'); |
173: | } |
174: | $value = new EInvoicePaymentMethodSpecificOutput(); |
175: | $this->eInvoicePaymentMethodSpecificOutput = $value->fromObject($object->eInvoicePaymentMethodSpecificOutput); |
176: | } |
177: | if (property_exists($object, 'invoicePaymentMethodSpecificOutput')) { |
178: | if (!is_object($object->invoicePaymentMethodSpecificOutput)) { |
179: | throw new UnexpectedValueException('value \'' . print_r($object->invoicePaymentMethodSpecificOutput, true) . '\' is not an object'); |
180: | } |
181: | $value = new InvoicePaymentMethodSpecificOutput(); |
182: | $this->invoicePaymentMethodSpecificOutput = $value->fromObject($object->invoicePaymentMethodSpecificOutput); |
183: | } |
184: | if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { |
185: | if (!is_object($object->mobilePaymentMethodSpecificOutput)) { |
186: | throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); |
187: | } |
188: | $value = new MobilePaymentMethodSpecificOutput(); |
189: | $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); |
190: | } |
191: | if (property_exists($object, 'paymentMethod')) { |
192: | $this->paymentMethod = $object->paymentMethod; |
193: | } |
194: | if (property_exists($object, 'redirectPaymentMethodSpecificOutput')) { |
195: | if (!is_object($object->redirectPaymentMethodSpecificOutput)) { |
196: | throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificOutput, true) . '\' is not an object'); |
197: | } |
198: | $value = new RedirectPaymentMethodSpecificOutput(); |
199: | $this->redirectPaymentMethodSpecificOutput = $value->fromObject($object->redirectPaymentMethodSpecificOutput); |
200: | } |
201: | if (property_exists($object, 'reversalReason')) { |
202: | $this->reversalReason = $object->reversalReason; |
203: | } |
204: | if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificOutput')) { |
205: | if (!is_object($object->sepaDirectDebitPaymentMethodSpecificOutput)) { |
206: | throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); |
207: | } |
208: | $value = new SepaDirectDebitPaymentMethodSpecificOutput(); |
209: | $this->sepaDirectDebitPaymentMethodSpecificOutput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificOutput); |
210: | } |
211: | return $this; |
212: | } |
213: | } |
214: | |