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 RefundReferences
38: */
39: public $refundReferences = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject()
45: {
46: $object = parent::toObject();
47: if (!is_null($this->amountOfMoney)) {
48: $object->amountOfMoney = $this->amountOfMoney->toObject();
49: }
50: if (!is_null($this->bankRefundMethodSpecificInput)) {
51: $object->bankRefundMethodSpecificInput = $this->bankRefundMethodSpecificInput->toObject();
52: }
53: if (!is_null($this->customer)) {
54: $object->customer = $this->customer->toObject();
55: }
56: if (!is_null($this->refundDate)) {
57: $object->refundDate = $this->refundDate;
58: }
59: if (!is_null($this->refundReferences)) {
60: $object->refundReferences = $this->refundReferences->toObject();
61: }
62: return $object;
63: }
64:
65: /**
66: * @param object $object
67: * @return $this
68: * @throws UnexpectedValueException
69: */
70: public function fromObject($object)
71: {
72: parent::fromObject($object);
73: if (property_exists($object, 'amountOfMoney')) {
74: if (!is_object($object->amountOfMoney)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
76: }
77: $value = new AmountOfMoney();
78: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
79: }
80: if (property_exists($object, 'bankRefundMethodSpecificInput')) {
81: if (!is_object($object->bankRefundMethodSpecificInput)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificInput, true) . '\' is not an object');
83: }
84: $value = new BankRefundMethodSpecificInput();
85: $this->bankRefundMethodSpecificInput = $value->fromObject($object->bankRefundMethodSpecificInput);
86: }
87: if (property_exists($object, 'customer')) {
88: if (!is_object($object->customer)) {
89: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
90: }
91: $value = new RefundCustomer();
92: $this->customer = $value->fromObject($object->customer);
93: }
94: if (property_exists($object, 'refundDate')) {
95: $this->refundDate = $object->refundDate;
96: }
97: if (property_exists($object, 'refundReferences')) {
98: if (!is_object($object->refundReferences)) {
99: throw new UnexpectedValueException('value \'' . print_r($object->refundReferences, true) . '\' is not an object');
100: }
101: $value = new RefundReferences();
102: $this->refundReferences = $value->fromObject($object->refundReferences);
103: }
104: return $this;
105: }
106: }
107: