1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use UnexpectedValueException; |
8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
9: | |
10: | |
11: | |
12: | |
13: | class TerminalData extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $allowSingleTap = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $cardReadingCapabilities = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $cardholderActivatedTerminalLevel = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $isAttendedTerminal = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $pinEntryCapability = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $terminalId = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $terminalLocation = null; |
49: | |
50: | |
51: | |
52: | |
53: | public function toObject() |
54: | { |
55: | $object = parent::toObject(); |
56: | if (!is_null($this->allowSingleTap)) { |
57: | $object->allowSingleTap = $this->allowSingleTap; |
58: | } |
59: | if (!is_null($this->cardReadingCapabilities)) { |
60: | $object->cardReadingCapabilities = []; |
61: | foreach ($this->cardReadingCapabilities as $element) { |
62: | if (!is_null($element)) { |
63: | $object->cardReadingCapabilities[] = $element; |
64: | } |
65: | } |
66: | } |
67: | if (!is_null($this->cardholderActivatedTerminalLevel)) { |
68: | $object->cardholderActivatedTerminalLevel = $this->cardholderActivatedTerminalLevel; |
69: | } |
70: | if (!is_null($this->isAttendedTerminal)) { |
71: | $object->isAttendedTerminal = $this->isAttendedTerminal; |
72: | } |
73: | if (!is_null($this->pinEntryCapability)) { |
74: | $object->pinEntryCapability = $this->pinEntryCapability; |
75: | } |
76: | if (!is_null($this->terminalId)) { |
77: | $object->terminalId = $this->terminalId; |
78: | } |
79: | if (!is_null($this->terminalLocation)) { |
80: | $object->terminalLocation = $this->terminalLocation; |
81: | } |
82: | return $object; |
83: | } |
84: | |
85: | |
86: | |
87: | |
88: | |
89: | |
90: | public function fromObject($object) |
91: | { |
92: | parent::fromObject($object); |
93: | if (property_exists($object, 'allowSingleTap')) { |
94: | $this->allowSingleTap = $object->allowSingleTap; |
95: | } |
96: | if (property_exists($object, 'cardReadingCapabilities')) { |
97: | if (!is_array($object->cardReadingCapabilities) && !is_object($object->cardReadingCapabilities)) { |
98: | throw new UnexpectedValueException('value \'' . print_r($object->cardReadingCapabilities, true) . '\' is not an array or object'); |
99: | } |
100: | $this->cardReadingCapabilities = []; |
101: | foreach ($object->cardReadingCapabilities as $element) { |
102: | $this->cardReadingCapabilities[] = $element; |
103: | } |
104: | } |
105: | if (property_exists($object, 'cardholderActivatedTerminalLevel')) { |
106: | $this->cardholderActivatedTerminalLevel = $object->cardholderActivatedTerminalLevel; |
107: | } |
108: | if (property_exists($object, 'isAttendedTerminal')) { |
109: | $this->isAttendedTerminal = $object->isAttendedTerminal; |
110: | } |
111: | if (property_exists($object, 'pinEntryCapability')) { |
112: | $this->pinEntryCapability = $object->pinEntryCapability; |
113: | } |
114: | if (property_exists($object, 'terminalId')) { |
115: | $this->terminalId = $object->terminalId; |
116: | } |
117: | if (property_exists($object, 'terminalLocation')) { |
118: | $this->terminalLocation = $object->terminalLocation; |
119: | } |
120: | return $this; |
121: | } |
122: | } |
123: | |