1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use DateTime;
8: use UnexpectedValueException;
9: use Worldline\Acquiring\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Acquiring\Sdk\V1\Domain
13: */
14: class ApiPaymentSummaryForResponse extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $paymentId = null;
20:
21: /**
22: * @var ApiReferencesForResponses|null
23: */
24: public ?ApiReferencesForResponses $references = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $status = null;
30:
31: /**
32: * @var DateTime|null
33: */
34: public ?DateTime $statusTimestamp = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->paymentId)) {
43: $object->paymentId = $this->paymentId;
44: }
45: if (!is_null($this->references)) {
46: $object->references = $this->references->toObject();
47: }
48: if (!is_null($this->status)) {
49: $object->status = $this->status;
50: }
51: if (!is_null($this->statusTimestamp)) {
52: $object->statusTimestamp = $this->statusTimestamp->format('Y-m-d\\TH:i:s.vP');
53: }
54: return $object;
55: }
56:
57: /**
58: * @param object $object
59: *
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject(object $object): ApiPaymentSummaryForResponse
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'paymentId')) {
67: $this->paymentId = $object->paymentId;
68: }
69: if (property_exists($object, 'references')) {
70: if (!is_object($object->references)) {
71: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
72: }
73: $value = new ApiReferencesForResponses();
74: $this->references = $value->fromObject($object->references);
75: }
76: if (property_exists($object, 'status')) {
77: $this->status = $object->status;
78: }
79: if (property_exists($object, 'statusTimestamp')) {
80: $this->statusTimestamp = new DateTime($object->statusTimestamp);
81: }
82: return $this;
83: }
84: }
85: