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