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|null
18: */
19: public ?string $operationId = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $reason = null;
25:
26: /**
27: * @var TerminalData|null
28: */
29: public ?TerminalData $terminalData = null;
30:
31: /**
32: * @var DateTime|null
33: */
34: public ?DateTime $transactionTimestamp = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
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: *
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject(object $object): ApiTechnicalReversalRequest
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'operationId')) {
67: $this->operationId = $object->operationId;
68: }
69: if (property_exists($object, 'reason')) {
70: $this->reason = $object->reason;
71: }
72: if (property_exists($object, 'terminalData')) {
73: if (!is_object($object->terminalData)) {
74: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
75: }
76: $value = new TerminalData();
77: $this->terminalData = $value->fromObject($object->terminalData);
78: }
79: if (property_exists($object, 'transactionTimestamp')) {
80: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
81: }
82: return $this;
83: }
84: }
85: