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 ApiAccountVerificationRequest extends DataObject
15: {
16: /**
17: * @var CardPaymentDataForVerification|null
18: */
19: public ?CardPaymentDataForVerification $cardPaymentData = null;
20:
21: /**
22: * @var MerchantData|null
23: */
24: public ?MerchantData $merchant = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $operationId = null;
30:
31: /**
32: * @var PaymentReferences|null
33: */
34: public ?PaymentReferences $references = null;
35:
36: /**
37: * @var TerminalData|null
38: */
39: public ?TerminalData $terminalData = null;
40:
41: /**
42: * @var DateTime|null
43: */
44: public ?DateTime $transactionTimestamp = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject(): object
50: {
51: $object = parent::toObject();
52: if (!is_null($this->cardPaymentData)) {
53: $object->cardPaymentData = $this->cardPaymentData->toObject();
54: }
55: if (!is_null($this->merchant)) {
56: $object->merchant = $this->merchant->toObject();
57: }
58: if (!is_null($this->operationId)) {
59: $object->operationId = $this->operationId;
60: }
61: if (!is_null($this->references)) {
62: $object->references = $this->references->toObject();
63: }
64: if (!is_null($this->terminalData)) {
65: $object->terminalData = $this->terminalData->toObject();
66: }
67: if (!is_null($this->transactionTimestamp)) {
68: $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP');
69: }
70: return $object;
71: }
72:
73: /**
74: * @param object $object
75: *
76: * @return $this
77: * @throws UnexpectedValueException
78: */
79: public function fromObject(object $object): ApiAccountVerificationRequest
80: {
81: parent::fromObject($object);
82: if (property_exists($object, 'cardPaymentData')) {
83: if (!is_object($object->cardPaymentData)) {
84: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
85: }
86: $value = new CardPaymentDataForVerification();
87: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
88: }
89: if (property_exists($object, 'merchant')) {
90: if (!is_object($object->merchant)) {
91: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
92: }
93: $value = new MerchantData();
94: $this->merchant = $value->fromObject($object->merchant);
95: }
96: if (property_exists($object, 'operationId')) {
97: $this->operationId = $object->operationId;
98: }
99: if (property_exists($object, 'references')) {
100: if (!is_object($object->references)) {
101: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
102: }
103: $value = new PaymentReferences();
104: $this->references = $value->fromObject($object->references);
105: }
106: if (property_exists($object, 'terminalData')) {
107: if (!is_object($object->terminalData)) {
108: throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object');
109: }
110: $value = new TerminalData();
111: $this->terminalData = $value->fromObject($object->terminalData);
112: }
113: if (property_exists($object, 'transactionTimestamp')) {
114: $this->transactionTimestamp = new DateTime($object->transactionTimestamp);
115: }
116: return $this;
117: }
118: }
119: