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
18: */
19: public $amountOfMoney = null;
20:
21: /**
22: * @var BankRefundMethodSpecificInput
23: */
24: public $bankRefundMethodSpecificInput = null;
25:
26: /**
27: * @var RefundCustomer
28: */
29: public $customer = null;
30:
31: /**
32: * @var string
33: */
34: public $refundDate = null;
35:
36: /**
37: * @var string
38: */
39: public $refundReason = null;
40:
41: /**
42: * @var RefundReferences
43: */
44: public $refundReferences = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject()
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: * @return $this
76: * @throws UnexpectedValueException
77: */
78: public function fromObject($object)
79: {
80: parent::fromObject($object);
81: if (property_exists($object, 'amountOfMoney')) {
82: if (!is_object($object->amountOfMoney)) {
83: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
84: }
85: $value = new AmountOfMoney();
86: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
87: }
88: if (property_exists($object, 'bankRefundMethodSpecificInput')) {
89: if (!is_object($object->bankRefundMethodSpecificInput)) {
90: throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificInput, true) . '\' is not an object');
91: }
92: $value = new BankRefundMethodSpecificInput();
93: $this->bankRefundMethodSpecificInput = $value->fromObject($object->bankRefundMethodSpecificInput);
94: }
95: if (property_exists($object, 'customer')) {
96: if (!is_object($object->customer)) {
97: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
98: }
99: $value = new RefundCustomer();
100: $this->customer = $value->fromObject($object->customer);
101: }
102: if (property_exists($object, 'refundDate')) {
103: $this->refundDate = $object->refundDate;
104: }
105: if (property_exists($object, 'refundReason')) {
106: $this->refundReason = $object->refundReason;
107: }
108: if (property_exists($object, 'refundReferences')) {
109: if (!is_object($object->refundReferences)) {
110: throw new UnexpectedValueException('value \'' . print_r($object->refundReferences, true) . '\' is not an object');
111: }
112: $value = new RefundReferences();
113: $this->refundReferences = $value->fromObject($object->refundReferences);
114: }
115: return $this;
116: }
117: }
118: