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 ApiIncrementRequest extends DataObject
15: {
16: /**
17: * @var DccData|null
18: */
19: public ?DccData $dynamicCurrencyConversion = null;
20:
21: /**
22: * @var AmountData|null
23: */
24: public ?AmountData $incrementAmount = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $operationId = null;
30:
31: /**
32: * @var TerminalData|null
33: */
34: public ?TerminalData $terminalData = null;
35:
36: /**
37: * @var DateTime|null
38: */
39: public ?DateTime $transactionTimestamp = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject(): object
45: {
46: $object = parent::toObject();
47: if (!is_null($this->dynamicCurrencyConversion)) {
48: $object->dynamicCurrencyConversion = $this->dynamicCurrencyConversion->toObject();
49: }
50: if (!is_null($this->incrementAmount)) {
51: $object->incrementAmount = $this->incrementAmount->toObject();
52: }
53: if (!is_null($this->operationId)) {
54: $object->operationId = $this->operationId;
55: }
56: if (!is_null($this->terminalData)) {
57: $object->terminalData = $this->terminalData->toObject();
58: }
59: if (!is_null($this->transactionTimestamp)) {
60: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
61: }
62: return $object;
63: }
64:
65: /**
66: * @param object $object
67: *
68: * @return $this
69: * @throws UnexpectedValueException
70: */
71: public function fromObject(object $object): ApiIncrementRequest
72: {
73: parent::fromObject($object);
74: if (property_exists($object, 'dynamicCurrencyConversion')) {
75: if (!is_object($object->dynamicCurrencyConversion)) {
76: throw new UnexpectedValueException('value \'' . print_r($object->dynamicCurrencyConversion, true) . '\' is not an object');
77: }
78: $value = new DccData();
79: $this->dynamicCurrencyConversion = $value->fromObject($object->dynamicCurrencyConversion);
80: }
81: if (property_exists($object, 'incrementAmount')) {
82: if (!is_object($object->incrementAmount)) {
83: throw new UnexpectedValueException('value \'' . print_r($object->incrementAmount, true) . '\' is not an object');
84: }
85: $value = new AmountData();
86: $this->incrementAmount = $value->fromObject($object->incrementAmount);
87: }
88: if (property_exists($object, 'operationId')) {
89: $this->operationId = $object->operationId;
90: }
91: if (property_exists($object, 'terminalData')) {
92: if (!is_object($object->terminalData)) {
93: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
94: }
95: $value = new TerminalData();
96: $this->terminalData = $value->fromObject($object->terminalData);
97: }
98: if (property_exists($object, 'transactionTimestamp')) {
99: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
100: }
101: return $this;
102: }
103: }
104: