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 ApiRefundSummaryForResponse extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $references = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $refundId = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $retryAfter = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $status = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $statusTimestamp = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
45: | { |
46: | $object = parent::toObject(); |
47: | if (!is_null($this->references)) { |
48: | $object->references = $this->references->toObject(); |
49: | } |
50: | if (!is_null($this->refundId)) { |
51: | $object->refundId = $this->refundId; |
52: | } |
53: | if (!is_null($this->retryAfter)) { |
54: | $object->retryAfter = $this->retryAfter; |
55: | } |
56: | if (!is_null($this->status)) { |
57: | $object->status = $this->status; |
58: | } |
59: | if (!is_null($this->statusTimestamp)) { |
60: | $object->statusTimestamp = $this->statusTimestamp->format('Y-m-d\\TH:i:s.vP'); |
61: | } |
62: | return $object; |
63: | } |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | public function fromObject($object) |
71: | { |
72: | parent::fromObject($object); |
73: | if (property_exists($object, 'references')) { |
74: | if (!is_object($object->references)) { |
75: | throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); |
76: | } |
77: | $value = new ApiReferencesForResponses(); |
78: | $this->references = $value->fromObject($object->references); |
79: | } |
80: | if (property_exists($object, 'refundId')) { |
81: | $this->refundId = $object->refundId; |
82: | } |
83: | if (property_exists($object, 'retryAfter')) { |
84: | $this->retryAfter = $object->retryAfter; |
85: | } |
86: | if (property_exists($object, 'status')) { |
87: | $this->status = $object->status; |
88: | } |
89: | if (property_exists($object, 'statusTimestamp')) { |
90: | $this->statusTimestamp = new DateTime($object->statusTimestamp); |
91: | } |
92: | return $this; |
93: | } |
94: | } |
95: | |