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 ApiTechnicalReversalRequest extends DataObject
15: {
16: /**
17: * @var string
18: */
19: public $operationId = null;
20:
21: /**
22: * @var string
23: */
24: public $reason = null;
25:
26: /**
27: * @var TerminalData
28: */
29: public $terminalData = 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->operationId)) {
43: $object->operationId = $this->operationId;
44: }
45: if (!is_null($this->reason)) {
46: $object->reason = $this->reason;
47: }
48: if (!is_null($this->terminalData)) {
49: $object->terminalData = $this->terminalData->toObject();
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, 'operationId')) {
66: $this->operationId = $object->operationId;
67: }
68: if (property_exists($object, 'reason')) {
69: $this->reason = $object->reason;
70: }
71: if (property_exists($object, 'terminalData')) {
72: if (!is_object($object->terminalData)) {
73: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
74: }
75: $value = new TerminalData();
76: $this->terminalData = $value->fromObject($object->terminalData);
77: }
78: if (property_exists($object, 'transactionTimestamp')) {
79: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
80: }
81: return $this;
82: }
83: }
84: