1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9:
10: /**
11: * @package Worldline\Connect\Sdk\V1\Domain
12: */
13: class CardPaymentMethodSpecificInput extends AbstractCardPaymentMethodSpecificInput
14: {
15: /**
16: * @var Card|null
17: */
18: public ?Card $card = null;
19:
20: /**
21: * @var ClickToPayInput|null
22: */
23: public ?ClickToPayInput $clickToPay = null;
24:
25: /**
26: * @var ExternalCardholderAuthenticationData|null
27: *
28: * @deprecated Use threeDSecure.externalCardholderAuthenticationData instead
29: */
30: public ?ExternalCardholderAuthenticationData $externalCardholderAuthenticationData = null;
31:
32: /**
33: * @var bool|null
34: */
35: public ?bool $isRecurring = null;
36:
37: /**
38: * @var string|null
39: */
40: public ?string $merchantInitiatedReasonIndicator = null;
41:
42: /**
43: * @var SchemeTokenData|null
44: */
45: public ?SchemeTokenData $networkTokenData = null;
46:
47: /**
48: * @var string|null
49: *
50: * @deprecated Use threeDSecure.redirectionData.returnUrl instead
51: */
52: public ?string $returnUrl = null;
53:
54: /**
55: * @var ThreeDSecure|null
56: */
57: public ?ThreeDSecure $threeDSecure = null;
58:
59: /**
60: * @return object
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: * @param object $object
94: *
95: * @return $this
96: * @throws UnexpectedValueException
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: