| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
| 6: | |
| 7: | use UnexpectedValueException; |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | class ZpkPinEncryptionData extends PinEncryptionData |
| 13: | { |
| 14: | const PIN_ENCRYPTION_TYPE = 'ZPK'; |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | public ?string $zonePinKeyId = null; |
| 20: | |
| 21: | public function __construct() |
| 22: | { |
| 23: | $this->pinEncryptionType = self::PIN_ENCRYPTION_TYPE; |
| 24: | } |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public function toObject(): object |
| 30: | { |
| 31: | $object = parent::toObject(); |
| 32: | if (!is_null($this->zonePinKeyId)) { |
| 33: | $object->zonePinKeyId = $this->zonePinKeyId; |
| 34: | } |
| 35: | $object->pinEncryptionType = self::PIN_ENCRYPTION_TYPE; |
| 36: | return $object; |
| 37: | } |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | |
| 45: | public function fromObject(object $object): ZpkPinEncryptionData |
| 46: | { |
| 47: | parent::fromObject($object); |
| 48: | $this->pinEncryptionType = self::PIN_ENCRYPTION_TYPE; |
| 49: | if (property_exists($object, 'zonePinKeyId')) { |
| 50: | $this->zonePinKeyId = $object->zonePinKeyId; |
| 51: | } |
| 52: | return $this; |
| 53: | } |
| 54: | } |
| 55: | |