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 ApiBalanceInquiryRequest 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 $terminalData = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $transactionTimestamp = null; |
45: | |
46: | |
47: | |
48: | |
49: | public function toObject() |
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: | |
75: | |
76: | |
77: | |
78: | public function fromObject($object) |
79: | { |
80: | parent::fromObject($object); |
81: | if (property_exists($object, 'cardPaymentData')) { |
82: | if (!is_object($object->cardPaymentData)) { |
83: | throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object'); |
84: | } |
85: | $value = new CardPaymentDataForBalanceInquiry(); |
86: | $this->cardPaymentData = $value->fromObject($object->cardPaymentData); |
87: | } |
88: | if (property_exists($object, 'merchant')) { |
89: | if (!is_object($object->merchant)) { |
90: | throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object'); |
91: | } |
92: | $value = new MerchantData(); |
93: | $this->merchant = $value->fromObject($object->merchant); |
94: | } |
95: | if (property_exists($object, 'operationId')) { |
96: | $this->operationId = $object->operationId; |
97: | } |
98: | if (property_exists($object, 'references')) { |
99: | if (!is_object($object->references)) { |
100: | throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); |
101: | } |
102: | $value = new PaymentReferences(); |
103: | $this->references = $value->fromObject($object->references); |
104: | } |
105: | if (property_exists($object, 'terminalData')) { |
106: | if (!is_object($object->terminalData)) { |
107: | throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object'); |
108: | } |
109: | $value = new TerminalData(); |
110: | $this->terminalData = $value->fromObject($object->terminalData); |
111: | } |
112: | if (property_exists($object, 'transactionTimestamp')) { |
113: | $this->transactionTimestamp = new DateTime($object->transactionTimestamp); |
114: | } |
115: | return $this; |
116: | } |
117: | } |
118: | |