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