| 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 PlainCardData extends DataObject |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public $cardNumber = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public $cardSecurityCode = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public $cardSequenceNumber = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public $expiryDate = null; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public function toObject() |
| 39: | { |
| 40: | $object = parent::toObject(); |
| 41: | if (!is_null($this->cardNumber)) { |
| 42: | $object->cardNumber = $this->cardNumber; |
| 43: | } |
| 44: | if (!is_null($this->cardSecurityCode)) { |
| 45: | $object->cardSecurityCode = $this->cardSecurityCode; |
| 46: | } |
| 47: | if (!is_null($this->cardSequenceNumber)) { |
| 48: | $object->cardSequenceNumber = $this->cardSequenceNumber; |
| 49: | } |
| 50: | if (!is_null($this->expiryDate)) { |
| 51: | $object->expiryDate = $this->expiryDate; |
| 52: | } |
| 53: | return $object; |
| 54: | } |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: | |
| 61: | public function fromObject($object) |
| 62: | { |
| 63: | parent::fromObject($object); |
| 64: | if (property_exists($object, 'cardNumber')) { |
| 65: | $this->cardNumber = $object->cardNumber; |
| 66: | } |
| 67: | if (property_exists($object, 'cardSecurityCode')) { |
| 68: | $this->cardSecurityCode = $object->cardSecurityCode; |
| 69: | } |
| 70: | if (property_exists($object, 'cardSequenceNumber')) { |
| 71: | $this->cardSequenceNumber = $object->cardSequenceNumber; |
| 72: | } |
| 73: | if (property_exists($object, 'expiryDate')) { |
| 74: | $this->expiryDate = $object->expiryDate; |
| 75: | } |
| 76: | return $this; |
| 77: | } |
| 78: | } |
| 79: | |