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 RefundCustomer 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 $fiscalNumber = null; |
35: | |
36: | |
37: | |
38: | |
39: | public function toObject() |
40: | { |
41: | $object = parent::toObject(); |
42: | if (!is_null($this->address)) { |
43: | $object->address = $this->address->toObject(); |
44: | } |
45: | if (!is_null($this->companyInformation)) { |
46: | $object->companyInformation = $this->companyInformation->toObject(); |
47: | } |
48: | if (!is_null($this->contactDetails)) { |
49: | $object->contactDetails = $this->contactDetails->toObject(); |
50: | } |
51: | if (!is_null($this->fiscalNumber)) { |
52: | $object->fiscalNumber = $this->fiscalNumber; |
53: | } |
54: | return $object; |
55: | } |
56: | |
57: | |
58: | |
59: | |
60: | |
61: | |
62: | public function fromObject($object) |
63: | { |
64: | parent::fromObject($object); |
65: | if (property_exists($object, 'address')) { |
66: | if (!is_object($object->address)) { |
67: | throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); |
68: | } |
69: | $value = new AddressPersonal(); |
70: | $this->address = $value->fromObject($object->address); |
71: | } |
72: | if (property_exists($object, 'companyInformation')) { |
73: | if (!is_object($object->companyInformation)) { |
74: | throw new UnexpectedValueException('value \'' . print_r($object->companyInformation, true) . '\' is not an object'); |
75: | } |
76: | $value = new CompanyInformation(); |
77: | $this->companyInformation = $value->fromObject($object->companyInformation); |
78: | } |
79: | if (property_exists($object, 'contactDetails')) { |
80: | if (!is_object($object->contactDetails)) { |
81: | throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object'); |
82: | } |
83: | $value = new ContactDetailsBase(); |
84: | $this->contactDetails = $value->fromObject($object->contactDetails); |
85: | } |
86: | if (property_exists($object, 'fiscalNumber')) { |
87: | $this->fiscalNumber = $object->fiscalNumber; |
88: | } |
89: | return $this; |
90: | } |
91: | } |
92: | |