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