1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8: use Worldline\Acquiring\Sdk\Domain\DataObject;
9:
10: /**
11: * @package Worldline\Acquiring\Sdk\V1\Domain
12: */
13: class SearchDisputesRequest extends DataObject
14: {
15: /**
16: * @var string|null
17: */
18: public ?string $acquirerDisputeReference = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $acquirerReferenceNumber = null;
24:
25: /**
26: * @var DateTimeRange|null
27: */
28: public ?DateTimeRange $closedDateTime = null;
29:
30: /**
31: * @var string|null
32: */
33: public ?string $disputeId = null;
34:
35: /**
36: * @var string[]|null
37: */
38: public ?array $disputeStages = null;
39:
40: /**
41: * @var string[]|null
42: */
43: public ?array $disputeStatusCategories = null;
44:
45: /**
46: * @var bool|null
47: */
48: public ?bool $isOpen = null;
49:
50: /**
51: * @var DateTimeRange|null
52: */
53: public ?DateTimeRange $lastStatusChangedDateTime = null;
54:
55: /**
56: * @var string|null
57: */
58: public ?string $merchantReference = null;
59:
60: /**
61: * @var MerchantScope|null
62: */
63: public ?MerchantScope $merchantScope = null;
64:
65: /**
66: * @var DateTimeRange|null
67: */
68: public ?DateTimeRange $openedDateTime = null;
69:
70: /**
71: * @var PaginationRequest|null
72: */
73: public ?PaginationRequest $pagination = null;
74:
75: /**
76: * @var string|null
77: */
78: public ?string $paymentId = null;
79:
80: /**
81: * @var DateRange|null
82: */
83: public ?DateRange $responseDueDate = null;
84:
85: /**
86: * @var string[]|null
87: */
88: public ?array $schemes = null;
89:
90: /**
91: * @var string|null
92: */
93: public ?string $sortBy = null;
94:
95: /**
96: * @var string|null
97: */
98: public ?string $sortOrder = null;
99:
100: /**
101: * @var string[]|null
102: */
103: public ?array $unifiedCategories = null;
104:
105: /**
106: * @return object
107: */
108: public function toObject(): object
109: {
110: $object = parent::toObject();
111: if (!is_null($this->acquirerDisputeReference)) {
112: $object->acquirerDisputeReference = $this->acquirerDisputeReference;
113: }
114: if (!is_null($this->acquirerReferenceNumber)) {
115: $object->acquirerReferenceNumber = $this->acquirerReferenceNumber;
116: }
117: if (!is_null($this->closedDateTime)) {
118: $object->closedDateTime = $this->closedDateTime->toObject();
119: }
120: if (!is_null($this->disputeId)) {
121: $object->disputeId = $this->disputeId;
122: }
123: if (!is_null($this->disputeStages)) {
124: $object->disputeStages = [];
125: foreach ($this->disputeStages as $element) {
126: if (!is_null($element)) {
127: $object->disputeStages[] = $element;
128: }
129: }
130: }
131: if (!is_null($this->disputeStatusCategories)) {
132: $object->disputeStatusCategories = [];
133: foreach ($this->disputeStatusCategories as $element) {
134: if (!is_null($element)) {
135: $object->disputeStatusCategories[] = $element;
136: }
137: }
138: }
139: if (!is_null($this->isOpen)) {
140: $object->isOpen = $this->isOpen;
141: }
142: if (!is_null($this->lastStatusChangedDateTime)) {
143: $object->lastStatusChangedDateTime = $this->lastStatusChangedDateTime->toObject();
144: }
145: if (!is_null($this->merchantReference)) {
146: $object->merchantReference = $this->merchantReference;
147: }
148: if (!is_null($this->merchantScope)) {
149: $object->merchantScope = $this->merchantScope->toObject();
150: }
151: if (!is_null($this->openedDateTime)) {
152: $object->openedDateTime = $this->openedDateTime->toObject();
153: }
154: if (!is_null($this->pagination)) {
155: $object->pagination = $this->pagination->toObject();
156: }
157: if (!is_null($this->paymentId)) {
158: $object->paymentId = $this->paymentId;
159: }
160: if (!is_null($this->responseDueDate)) {
161: $object->responseDueDate = $this->responseDueDate->toObject();
162: }
163: if (!is_null($this->schemes)) {
164: $object->schemes = [];
165: foreach ($this->schemes as $element) {
166: if (!is_null($element)) {
167: $object->schemes[] = $element;
168: }
169: }
170: }
171: if (!is_null($this->sortBy)) {
172: $object->sortBy = $this->sortBy;
173: }
174: if (!is_null($this->sortOrder)) {
175: $object->sortOrder = $this->sortOrder;
176: }
177: if (!is_null($this->unifiedCategories)) {
178: $object->unifiedCategories = [];
179: foreach ($this->unifiedCategories as $element) {
180: if (!is_null($element)) {
181: $object->unifiedCategories[] = $element;
182: }
183: }
184: }
185: return $object;
186: }
187:
188: /**
189: * @param object $object
190: *
191: * @return $this
192: * @throws UnexpectedValueException
193: */
194: public function fromObject(object $object): SearchDisputesRequest
195: {
196: parent::fromObject($object);
197: if (property_exists($object, 'acquirerDisputeReference')) {
198: $this->acquirerDisputeReference = $object->acquirerDisputeReference;
199: }
200: if (property_exists($object, 'acquirerReferenceNumber')) {
201: $this->acquirerReferenceNumber = $object->acquirerReferenceNumber;
202: }
203: if (property_exists($object, 'closedDateTime')) {
204: if (!is_object($object->closedDateTime)) {
205: throw new UnexpectedValueException('value \'' . print_r($object->closedDateTime, true) . '\' is not an object');
206: }
207: $value = new DateTimeRange();
208: $this->closedDateTime = $value->fromObject($object->closedDateTime);
209: }
210: if (property_exists($object, 'disputeId')) {
211: $this->disputeId = $object->disputeId;
212: }
213: if (property_exists($object, 'disputeStages')) {
214: if (!is_array($object->disputeStages) && !is_object($object->disputeStages)) {
215: throw new UnexpectedValueException('value \'' . print_r($object->disputeStages, true) . '\' is not an array or object');
216: }
217: $this->disputeStages = [];
218: foreach ($object->disputeStages as $element) {
219: $this->disputeStages[] = $element;
220: }
221: }
222: if (property_exists($object, 'disputeStatusCategories')) {
223: if (!is_array($object->disputeStatusCategories) && !is_object($object->disputeStatusCategories)) {
224: throw new UnexpectedValueException('value \'' . print_r($object->disputeStatusCategories, true) . '\' is not an array or object');
225: }
226: $this->disputeStatusCategories = [];
227: foreach ($object->disputeStatusCategories as $element) {
228: $this->disputeStatusCategories[] = $element;
229: }
230: }
231: if (property_exists($object, 'isOpen')) {
232: $this->isOpen = $object->isOpen;
233: }
234: if (property_exists($object, 'lastStatusChangedDateTime')) {
235: if (!is_object($object->lastStatusChangedDateTime)) {
236: throw new UnexpectedValueException('value \'' . print_r($object->lastStatusChangedDateTime, true) . '\' is not an object');
237: }
238: $value = new DateTimeRange();
239: $this->lastStatusChangedDateTime = $value->fromObject($object->lastStatusChangedDateTime);
240: }
241: if (property_exists($object, 'merchantReference')) {
242: $this->merchantReference = $object->merchantReference;
243: }
244: if (property_exists($object, 'merchantScope')) {
245: if (!is_object($object->merchantScope)) {
246: throw new UnexpectedValueException('value \'' . print_r($object->merchantScope, true) . '\' is not an object');
247: }
248: $value = new MerchantScope();
249: $this->merchantScope = $value->fromObject($object->merchantScope);
250: }
251: if (property_exists($object, 'openedDateTime')) {
252: if (!is_object($object->openedDateTime)) {
253: throw new UnexpectedValueException('value \'' . print_r($object->openedDateTime, true) . '\' is not an object');
254: }
255: $value = new DateTimeRange();
256: $this->openedDateTime = $value->fromObject($object->openedDateTime);
257: }
258: if (property_exists($object, 'pagination')) {
259: if (!is_object($object->pagination)) {
260: throw new UnexpectedValueException('value \'' . print_r($object->pagination, true) . '\' is not an object');
261: }
262: $value = new PaginationRequest();
263: $this->pagination = $value->fromObject($object->pagination);
264: }
265: if (property_exists($object, 'paymentId')) {
266: $this->paymentId = $object->paymentId;
267: }
268: if (property_exists($object, 'responseDueDate')) {
269: if (!is_object($object->responseDueDate)) {
270: throw new UnexpectedValueException('value \'' . print_r($object->responseDueDate, true) . '\' is not an object');
271: }
272: $value = new DateRange();
273: $this->responseDueDate = $value->fromObject($object->responseDueDate);
274: }
275: if (property_exists($object, 'schemes')) {
276: if (!is_array($object->schemes) && !is_object($object->schemes)) {
277: throw new UnexpectedValueException('value \'' . print_r($object->schemes, true) . '\' is not an array or object');
278: }
279: $this->schemes = [];
280: foreach ($object->schemes as $element) {
281: $this->schemes[] = $element;
282: }
283: }
284: if (property_exists($object, 'sortBy')) {
285: $this->sortBy = $object->sortBy;
286: }
287: if (property_exists($object, 'sortOrder')) {
288: $this->sortOrder = $object->sortOrder;
289: }
290: if (property_exists($object, 'unifiedCategories')) {
291: if (!is_array($object->unifiedCategories) && !is_object($object->unifiedCategories)) {
292: throw new UnexpectedValueException('value \'' . print_r($object->unifiedCategories, true) . '\' is not an array or object');
293: }
294: $this->unifiedCategories = [];
295: foreach ($object->unifiedCategories as $element) {
296: $this->unifiedCategories[] = $element;
297: }
298: }
299: return $this;
300: }
301: }
302: