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 DisputeEntry extends DataObject
15: {
16: /**
17: * @var DisputeDocument[]|null
18: */
19: public ?array $documents = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $elaboration = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $entryCategory = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $entryDateTime = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $entryId = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $entryType = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $entryTypeDescription = null;
50:
51: /**
52: * @var string|null
53: */
54: public ?string $messageText = null;
55:
56: /**
57: * @var string|null
58: */
59: public ?string $questionnaire = null;
60:
61: /**
62: * @var DateTime|null
63: */
64: public ?DateTime $responseDueDate = null;
65:
66: /**
67: * @var string|null
68: */
69: public ?string $schemeReason = null;
70:
71: /**
72: * @var string|null
73: */
74: public ?string $schemeReasonDescription = null;
75:
76: /**
77: * @var AmountData|null
78: */
79: public ?AmountData $settlementAmount = null;
80:
81: /**
82: * @var AmountData|null
83: */
84: public ?AmountData $transactionAmount = null;
85:
86: /**
87: * @var string|null
88: */
89: public ?string $userId = null;
90:
91: /**
92: * @return object
93: */
94: public function toObject(): object
95: {
96: $object = parent::toObject();
97: if (!is_null($this->documents)) {
98: $object->documents = [];
99: foreach ($this->documents as $element) {
100: if (!is_null($element)) {
101: $object->documents[] = $element->toObject();
102: }
103: }
104: }
105: if (!is_null($this->elaboration)) {
106: $object->elaboration = $this->elaboration;
107: }
108: if (!is_null($this->entryCategory)) {
109: $object->entryCategory = $this->entryCategory;
110: }
111: if (!is_null($this->entryDateTime)) {
112: $object->entryDateTime = $this->entryDateTime;
113: }
114: if (!is_null($this->entryId)) {
115: $object->entryId = $this->entryId;
116: }
117: if (!is_null($this->entryType)) {
118: $object->entryType = $this->entryType;
119: }
120: if (!is_null($this->entryTypeDescription)) {
121: $object->entryTypeDescription = $this->entryTypeDescription;
122: }
123: if (!is_null($this->messageText)) {
124: $object->messageText = $this->messageText;
125: }
126: if (!is_null($this->questionnaire)) {
127: $object->questionnaire = $this->questionnaire;
128: }
129: if (!is_null($this->responseDueDate)) {
130: $object->responseDueDate = $this->responseDueDate->format('Y-m-d');
131: }
132: if (!is_null($this->schemeReason)) {
133: $object->schemeReason = $this->schemeReason;
134: }
135: if (!is_null($this->schemeReasonDescription)) {
136: $object->schemeReasonDescription = $this->schemeReasonDescription;
137: }
138: if (!is_null($this->settlementAmount)) {
139: $object->settlementAmount = $this->settlementAmount->toObject();
140: }
141: if (!is_null($this->transactionAmount)) {
142: $object->transactionAmount = $this->transactionAmount->toObject();
143: }
144: if (!is_null($this->userId)) {
145: $object->userId = $this->userId;
146: }
147: return $object;
148: }
149:
150: /**
151: * @param object $object
152: *
153: * @return $this
154: * @throws UnexpectedValueException
155: */
156: public function fromObject(object $object): DisputeEntry
157: {
158: parent::fromObject($object);
159: if (property_exists($object, 'documents')) {
160: if (!is_array($object->documents) && !is_object($object->documents)) {
161: throw new UnexpectedValueException('value \'' . print_r($object->documents, true) . '\' is not an array or object');
162: }
163: $this->documents = [];
164: foreach ($object->documents as $element) {
165: $value = new DisputeDocument();
166: $this->documents[] = $value->fromObject($element);
167: }
168: }
169: if (property_exists($object, 'elaboration')) {
170: $this->elaboration = $object->elaboration;
171: }
172: if (property_exists($object, 'entryCategory')) {
173: $this->entryCategory = $object->entryCategory;
174: }
175: if (property_exists($object, 'entryDateTime')) {
176: $this->entryDateTime = $object->entryDateTime;
177: }
178: if (property_exists($object, 'entryId')) {
179: $this->entryId = $object->entryId;
180: }
181: if (property_exists($object, 'entryType')) {
182: $this->entryType = $object->entryType;
183: }
184: if (property_exists($object, 'entryTypeDescription')) {
185: $this->entryTypeDescription = $object->entryTypeDescription;
186: }
187: if (property_exists($object, 'messageText')) {
188: $this->messageText = $object->messageText;
189: }
190: if (property_exists($object, 'questionnaire')) {
191: $this->questionnaire = $object->questionnaire;
192: }
193: if (property_exists($object, 'responseDueDate')) {
194: $this->responseDueDate = new DateTime($object->responseDueDate);
195: }
196: if (property_exists($object, 'schemeReason')) {
197: $this->schemeReason = $object->schemeReason;
198: }
199: if (property_exists($object, 'schemeReasonDescription')) {
200: $this->schemeReasonDescription = $object->schemeReasonDescription;
201: }
202: if (property_exists($object, 'settlementAmount')) {
203: if (!is_object($object->settlementAmount)) {
204: throw new UnexpectedValueException('value \'' . print_r($object->settlementAmount, true) . '\' is not an object');
205: }
206: $value = new AmountData();
207: $this->settlementAmount = $value->fromObject($object->settlementAmount);
208: }
209: if (property_exists($object, 'transactionAmount')) {
210: if (!is_object($object->transactionAmount)) {
211: throw new UnexpectedValueException('value \'' . print_r($object->transactionAmount, true) . '\' is not an object');
212: }
213: $value = new AmountData();
214: $this->transactionAmount = $value->fromObject($object->transactionAmount);
215: }
216: if (property_exists($object, 'userId')) {
217: $this->userId = $object->userId;
218: }
219: return $this;
220: }
221: }
222: