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