| 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 CardPaymentData extends DataObject |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public $allowPartialApproval = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public $brand = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public $brandSelector = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public $captureImmediately = null; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public $cardData = null; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public $cardEntryMode = null; |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | public $cardOnFileData = null; |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public $cardholderVerificationMethod = null; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public $ecommerceData = null; |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public $networkTokenData = null; |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | public $pointOfSaleData = null; |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | public $serviceLocationData = null; |
| 74: | |
| 75: | |
| 76: | |
| 77: | |
| 78: | public $walletId = null; |
| 79: | |
| 80: | |
| 81: | |
| 82: | |
| 83: | public function toObject() |
| 84: | { |
| 85: | $object = parent::toObject(); |
| 86: | if (!is_null($this->allowPartialApproval)) { |
| 87: | $object->allowPartialApproval = $this->allowPartialApproval; |
| 88: | } |
| 89: | if (!is_null($this->brand)) { |
| 90: | $object->brand = $this->brand; |
| 91: | } |
| 92: | if (!is_null($this->brandSelector)) { |
| 93: | $object->brandSelector = $this->brandSelector; |
| 94: | } |
| 95: | if (!is_null($this->captureImmediately)) { |
| 96: | $object->captureImmediately = $this->captureImmediately; |
| 97: | } |
| 98: | if (!is_null($this->cardData)) { |
| 99: | $object->cardData = $this->cardData->toObject(); |
| 100: | } |
| 101: | if (!is_null($this->cardEntryMode)) { |
| 102: | $object->cardEntryMode = $this->cardEntryMode; |
| 103: | } |
| 104: | if (!is_null($this->cardOnFileData)) { |
| 105: | $object->cardOnFileData = $this->cardOnFileData->toObject(); |
| 106: | } |
| 107: | if (!is_null($this->cardholderVerificationMethod)) { |
| 108: | $object->cardholderVerificationMethod = $this->cardholderVerificationMethod; |
| 109: | } |
| 110: | if (!is_null($this->ecommerceData)) { |
| 111: | $object->ecommerceData = $this->ecommerceData->toObject(); |
| 112: | } |
| 113: | if (!is_null($this->networkTokenData)) { |
| 114: | $object->networkTokenData = $this->networkTokenData->toObject(); |
| 115: | } |
| 116: | if (!is_null($this->pointOfSaleData)) { |
| 117: | $object->pointOfSaleData = $this->pointOfSaleData->toObject(); |
| 118: | } |
| 119: | if (!is_null($this->serviceLocationData)) { |
| 120: | $object->serviceLocationData = $this->serviceLocationData->toObject(); |
| 121: | } |
| 122: | if (!is_null($this->walletId)) { |
| 123: | $object->walletId = $this->walletId; |
| 124: | } |
| 125: | return $object; |
| 126: | } |
| 127: | |
| 128: | |
| 129: | |
| 130: | |
| 131: | |
| 132: | |
| 133: | public function fromObject($object) |
| 134: | { |
| 135: | parent::fromObject($object); |
| 136: | if (property_exists($object, 'allowPartialApproval')) { |
| 137: | $this->allowPartialApproval = $object->allowPartialApproval; |
| 138: | } |
| 139: | if (property_exists($object, 'brand')) { |
| 140: | $this->brand = $object->brand; |
| 141: | } |
| 142: | if (property_exists($object, 'brandSelector')) { |
| 143: | $this->brandSelector = $object->brandSelector; |
| 144: | } |
| 145: | if (property_exists($object, 'captureImmediately')) { |
| 146: | $this->captureImmediately = $object->captureImmediately; |
| 147: | } |
| 148: | if (property_exists($object, 'cardData')) { |
| 149: | if (!is_object($object->cardData)) { |
| 150: | throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object'); |
| 151: | } |
| 152: | $value = new PlainCardData(); |
| 153: | $this->cardData = $value->fromObject($object->cardData); |
| 154: | } |
| 155: | if (property_exists($object, 'cardEntryMode')) { |
| 156: | $this->cardEntryMode = $object->cardEntryMode; |
| 157: | } |
| 158: | if (property_exists($object, 'cardOnFileData')) { |
| 159: | if (!is_object($object->cardOnFileData)) { |
| 160: | throw new UnexpectedValueException('value \'' . print_r($object->cardOnFileData, true) . '\' is not an object'); |
| 161: | } |
| 162: | $value = new CardOnFileData(); |
| 163: | $this->cardOnFileData = $value->fromObject($object->cardOnFileData); |
| 164: | } |
| 165: | if (property_exists($object, 'cardholderVerificationMethod')) { |
| 166: | $this->cardholderVerificationMethod = $object->cardholderVerificationMethod; |
| 167: | } |
| 168: | if (property_exists($object, 'ecommerceData')) { |
| 169: | if (!is_object($object->ecommerceData)) { |
| 170: | throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object'); |
| 171: | } |
| 172: | $value = new ECommerceData(); |
| 173: | $this->ecommerceData = $value->fromObject($object->ecommerceData); |
| 174: | } |
| 175: | if (property_exists($object, 'networkTokenData')) { |
| 176: | if (!is_object($object->networkTokenData)) { |
| 177: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
| 178: | } |
| 179: | $value = new NetworkTokenData(); |
| 180: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
| 181: | } |
| 182: | if (property_exists($object, 'pointOfSaleData')) { |
| 183: | if (!is_object($object->pointOfSaleData)) { |
| 184: | throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object'); |
| 185: | } |
| 186: | $value = new PointOfSaleData(); |
| 187: | $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData); |
| 188: | } |
| 189: | if (property_exists($object, 'serviceLocationData')) { |
| 190: | if (!is_object($object->serviceLocationData)) { |
| 191: | throw new UnexpectedValueException('value \'' . print_r($object->serviceLocationData, true) . '\' is not an object'); |
| 192: | } |
| 193: | $value = new ServiceLocationData(); |
| 194: | $this->serviceLocationData = $value->fromObject($object->serviceLocationData); |
| 195: | } |
| 196: | if (property_exists($object, 'walletId')) { |
| 197: | $this->walletId = $object->walletId; |
| 198: | } |
| 199: | return $this; |
| 200: | } |
| 201: | } |
| 202: | |