|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Daaner\NovaPoshta\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Daaner\NovaPoshta\NovaPoshta; |
|
6
|
|
|
use Daaner\NovaPoshta\Traits\Limit; |
|
7
|
|
|
use Daaner\NovaPoshta\Traits\WarehousesFilter; |
|
8
|
|
|
use Daaner\NovaPoshta\Traits\AddressSettlementProperty; |
|
9
|
|
|
|
|
10
|
|
|
class Address extends NovaPoshta |
|
11
|
|
|
{ |
|
12
|
|
|
use Limit, WarehousesFilter, AddressSettlementProperty; |
|
13
|
|
|
|
|
14
|
|
|
protected $model = 'Address'; |
|
15
|
|
|
protected $calledMethod; |
|
16
|
|
|
protected $methodProperties = []; |
|
17
|
|
|
|
|
18
|
|
|
public function getAreas() |
|
19
|
|
|
{ |
|
20
|
|
|
$this->calledMethod = 'getAreas'; |
|
21
|
|
|
$this->methodProperties = null; |
|
22
|
|
|
|
|
23
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function getCities($find = null, $string = true) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->calledMethod = 'getCities'; |
|
29
|
|
|
$this->addLimit(); |
|
30
|
|
|
$this->getPage(); |
|
31
|
|
|
|
|
32
|
|
|
if ($find) { |
|
33
|
|
|
if ($string) { |
|
34
|
|
|
$this->methodProperties['FindByString'] = $find; |
|
35
|
|
|
} else { |
|
36
|
|
|
$this->methodProperties['Ref'] = $find; |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getWarehouses($cityRef, $string = true) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->calledMethod = 'getWarehouses'; |
|
46
|
|
|
$this->getTypeOfWarehouseRef(); |
|
47
|
|
|
|
|
48
|
|
|
if ($string) { |
|
49
|
|
|
$this->methodProperties['CityName'] = $cityRef; |
|
50
|
|
|
} else { |
|
51
|
|
|
$this->methodProperties['CityRef'] = $cityRef; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getWarehouseTypes($cityRef, $string = true) |
|
58
|
|
|
{ |
|
59
|
|
|
$this->calledMethod = 'getWarehouseTypes'; |
|
60
|
|
|
|
|
61
|
|
|
if ($string) { |
|
62
|
|
|
$this->methodProperties['CityName'] = $cityRef; |
|
63
|
|
|
} else { |
|
64
|
|
|
$this->methodProperties['CityRef'] = $cityRef; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function getWarehouseSettlements($settlementRef) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->calledMethod = 'getWarehouses'; |
|
73
|
|
|
$this->getTypeOfWarehouseRef(); |
|
74
|
|
|
|
|
75
|
|
|
$this->methodProperties['SettlementRef'] = $settlementRef; |
|
76
|
|
|
|
|
77
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function searchSettlements($search) |
|
81
|
|
|
{ |
|
82
|
|
|
$this->calledMethod = 'searchSettlements'; |
|
83
|
|
|
$this->addLimit(); |
|
84
|
|
|
|
|
85
|
|
|
$this->methodProperties['CityName'] = $search; |
|
86
|
|
|
|
|
87
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function searchSettlementStreets($ref, $street) |
|
91
|
|
|
{ |
|
92
|
|
|
$this->calledMethod = 'searchSettlementStreets'; |
|
93
|
|
|
$this->addLimit(); |
|
94
|
|
|
|
|
95
|
|
|
$this->methodProperties['SettlementRef'] = $ref; |
|
96
|
|
|
$this->methodProperties['StreetName'] = $street; |
|
97
|
|
|
|
|
98
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function getSettlements($find = null) |
|
102
|
|
|
{ |
|
103
|
|
|
$this->calledMethod = 'getSettlements'; |
|
104
|
|
|
$this->methodProperties = null; |
|
105
|
|
|
$this->addLimit(); |
|
106
|
|
|
$this->getPage(); |
|
107
|
|
|
|
|
108
|
|
|
//add AddressSettlementProperty |
|
109
|
|
|
$this->getAreaRef(); |
|
110
|
|
|
$this->getRegionRef(); |
|
111
|
|
|
$this->getWarehouse(); |
|
112
|
|
|
$this->getRef(); |
|
113
|
|
|
|
|
114
|
|
|
if ($find) { |
|
115
|
|
|
$this->methodProperties['FindByString'] = $find; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
public function getStreet($city, $find = null) |
|
122
|
|
|
{ |
|
123
|
|
|
$this->calledMethod = 'getStreet'; |
|
124
|
|
|
$this->addLimit(); |
|
125
|
|
|
$this->getPage(); |
|
126
|
|
|
|
|
127
|
|
|
$this->methodProperties['CityRef'] = $city; |
|
128
|
|
|
if ($find) { |
|
129
|
|
|
$this->methodProperties['FindByString'] = $find; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
//Counterparty API |
|
136
|
|
|
public function save() |
|
137
|
|
|
{ |
|
138
|
|
|
$this->calledMethod = 'save'; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
public function update() |
|
142
|
|
|
{ |
|
143
|
|
|
$this->calledMethod = 'update'; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
public function delete() |
|
147
|
|
|
{ |
|
148
|
|
|
$this->calledMethod = 'delete'; |
|
149
|
|
|
} |
|
150
|
|
|
} |
|
151
|
|
|
|