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