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