| 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 CardPaymentDataForBalanceInquiry extends DataObject |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public $brand = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public $brandSelector = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public $cardData = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public $cardEntryMode = null; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public $cardholderVerificationMethod = null; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public $ecommerceData = null; |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | public $pointOfSaleData = null; |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public $walletId = null; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public function toObject() |
| 59: | { |
| 60: | $object = parent::toObject(); |
| 61: | if (!is_null($this->brand)) { |
| 62: | $object->brand = $this->brand; |
| 63: | } |
| 64: | if (!is_null($this->brandSelector)) { |
| 65: | $object->brandSelector = $this->brandSelector; |
| 66: | } |
| 67: | if (!is_null($this->cardData)) { |
| 68: | $object->cardData = $this->cardData->toObject(); |
| 69: | } |
| 70: | if (!is_null($this->cardEntryMode)) { |
| 71: | $object->cardEntryMode = $this->cardEntryMode; |
| 72: | } |
| 73: | if (!is_null($this->cardholderVerificationMethod)) { |
| 74: | $object->cardholderVerificationMethod = $this->cardholderVerificationMethod; |
| 75: | } |
| 76: | if (!is_null($this->ecommerceData)) { |
| 77: | $object->ecommerceData = $this->ecommerceData->toObject(); |
| 78: | } |
| 79: | if (!is_null($this->pointOfSaleData)) { |
| 80: | $object->pointOfSaleData = $this->pointOfSaleData->toObject(); |
| 81: | } |
| 82: | if (!is_null($this->walletId)) { |
| 83: | $object->walletId = $this->walletId; |
| 84: | } |
| 85: | return $object; |
| 86: | } |
| 87: | |
| 88: | |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | public function fromObject($object) |
| 94: | { |
| 95: | parent::fromObject($object); |
| 96: | if (property_exists($object, 'brand')) { |
| 97: | $this->brand = $object->brand; |
| 98: | } |
| 99: | if (property_exists($object, 'brandSelector')) { |
| 100: | $this->brandSelector = $object->brandSelector; |
| 101: | } |
| 102: | if (property_exists($object, 'cardData')) { |
| 103: | if (!is_object($object->cardData)) { |
| 104: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
| 105: | } |
| 106: | $value = new PlainCardData(); |
| 107: | $this->cardData = $value->fromObject($object->cardData); |
| 108: | } |
| 109: | if (property_exists($object, 'cardEntryMode')) { |
| 110: | $this->cardEntryMode = $object->cardEntryMode; |
| 111: | } |
| 112: | if (property_exists($object, 'cardholderVerificationMethod')) { |
| 113: | $this->cardholderVerificationMethod = $object->cardholderVerificationMethod; |
| 114: | } |
| 115: | if (property_exists($object, 'ecommerceData')) { |
| 116: | if (!is_object($object->ecommerceData)) { |
| 117: | throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object'); |
| 118: | } |
| 119: | $value = new ECommerceData(); |
| 120: | $this->ecommerceData = $value->fromObject($object->ecommerceData); |
| 121: | } |
| 122: | if (property_exists($object, 'pointOfSaleData')) { |
| 123: | if (!is_object($object->pointOfSaleData)) { |
| 124: | throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object'); |
| 125: | } |
| 126: | $value = new PointOfSaleData(); |
| 127: | $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData); |
| 128: | } |
| 129: | if (property_exists($object, 'walletId')) { |
| 130: | $this->walletId = $object->walletId; |
| 131: | } |
| 132: | return $this; |
| 133: | } |
| 134: | } |
| 135: | |