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 RefundRequest extends DataObject
15: {
16: /**
17: * @var AmountOfMoney|null
18: */
19: public ?AmountOfMoney $amountOfMoney = null;
20:
21: /**
22: * @var BankRefundMethodSpecificInput|null
23: */
24: public ?BankRefundMethodSpecificInput $bankRefundMethodSpecificInput = null;
25:
26: /**
27: * @var RefundCustomer|null
28: */
29: public ?RefundCustomer $customer = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $refundDate = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $refundReason = null;
40:
41: /**
42: * @var RefundReferences|null
43: */
44: public ?RefundReferences $refundReferences = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject(): object
50: {
51: $object = parent::toObject();
52: if (!is_null($this->amountOfMoney)) {
53: $object->amountOfMoney = $this->amountOfMoney->toObject();
54: }
55: if (!is_null($this->bankRefundMethodSpecificInput)) {
56: $object->bankRefundMethodSpecificInput = $this->bankRefundMethodSpecificInput->toObject();
57: }
58: if (!is_null($this->customer)) {
59: $object->customer = $this->customer->toObject();
60: }
61: if (!is_null($this->refundDate)) {
62: $object->refundDate = $this->refundDate;
63: }
64: if (!is_null($this->refundReason)) {
65: $object->refundReason = $this->refundReason;
66: }
67: if (!is_null($this->refundReferences)) {
68: $object->refundReferences = $this->refundReferences->toObject();
69: }
70: return $object;
71: }
72:
73: /**
74: * @param object $object
75: *
76: * @return $this
77: * @throws UnexpectedValueException
78: */
79: public function fromObject(object $object): RefundRequest
80: {
81: parent::fromObject($object);
82: if (property_exists($object, 'amountOfMoney')) {
83: if (!is_object($object->amountOfMoney)) {
84: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
85: }
86: $value = new AmountOfMoney();
87: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
88: }
89: if (property_exists($object, 'bankRefundMethodSpecificInput')) {
90: if (!is_object($object->bankRefundMethodSpecificInput)) {
91: throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificInput, true) . '\' is not an object');
92: }
93: $value = new BankRefundMethodSpecificInput();
94: $this->bankRefundMethodSpecificInput = $value->fromObject($object->bankRefundMethodSpecificInput);
95: }
96: if (property_exists($object, 'customer')) {
97: if (!is_object($object->customer)) {
98: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
99: }
100: $value = new RefundCustomer();
101: $this->customer = $value->fromObject($object->customer);
102: }
103: if (property_exists($object, 'refundDate')) {
104: $this->refundDate = $object->refundDate;
105: }
106: if (property_exists($object, 'refundReason')) {
107: $this->refundReason = $object->refundReason;
108: }
109: if (property_exists($object, 'refundReferences')) {
110: if (!is_object($object->refundReferences)) {
111: throw new UnexpectedValueException('value \'' . print_r($object->refundReferences, true) . '\' is not an object');
112: }
113: $value = new RefundReferences();
114: $this->refundReferences = $value->fromObject($object->refundReferences);
115: }
116: return $this;
117: }
118: }
119: