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
18: */
19: public $alias = null;
20:
21: /**
22: * @var MandateCustomer
23: */
24: public $customer = null;
25:
26: /**
27: * @var string
28: */
29: public $customerReference = null;
30:
31: /**
32: * @var string
33: */
34: public $recurrenceType = null;
35:
36: /**
37: * @var string
38: */
39: public $status = null;
40:
41: /**
42: * @var string
43: */
44: public $uniqueMandateReference = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject()
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: * @return $this
76: * @throws UnexpectedValueException
77: */
78: public function fromObject($object)
79: {
80: parent::fromObject($object);
81: if (property_exists($object, 'alias')) {
82: $this->alias = $object->alias;
83: }
84: if (property_exists($object, 'customer')) {
85: if (!is_object($object->customer)) {
86: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
87: }
88: $value = new MandateCustomer();
89: $this->customer = $value->fromObject($object->customer);
90: }
91: if (property_exists($object, 'customerReference')) {
92: $this->customerReference = $object->customerReference;
93: }
94: if (property_exists($object, 'recurrenceType')) {
95: $this->recurrenceType = $object->recurrenceType;
96: }
97: if (property_exists($object, 'status')) {
98: $this->status = $object->status;
99: }
100: if (property_exists($object, 'uniqueMandateReference')) {
101: $this->uniqueMandateReference = $object->uniqueMandateReference;
102: }
103: return $this;
104: }
105: }
106: