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 ClickToPayConfiguration extends DataObject
15: {
16: /**
17: * @var ClickToPayDisplayHints
18: */
19: public $displayHints = null;
20:
21: /**
22: * @var ClickToPayConfigurationMastercard
23: */
24: public $mastercard = null;
25:
26: /**
27: * @var ClickToPayConfigurationVisa
28: */
29: public $visa = null;
30:
31: /**
32: * @return object
33: */
34: public function toObject()
35: {
36: $object = parent::toObject();
37: if (!is_null($this->displayHints)) {
38: $object->displayHints = $this->displayHints->toObject();
39: }
40: if (!is_null($this->mastercard)) {
41: $object->mastercard = $this->mastercard->toObject();
42: }
43: if (!is_null($this->visa)) {
44: $object->visa = $this->visa->toObject();
45: }
46: return $object;
47: }
48:
49: /**
50: * @param object $object
51: * @return $this
52: * @throws UnexpectedValueException
53: */
54: public function fromObject($object)
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'displayHints')) {
58: if (!is_object($object->displayHints)) {
59: throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object');
60: }
61: $value = new ClickToPayDisplayHints();
62: $this->displayHints = $value->fromObject($object->displayHints);
63: }
64: if (property_exists($object, 'mastercard')) {
65: if (!is_object($object->mastercard)) {
66: throw new UnexpectedValueException('value \'' . print_r($object->mastercard, true) . '\' is not an object');
67: }
68: $value = new ClickToPayConfigurationMastercard();
69: $this->mastercard = $value->fromObject($object->mastercard);
70: }
71: if (property_exists($object, 'visa')) {
72: if (!is_object($object->visa)) {
73: throw new UnexpectedValueException('value \'' . print_r($object->visa, true) . '\' is not an object');
74: }
75: $value = new ClickToPayConfigurationVisa();
76: $this->visa = $value->fromObject($object->visa);
77: }
78: return $this;
79: }
80: }
81: