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 SearchDisputeEntriesRequest extends DataObject
14: {
15: /**
16: * @var string|null
17: */
18: public ?string $disputeId = null;
19:
20: /**
21: * @var string[]|null
22: */
23: public ?array $entryCategories = null;
24:
25: /**
26: * @var DateTimeRange|null
27: */
28: public ?DateTimeRange $entryDateTime = null;
29:
30: /**
31: * @var string|null
32: */
33: public ?string $entryId = null;
34:
35: /**
36: * @var string[]|null
37: */
38: public ?array $entryTypes = null;
39:
40: /**
41: * @var bool|null
42: */
43: public ?bool $includeDisputeSummary = null;
44:
45: /**
46: * @var MerchantScope|null
47: */
48: public ?MerchantScope $merchantScope = null;
49:
50: /**
51: * @var PaginationRequest|null
52: */
53: public ?PaginationRequest $pagination = null;
54:
55: /**
56: * @var string|null
57: */
58: public ?string $sortOrder = null;
59:
60: /**
61: * @return object
62: */
63: public function toObject(): object
64: {
65: $object = parent::toObject();
66: if (!is_null($this->disputeId)) {
67: $object->disputeId = $this->disputeId;
68: }
69: if (!is_null($this->entryCategories)) {
70: $object->entryCategories = [];
71: foreach ($this->entryCategories as $element) {
72: if (!is_null($element)) {
73: $object->entryCategories[] = $element;
74: }
75: }
76: }
77: if (!is_null($this->entryDateTime)) {
78: $object->entryDateTime = $this->entryDateTime->toObject();
79: }
80: if (!is_null($this->entryId)) {
81: $object->entryId = $this->entryId;
82: }
83: if (!is_null($this->entryTypes)) {
84: $object->entryTypes = [];
85: foreach ($this->entryTypes as $element) {
86: if (!is_null($element)) {
87: $object->entryTypes[] = $element;
88: }
89: }
90: }
91: if (!is_null($this->includeDisputeSummary)) {
92: $object->includeDisputeSummary = $this->includeDisputeSummary;
93: }
94: if (!is_null($this->merchantScope)) {
95: $object->merchantScope = $this->merchantScope->toObject();
96: }
97: if (!is_null($this->pagination)) {
98: $object->pagination = $this->pagination->toObject();
99: }
100: if (!is_null($this->sortOrder)) {
101: $object->sortOrder = $this->sortOrder;
102: }
103: return $object;
104: }
105:
106: /**
107: * @param object $object
108: *
109: * @return $this
110: * @throws UnexpectedValueException
111: */
112: public function fromObject(object $object): SearchDisputeEntriesRequest
113: {
114: parent::fromObject($object);
115: if (property_exists($object, 'disputeId')) {
116: $this->disputeId = $object->disputeId;
117: }
118: if (property_exists($object, 'entryCategories')) {
119: if (!is_array($object->entryCategories) && !is_object($object->entryCategories)) {
120: throw new UnexpectedValueException('value \'' . print_r($object->entryCategories, true) . '\' is not an array or object');
121: }
122: $this->entryCategories = [];
123: foreach ($object->entryCategories as $element) {
124: $this->entryCategories[] = $element;
125: }
126: }
127: if (property_exists($object, 'entryDateTime')) {
128: if (!is_object($object->entryDateTime)) {
129: throw new UnexpectedValueException('value \'' . print_r($object->entryDateTime, true) . '\' is not an object');
130: }
131: $value = new DateTimeRange();
132: $this->entryDateTime = $value->fromObject($object->entryDateTime);
133: }
134: if (property_exists($object, 'entryId')) {
135: $this->entryId = $object->entryId;
136: }
137: if (property_exists($object, 'entryTypes')) {
138: if (!is_array($object->entryTypes) && !is_object($object->entryTypes)) {
139: throw new UnexpectedValueException('value \'' . print_r($object->entryTypes, true) . '\' is not an array or object');
140: }
141: $this->entryTypes = [];
142: foreach ($object->entryTypes as $element) {
143: $this->entryTypes[] = $element;
144: }
145: }
146: if (property_exists($object, 'includeDisputeSummary')) {
147: $this->includeDisputeSummary = $object->includeDisputeSummary;
148: }
149: if (property_exists($object, 'merchantScope')) {
150: if (!is_object($object->merchantScope)) {
151: throw new UnexpectedValueException('value \'' . print_r($object->merchantScope, true) . '\' is not an object');
152: }
153: $value = new MerchantScope();
154: $this->merchantScope = $value->fromObject($object->merchantScope);
155: }
156: if (property_exists($object, 'pagination')) {
157: if (!is_object($object->pagination)) {
158: throw new UnexpectedValueException('value \'' . print_r($object->pagination, true) . '\' is not an object');
159: }
160: $value = new PaginationRequest();
161: $this->pagination = $value->fromObject($object->pagination);
162: }
163: if (property_exists($object, 'sortOrder')) {
164: $this->sortOrder = $object->sortOrder;
165: }
166: return $this;
167: }
168: }
169: