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 SubmitEvidenceRequest extends DataObject
14: {
15: /**
16: * @var DisputeDocumentIdItem[]|null
17: */
18: public ?array $documentIds = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $elaboration = null;
24:
25: /**
26: * @var bool|null
27: */
28: public ?bool $includeEntries = null;
29:
30: /**
31: * @var AmountData|null
32: */
33: public ?AmountData $partialAmount = null;
34:
35: /**
36: * @var string|null
37: */
38: public ?string $userId = null;
39:
40: /**
41: * @return object
42: */
43: public function toObject(): object
44: {
45: $object = parent::toObject();
46: if (!is_null($this->documentIds)) {
47: $object->documentIds = [];
48: foreach ($this->documentIds as $element) {
49: if (!is_null($element)) {
50: $object->documentIds[] = $element->toObject();
51: }
52: }
53: }
54: if (!is_null($this->elaboration)) {
55: $object->elaboration = $this->elaboration;
56: }
57: if (!is_null($this->includeEntries)) {
58: $object->includeEntries = $this->includeEntries;
59: }
60: if (!is_null($this->partialAmount)) {
61: $object->partialAmount = $this->partialAmount->toObject();
62: }
63: if (!is_null($this->userId)) {
64: $object->userId = $this->userId;
65: }
66: return $object;
67: }
68:
69: /**
70: * @param object $object
71: *
72: * @return $this
73: * @throws UnexpectedValueException
74: */
75: public function fromObject(object $object): SubmitEvidenceRequest
76: {
77: parent::fromObject($object);
78: if (property_exists($object, 'documentIds')) {
79: if (!is_array($object->documentIds) && !is_object($object->documentIds)) {
80: throw new UnexpectedValueException('value \'' . print_r($object->documentIds, true) . '\' is not an array or object');
81: }
82: $this->documentIds = [];
83: foreach ($object->documentIds as $element) {
84: $value = new DisputeDocumentIdItem();
85: $this->documentIds[] = $value->fromObject($element);
86: }
87: }
88: if (property_exists($object, 'elaboration')) {
89: $this->elaboration = $object->elaboration;
90: }
91: if (property_exists($object, 'includeEntries')) {
92: $this->includeEntries = $object->includeEntries;
93: }
94: if (property_exists($object, 'partialAmount')) {
95: if (!is_object($object->partialAmount)) {
96: throw new UnexpectedValueException('value \'' . print_r($object->partialAmount, true) . '\' is not an object');
97: }
98: $value = new AmountData();
99: $this->partialAmount = $value->fromObject($object->partialAmount);
100: }
101: if (property_exists($object, 'userId')) {
102: $this->userId = $object->userId;
103: }
104: return $this;
105: }
106: }
107: