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