1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use DateTime;
8: use UnexpectedValueException;
9: use Worldline\Acquiring\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Acquiring\Sdk\V1\Domain
13: */
14: class ApiRefundRequest extends DataObject
15: {
16: /**
17: * @var AmountData
18: */
19: public $amount = null;
20:
21: /**
22: * @var CardPaymentDataForRefund
23: */
24: public $cardPaymentData = null;
25:
26: /**
27: * @var DccData
28: */
29: public $dynamicCurrencyConversion = null;
30:
31: /**
32: * @var MerchantData
33: */
34: public $merchant = null;
35:
36: /**
37: * @var string
38: */
39: public $operationId = null;
40:
41: /**
42: * @var PaymentReferences
43: */
44: public $references = null;
45:
46: /**
47: * @var TerminalData
48: */
49: public $terminalData = null;
50:
51: /**
52: * @var DateTime
53: */
54: public $transactionTimestamp = null;
55:
56: /**
57: * @return object
58: */
59: public function toObject()
60: {
61: $object = parent::toObject();
62: if (!is_null($this->amount)) {
63: $object->amount = $this->amount->toObject();
64: }
65: if (!is_null($this->cardPaymentData)) {
66: $object->cardPaymentData = $this->cardPaymentData->toObject();
67: }
68: if (!is_null($this->dynamicCurrencyConversion)) {
69: $object->dynamicCurrencyConversion = $this->dynamicCurrencyConversion->toObject();
70: }
71: if (!is_null($this->merchant)) {
72: $object->merchant = $this->merchant->toObject();
73: }
74: if (!is_null($this->operationId)) {
75: $object->operationId = $this->operationId;
76: }
77: if (!is_null($this->references)) {
78: $object->references = $this->references->toObject();
79: }
80: if (!is_null($this->terminalData)) {
81: $object->terminalData = $this->terminalData->toObject();
82: }
83: if (!is_null($this->transactionTimestamp)) {
84: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
85: }
86: return $object;
87: }
88:
89: /**
90: * @param object $object
91: * @return $this
92: * @throws UnexpectedValueException
93: */
94: public function fromObject($object)
95: {
96: parent::fromObject($object);
97: if (property_exists($object, 'amount')) {
98: if (!is_object($object->amount)) {
99: throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object');
100: }
101: $value = new AmountData();
102: $this->amount = $value->fromObject($object->amount);
103: }
104: if (property_exists($object, 'cardPaymentData')) {
105: if (!is_object($object->cardPaymentData)) {
106: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
107: }
108: $value = new CardPaymentDataForRefund();
109: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
110: }
111: if (property_exists($object, 'dynamicCurrencyConversion')) {
112: if (!is_object($object->dynamicCurrencyConversion)) {
113: throw new UnexpectedValueException('value \'' . print_r($object->dynamicCurrencyConversion, true) . '\' is not an object');
114: }
115: $value = new DccData();
116: $this->dynamicCurrencyConversion = $value->fromObject($object->dynamicCurrencyConversion);
117: }
118: if (property_exists($object, 'merchant')) {
119: if (!is_object($object->merchant)) {
120: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
121: }
122: $value = new MerchantData();
123: $this->merchant = $value->fromObject($object->merchant);
124: }
125: if (property_exists($object, 'operationId')) {
126: $this->operationId = $object->operationId;
127: }
128: if (property_exists($object, 'references')) {
129: if (!is_object($object->references)) {
130: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
131: }
132: $value = new PaymentReferences();
133: $this->references = $value->fromObject($object->references);
134: }
135: if (property_exists($object, 'terminalData')) {
136: if (!is_object($object->terminalData)) {
137: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
138: }
139: $value = new TerminalData();
140: $this->terminalData = $value->fromObject($object->terminalData);
141: }
142: if (property_exists($object, 'transactionTimestamp')) {
143: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
144: }
145: return $this;
146: }
147: }
148: