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 ApiPaymentResponse extends DataObject
15: {
16: /**
17: * @var AdditionalResponseData|null
18: */
19: public ?AdditionalResponseData $additionalResponseData = null;
20:
21: /**
22: * @var CardPaymentDataForResponse|null
23: */
24: public ?CardPaymentDataForResponse $cardPaymentData = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $initialAuthorizationCode = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $operationId = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $paymentId = null;
40:
41: /**
42: * @var ApiReferencesForResponses|null
43: */
44: public ?ApiReferencesForResponses $references = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $responder = null;
50:
51: /**
52: * @var string|null
53: */
54: public ?string $responseCode = null;
55:
56: /**
57: * @var string|null
58: */
59: public ?string $responseCodeCategory = null;
60:
61: /**
62: * @var string|null
63: */
64: public ?string $responseCodeDescription = null;
65:
66: /**
67: * @var string|null
68: */
69: public ?string $status = null;
70:
71: /**
72: * @var DateTime|null
73: */
74: public ?DateTime $statusTimestamp = null;
75:
76: /**
77: * @var AmountData|null
78: */
79: public ?AmountData $totalAuthorizedAmount = null;
80:
81: /**
82: * @return object
83: */
84: public function toObject(): object
85: {
86: $object = parent::toObject();
87: if (!is_null($this->additionalResponseData)) {
88: $object->additionalResponseData = $this->additionalResponseData->toObject();
89: }
90: if (!is_null($this->cardPaymentData)) {
91: $object->cardPaymentData = $this->cardPaymentData->toObject();
92: }
93: if (!is_null($this->initialAuthorizationCode)) {
94: $object->initialAuthorizationCode = $this->initialAuthorizationCode;
95: }
96: if (!is_null($this->operationId)) {
97: $object->operationId = $this->operationId;
98: }
99: if (!is_null($this->paymentId)) {
100: $object->paymentId = $this->paymentId;
101: }
102: if (!is_null($this->references)) {
103: $object->references = $this->references->toObject();
104: }
105: if (!is_null($this->responder)) {
106: $object->responder = $this->responder;
107: }
108: if (!is_null($this->responseCode)) {
109: $object->responseCode = $this->responseCode;
110: }
111: if (!is_null($this->responseCodeCategory)) {
112: $object->responseCodeCategory = $this->responseCodeCategory;
113: }
114: if (!is_null($this->responseCodeDescription)) {
115: $object->responseCodeDescription = $this->responseCodeDescription;
116: }
117: if (!is_null($this->status)) {
118: $object->status = $this->status;
119: }
120: if (!is_null($this->statusTimestamp)) {
121: $object->statusTimestamp = $this->statusTimestamp->format('Y-m-d\\TH:i:s.vP');
122: }
123: if (!is_null($this->totalAuthorizedAmount)) {
124: $object->totalAuthorizedAmount = $this->totalAuthorizedAmount->toObject();
125: }
126: return $object;
127: }
128:
129: /**
130: * @param object $object
131: *
132: * @return $this
133: * @throws UnexpectedValueException
134: */
135: public function fromObject(object $object): ApiPaymentResponse
136: {
137: parent::fromObject($object);
138: if (property_exists($object, 'additionalResponseData')) {
139: if (!is_object($object->additionalResponseData)) {
140: throw new UnexpectedValueException('value \'' . print_r($object->additionalResponseData, true) . '\' is not an object');
141: }
142: $value = new AdditionalResponseData();
143: $this->additionalResponseData = $value->fromObject($object->additionalResponseData);
144: }
145: if (property_exists($object, 'cardPaymentData')) {
146: if (!is_object($object->cardPaymentData)) {
147: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
148: }
149: $value = new CardPaymentDataForResponse();
150: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
151: }
152: if (property_exists($object, 'initialAuthorizationCode')) {
153: $this->initialAuthorizationCode = $object->initialAuthorizationCode;
154: }
155: if (property_exists($object, 'operationId')) {
156: $this->operationId = $object->operationId;
157: }
158: if (property_exists($object, 'paymentId')) {
159: $this->paymentId = $object->paymentId;
160: }
161: if (property_exists($object, 'references')) {
162: if (!is_object($object->references)) {
163: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
164: }
165: $value = new ApiReferencesForResponses();
166: $this->references = $value->fromObject($object->references);
167: }
168: if (property_exists($object, 'responder')) {
169: $this->responder = $object->responder;
170: }
171: if (property_exists($object, 'responseCode')) {
172: $this->responseCode = $object->responseCode;
173: }
174: if (property_exists($object, 'responseCodeCategory')) {
175: $this->responseCodeCategory = $object->responseCodeCategory;
176: }
177: if (property_exists($object, 'responseCodeDescription')) {
178: $this->responseCodeDescription = $object->responseCodeDescription;
179: }
180: if (property_exists($object, 'status')) {
181: $this->status = $object->status;
182: }
183: if (property_exists($object, 'statusTimestamp')) {
184: $this->statusTimestamp = new DateTime($object->statusTimestamp);
185: }
186: if (property_exists($object, 'totalAuthorizedAmount')) {
187: if (!is_object($object->totalAuthorizedAmount)) {
188: throw new UnexpectedValueException('value \'' . print_r($object->totalAuthorizedAmount, true) . '\' is not an object');
189: }
190: $value = new AmountData();
191: $this->totalAuthorizedAmount = $value->fromObject($object->totalAuthorizedAmount);
192: }
193: return $this;
194: }
195: }
196: