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