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 ApiCaptureRequest extends DataObject
15: {
16: /**
17: * @var AmountData|null
18: */
19: public ?AmountData $amount = null;
20:
21: /**
22: * @var CaptureAmountBreakdownData|null
23: */
24: public ?CaptureAmountBreakdownData $captureAmountBreakdownData = null;
25:
26: /**
27: * @var CapturePointOfSaleData|null
28: */
29: public ?CapturePointOfSaleData $capturePointOfSaleData = null;
30:
31: /**
32: * @var int|null
33: */
34: public ?int $captureSequenceNumber = null;
35:
36: /**
37: * @var DccData|null
38: */
39: public ?DccData $dynamicCurrencyConversion = null;
40:
41: /**
42: * @var bool|null
43: */
44: public ?bool $isFinal = null;
45:
46: /**
47: * @var MarketplaceData|null
48: */
49: public ?MarketplaceData $marketplaceData = null;
50:
51: /**
52: * @var string|null
53: */
54: public ?string $operationId = null;
55:
56: /**
57: * @var PaymentReferences|null
58: */
59: public ?PaymentReferences $references = null;
60:
61: /**
62: * @var TerminalData|null
63: */
64: public ?TerminalData $terminalData = null;
65:
66: /**
67: * @var DateTime|null
68: */
69: public ?DateTime $transactionTimestamp = null;
70:
71: /**
72: * @return object
73: */
74: public function toObject(): object
75: {
76: $object = parent::toObject();
77: if (!is_null($this->amount)) {
78: $object->amount = $this->amount->toObject();
79: }
80: if (!is_null($this->captureAmountBreakdownData)) {
81: $object->captureAmountBreakdownData = $this->captureAmountBreakdownData->toObject();
82: }
83: if (!is_null($this->capturePointOfSaleData)) {
84: $object->capturePointOfSaleData = $this->capturePointOfSaleData->toObject();
85: }
86: if (!is_null($this->captureSequenceNumber)) {
87: $object->captureSequenceNumber = $this->captureSequenceNumber;
88: }
89: if (!is_null($this->dynamicCurrencyConversion)) {
90: $object->dynamicCurrencyConversion = $this->dynamicCurrencyConversion->toObject();
91: }
92: if (!is_null($this->isFinal)) {
93: $object->isFinal = $this->isFinal;
94: }
95: if (!is_null($this->marketplaceData)) {
96: $object->marketplaceData = $this->marketplaceData->toObject();
97: }
98: if (!is_null($this->operationId)) {
99: $object->operationId = $this->operationId;
100: }
101: if (!is_null($this->references)) {
102: $object->references = $this->references->toObject();
103: }
104: if (!is_null($this->terminalData)) {
105: $object->terminalData = $this->terminalData->toObject();
106: }
107: if (!is_null($this->transactionTimestamp)) {
108: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
109: }
110: return $object;
111: }
112:
113: /**
114: * @param object $object
115: *
116: * @return $this
117: * @throws UnexpectedValueException
118: */
119: public function fromObject(object $object): ApiCaptureRequest
120: {
121: parent::fromObject($object);
122: if (property_exists($object, 'amount')) {
123: if (!is_object($object->amount)) {
124: throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object');
125: }
126: $value = new AmountData();
127: $this->amount = $value->fromObject($object->amount);
128: }
129: if (property_exists($object, 'captureAmountBreakdownData')) {
130: if (!is_object($object->captureAmountBreakdownData)) {
131: throw new UnexpectedValueException('value \'' . print_r($object->captureAmountBreakdownData, true) . '\' is not an object');
132: }
133: $value = new CaptureAmountBreakdownData();
134: $this->captureAmountBreakdownData = $value->fromObject($object->captureAmountBreakdownData);
135: }
136: if (property_exists($object, 'capturePointOfSaleData')) {
137: if (!is_object($object->capturePointOfSaleData)) {
138: throw new UnexpectedValueException('value \'' . print_r($object->capturePointOfSaleData, true) . '\' is not an object');
139: }
140: $value = new CapturePointOfSaleData();
141: $this->capturePointOfSaleData = $value->fromObject($object->capturePointOfSaleData);
142: }
143: if (property_exists($object, 'captureSequenceNumber')) {
144: $this->captureSequenceNumber = $object->captureSequenceNumber;
145: }
146: if (property_exists($object, 'dynamicCurrencyConversion')) {
147: if (!is_object($object->dynamicCurrencyConversion)) {
148: throw new UnexpectedValueException('value \'' . print_r($object->dynamicCurrencyConversion, true) . '\' is not an object');
149: }
150: $value = new DccData();
151: $this->dynamicCurrencyConversion = $value->fromObject($object->dynamicCurrencyConversion);
152: }
153: if (property_exists($object, 'isFinal')) {
154: $this->isFinal = $object->isFinal;
155: }
156: if (property_exists($object, 'marketplaceData')) {
157: if (!is_object($object->marketplaceData)) {
158: throw new UnexpectedValueException('value \'' . print_r($object->marketplaceData, true) . '\' is not an object');
159: }
160: $value = new MarketplaceData();
161: $this->marketplaceData = $value->fromObject($object->marketplaceData);
162: }
163: if (property_exists($object, 'operationId')) {
164: $this->operationId = $object->operationId;
165: }
166: if (property_exists($object, 'references')) {
167: if (!is_object($object->references)) {
168: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
169: }
170: $value = new PaymentReferences();
171: $this->references = $value->fromObject($object->references);
172: }
173: if (property_exists($object, 'terminalData')) {
174: if (!is_object($object->terminalData)) {
175: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
176: }
177: $value = new TerminalData();
178: $this->terminalData = $value->fromObject($object->terminalData);
179: }
180: if (property_exists($object, 'transactionTimestamp')) {
181: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
182: }
183: return $this;
184: }
185: }
186: