| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Domain; |
| 7: | |
| 8: | use UnexpectedValueException; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | class CardPaymentMethodSpecificInput extends AbstractCardPaymentMethodSpecificInput |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public ?Card $card = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public ?ClickToPayInput $clickToPay = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | public ?ExternalCardholderAuthenticationData $externalCardholderAuthenticationData = null; |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | public ?bool $isRecurring = null; |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | public ?string $merchantInitiatedReasonIndicator = null; |
| 41: | |
| 42: | |
| 43: | |
| 44: | |
| 45: | public ?SchemeTokenData $networkTokenData = null; |
| 46: | |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | public ?string $returnUrl = null; |
| 53: | |
| 54: | |
| 55: | |
| 56: | |
| 57: | public ?ThreeDSecure $threeDSecure = null; |
| 58: | |
| 59: | |
| 60: | |
| 61: | |
| 62: | public function toObject(): object |
| 63: | { |
| 64: | $object = parent::toObject(); |
| 65: | if (!is_null($this->card)) { |
| 66: | $object->card = $this->card->toObject(); |
| 67: | } |
| 68: | if (!is_null($this->clickToPay)) { |
| 69: | $object->clickToPay = $this->clickToPay->toObject(); |
| 70: | } |
| 71: | if (!is_null($this->externalCardholderAuthenticationData)) { |
| 72: | $object->externalCardholderAuthenticationData = $this->externalCardholderAuthenticationData->toObject(); |
| 73: | } |
| 74: | if (!is_null($this->isRecurring)) { |
| 75: | $object->isRecurring = $this->isRecurring; |
| 76: | } |
| 77: | if (!is_null($this->merchantInitiatedReasonIndicator)) { |
| 78: | $object->merchantInitiatedReasonIndicator = $this->merchantInitiatedReasonIndicator; |
| 79: | } |
| 80: | if (!is_null($this->networkTokenData)) { |
| 81: | $object->networkTokenData = $this->networkTokenData->toObject(); |
| 82: | } |
| 83: | if (!is_null($this->returnUrl)) { |
| 84: | $object->returnUrl = $this->returnUrl; |
| 85: | } |
| 86: | if (!is_null($this->threeDSecure)) { |
| 87: | $object->threeDSecure = $this->threeDSecure->toObject(); |
| 88: | } |
| 89: | return $object; |
| 90: | } |
| 91: | |
| 92: | |
| 93: | |
| 94: | |
| 95: | |
| 96: | |
| 97: | |
| 98: | public function fromObject(object $object): CardPaymentMethodSpecificInput |
| 99: | { |
| 100: | parent::fromObject($object); |
| 101: | if (property_exists($object, 'card')) { |
| 102: | if (!is_object($object->card)) { |
| 103: | throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); |
| 104: | } |
| 105: | $value = new Card(); |
| 106: | $this->card = $value->fromObject($object->card); |
| 107: | } |
| 108: | if (property_exists($object, 'clickToPay')) { |
| 109: | if (!is_object($object->clickToPay)) { |
| 110: | throw new UnexpectedValueException('value \'' . print_r($object->clickToPay, true) . '\' is not an object'); |
| 111: | } |
| 112: | $value = new ClickToPayInput(); |
| 113: | $this->clickToPay = $value->fromObject($object->clickToPay); |
| 114: | } |
| 115: | if (property_exists($object, 'externalCardholderAuthenticationData')) { |
| 116: | if (!is_object($object->externalCardholderAuthenticationData)) { |
| 117: | throw new UnexpectedValueException('value \'' . print_r($object->externalCardholderAuthenticationData, true) . '\' is not an object'); |
| 118: | } |
| 119: | $value = new ExternalCardholderAuthenticationData(); |
| 120: | $this->externalCardholderAuthenticationData = $value->fromObject($object->externalCardholderAuthenticationData); |
| 121: | } |
| 122: | if (property_exists($object, 'isRecurring')) { |
| 123: | $this->isRecurring = $object->isRecurring; |
| 124: | } |
| 125: | if (property_exists($object, 'merchantInitiatedReasonIndicator')) { |
| 126: | $this->merchantInitiatedReasonIndicator = $object->merchantInitiatedReasonIndicator; |
| 127: | } |
| 128: | if (property_exists($object, 'networkTokenData')) { |
| 129: | if (!is_object($object->networkTokenData)) { |
| 130: | throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object'); |
| 131: | } |
| 132: | $value = new SchemeTokenData(); |
| 133: | $this->networkTokenData = $value->fromObject($object->networkTokenData); |
| 134: | } |
| 135: | if (property_exists($object, 'returnUrl')) { |
| 136: | $this->returnUrl = $object->returnUrl; |
| 137: | } |
| 138: | if (property_exists($object, 'threeDSecure')) { |
| 139: | if (!is_object($object->threeDSecure)) { |
| 140: | throw new UnexpectedValueException('value \'' . print_r($object->threeDSecure, true) . '\' is not an object'); |
| 141: | } |
| 142: | $value = new ThreeDSecure(); |
| 143: | $this->threeDSecure = $value->fromObject($object->threeDSecure); |
| 144: | } |
| 145: | return $this; |
| 146: | } |
| 147: | } |
| 148: | |