1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Ticketpark\SaferpayJson\Request\PaymentPage; |
4
|
|
|
|
5
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
6
|
|
|
use Ticketpark\SaferpayJson\Request\Container\AddressForm; |
7
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Authentication; |
8
|
|
|
use Ticketpark\SaferpayJson\Request\Container\CardForm; |
9
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Notification; |
10
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Payer; |
11
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Payment; |
12
|
|
|
use Ticketpark\SaferpayJson\Request\Container\PaymentMethodsOptions; |
13
|
|
|
use Ticketpark\SaferpayJson\Request\Container\RegisterAlias; |
14
|
|
|
use Ticketpark\SaferpayJson\Request\Container\ReturnUrls; |
15
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Styling; |
16
|
|
|
use Ticketpark\SaferpayJson\Request\Request; |
17
|
|
|
use Ticketpark\SaferpayJson\Request\RequestCommonsTrait; |
18
|
|
|
use Ticketpark\SaferpayJson\Request\RequestConfig; |
19
|
|
|
use Ticketpark\SaferpayJson\Response\PaymentPage\InitializeResponse; |
20
|
|
|
|
21
|
|
|
final class InitializeRequest extends Request |
22
|
|
|
{ |
23
|
|
|
const API_PATH = '/Payment/v1/PaymentPage/Initialize'; |
24
|
|
|
const RESPONSE_CLASS = InitializeResponse::class; |
25
|
|
|
|
26
|
|
|
const PAYMENT_METHOD_ALIPAY = "ALIPAY"; |
27
|
|
|
const PAYMENT_METHOD_AMEX = "AMEX"; |
28
|
|
|
const PAYMENT_METHOD_BANCONTACT = "BANCONTACT"; |
29
|
|
|
const PAYMENT_METHOD_BONUS = "BONUS"; |
30
|
|
|
const PAYMENT_METHOD_DINERS = "DINERS"; |
31
|
|
|
const PAYMENT_METHOD_DIRECTDEBIT = "DIRECTDEBIT"; |
32
|
|
|
const PAYMENT_METHOD_EPRZELEWY = "EPRZELEWY"; |
33
|
|
|
const PAYMENT_METHOD_EPS = "EPS"; |
34
|
|
|
const PAYMENT_METHOD_GIROPAY = "GIROPAY"; |
35
|
|
|
const PAYMENT_METHOD_IDEAL = "IDEAL"; |
36
|
|
|
const PAYMENT_METHOD_INVOICE = "INVOICE"; |
37
|
|
|
const PAYMENT_METHOD_JCB = "JCB"; |
38
|
|
|
const PAYMENT_METHOD_MAESTRO = "MAESTRO"; |
39
|
|
|
const PAYMENT_METHOD_MASTERCARD = "MASTERCARD"; |
40
|
|
|
const PAYMENT_METHOD_MYONE = "MYONE"; |
41
|
|
|
const PAYMENT_METHOD_PAYPAL = "PAYPAL"; |
42
|
|
|
const PAYMENT_METHOD_PAYDIREKT = "PAYDIREKT"; |
43
|
|
|
const PAYMENT_METHOD_POSTCARD = "POSTCARD"; |
44
|
|
|
const PAYMENT_METHOD_POSTFINANCE = "POSTFINANCE"; |
45
|
|
|
const PAYMENT_METHOD_SAFERPAYTEST = "SAFERPAYTEST"; |
46
|
|
|
const PAYMENT_METHOD_SOFORT = "SOFORT"; |
47
|
|
|
const PAYMENT_METHOD_TWINT = "TWINT"; |
48
|
|
|
const PAYMENT_METHOD_UNIONPAY = "UNIONPAY"; |
49
|
|
|
const PAYMENT_METHOD_VISA = "VISA"; |
50
|
|
|
const PAYMENT_METHOD_VPAY = "VPAY"; |
51
|
|
|
|
52
|
|
|
const WALLET_MASTERPASS = "MASTERPASS"; |
53
|
|
|
const WALLET_APPLEPAY = "APPLEPAY"; |
54
|
|
|
|
55
|
|
|
const CONDITION_WITH_LIABILITY_SHIFT = 'WITH_LIABILITY_SHIFT'; |
56
|
|
|
const CONDITION_IF_ALLOWED_BY_SCHEME = 'IF_ALLOWED_BY_SCHEME'; |
57
|
|
|
|
58
|
|
|
use RequestCommonsTrait; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
* @SerializedName("TerminalId") |
63
|
|
|
*/ |
64
|
|
|
private $terminalId; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var Payment |
68
|
|
|
* @SerializedName("Payment") |
69
|
|
|
*/ |
70
|
|
|
private $payment; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var ReturnUrls |
74
|
|
|
* @SerializedName("ReturnUrls") |
75
|
|
|
*/ |
76
|
|
|
private $returnUrls; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var string|null |
80
|
|
|
* @SerializedName("ConfigSet") |
81
|
|
|
*/ |
82
|
|
|
private $configSet; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var array<string>|null |
86
|
|
|
* @SerializedName("PaymentMethods") |
87
|
|
|
*/ |
88
|
|
|
private $paymentMethods; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var PaymentMethodsOptions|null |
92
|
|
|
* @SerializedName("PaymentMethodsOptions") |
93
|
|
|
*/ |
94
|
|
|
private $paymentMethodsOptions; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var Authentication|null |
98
|
|
|
* @SerializedName("Authentication") |
99
|
|
|
*/ |
100
|
|
|
private $authentication; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @var array<string>|null |
104
|
|
|
* @SerializedName("Wallets") |
105
|
|
|
*/ |
106
|
|
|
private $wallets; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var Payer|null |
110
|
|
|
* @SerializedName("Payer") |
111
|
|
|
*/ |
112
|
|
|
private $payer; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var RegisterAlias|null |
116
|
|
|
* @SerializedName("RegisterAlias") |
117
|
|
|
*/ |
118
|
|
|
private $registerAlias; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var Notification|null |
122
|
|
|
* @SerializedName("Notification") |
123
|
|
|
*/ |
124
|
|
|
private $notification; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var Styling|null |
128
|
|
|
* @SerializedName("Styling") |
129
|
|
|
*/ |
130
|
|
|
private $styling; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @var AddressForm|null |
134
|
|
|
* @SerializedName("BillingAddressForm") |
135
|
|
|
*/ |
136
|
|
|
private $billingAddressForm; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var AddressForm|null |
140
|
|
|
* @SerializedName("DeliveryAddressForm") |
141
|
|
|
*/ |
142
|
|
|
private $deliveryAddressForm; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @var CardForm|null |
146
|
|
|
* @SerializedName("CardForm") |
147
|
|
|
*/ |
148
|
|
|
private $cardForm; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @var string|null |
152
|
|
|
* @SerializedName("Condition") |
153
|
|
|
*/ |
154
|
|
|
private $condition; |
155
|
|
|
|
156
|
|
|
public function __construct( |
157
|
|
|
RequestConfig $requestConfig, |
158
|
|
|
string $terminalId, |
159
|
|
|
Payment $payment, |
160
|
|
|
ReturnUrls $returnUrls |
161
|
|
|
) { |
162
|
|
|
$this->terminalId = $terminalId; |
163
|
|
|
$this->payment = $payment; |
164
|
|
|
$this->returnUrls = $returnUrls; |
165
|
|
|
|
166
|
|
|
parent::__construct($requestConfig); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function getTerminalId(): string |
170
|
|
|
{ |
171
|
|
|
return $this->terminalId; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function setTerminalId(string $terminalId): self |
175
|
|
|
{ |
176
|
|
|
$this->terminalId = $terminalId; |
177
|
|
|
|
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function getPayment(): Payment |
182
|
|
|
{ |
183
|
|
|
return $this->payment; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function setPayment(Payment $payment): self |
187
|
|
|
{ |
188
|
|
|
$this->payment = $payment; |
189
|
|
|
|
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function getReturnUrls(): ReturnUrls |
194
|
|
|
{ |
195
|
|
|
return $this->returnUrls; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
public function setReturnUrls(ReturnUrls $returnUrls): self |
199
|
|
|
{ |
200
|
|
|
$this->returnUrls = $returnUrls; |
201
|
|
|
|
202
|
|
|
return $this; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function getConfigSet(): ?string |
206
|
|
|
{ |
207
|
|
|
return $this->configSet; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function setConfigSet(?string $configSet): self |
211
|
|
|
{ |
212
|
|
|
$this->configSet = $configSet; |
213
|
|
|
|
214
|
|
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
public function getPaymentMethods(): ?array |
218
|
|
|
{ |
219
|
|
|
return $this->paymentMethods; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function setPaymentMethods(?array $paymentMethods): self |
223
|
|
|
{ |
224
|
|
|
$this->paymentMethods = $paymentMethods; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
public function getPaymentMethodsOptions(): ?PaymentMethodsOptions |
230
|
|
|
{ |
231
|
|
|
return $this->paymentMethodsOptions; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
public function setPaymentMethodsOptions(?PaymentMethodsOptions $paymentMethodsOptions): self |
235
|
|
|
{ |
236
|
|
|
$this->paymentMethodsOptions = $paymentMethodsOptions; |
237
|
|
|
|
238
|
|
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
public function getAuthentication(): ?Authentication |
242
|
|
|
{ |
243
|
|
|
return $this->authentication; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
public function setAuthentication(?Authentication $authentication): self |
247
|
|
|
{ |
248
|
|
|
$this->authentication = $authentication; |
249
|
|
|
|
250
|
|
|
return $this; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function getWallets(): ?array |
254
|
|
|
{ |
255
|
|
|
return $this->wallets; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
public function setWallets(?array $wallets): self |
259
|
|
|
{ |
260
|
|
|
$this->wallets = $wallets; |
261
|
|
|
|
262
|
|
|
return $this; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
public function getPayer(): ?Payer |
266
|
|
|
{ |
267
|
|
|
return $this->payer; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
public function setPayer(?Payer $payer): self |
271
|
|
|
{ |
272
|
|
|
$this->payer = $payer; |
273
|
|
|
|
274
|
|
|
return $this; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public function getRegisterAlias(): ?RegisterAlias |
278
|
|
|
{ |
279
|
|
|
return $this->registerAlias; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
public function setRegisterAlias(?RegisterAlias $registerAlias): self |
283
|
|
|
{ |
284
|
|
|
$this->registerAlias = $registerAlias; |
285
|
|
|
|
286
|
|
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public function getNotification(): ?Notification |
290
|
|
|
{ |
291
|
|
|
return $this->notification; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public function setNotification(?Notification $notification): self |
295
|
|
|
{ |
296
|
|
|
$this->notification = $notification; |
297
|
|
|
|
298
|
|
|
return $this; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public function getStyling(): ?Styling |
302
|
|
|
{ |
303
|
|
|
return $this->styling; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
public function setStyling(?Styling $styling): self |
307
|
|
|
{ |
308
|
|
|
$this->styling = $styling; |
309
|
|
|
|
310
|
|
|
return $this; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
public function getBillingAddressForm(): ?AddressForm |
314
|
|
|
{ |
315
|
|
|
return $this->billingAddressForm; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
public function setBillingAddressForm(?AddressForm $billingAddressForm): self |
319
|
|
|
{ |
320
|
|
|
$this->billingAddressForm = $billingAddressForm; |
321
|
|
|
|
322
|
|
|
return $this; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
public function getDeliveryAddressForm(): ?AddressForm |
326
|
|
|
{ |
327
|
|
|
return $this->deliveryAddressForm; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
public function setDeliveryAddressForm(?AddressForm $deliveryAddressForm): self |
331
|
|
|
{ |
332
|
|
|
$this->deliveryAddressForm = $deliveryAddressForm; |
333
|
|
|
|
334
|
|
|
return $this; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
public function getCardForm(): ?CardForm |
338
|
|
|
{ |
339
|
|
|
return $this->cardForm; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
public function setCardForm(?CardForm $cardForm): self |
343
|
|
|
{ |
344
|
|
|
$this->cardForm = $cardForm; |
345
|
|
|
|
346
|
|
|
return $this; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
public function getCondition(): ?string |
350
|
|
|
{ |
351
|
|
|
return $this->condition; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
public function setCondition(?string $condition): self |
355
|
|
|
{ |
356
|
|
|
$this->condition = $condition; |
357
|
|
|
|
358
|
|
|
return $this; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
public function execute(): InitializeResponse |
362
|
|
|
{ |
363
|
|
|
/** @var InitializeResponse $response */ |
364
|
|
|
$response = $this->doExecute(); |
365
|
|
|
|
366
|
|
|
return $response; |
367
|
|
|
} |
368
|
|
|
} |
369
|
|
|
|