1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | |
10: | |
11: | |
12: | |
13: | class Customer extends CustomerBase |
14: | { |
15: | |
16: | |
17: | |
18: | public $account = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $accountType = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $billingAddress = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $contactDetails = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $device = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $fiscalNumber = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $isCompany = null; |
49: | |
50: | |
51: | |
52: | |
53: | public $isPreviousCustomer = null; |
54: | |
55: | |
56: | |
57: | |
58: | public $locale = null; |
59: | |
60: | |
61: | |
62: | |
63: | public $personalInformation = null; |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | public $shippingAddress = null; |
70: | |
71: | |
72: | |
73: | |
74: | public function toObject() |
75: | { |
76: | $object = parent::toObject(); |
77: | if (!is_null($this->account)) { |
78: | $object->account = $this->account->toObject(); |
79: | } |
80: | if (!is_null($this->accountType)) { |
81: | $object->accountType = $this->accountType; |
82: | } |
83: | if (!is_null($this->billingAddress)) { |
84: | $object->billingAddress = $this->billingAddress->toObject(); |
85: | } |
86: | if (!is_null($this->contactDetails)) { |
87: | $object->contactDetails = $this->contactDetails->toObject(); |
88: | } |
89: | if (!is_null($this->device)) { |
90: | $object->device = $this->device->toObject(); |
91: | } |
92: | if (!is_null($this->fiscalNumber)) { |
93: | $object->fiscalNumber = $this->fiscalNumber; |
94: | } |
95: | if (!is_null($this->isCompany)) { |
96: | $object->isCompany = $this->isCompany; |
97: | } |
98: | if (!is_null($this->isPreviousCustomer)) { |
99: | $object->isPreviousCustomer = $this->isPreviousCustomer; |
100: | } |
101: | if (!is_null($this->locale)) { |
102: | $object->locale = $this->locale; |
103: | } |
104: | if (!is_null($this->personalInformation)) { |
105: | $object->personalInformation = $this->personalInformation->toObject(); |
106: | } |
107: | if (!is_null($this->shippingAddress)) { |
108: | $object->shippingAddress = $this->shippingAddress->toObject(); |
109: | } |
110: | return $object; |
111: | } |
112: | |
113: | |
114: | |
115: | |
116: | |
117: | |
118: | public function fromObject($object) |
119: | { |
120: | parent::fromObject($object); |
121: | if (property_exists($object, 'account')) { |
122: | if (!is_object($object->account)) { |
123: | throw new UnexpectedValueException('value \'' . print_r($object->account, true) . '\' is not an object'); |
124: | } |
125: | $value = new CustomerAccount(); |
126: | $this->account = $value->fromObject($object->account); |
127: | } |
128: | if (property_exists($object, 'accountType')) { |
129: | $this->accountType = $object->accountType; |
130: | } |
131: | if (property_exists($object, 'billingAddress')) { |
132: | if (!is_object($object->billingAddress)) { |
133: | throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object'); |
134: | } |
135: | $value = new Address(); |
136: | $this->billingAddress = $value->fromObject($object->billingAddress); |
137: | } |
138: | if (property_exists($object, 'contactDetails')) { |
139: | if (!is_object($object->contactDetails)) { |
140: | throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); |
141: | } |
142: | $value = new ContactDetails(); |
143: | $this->contactDetails = $value->fromObject($object->contactDetails); |
144: | } |
145: | if (property_exists($object, 'device')) { |
146: | if (!is_object($object->device)) { |
147: | throw new UnexpectedValueException('value \'' . print_r($object->device, true) . '\' is not an object'); |
148: | } |
149: | $value = new CustomerDevice(); |
150: | $this->device = $value->fromObject($object->device); |
151: | } |
152: | if (property_exists($object, 'fiscalNumber')) { |
153: | $this->fiscalNumber = $object->fiscalNumber; |
154: | } |
155: | if (property_exists($object, 'isCompany')) { |
156: | $this->isCompany = $object->isCompany; |
157: | } |
158: | if (property_exists($object, 'isPreviousCustomer')) { |
159: | $this->isPreviousCustomer = $object->isPreviousCustomer; |
160: | } |
161: | if (property_exists($object, 'locale')) { |
162: | $this->locale = $object->locale; |
163: | } |
164: | if (property_exists($object, 'personalInformation')) { |
165: | if (!is_object($object->personalInformation)) { |
166: | throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object'); |
167: | } |
168: | $value = new PersonalInformation(); |
169: | $this->personalInformation = $value->fromObject($object->personalInformation); |
170: | } |
171: | if (property_exists($object, 'shippingAddress')) { |
172: | if (!is_object($object->shippingAddress)) { |
173: | throw new UnexpectedValueException('value \'' . print_r($object->shippingAddress, true) . '\' is not an object'); |
174: | } |
175: | $value = new AddressPersonal(); |
176: | $this->shippingAddress = $value->fromObject($object->shippingAddress); |
177: | } |
178: | return $this; |
179: | } |
180: | } |
181: | |