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