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