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