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