1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use UnexpectedValueException; |
8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
9: | |
10: | |
11: | |
12: | |
13: | class MerchantData extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $address = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $city = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $countryCode = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $merchantCategoryCode = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $name = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $postalCode = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $stateCode = null; |
49: | |
50: | |
51: | |
52: | |
53: | public function toObject() |
54: | { |
55: | $object = parent::toObject(); |
56: | if (!is_null($this->address)) { |
57: | $object->address = $this->address; |
58: | } |
59: | if (!is_null($this->city)) { |
60: | $object->city = $this->city; |
61: | } |
62: | if (!is_null($this->countryCode)) { |
63: | $object->countryCode = $this->countryCode; |
64: | } |
65: | if (!is_null($this->merchantCategoryCode)) { |
66: | $object->merchantCategoryCode = $this->merchantCategoryCode; |
67: | } |
68: | if (!is_null($this->name)) { |
69: | $object->name = $this->name; |
70: | } |
71: | if (!is_null($this->postalCode)) { |
72: | $object->postalCode = $this->postalCode; |
73: | } |
74: | if (!is_null($this->stateCode)) { |
75: | $object->stateCode = $this->stateCode; |
76: | } |
77: | return $object; |
78: | } |
79: | |
80: | |
81: | |
82: | |
83: | |
84: | |
85: | public function fromObject($object) |
86: | { |
87: | parent::fromObject($object); |
88: | if (property_exists($object, 'address')) { |
89: | $this->address = $object->address; |
90: | } |
91: | if (property_exists($object, 'city')) { |
92: | $this->city = $object->city; |
93: | } |
94: | if (property_exists($object, 'countryCode')) { |
95: | $this->countryCode = $object->countryCode; |
96: | } |
97: | if (property_exists($object, 'merchantCategoryCode')) { |
98: | $this->merchantCategoryCode = $object->merchantCategoryCode; |
99: | } |
100: | if (property_exists($object, 'name')) { |
101: | $this->name = $object->name; |
102: | } |
103: | if (property_exists($object, 'postalCode')) { |
104: | $this->postalCode = $object->postalCode; |
105: | } |
106: | if (property_exists($object, 'stateCode')) { |
107: | $this->stateCode = $object->stateCode; |
108: | } |
109: | return $this; |
110: | } |
111: | } |
112: | |