1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use UnexpectedValueException; |
8: | |
9: | |
10: | |
11: | |
12: | class ApiReversalResponse extends ApiActionResponse |
13: | { |
14: | |
15: | |
16: | |
17: | public $totalAuthorizedAmount = null; |
18: | |
19: | |
20: | |
21: | |
22: | public function toObject() |
23: | { |
24: | $object = parent::toObject(); |
25: | if (!is_null($this->totalAuthorizedAmount)) { |
26: | $object->totalAuthorizedAmount = $this->totalAuthorizedAmount->toObject(); |
27: | } |
28: | return $object; |
29: | } |
30: | |
31: | |
32: | |
33: | |
34: | |
35: | |
36: | public function fromObject($object) |
37: | { |
38: | parent::fromObject($object); |
39: | if (property_exists($object, 'totalAuthorizedAmount')) { |
40: | if (!is_object($object->totalAuthorizedAmount)) { |
41: | throw new UnexpectedValueException('value \'' . print_r($object->totalAuthorizedAmount, true) . '\' is not an object'); |
42: | } |
43: | $value = new AmountData(); |
44: | $this->totalAuthorizedAmount = $value->fromObject($object->totalAuthorizedAmount); |
45: | } |
46: | return $this; |
47: | } |
48: | } |
49: | |