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 DateTime
48: */
49: public $transactionTimestamp = null;
50:
51: /**
52: * @return object
53: */
54: public function toObject()
55: {
56: $object = parent::toObject();
57: if (!is_null($this->amount)) {
58: $object->amount = $this->amount->toObject();
59: }
60: if (!is_null($this->cardPaymentData)) {
61: $object->cardPaymentData = $this->cardPaymentData->toObject();
62: }
63: if (!is_null($this->dynamicCurrencyConversion)) {
64: $object->dynamicCurrencyConversion = $this->dynamicCurrencyConversion->toObject();
65: }
66: if (!is_null($this->merchant)) {
67: $object->merchant = $this->merchant->toObject();
68: }
69: if (!is_null($this->operationId)) {
70: $object->operationId = $this->operationId;
71: }
72: if (!is_null($this->references)) {
73: $object->references = $this->references->toObject();
74: }
75: if (!is_null($this->transactionTimestamp)) {
76: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
77: }
78: return $object;
79: }
80:
81: /**
82: * @param object $object
83: * @return $this
84: * @throws UnexpectedValueException
85: */
86: public function fromObject($object)
87: {
88: parent::fromObject($object);
89: if (property_exists($object, 'amount')) {
90: if (!is_object($object->amount)) {
91: throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object');
92: }
93: $value = new AmountData();
94: $this->amount = $value->fromObject($object->amount);
95: }
96: if (property_exists($object, 'cardPaymentData')) {
97: if (!is_object($object->cardPaymentData)) {
98: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
99: }
100: $value = new CardPaymentDataForRefund();
101: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
102: }
103: if (property_exists($object, 'dynamicCurrencyConversion')) {
104: if (!is_object($object->dynamicCurrencyConversion)) {
105: throw new UnexpectedValueException('value \'' . print_r($object->dynamicCurrencyConversion, true) . '\' is not an object');
106: }
107: $value = new DccData();
108: $this->dynamicCurrencyConversion = $value->fromObject($object->dynamicCurrencyConversion);
109: }
110: if (property_exists($object, 'merchant')) {
111: if (!is_object($object->merchant)) {
112: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
113: }
114: $value = new MerchantData();
115: $this->merchant = $value->fromObject($object->merchant);
116: }
117: if (property_exists($object, 'operationId')) {
118: $this->operationId = $object->operationId;
119: }
120: if (property_exists($object, 'references')) {
121: if (!is_object($object->references)) {
122: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
123: }
124: $value = new PaymentReferences();
125: $this->references = $value->fromObject($object->references);
126: }
127: if (property_exists($object, 'transactionTimestamp')) {
128: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
129: }
130: return $this;
131: }
132: }
133: