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: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class PaymentProduct extends DataObject
15: {
16: /**
17: * @var AccountOnFile[]
18: */
19: public $accountsOnFile = null;
20:
21: /**
22: * @var string
23: */
24: public $acquirerCountry = null;
25:
26: /**
27: * @var bool
28: */
29: public $allowsInstallments = null;
30:
31: /**
32: * @var bool
33: */
34: public $allowsRecurring = null;
35:
36: /**
37: * @var bool
38: */
39: public $allowsTokenization = null;
40:
41: /**
42: * @var AuthenticationIndicator
43: */
44: public $authenticationIndicator = null;
45:
46: /**
47: * @var bool
48: */
49: public $autoTokenized = null;
50:
51: /**
52: * @var bool
53: */
54: public $canBeIframed = null;
55:
56: /**
57: * @var bool
58: */
59: public $deviceFingerprintEnabled = null;
60:
61: /**
62: * @var PaymentProductDisplayHints
63: */
64: public $displayHints = null;
65:
66: /**
67: * @var PaymentProductField[]
68: */
69: public $fields = null;
70:
71: /**
72: * @var string
73: */
74: public $fieldsWarning = null;
75:
76: /**
77: * @var int
78: */
79: public $id = null;
80:
81: /**
82: * @var bool
83: */
84: public $isAuthenticationSupported = null;
85:
86: /**
87: * @var bool
88: */
89: public $isJavaScriptRequired = null;
90:
91: /**
92: * @var int
93: */
94: public $maxAmount = null;
95:
96: /**
97: * @var int
98: */
99: public $minAmount = null;
100:
101: /**
102: * @var string
103: */
104: public $mobileIntegrationLevel = null;
105:
106: /**
107: * @var string
108: */
109: public $paymentMethod = null;
110:
111: /**
112: * @var PaymentProduct302SpecificData
113: */
114: public $paymentProduct302SpecificData = null;
115:
116: /**
117: * @var PaymentProduct320SpecificData
118: */
119: public $paymentProduct320SpecificData = null;
120:
121: /**
122: * @var PaymentProduct863SpecificData
123: */
124: public $paymentProduct863SpecificData = null;
125:
126: /**
127: * @var string
128: */
129: public $paymentProductGroup = null;
130:
131: /**
132: * @var bool
133: */
134: public $supportsMandates = null;
135:
136: /**
137: * @var bool
138: */
139: public $usesRedirectionTo3rdParty = null;
140:
141: /**
142: * @return object
143: */
144: public function toObject()
145: {
146: $object = parent::toObject();
147: if (!is_null($this->accountsOnFile)) {
148: $object->accountsOnFile = [];
149: foreach ($this->accountsOnFile as $element) {
150: if (!is_null($element)) {
151: $object->accountsOnFile[] = $element->toObject();
152: }
153: }
154: }
155: if (!is_null($this->acquirerCountry)) {
156: $object->acquirerCountry = $this->acquirerCountry;
157: }
158: if (!is_null($this->allowsInstallments)) {
159: $object->allowsInstallments = $this->allowsInstallments;
160: }
161: if (!is_null($this->allowsRecurring)) {
162: $object->allowsRecurring = $this->allowsRecurring;
163: }
164: if (!is_null($this->allowsTokenization)) {
165: $object->allowsTokenization = $this->allowsTokenization;
166: }
167: if (!is_null($this->authenticationIndicator)) {
168: $object->authenticationIndicator = $this->authenticationIndicator->toObject();
169: }
170: if (!is_null($this->autoTokenized)) {
171: $object->autoTokenized = $this->autoTokenized;
172: }
173: if (!is_null($this->canBeIframed)) {
174: $object->canBeIframed = $this->canBeIframed;
175: }
176: if (!is_null($this->deviceFingerprintEnabled)) {
177: $object->deviceFingerprintEnabled = $this->deviceFingerprintEnabled;
178: }
179: if (!is_null($this->displayHints)) {
180: $object->displayHints = $this->displayHints->toObject();
181: }
182: if (!is_null($this->fields)) {
183: $object->fields = [];
184: foreach ($this->fields as $element) {
185: if (!is_null($element)) {
186: $object->fields[] = $element->toObject();
187: }
188: }
189: }
190: if (!is_null($this->fieldsWarning)) {
191: $object->fieldsWarning = $this->fieldsWarning;
192: }
193: if (!is_null($this->id)) {
194: $object->id = $this->id;
195: }
196: if (!is_null($this->isAuthenticationSupported)) {
197: $object->isAuthenticationSupported = $this->isAuthenticationSupported;
198: }
199: if (!is_null($this->isJavaScriptRequired)) {
200: $object->isJavaScriptRequired = $this->isJavaScriptRequired;
201: }
202: if (!is_null($this->maxAmount)) {
203: $object->maxAmount = $this->maxAmount;
204: }
205: if (!is_null($this->minAmount)) {
206: $object->minAmount = $this->minAmount;
207: }
208: if (!is_null($this->mobileIntegrationLevel)) {
209: $object->mobileIntegrationLevel = $this->mobileIntegrationLevel;
210: }
211: if (!is_null($this->paymentMethod)) {
212: $object->paymentMethod = $this->paymentMethod;
213: }
214: if (!is_null($this->paymentProduct302SpecificData)) {
215: $object->paymentProduct302SpecificData = $this->paymentProduct302SpecificData->toObject();
216: }
217: if (!is_null($this->paymentProduct320SpecificData)) {
218: $object->paymentProduct320SpecificData = $this->paymentProduct320SpecificData->toObject();
219: }
220: if (!is_null($this->paymentProduct863SpecificData)) {
221: $object->paymentProduct863SpecificData = $this->paymentProduct863SpecificData->toObject();
222: }
223: if (!is_null($this->paymentProductGroup)) {
224: $object->paymentProductGroup = $this->paymentProductGroup;
225: }
226: if (!is_null($this->supportsMandates)) {
227: $object->supportsMandates = $this->supportsMandates;
228: }
229: if (!is_null($this->usesRedirectionTo3rdParty)) {
230: $object->usesRedirectionTo3rdParty = $this->usesRedirectionTo3rdParty;
231: }
232: return $object;
233: }
234:
235: /**
236: * @param object $object
237: * @return $this
238: * @throws UnexpectedValueException
239: */
240: public function fromObject($object)
241: {
242: parent::fromObject($object);
243: if (property_exists($object, 'accountsOnFile')) {
244: if (!is_array($object->accountsOnFile) && !is_object($object->accountsOnFile)) {
245: throw new UnexpectedValueException('value \'' . print_r($object->accountsOnFile, true) . '\' is not an array or object');
246: }
247: $this->accountsOnFile = [];
248: foreach ($object->accountsOnFile as $element) {
249: $value = new AccountOnFile();
250: $this->accountsOnFile[] = $value->fromObject($element);
251: }
252: }
253: if (property_exists($object, 'acquirerCountry')) {
254: $this->acquirerCountry = $object->acquirerCountry;
255: }
256: if (property_exists($object, 'allowsInstallments')) {
257: $this->allowsInstallments = $object->allowsInstallments;
258: }
259: if (property_exists($object, 'allowsRecurring')) {
260: $this->allowsRecurring = $object->allowsRecurring;
261: }
262: if (property_exists($object, 'allowsTokenization')) {
263: $this->allowsTokenization = $object->allowsTokenization;
264: }
265: if (property_exists($object, 'authenticationIndicator')) {
266: if (!is_object($object->authenticationIndicator)) {
267: throw new UnexpectedValueException('value \'' . print_r($object->authenticationIndicator, true) . '\' is not an object');
268: }
269: $value = new AuthenticationIndicator();
270: $this->authenticationIndicator = $value->fromObject($object->authenticationIndicator);
271: }
272: if (property_exists($object, 'autoTokenized')) {
273: $this->autoTokenized = $object->autoTokenized;
274: }
275: if (property_exists($object, 'canBeIframed')) {
276: $this->canBeIframed = $object->canBeIframed;
277: }
278: if (property_exists($object, 'deviceFingerprintEnabled')) {
279: $this->deviceFingerprintEnabled = $object->deviceFingerprintEnabled;
280: }
281: if (property_exists($object, 'displayHints')) {
282: if (!is_object($object->displayHints)) {
283: throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object');
284: }
285: $value = new PaymentProductDisplayHints();
286: $this->displayHints = $value->fromObject($object->displayHints);
287: }
288: if (property_exists($object, 'fields')) {
289: if (!is_array($object->fields) && !is_object($object->fields)) {
290: throw new UnexpectedValueException('value \'' . print_r($object->fields, true) . '\' is not an array or object');
291: }
292: $this->fields = [];
293: foreach ($object->fields as $element) {
294: $value = new PaymentProductField();
295: $this->fields[] = $value->fromObject($element);
296: }
297: }
298: if (property_exists($object, 'fieldsWarning')) {
299: $this->fieldsWarning = $object->fieldsWarning;
300: }
301: if (property_exists($object, 'id')) {
302: $this->id = $object->id;
303: }
304: if (property_exists($object, 'isAuthenticationSupported')) {
305: $this->isAuthenticationSupported = $object->isAuthenticationSupported;
306: }
307: if (property_exists($object, 'isJavaScriptRequired')) {
308: $this->isJavaScriptRequired = $object->isJavaScriptRequired;
309: }
310: if (property_exists($object, 'maxAmount')) {
311: $this->maxAmount = $object->maxAmount;
312: }
313: if (property_exists($object, 'minAmount')) {
314: $this->minAmount = $object->minAmount;
315: }
316: if (property_exists($object, 'mobileIntegrationLevel')) {
317: $this->mobileIntegrationLevel = $object->mobileIntegrationLevel;
318: }
319: if (property_exists($object, 'paymentMethod')) {
320: $this->paymentMethod = $object->paymentMethod;
321: }
322: if (property_exists($object, 'paymentProduct302SpecificData')) {
323: if (!is_object($object->paymentProduct302SpecificData)) {
324: throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct302SpecificData, true) . '\' is not an object');
325: }
326: $value = new PaymentProduct302SpecificData();
327: $this->paymentProduct302SpecificData = $value->fromObject($object->paymentProduct302SpecificData);
328: }
329: if (property_exists($object, 'paymentProduct320SpecificData')) {
330: if (!is_object($object->paymentProduct320SpecificData)) {
331: throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct320SpecificData, true) . '\' is not an object');
332: }
333: $value = new PaymentProduct320SpecificData();
334: $this->paymentProduct320SpecificData = $value->fromObject($object->paymentProduct320SpecificData);
335: }
336: if (property_exists($object, 'paymentProduct863SpecificData')) {
337: if (!is_object($object->paymentProduct863SpecificData)) {
338: throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct863SpecificData, true) . '\' is not an object');
339: }
340: $value = new PaymentProduct863SpecificData();
341: $this->paymentProduct863SpecificData = $value->fromObject($object->paymentProduct863SpecificData);
342: }
343: if (property_exists($object, 'paymentProductGroup')) {
344: $this->paymentProductGroup = $object->paymentProductGroup;
345: }
346: if (property_exists($object, 'supportsMandates')) {
347: $this->supportsMandates = $object->supportsMandates;
348: }
349: if (property_exists($object, 'usesRedirectionTo3rdParty')) {
350: $this->usesRedirectionTo3rdParty = $object->usesRedirectionTo3rdParty;
351: }
352: return $this;
353: }
354: }
355: