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