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