PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.1
Booking for Appointments and Events Calendar – Amelia v2.1
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / Payment / Payment.php
ameliabooking / src / Domain / Entity / Payment Last commit date
Payment.php 6 months ago PaymentGateway.php 6 months ago
Payment.php
526 lines
1 <?php
2
3 /**
4 * @copyright © Melograno Ventures. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace AmeliaBooking\Domain\Entity\Payment;
9
10 use AmeliaBooking\Domain\ValueObjects\BooleanValueObject;
11 use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue;
12 use AmeliaBooking\Domain\ValueObjects\Json;
13 use AmeliaBooking\Domain\ValueObjects\Number\Float\Price;
14 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
15 use AmeliaBooking\Domain\ValueObjects\String\Name;
16 use AmeliaBooking\Domain\ValueObjects\String\PaymentStatus;
17 use AmeliaBooking\Domain\ValueObjects\String\PaymentData;
18 use AmeliaBooking\Domain\ValueObjects\String\Url;
19
20 /**
21 * Class Payment
22 *
23 * @package AmeliaBooking\Domain\Entity\Payment
24 */
25 class Payment
26 {
27 /** @var Id */
28 private $id;
29
30 /** @var Id */
31 private $customerBookingId;
32
33 /** @var Id */
34 private $packageCustomerId;
35
36 /** @var Id */
37 private $parentId;
38
39 /** @var Id */
40 private $invoiceNumber;
41
42 /** @var Price */
43 private $amount;
44
45 /** @var DateTimeValue */
46 private $dateTime;
47
48 /** @var PaymentStatus */
49 private $status;
50
51 /** @var PaymentGateway */
52 private $gateway;
53
54 /** @var Name */
55 private $gatewayTitle;
56
57 /** @var PaymentData */
58 private $data;
59
60 /** @var DateTimeValue */
61 private $created;
62
63 /** @var Name */
64 private $entity;
65
66 /** @var BooleanValueObject */
67 private $actionsCompleted;
68
69 /** @var BooleanValueObject */
70 private $triggeredActions;
71
72 /** @var Id */
73 private $wcOrderId;
74
75 /** @var Id */
76 private $wcOrderItemId;
77
78 /** @var Url */
79 private $wcOrderUrl;
80
81 /** @var Price */
82 private $wcItemCouponValue;
83
84 /** @var Price */
85 private $wcItemTaxValue;
86
87 /** @var string */
88 private $transactionId;
89
90 /** @var Json */
91 private $transfers;
92
93 /** @var array */
94 private $paymentLinks;
95
96 /**
97 * Payment constructor.
98 *
99 * @param Price $amount
100 * @param DateTimeValue $dateTime
101 * @param PaymentStatus $status
102 * @param PaymentGateway $gateway
103 * @param PaymentData $data
104 */
105 public function __construct(
106 Price $amount,
107 DateTimeValue $dateTime,
108 PaymentStatus $status,
109 PaymentGateway $gateway,
110 PaymentData $data
111 ) {
112 $this->amount = $amount;
113
114 $this->dateTime = $dateTime;
115
116 $this->status = $status;
117
118 $this->gateway = $gateway;
119
120 $this->data = $data;
121 }
122
123 /**
124 * @return Id
125 */
126 public function getId()
127 {
128 return $this->id;
129 }
130
131 /**
132 * @param Id $id
133 */
134 public function setId($id)
135 {
136 $this->id = $id;
137 }
138
139 /**
140 * @return Id
141 */
142 public function getCustomerBookingId()
143 {
144 return $this->customerBookingId;
145 }
146
147 /**
148 * @param Id $customerBookingId
149 */
150 public function setCustomerBookingId($customerBookingId)
151 {
152 $this->customerBookingId = $customerBookingId;
153 }
154
155 /**
156 * @return Id
157 */
158 public function getPackageCustomerId()
159 {
160 return $this->packageCustomerId;
161 }
162
163 /**
164 * @param Id $packageCustomerId
165 */
166 public function setPackageCustomerId($packageCustomerId)
167 {
168 $this->packageCustomerId = $packageCustomerId;
169 }
170
171 /**
172 * @return Id
173 */
174 public function getParentId()
175 {
176 return $this->parentId;
177 }
178
179 /**
180 * @param Id $parentId
181 */
182 public function setParentId($parentId)
183 {
184 $this->parentId = $parentId;
185 }
186
187 /**
188 * @return Id
189 */
190 public function getInvoiceNumber()
191 {
192 return $this->invoiceNumber;
193 }
194
195 /**
196 * @param Id $invoiceNumber
197 */
198 public function setInvoiceNumber($invoiceNumber)
199 {
200 $this->invoiceNumber = $invoiceNumber;
201 }
202
203
204 /**
205 * @return Price
206 */
207 public function getAmount()
208 {
209 return $this->amount;
210 }
211
212 /**
213 * @param Price $amount
214 */
215 public function setAmount($amount)
216 {
217 $this->amount = $amount;
218 }
219
220 /**
221 * @return DateTimeValue
222 */
223 public function getDateTime()
224 {
225 return $this->dateTime;
226 }
227
228 /**
229 * @param DateTimeValue $dateTime
230 */
231 public function setDateTime($dateTime)
232 {
233 $this->dateTime = $dateTime;
234 }
235
236 /**
237 * @return PaymentStatus
238 */
239 public function getStatus()
240 {
241 return $this->status;
242 }
243
244 /**
245 * @param PaymentStatus $status
246 */
247 public function setStatus($status)
248 {
249 $this->status = $status;
250 }
251
252 /**
253 * @return PaymentGateway
254 */
255 public function getGateway()
256 {
257 return $this->gateway;
258 }
259
260 /**
261 * @param PaymentGateway $gateway
262 */
263 public function setGateway($gateway)
264 {
265 $this->gateway = $gateway;
266 }
267
268 /**
269 * @return Name
270 */
271 public function getGatewayTitle()
272 {
273 return $this->gatewayTitle;
274 }
275
276 /**
277 * @param Name $gatewayTitle
278 */
279 public function setGatewayTitle($gatewayTitle)
280 {
281 $this->gatewayTitle = $gatewayTitle;
282 }
283
284 /**
285 * @return PaymentData
286 */
287 public function getData()
288 {
289 return $this->data;
290 }
291
292 /**
293 * @param PaymentData $data
294 */
295 public function setData($data)
296 {
297 $this->data = $data;
298 }
299
300 /**
301 * @return DateTimeValue
302 */
303 public function getCreated()
304 {
305 return $this->created;
306 }
307
308 /**
309 * @param DateTimeValue $created
310 */
311 public function setCreated($created)
312 {
313 $this->created = $created;
314 }
315
316 /**
317 * @return Name
318 */
319 public function getEntity()
320 {
321 return $this->entity;
322 }
323
324 /**
325 * @param Name $entity
326 */
327 public function setEntity($entity)
328 {
329 $this->entity = $entity;
330 }
331
332 /**
333 * @return BooleanValueObject
334 */
335 public function getActionsCompleted()
336 {
337 return $this->actionsCompleted;
338 }
339
340 /**
341 * @param BooleanValueObject $actionsCompleted
342 */
343 public function setActionsCompleted($actionsCompleted)
344 {
345 $this->actionsCompleted = $actionsCompleted;
346 }
347
348 /**
349 * @return BooleanValueObject
350 */
351 public function getTriggeredActions()
352 {
353 return $this->triggeredActions;
354 }
355
356 /**
357 * @param BooleanValueObject $triggeredActions
358 */
359 public function setTriggeredActions($triggeredActions)
360 {
361 $this->triggeredActions = $triggeredActions;
362 }
363
364 /**
365 * @return Id
366 */
367 public function getWcOrderId()
368 {
369 return $this->wcOrderId;
370 }
371
372 /**
373 * @param Id $wcOrderId
374 */
375 public function setWcOrderId($wcOrderId)
376 {
377 $this->wcOrderId = $wcOrderId;
378 }
379
380 /**
381 * @return Id
382 */
383 public function getWcOrderItemId()
384 {
385 return $this->wcOrderItemId;
386 }
387
388 /**
389 * @param Id $wcOrderItemId
390 */
391 public function setWcOrderItemId($wcOrderItemId)
392 {
393 $this->wcOrderItemId = $wcOrderItemId;
394 }
395
396 /**
397 * @return Url
398 */
399 public function getWcOrderUrl()
400 {
401 return $this->wcOrderUrl;
402 }
403
404 /**
405 * @param Url $wcOrderUrl
406 */
407 public function setWcOrderUrl($wcOrderUrl)
408 {
409 $this->wcOrderUrl = $wcOrderUrl;
410 }
411
412 /**
413 * @return Price
414 */
415 public function getWcItemCouponValue()
416 {
417 return $this->wcItemCouponValue;
418 }
419
420 /**
421 * @param Price $wcItemCouponValue
422 */
423 public function setWcItemCouponValue($wcItemCouponValue)
424 {
425 $this->wcItemCouponValue = $wcItemCouponValue;
426 }
427
428 /**
429 * @return Price
430 */
431 public function getWcItemTaxValue()
432 {
433 return $this->wcItemTaxValue;
434 }
435
436 /**
437 * @param Price $wcItemTaxValue
438 */
439 public function setWcItemTaxValue($wcItemTaxValue)
440 {
441 $this->wcItemTaxValue = $wcItemTaxValue;
442 }
443
444
445 /**
446 * @return string|null
447 */
448 public function getTransactionId()
449 {
450 return $this->transactionId;
451 }
452
453 /**
454 * @param string|null $transactionId
455 */
456 public function setTransactionId($transactionId)
457 {
458 $this->transactionId = $transactionId;
459 }
460
461 /**
462 * @return Json
463 */
464 public function getTransfers()
465 {
466 return $this->transfers;
467 }
468
469 /**
470 * @param Json $transfers
471 */
472 public function setTransfers($transfers)
473 {
474 $this->transfers = $transfers;
475 }
476
477 /**
478 * @return array
479 */
480 public function getPaymentLinks()
481 {
482 return $this->paymentLinks;
483 }
484
485 /**
486 * @param array $paymentLinks
487 */
488 public function setPaymentLinks($paymentLinks)
489 {
490 $this->paymentLinks = $paymentLinks;
491 }
492
493
494 /**
495 * @return array
496 */
497 public function toArray()
498 {
499 return [
500 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
501 'customerBookingId' => $this->customerBookingId ? $this->customerBookingId->getValue() : null,
502 'packageCustomerId' => $this->packageCustomerId ? $this->packageCustomerId->getValue() : null,
503 'parentId' => $this->getParentId() ? $this->getParentId()->getValue() : null,
504 'amount' => $this->amount->getValue(),
505 'gateway' => $this->gateway->getName()->getValue(),
506 'gatewayTitle' => null !== $this->getGatewayTitle() ? $this->getGatewayTitle()->getValue() : '',
507 'dateTime' => null !== $this->dateTime ? $this->dateTime->getValue()->format('Y-m-d H:i:s') : null,
508 'status' => $this->status->getValue(),
509 'data' => $this->data->getValue(),
510 'entity' => $this->getEntity() ? $this->getEntity()->getValue() : null,
511 'created' => $this->getCreated() ? $this->getCreated()->getValue()->format('Y-m-d H:i:s') : null,
512 'actionsCompleted' => $this->getActionsCompleted() ? $this->getActionsCompleted()->getValue() : null,
513 'triggeredActions' => $this->getTriggeredActions() ? $this->getTriggeredActions()->getValue() : null,
514 'wcOrderId' => $this->getWcOrderId() ? $this->getWcOrderId()->getValue() : null,
515 'wcOrderItemId' => $this->getWcOrderItemId() ? $this->getWcOrderItemId()->getValue() : null,
516 'wcOrderUrl' => $this->getWcOrderUrl() ? $this->getWcOrderUrl()->getValue() : null,
517 'wcItemCouponValue' => $this->getWcItemCouponValue() ? $this->getWcItemCouponValue()->getValue() : null,
518 'wcItemTaxValue' => $this->getWcItemTaxValue() ? $this->getWcItemTaxValue()->getValue() : null,
519 'transactionId' => $this->getTransactionId(),
520 'transfers' => $this->getTransfers() ? $this->getTransfers()->getValue() : null,
521 'invoiceNumber' => $this->getInvoiceNumber() ? $this->getInvoiceNumber()->getValue() : null,
522 'paymentLinks' => $this->getPaymentLinks() ?: null,
523 ];
524 }
525 }
526