1: <?php
2: /*
3: * This file was automatically generated.
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: * @package Worldline\Acquiring\Sdk\V1\Domain
13: */
14: class SubOperation extends DataObject
15: {
16: /**
17: * @var AmountData|null
18: */
19: public ?AmountData $amount = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $authorizationCode = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $operationId = null;
30:
31: /**
32: * @var DateTime|null
33: */
34: public ?DateTime $operationTimestamp = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $operationType = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $responseCode = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $responseCodeCategory = null;
50:
51: /**
52: * @var string|null
53: */
54: public ?string $responseCodeDescription = null;
55:
56: /**
57: * @return object
58: */
59: public function toObject(): object
60: {
61: $object = parent::toObject();
62: if (!is_null($this->amount)) {
63: $object->amount = $this->amount->toObject();
64: }
65: if (!is_null($this->authorizationCode)) {
66: $object->authorizationCode = $this->authorizationCode;
67: }
68: if (!is_null($this->operationId)) {
69: $object->operationId = $this->operationId;
70: }
71: if (!is_null($this->operationTimestamp)) {
72: $object->operationTimestamp = $this->operationTimestamp->format('Y-m-d\\TH:i:s.vP');
73: }
74: if (!is_null($this->operationType)) {
75: $object->operationType = $this->operationType;
76: }
77: if (!is_null($this->responseCode)) {
78: $object->responseCode = $this->responseCode;
79: }
80: if (!is_null($this->responseCodeCategory)) {
81: $object->responseCodeCategory = $this->responseCodeCategory;
82: }
83: if (!is_null($this->responseCodeDescription)) {
84: $object->responseCodeDescription = $this->responseCodeDescription;
85: }
86: return $object;
87: }
88:
89: /**
90: * @param object $object
91: *
92: * @return $this
93: * @throws UnexpectedValueException
94: */
95: public function fromObject(object $object): SubOperation
96: {
97: parent::fromObject($object);
98: if (property_exists($object, 'amount')) {
99: if (!is_object($object->amount)) {
100: throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object');
101: }
102: $value = new AmountData();
103: $this->amount = $value->fromObject($object->amount);
104: }
105: if (property_exists($object, 'authorizationCode')) {
106: $this->authorizationCode = $object->authorizationCode;
107: }
108: if (property_exists($object, 'operationId')) {
109: $this->operationId = $object->operationId;
110: }
111: if (property_exists($object, 'operationTimestamp')) {
112: $this->operationTimestamp = new DateTime($object->operationTimestamp);
113: }
114: if (property_exists($object, 'operationType')) {
115: $this->operationType = $object->operationType;
116: }
117: if (property_exists($object, 'responseCode')) {
118: $this->responseCode = $object->responseCode;
119: }
120: if (property_exists($object, 'responseCodeCategory')) {
121: $this->responseCodeCategory = $object->responseCodeCategory;
122: }
123: if (property_exists($object, 'responseCodeDescription')) {
124: $this->responseCodeDescription = $object->responseCodeDescription;
125: }
126: return $this;
127: }
128: }
129: