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 CreateHostedCheckoutRequest 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 $eInvoicePaymentMethodSpecificInput = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $fraudFields = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $hostedCheckoutSpecificInput = null; |
45: | |
46: | |
47: | |
48: | |
49: | public $merchant = null; |
50: | |
51: | |
52: | |
53: | |
54: | public $mobilePaymentMethodSpecificInput = null; |
55: | |
56: | |
57: | |
58: | |
59: | public $order = null; |
60: | |
61: | |
62: | |
63: | |
64: | public $redirectPaymentMethodSpecificInput = null; |
65: | |
66: | |
67: | |
68: | |
69: | public $sepaDirectDebitPaymentMethodSpecificInput = null; |
70: | |
71: | |
72: | |
73: | |
74: | public function toObject() |
75: | { |
76: | $object = parent::toObject(); |
77: | if (!is_null($this->bankTransferPaymentMethodSpecificInput)) { |
78: | $object->bankTransferPaymentMethodSpecificInput = $this->bankTransferPaymentMethodSpecificInput->toObject(); |
79: | } |
80: | if (!is_null($this->cardPaymentMethodSpecificInput)) { |
81: | $object->cardPaymentMethodSpecificInput = $this->cardPaymentMethodSpecificInput->toObject(); |
82: | } |
83: | if (!is_null($this->cashPaymentMethodSpecificInput)) { |
84: | $object->cashPaymentMethodSpecificInput = $this->cashPaymentMethodSpecificInput->toObject(); |
85: | } |
86: | if (!is_null($this->eInvoicePaymentMethodSpecificInput)) { |
87: | $object->eInvoicePaymentMethodSpecificInput = $this->eInvoicePaymentMethodSpecificInput->toObject(); |
88: | } |
89: | if (!is_null($this->fraudFields)) { |
90: | $object->fraudFields = $this->fraudFields->toObject(); |
91: | } |
92: | if (!is_null($this->hostedCheckoutSpecificInput)) { |
93: | $object->hostedCheckoutSpecificInput = $this->hostedCheckoutSpecificInput->toObject(); |
94: | } |
95: | if (!is_null($this->merchant)) { |
96: | $object->merchant = $this->merchant->toObject(); |
97: | } |
98: | if (!is_null($this->mobilePaymentMethodSpecificInput)) { |
99: | $object->mobilePaymentMethodSpecificInput = $this->mobilePaymentMethodSpecificInput->toObject(); |
100: | } |
101: | if (!is_null($this->order)) { |
102: | $object->order = $this->order->toObject(); |
103: | } |
104: | if (!is_null($this->redirectPaymentMethodSpecificInput)) { |
105: | $object->redirectPaymentMethodSpecificInput = $this->redirectPaymentMethodSpecificInput->toObject(); |
106: | } |
107: | if (!is_null($this->sepaDirectDebitPaymentMethodSpecificInput)) { |
108: | $object->sepaDirectDebitPaymentMethodSpecificInput = $this->sepaDirectDebitPaymentMethodSpecificInput->toObject(); |
109: | } |
110: | return $object; |
111: | } |
112: | |
113: | |
114: | |
115: | |
116: | |
117: | |
118: | public function fromObject($object) |
119: | { |
120: | parent::fromObject($object); |
121: | if (property_exists($object, 'bankTransferPaymentMethodSpecificInput')) { |
122: | if (!is_object($object->bankTransferPaymentMethodSpecificInput)) { |
123: | throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificInput, true) . '\' is not an object'); |
124: | } |
125: | $value = new BankTransferPaymentMethodSpecificInputBase(); |
126: | $this->bankTransferPaymentMethodSpecificInput = $value->fromObject($object->bankTransferPaymentMethodSpecificInput); |
127: | } |
128: | if (property_exists($object, 'cardPaymentMethodSpecificInput')) { |
129: | if (!is_object($object->cardPaymentMethodSpecificInput)) { |
130: | throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificInput, true) . '\' is not an object'); |
131: | } |
132: | $value = new CardPaymentMethodSpecificInputBase(); |
133: | $this->cardPaymentMethodSpecificInput = $value->fromObject($object->cardPaymentMethodSpecificInput); |
134: | } |
135: | if (property_exists($object, 'cashPaymentMethodSpecificInput')) { |
136: | if (!is_object($object->cashPaymentMethodSpecificInput)) { |
137: | throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificInput, true) . '\' is not an object'); |
138: | } |
139: | $value = new CashPaymentMethodSpecificInputBase(); |
140: | $this->cashPaymentMethodSpecificInput = $value->fromObject($object->cashPaymentMethodSpecificInput); |
141: | } |
142: | if (property_exists($object, 'eInvoicePaymentMethodSpecificInput')) { |
143: | if (!is_object($object->eInvoicePaymentMethodSpecificInput)) { |
144: | throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificInput, true) . '\' is not an object'); |
145: | } |
146: | $value = new EInvoicePaymentMethodSpecificInputBase(); |
147: | $this->eInvoicePaymentMethodSpecificInput = $value->fromObject($object->eInvoicePaymentMethodSpecificInput); |
148: | } |
149: | if (property_exists($object, 'fraudFields')) { |
150: | if (!is_object($object->fraudFields)) { |
151: | throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object'); |
152: | } |
153: | $value = new FraudFields(); |
154: | $this->fraudFields = $value->fromObject($object->fraudFields); |
155: | } |
156: | if (property_exists($object, 'hostedCheckoutSpecificInput')) { |
157: | if (!is_object($object->hostedCheckoutSpecificInput)) { |
158: | throw new UnexpectedValueException('value \'' . print_r($object->hostedCheckoutSpecificInput, true) . '\' is not an object'); |
159: | } |
160: | $value = new HostedCheckoutSpecificInput(); |
161: | $this->hostedCheckoutSpecificInput = $value->fromObject($object->hostedCheckoutSpecificInput); |
162: | } |
163: | if (property_exists($object, 'merchant')) { |
164: | if (!is_object($object->merchant)) { |
165: | throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); |
166: | } |
167: | $value = new Merchant(); |
168: | $this->merchant = $value->fromObject($object->merchant); |
169: | } |
170: | if (property_exists($object, 'mobilePaymentMethodSpecificInput')) { |
171: | if (!is_object($object->mobilePaymentMethodSpecificInput)) { |
172: | throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificInput, true) . '\' is not an object'); |
173: | } |
174: | $value = new MobilePaymentMethodSpecificInputHostedCheckout(); |
175: | $this->mobilePaymentMethodSpecificInput = $value->fromObject($object->mobilePaymentMethodSpecificInput); |
176: | } |
177: | if (property_exists($object, 'order')) { |
178: | if (!is_object($object->order)) { |
179: | throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object'); |
180: | } |
181: | $value = new Order(); |
182: | $this->order = $value->fromObject($object->order); |
183: | } |
184: | if (property_exists($object, 'redirectPaymentMethodSpecificInput')) { |
185: | if (!is_object($object->redirectPaymentMethodSpecificInput)) { |
186: | throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificInput, true) . '\' is not an object'); |
187: | } |
188: | $value = new RedirectPaymentMethodSpecificInputBase(); |
189: | $this->redirectPaymentMethodSpecificInput = $value->fromObject($object->redirectPaymentMethodSpecificInput); |
190: | } |
191: | if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificInput')) { |
192: | if (!is_object($object->sepaDirectDebitPaymentMethodSpecificInput)) { |
193: | throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificInput, true) . '\' is not an object'); |
194: | } |
195: | $value = new SepaDirectDebitPaymentMethodSpecificInputBase(); |
196: | $this->sepaDirectDebitPaymentMethodSpecificInput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificInput); |
197: | } |
198: | return $this; |
199: | } |
200: | } |
201: | |