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 CreateHostedCheckoutResponse extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $RETURNMAC = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $hostedCheckoutId = null;
25:
26: /**
27: * @var string[]|null
28: */
29: public ?array $invalidTokens = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $merchantReference = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $partialRedirectUrl = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject(): object
45: {
46: $object = parent::toObject();
47: if (!is_null($this->RETURNMAC)) {
48: $object->RETURNMAC = $this->RETURNMAC;
49: }
50: if (!is_null($this->hostedCheckoutId)) {
51: $object->hostedCheckoutId = $this->hostedCheckoutId;
52: }
53: if (!is_null($this->invalidTokens)) {
54: $object->invalidTokens = [];
55: foreach ($this->invalidTokens as $element) {
56: if (!is_null($element)) {
57: $object->invalidTokens[] = $element;
58: }
59: }
60: }
61: if (!is_null($this->merchantReference)) {
62: $object->merchantReference = $this->merchantReference;
63: }
64: if (!is_null($this->partialRedirectUrl)) {
65: $object->partialRedirectUrl = $this->partialRedirectUrl;
66: }
67: return $object;
68: }
69:
70: /**
71: * @param object $object
72: *
73: * @return $this
74: * @throws UnexpectedValueException
75: */
76: public function fromObject(object $object): CreateHostedCheckoutResponse
77: {
78: parent::fromObject($object);
79: if (property_exists($object, 'RETURNMAC')) {
80: $this->RETURNMAC = $object->RETURNMAC;
81: }
82: if (property_exists($object, 'hostedCheckoutId')) {
83: $this->hostedCheckoutId = $object->hostedCheckoutId;
84: }
85: if (property_exists($object, 'invalidTokens')) {
86: if (!is_array($object->invalidTokens) && !is_object($object->invalidTokens)) {
87: throw new UnexpectedValueException('value \'' . print_r($object->invalidTokens, true) . '\' is not an array or object');
88: }
89: $this->invalidTokens = [];
90: foreach ($object->invalidTokens as $element) {
91: $this->invalidTokens[] = $element;
92: }
93: }
94: if (property_exists($object, 'merchantReference')) {
95: $this->merchantReference = $object->merchantReference;
96: }
97: if (property_exists($object, 'partialRedirectUrl')) {
98: $this->partialRedirectUrl = $object->partialRedirectUrl;
99: }
100: return $this;
101: }
102: }
103: