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