| 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 $isOfflineApproved = null; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public $offlineAuthorizationResponseCode = null; |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | public $pinEntryCapability = null; |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public $terminalId = null; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public $terminalLocation = null; |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public function toObject() |
| 64: | { |
| 65: | $object = parent::toObject(); |
| 66: | if (!is_null($this->allowSingleTap)) { |
| 67: | $object->allowSingleTap = $this->allowSingleTap; |
| 68: | } |
| 69: | if (!is_null($this->cardReadingCapabilities)) { |
| 70: | $object->cardReadingCapabilities = []; |
| 71: | foreach ($this->cardReadingCapabilities as $element) { |
| 72: | if (!is_null($element)) { |
| 73: | $object->cardReadingCapabilities[] = $element; |
| 74: | } |
| 75: | } |
| 76: | } |
| 77: | if (!is_null($this->cardholderActivatedTerminalLevel)) { |
| 78: | $object->cardholderActivatedTerminalLevel = $this->cardholderActivatedTerminalLevel; |
| 79: | } |
| 80: | if (!is_null($this->isAttendedTerminal)) { |
| 81: | $object->isAttendedTerminal = $this->isAttendedTerminal; |
| 82: | } |
| 83: | if (!is_null($this->isOfflineApproved)) { |
| 84: | $object->isOfflineApproved = $this->isOfflineApproved; |
| 85: | } |
| 86: | if (!is_null($this->offlineAuthorizationResponseCode)) { |
| 87: | $object->offlineAuthorizationResponseCode = $this->offlineAuthorizationResponseCode; |
| 88: | } |
| 89: | if (!is_null($this->pinEntryCapability)) { |
| 90: | $object->pinEntryCapability = $this->pinEntryCapability; |
| 91: | } |
| 92: | if (!is_null($this->terminalId)) { |
| 93: | $object->terminalId = $this->terminalId; |
| 94: | } |
| 95: | if (!is_null($this->terminalLocation)) { |
| 96: | $object->terminalLocation = $this->terminalLocation; |
| 97: | } |
| 98: | return $object; |
| 99: | } |
| 100: | |
| 101: | |
| 102: | |
| 103: | |
| 104: | |
| 105: | |
| 106: | public function fromObject($object) |
| 107: | { |
| 108: | parent::fromObject($object); |
| 109: | if (property_exists($object, 'allowSingleTap')) { |
| 110: | $this->allowSingleTap = $object->allowSingleTap; |
| 111: | } |
| 112: | if (property_exists($object, 'cardReadingCapabilities')) { |
| 113: | if (!is_array($object->cardReadingCapabilities) && !is_object($object->cardReadingCapabilities)) { |
| 114: | throw new UnexpectedValueException('value \'' . print_r($object->cardReadingCapabilities, true) . '\' is not an array or object'); |
| 115: | } |
| 116: | $this->cardReadingCapabilities = []; |
| 117: | foreach ($object->cardReadingCapabilities as $element) { |
| 118: | $this->cardReadingCapabilities[] = $element; |
| 119: | } |
| 120: | } |
| 121: | if (property_exists($object, 'cardholderActivatedTerminalLevel')) { |
| 122: | $this->cardholderActivatedTerminalLevel = $object->cardholderActivatedTerminalLevel; |
| 123: | } |
| 124: | if (property_exists($object, 'isAttendedTerminal')) { |
| 125: | $this->isAttendedTerminal = $object->isAttendedTerminal; |
| 126: | } |
| 127: | if (property_exists($object, 'isOfflineApproved')) { |
| 128: | $this->isOfflineApproved = $object->isOfflineApproved; |
| 129: | } |
| 130: | if (property_exists($object, 'offlineAuthorizationResponseCode')) { |
| 131: | $this->offlineAuthorizationResponseCode = $object->offlineAuthorizationResponseCode; |
| 132: | } |
| 133: | if (property_exists($object, 'pinEntryCapability')) { |
| 134: | $this->pinEntryCapability = $object->pinEntryCapability; |
| 135: | } |
| 136: | if (property_exists($object, 'terminalId')) { |
| 137: | $this->terminalId = $object->terminalId; |
| 138: | } |
| 139: | if (property_exists($object, 'terminalLocation')) { |
| 140: | $this->terminalLocation = $object->terminalLocation; |
| 141: | } |
| 142: | return $this; |
| 143: | } |
| 144: | } |
| 145: | |