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 ApiPaymentRequest extends DataObject
15: {
16: /**
17: * @var AmountData
18: */
19: public $amount = null;
20:
21: /**
22: * @var string
23: */
24: public $authorizationType = null;
25:
26: /**
27: * @var CardPaymentData
28: */
29: public $cardPaymentData = null;
30:
31: /**
32: * @var DccData
33: */
34: public $dynamicCurrencyConversion = null;
35:
36: /**
37: * @var MerchantData
38: */
39: public $merchant = null;
40:
41: /**
42: * @var string
43: */
44: public $operationId = null;
45:
46: /**
47: * @var PaymentReferences
48: */
49: public $references = 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->authorizationType)) {
66: $object->authorizationType = $this->authorizationType;
67: }
68: if (!is_null($this->cardPaymentData)) {
69: $object->cardPaymentData = $this->cardPaymentData->toObject();
70: }
71: if (!is_null($this->dynamicCurrencyConversion)) {
72: $object->dynamicCurrencyConversion = $this->dynamicCurrencyConversion->toObject();
73: }
74: if (!is_null($this->merchant)) {
75: $object->merchant = $this->merchant->toObject();
76: }
77: if (!is_null($this->operationId)) {
78: $object->operationId = $this->operationId;
79: }
80: if (!is_null($this->references)) {
81: $object->references = $this->references->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, 'authorizationType')) {
105: $this->authorizationType = $object->authorizationType;
106: }
107: if (property_exists($object, 'cardPaymentData')) {
108: if (!is_object($object->cardPaymentData)) {
109: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
110: }
111: $value = new CardPaymentData();
112: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
113: }
114: if (property_exists($object, 'dynamicCurrencyConversion')) {
115: if (!is_object($object->dynamicCurrencyConversion)) {
116: throw new UnexpectedValueException('value \'' . print_r($object->dynamicCurrencyConversion, true) . '\' is not an object');
117: }
118: $value = new DccData();
119: $this->dynamicCurrencyConversion = $value->fromObject($object->dynamicCurrencyConversion);
120: }
121: if (property_exists($object, 'merchant')) {
122: if (!is_object($object->merchant)) {
123: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
124: }
125: $value = new MerchantData();
126: $this->merchant = $value->fromObject($object->merchant);
127: }
128: if (property_exists($object, 'operationId')) {
129: $this->operationId = $object->operationId;
130: }
131: if (property_exists($object, 'references')) {
132: if (!is_object($object->references)) {
133: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
134: }
135: $value = new PaymentReferences();
136: $this->references = $value->fromObject($object->references);
137: }
138: if (property_exists($object, 'transactionTimestamp')) {
139: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
140: }
141: return $this;
142: }
143: }
144: