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