1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class PayoutCustomer extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $address = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $companyInformation = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $contactDetails = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $merchantCustomerId = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $name = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
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: | |
67: | |
68: | |
69: | |
70: | public function fromObject($object) |
71: | { |
72: | parent::fromObject($object); |
73: | if (property_exists($object, 'address')) { |
74: | if (!is_object($object->address)) { |
75: | throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); |
76: | } |
77: | $value = new Address(); |
78: | $this->address = $value->fromObject($object->address); |
79: | } |
80: | if (property_exists($object, 'companyInformation')) { |
81: | if (!is_object($object->companyInformation)) { |
82: | throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); |
83: | } |
84: | $value = new CompanyInformation(); |
85: | $this->companyInformation = $value->fromObject($object->companyInformation); |
86: | } |
87: | if (property_exists($object, 'contactDetails')) { |
88: | if (!is_object($object->contactDetails)) { |
89: | throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); |
90: | } |
91: | $value = new ContactDetailsBase(); |
92: | $this->contactDetails = $value->fromObject($object->contactDetails); |
93: | } |
94: | if (property_exists($object, 'merchantCustomerId')) { |
95: | $this->merchantCustomerId = $object->merchantCustomerId; |
96: | } |
97: | if (property_exists($object, 'name')) { |
98: | if (!is_object($object->name)) { |
99: | throw new UnexpectedValueException('value \'' . print_r($object->name, true) . '\' is not an object'); |
100: | } |
101: | $value = new PersonalName(); |
102: | $this->name = $value->fromObject($object->name); |
103: | } |
104: | return $this; |
105: | } |
106: | } |
107: | |