@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | public function getTrack($tracking_or_reference = 'trackingNumber', $value, $lang = 'ita') |
41 | 41 | { |
42 | 42 | $client = new GuzzleHttp\Client(); |
43 | - $res = $client->get(config('qapla.url').'getTrack/', ['query' => [ |
|
43 | + $res = $client->get(config('qapla.url').'getTrack/', [ 'query' => [ |
|
44 | 44 | 'apiKey' => $this->privateApiKey, |
45 | 45 | $tracking_or_reference => $value, |
46 | - 'lang' => $lang] |
|
46 | + 'lang' => $lang ] |
|
47 | 47 | ]); |
48 | 48 | $result = GuzzleHttp\json_decode($res->getBody()); |
49 | - if($result->getTrack->result == 'KO') return $result->getTrack->error; |
|
49 | + if ($result->getTrack->result == 'KO') return $result->getTrack->error; |
|
50 | 50 | return $result->getTrack; |
51 | 51 | } |
52 | 52 | |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function pushTrack($data) |
60 | 60 | { |
61 | - $json ='{ |
|
61 | + $json = '{ |
|
62 | 62 | "apiKey": "'.$this->privateApiKey.'", |
63 | 63 | "pushTrack": '.json_encode($data).' |
64 | 64 | }'; |
65 | 65 | |
66 | 66 | $client = new GuzzleHttp\Client(); |
67 | 67 | $res = $client->post(config('qapla.url').'pushTrack/', [ |
68 | - 'headers' => ['content-type' => 'application/json'], |
|
68 | + 'headers' => [ 'content-type' => 'application/json' ], |
|
69 | 69 | 'body' => $json |
70 | 70 | ]); |
71 | 71 | $result = GuzzleHttp\json_decode($res->getBody()); |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $param_name = 'dateFrom'; |
84 | 84 | $date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate'); |
85 | - if(strtotime($date_or_days) === false) $param_name = 'days'; |
|
85 | + if (strtotime($date_or_days) === false) $param_name = 'days'; |
|
86 | 86 | |
87 | 87 | $client = new GuzzleHttp\Client(); |
88 | - $res = $client->get(config('qapla.url').'getTracks/', ['query' => [ |
|
88 | + $res = $client->get(config('qapla.url').'getTracks/', [ 'query' => [ |
|
89 | 89 | 'apiKey' => $this->privateApiKey, |
90 | - $param_name => $date_or_days] |
|
90 | + $param_name => $date_or_days ] |
|
91 | 91 | ]); |
92 | 92 | $result = GuzzleHttp\json_decode($res->getBody()); |
93 | - if($result->getTracks->result == 'KO') return $result->getTracks->error; |
|
93 | + if ($result->getTracks->result == 'KO') return $result->getTracks->error; |
|
94 | 94 | return $result->getTracks->tracks; |
95 | 95 | } |
96 | 96 | |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | public function deleteTrack($trackingNumber) |
104 | 104 | { |
105 | 105 | $client = new GuzzleHttp\Client(); |
106 | - $res = $client->get(config('qapla.url').'deleteTrack/', ['query' => [ |
|
106 | + $res = $client->get(config('qapla.url').'deleteTrack/', [ 'query' => [ |
|
107 | 107 | 'apiKey' => $this->privateApiKey, |
108 | - 'trackingNumber' => $trackingNumber] |
|
108 | + 'trackingNumber' => $trackingNumber ] |
|
109 | 109 | ]); |
110 | 110 | $result = GuzzleHttp\json_decode($res->getBody()); |
111 | - if($result->deleteTrack->result == 'KO') return $result->deleteTrack->error; |
|
111 | + if ($result->deleteTrack->result == 'KO') return $result->deleteTrack->error; |
|
112 | 112 | return true; |
113 | 113 | } |
114 | 114 | |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | { |
123 | 123 | $param_name = 'dateFrom'; |
124 | 124 | $date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate'); |
125 | - if(strtotime($date_or_days) === false) $param_name = 'days'; |
|
125 | + if (strtotime($date_or_days) === false) $param_name = 'days'; |
|
126 | 126 | |
127 | 127 | $client = new GuzzleHttp\Client(); |
128 | - $res = $client->get(config('qapla.url').'getOrders/', ['query' => [ |
|
128 | + $res = $client->get(config('qapla.url').'getOrders/', [ 'query' => [ |
|
129 | 129 | 'apiKey' => $this->privateApiKey, |
130 | - $param_name => $date_or_days] |
|
130 | + $param_name => $date_or_days ] |
|
131 | 131 | ]); |
132 | 132 | $result = GuzzleHttp\json_decode($res->getBody()); |
133 | - if($result->getOrders->result == 'KO') return $result->getOrders->error; |
|
133 | + if ($result->getOrders->result == 'KO') return $result->getOrders->error; |
|
134 | 134 | return $result->getOrders->orders; |
135 | 135 | } |
136 | 136 | |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function pushOrder($data) |
144 | 144 | { |
145 | - $json ='{ |
|
145 | + $json = '{ |
|
146 | 146 | "apiKey": "'.$this->privateApiKey.'", |
147 | 147 | "pushOrder": '.json_encode($data).' |
148 | 148 | }'; |
149 | 149 | |
150 | 150 | $client = new GuzzleHttp\Client(); |
151 | 151 | $res = $client->post(config('qapla.url').'pushOrder/', [ |
152 | - 'headers' => ['content-type' => 'application/json'], |
|
152 | + 'headers' => [ 'content-type' => 'application/json' ], |
|
153 | 153 | 'body' => $json |
154 | 154 | ]); |
155 | 155 | $result = GuzzleHttp\json_decode($res->getBody()); |
156 | - if($result->pushOrder->result == 'KO') return $result->pushOrder->error; |
|
156 | + if ($result->pushOrder->result == 'KO') return $result->pushOrder->error; |
|
157 | 157 | return true; |
158 | 158 | } |
159 | 159 | |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | public function getCredits() |
165 | 165 | { |
166 | 166 | $client = new GuzzleHttp\Client(); |
167 | - $res = $client->get(config('qapla.url').'getCredits/', ['query' => [ |
|
168 | - 'apiKey' => $this->privateApiKey] |
|
167 | + $res = $client->get(config('qapla.url').'getCredits/', [ 'query' => [ |
|
168 | + 'apiKey' => $this->privateApiKey ] |
|
169 | 169 | ]); |
170 | 170 | $result = GuzzleHttp\json_decode($res->getBody()); |
171 | - if($result->getCredits->result == 'KO') return $result->getCredits->error; |
|
171 | + if ($result->getCredits->result == 'KO') return $result->getCredits->error; |
|
172 | 172 | return $result->getCredits->credits; |
173 | 173 | } |
174 | 174 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | public function getCouriers($country = null) |
182 | 182 | { |
183 | 183 | $client = new GuzzleHttp\Client(); |
184 | - $res = $client->get(config('qapla.url').'getCouriers/', ['query' => [ |
|
184 | + $res = $client->get(config('qapla.url').'getCouriers/', [ 'query' => [ |
|
185 | 185 | 'apiKey' => $this->privateApiKey, |
186 | - 'country' => $country ?: config('qapla.couriers.default_country')] |
|
186 | + 'country' => $country ?: config('qapla.couriers.default_country') ] |
|
187 | 187 | ]); |
188 | 188 | $result = GuzzleHttp\json_decode($res->getBody()); |
189 | - if($result->getCouriers->result == 'KO') return $result->getCouriers->error; |
|
189 | + if ($result->getCouriers->result == 'KO') return $result->getCouriers->error; |
|
190 | 190 | return $result->getCouriers->courier; |
191 | 191 | } |
192 | 192 | } |
193 | 193 | \ No newline at end of file |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | 'lang' => $lang] |
47 | 47 | ]); |
48 | 48 | $result = GuzzleHttp\json_decode($res->getBody()); |
49 | - if($result->getTrack->result == 'KO') return $result->getTrack->error; |
|
49 | + if($result->getTrack->result == 'KO') { |
|
50 | + return $result->getTrack->error; |
|
51 | + } |
|
50 | 52 | return $result->getTrack; |
51 | 53 | } |
52 | 54 | |
@@ -82,7 +84,9 @@ discard block |
||
82 | 84 | { |
83 | 85 | $param_name = 'dateFrom'; |
84 | 86 | $date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate'); |
85 | - if(strtotime($date_or_days) === false) $param_name = 'days'; |
|
87 | + if(strtotime($date_or_days) === false) { |
|
88 | + $param_name = 'days'; |
|
89 | + } |
|
86 | 90 | |
87 | 91 | $client = new GuzzleHttp\Client(); |
88 | 92 | $res = $client->get(config('qapla.url').'getTracks/', ['query' => [ |
@@ -90,7 +94,9 @@ discard block |
||
90 | 94 | $param_name => $date_or_days] |
91 | 95 | ]); |
92 | 96 | $result = GuzzleHttp\json_decode($res->getBody()); |
93 | - if($result->getTracks->result == 'KO') return $result->getTracks->error; |
|
97 | + if($result->getTracks->result == 'KO') { |
|
98 | + return $result->getTracks->error; |
|
99 | + } |
|
94 | 100 | return $result->getTracks->tracks; |
95 | 101 | } |
96 | 102 | |
@@ -108,7 +114,9 @@ discard block |
||
108 | 114 | 'trackingNumber' => $trackingNumber] |
109 | 115 | ]); |
110 | 116 | $result = GuzzleHttp\json_decode($res->getBody()); |
111 | - if($result->deleteTrack->result == 'KO') return $result->deleteTrack->error; |
|
117 | + if($result->deleteTrack->result == 'KO') { |
|
118 | + return $result->deleteTrack->error; |
|
119 | + } |
|
112 | 120 | return true; |
113 | 121 | } |
114 | 122 | |
@@ -122,7 +130,9 @@ discard block |
||
122 | 130 | { |
123 | 131 | $param_name = 'dateFrom'; |
124 | 132 | $date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate'); |
125 | - if(strtotime($date_or_days) === false) $param_name = 'days'; |
|
133 | + if(strtotime($date_or_days) === false) { |
|
134 | + $param_name = 'days'; |
|
135 | + } |
|
126 | 136 | |
127 | 137 | $client = new GuzzleHttp\Client(); |
128 | 138 | $res = $client->get(config('qapla.url').'getOrders/', ['query' => [ |
@@ -130,7 +140,9 @@ discard block |
||
130 | 140 | $param_name => $date_or_days] |
131 | 141 | ]); |
132 | 142 | $result = GuzzleHttp\json_decode($res->getBody()); |
133 | - if($result->getOrders->result == 'KO') return $result->getOrders->error; |
|
143 | + if($result->getOrders->result == 'KO') { |
|
144 | + return $result->getOrders->error; |
|
145 | + } |
|
134 | 146 | return $result->getOrders->orders; |
135 | 147 | } |
136 | 148 | |
@@ -153,7 +165,9 @@ discard block |
||
153 | 165 | 'body' => $json |
154 | 166 | ]); |
155 | 167 | $result = GuzzleHttp\json_decode($res->getBody()); |
156 | - if($result->pushOrder->result == 'KO') return $result->pushOrder->error; |
|
168 | + if($result->pushOrder->result == 'KO') { |
|
169 | + return $result->pushOrder->error; |
|
170 | + } |
|
157 | 171 | return true; |
158 | 172 | } |
159 | 173 | |
@@ -168,7 +182,9 @@ discard block |
||
168 | 182 | 'apiKey' => $this->privateApiKey] |
169 | 183 | ]); |
170 | 184 | $result = GuzzleHttp\json_decode($res->getBody()); |
171 | - if($result->getCredits->result == 'KO') return $result->getCredits->error; |
|
185 | + if($result->getCredits->result == 'KO') { |
|
186 | + return $result->getCredits->error; |
|
187 | + } |
|
172 | 188 | return $result->getCredits->credits; |
173 | 189 | } |
174 | 190 | |
@@ -186,7 +202,9 @@ discard block |
||
186 | 202 | 'country' => $country ?: config('qapla.couriers.default_country')] |
187 | 203 | ]); |
188 | 204 | $result = GuzzleHttp\json_decode($res->getBody()); |
189 | - if($result->getCouriers->result == 'KO') return $result->getCouriers->error; |
|
205 | + if($result->getCouriers->result == 'KO') { |
|
206 | + return $result->getCouriers->error; |
|
207 | + } |
|
190 | 208 | return $result->getCouriers->courier; |
191 | 209 | } |
192 | 210 | } |
193 | 211 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Config parameters |
12 | 12 | */ |
13 | 13 | 'tracks' => [ |
14 | - 'default_fromDate' => '1970-01-01 00:00:00', // Get shipments from 1970 to today = ALL |
|
14 | + 'default_fromDate' => '1970-01-01 00:00:00', // Get shipments from 1970 to today = ALL |
|
15 | 15 | ], |
16 | 16 | |
17 | 17 | /* |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * Config parameters |
20 | 20 | */ |
21 | 21 | 'orders' => [ |
22 | - 'default_fromDate' => '1970-01-01 00:00:00', // Get orders from 1970 to today = ALL |
|
22 | + 'default_fromDate' => '1970-01-01 00:00:00', // Get orders from 1970 to today = ALL |
|
23 | 23 | ], |
24 | 24 | |
25 | 25 | /* |