1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8:
9: /**
10: * @package Worldline\Acquiring\Sdk\V1\Domain
11: */
12: class ApiIncrementResponse extends ApiActionResponse
13: {
14: /**
15: * @var string|null
16: */
17: public ?string $authorizationCode = null;
18:
19: /**
20: * @var AmountData|null
21: */
22: public ?AmountData $totalAuthorizedAmount = null;
23:
24: /**
25: * @return object
26: */
27: public function toObject(): object
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: * @param object $object
41: *
42: * @return $this
43: * @throws UnexpectedValueException
44: */
45: public function fromObject(object $object): ApiIncrementResponse
46: {
47: parent::fromObject($object);
48: if (property_exists($object, 'authorizationCode')) {
49: $this->authorizationCode = $object->authorizationCode;
50: }
51: if (property_exists($object, 'totalAuthorizedAmount')) {
52: if (!is_object($object->totalAuthorizedAmount)) {
53: throw new UnexpectedValueException('value \'' . print_r($object->totalAuthorizedAmount, true) . '\' is not an object');
54: }
55: $value = new AmountData();
56: $this->totalAuthorizedAmount = $value->fromObject($object->totalAuthorizedAmount);
57: }
58: return $this;
59: }
60: }
61: