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