1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class CreateDisputeRequest extends DataObject
15: {
16: /**
17: * @var AmountOfMoney|null
18: */
19: public ?AmountOfMoney $amountOfMoney = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $contactPerson = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $emailAddress = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $replyTo = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $requestMessage = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject(): object
45: {
46: $object = parent::toObject();
47: if (!is_null($this->amountOfMoney)) {
48: $object->amountOfMoney = $this->amountOfMoney->toObject();
49: }
50: if (!is_null($this->contactPerson)) {
51: $object->contactPerson = $this->contactPerson;
52: }
53: if (!is_null($this->emailAddress)) {
54: $object->emailAddress = $this->emailAddress;
55: }
56: if (!is_null($this->replyTo)) {
57: $object->replyTo = $this->replyTo;
58: }
59: if (!is_null($this->requestMessage)) {
60: $object->requestMessage = $this->requestMessage;
61: }
62: return $object;
63: }
64:
65: /**
66: * @param object $object
67: *
68: * @return $this
69: * @throws UnexpectedValueException
70: */
71: public function fromObject(object $object): CreateDisputeRequest
72: {
73: parent::fromObject($object);
74: if (property_exists($object, 'amountOfMoney')) {
75: if (!is_object($object->amountOfMoney)) {
76: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
77: }
78: $value = new AmountOfMoney();
79: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
80: }
81: if (property_exists($object, 'contactPerson')) {
82: $this->contactPerson = $object->contactPerson;
83: }
84: if (property_exists($object, 'emailAddress')) {
85: $this->emailAddress = $object->emailAddress;
86: }
87: if (property_exists($object, 'replyTo')) {
88: $this->replyTo = $object->replyTo;
89: }
90: if (property_exists($object, 'requestMessage')) {
91: $this->requestMessage = $object->requestMessage;
92: }
93: return $this;
94: }
95: }
96: