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