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 ApiCaptureRequestForRefund extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $operationId = null;
20:
21: /**
22: * @var PaymentReferences|null
23: */
24: public ?PaymentReferences $references = 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->references)) {
46: $object->references = $this->references->toObject();
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): ApiCaptureRequestForRefund
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'operationId')) {
67: $this->operationId = $object->operationId;
68: }
69: if (property_exists($object, 'references')) {
70: if (!is_object($object->references)) {
71: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
72: }
73: $value = new PaymentReferences();
74: $this->references = $value->fromObject($object->references);
75: }
76: if (property_exists($object, 'terminalData')) {
77: if (!is_object($object->terminalData)) {
78: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
79: }
80: $value = new TerminalData();
81: $this->terminalData = $value->fromObject($object->terminalData);
82: }
83: if (property_exists($object, 'transactionTimestamp')) {
84: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
85: }
86: return $this;
87: }
88: }
89: