@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | protected $auth_token = null; |
17 | 17 | |
18 | 18 | /** |
19 | - * @param string $api_key |
|
20 | - * @param string $auth_token is available on the d |
|
21 | - * @param string $endpoint can be set if you are working on an alternative server. |
|
22 | - * @return array AuthToken object. |
|
23 | - */ |
|
19 | + * @param string $api_key |
|
20 | + * @param string $auth_token is available on the d |
|
21 | + * @param string $endpoint can be set if you are working on an alternative server. |
|
22 | + * @return array AuthToken object. |
|
23 | + */ |
|
24 | 24 | public function __construct($api_key, $auth_token=null, $endpoint=null) |
25 | 25 | { |
26 | 26 | $this->api_key = (string) $api_key; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * @return array headers with Authentication tokens added |
|
42 | - */ |
|
41 | + * @return array headers with Authentication tokens added |
|
42 | + */ |
|
43 | 43 | private function build_curl_headers() |
44 | 44 | { |
45 | 45 | $headers = array("X-Api-key: $this->api_key"); |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * @param string $path |
|
59 | - * @return string adds the path to endpoint with. |
|
60 | - */ |
|
58 | + * @param string $path |
|
59 | + * @return string adds the path to endpoint with. |
|
60 | + */ |
|
61 | 61 | private function build_api_call_url($path) |
62 | 62 | { |
63 | 63 | if (strpos($path, '/?') === false and strpos($path, '?') === false) { |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param string $method ('GET', 'POST', 'DELETE', 'PATCH') |
|
72 | - * @param string $path whichever API path you want to target. |
|
73 | - * @param array $data contains the POST data to be sent to the API. |
|
74 | - * @return array decoded json returned by API. |
|
75 | - */ |
|
71 | + * @param string $method ('GET', 'POST', 'DELETE', 'PATCH') |
|
72 | + * @param string $path whichever API path you want to target. |
|
73 | + * @param array $data contains the POST data to be sent to the API. |
|
74 | + * @return array decoded json returned by API. |
|
75 | + */ |
|
76 | 76 | private function api_call($method, $path, array $data=null) |
77 | 77 | { |
78 | 78 | $path = (string) $path; |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * @return string URL to upload file or cover image asynchronously |
|
136 | - */ |
|
135 | + * @return string URL to upload file or cover image asynchronously |
|
136 | + */ |
|
137 | 137 | public function getUploadUrl() |
138 | 138 | { |
139 | 139 | $result = $this->api_call('GET', 'links/get_file_upload_url', array()); |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * @param string $file_path |
|
145 | - * @return string JSON returned when the file upload is complete. |
|
146 | - */ |
|
144 | + * @param string $file_path |
|
145 | + * @return string JSON returned when the file upload is complete. |
|
146 | + */ |
|
147 | 147 | public function uploadFile($file_path) |
148 | 148 | { |
149 | 149 | $upload_url = $this->getUploadUrl(); |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Uploads any file or cover image mentioned in $link and |
|
181 | - * updates it with the json required by the API. |
|
182 | - * @param array $link |
|
183 | - * @return array $link updated with uploaded file information if applicable. |
|
184 | - */ |
|
180 | + * Uploads any file or cover image mentioned in $link and |
|
181 | + * updates it with the json required by the API. |
|
182 | + * @param array $link |
|
183 | + * @return array $link updated with uploaded file information if applicable. |
|
184 | + */ |
|
185 | 185 | public function uploadMagic(array $link) |
186 | 186 | { |
187 | 187 | if(!empty($link['file_upload'])) { |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
201 | - * Authenticate using username and password of a user. |
|
202 | - * Automatically updates the auth_token value. |
|
203 | - * @param array $args contains username=>USERNAME and password=PASSWORD |
|
204 | - * @return array AuthToken object. |
|
205 | - */ |
|
201 | + * Authenticate using username and password of a user. |
|
202 | + * Automatically updates the auth_token value. |
|
203 | + * @param array $args contains username=>USERNAME and password=PASSWORD |
|
204 | + * @return array AuthToken object. |
|
205 | + */ |
|
206 | 206 | public function auth(array $args) |
207 | 207 | { |
208 | 208 | $response = $this->api_call('POST', 'auth', $args); |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * @return array list of Link objects. |
|
215 | - */ |
|
214 | + * @return array list of Link objects. |
|
215 | + */ |
|
216 | 216 | public function linksList() |
217 | 217 | { |
218 | 218 | $response = $this->api_call('GET', 'links', array()); |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
223 | - * @return array single Link object. |
|
224 | - */ |
|
223 | + * @return array single Link object. |
|
224 | + */ |
|
225 | 225 | public function linkDetail($slug) |
226 | 226 | { |
227 | 227 | $response = $this->api_call('GET', 'links/' . $slug, array()); |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | - * @return array single Link object. |
|
233 | - */ |
|
232 | + * @return array single Link object. |
|
233 | + */ |
|
234 | 234 | public function linkCreate(array $link) |
235 | 235 | { |
236 | 236 | if(empty($link['currency'])){ |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
245 | - * @return array single Link object. |
|
246 | - */ |
|
245 | + * @return array single Link object. |
|
246 | + */ |
|
247 | 247 | public function linkEdit($slug, array $link) |
248 | 248 | { |
249 | 249 | $link = $this->uploadMagic($link); |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @return array single Link object. |
|
256 | - */ |
|
255 | + * @return array single Link object. |
|
256 | + */ |
|
257 | 257 | public function linkDelete($slug) |
258 | 258 | { |
259 | 259 | $response = $this->api_call('DELETE', 'links/' . $slug, array()); |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
264 | - * @return array list of Payment objects. |
|
265 | - */ |
|
264 | + * @return array list of Payment objects. |
|
265 | + */ |
|
266 | 266 | public function paymentsList($limit = null, $page = null) |
267 | 267 | { |
268 | 268 | $params = array(); |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * @param string payment_id as provided by paymentsList() or Instamojo's webhook or redirect functions. |
|
283 | - * @return array single Payment object. |
|
284 | - */ |
|
282 | + * @param string payment_id as provided by paymentsList() or Instamojo's webhook or redirect functions. |
|
283 | + * @return array single Payment object. |
|
284 | + */ |
|
285 | 285 | public function paymentDetail($payment_id) |
286 | 286 | { |
287 | 287 | $response = $this->api_call('GET', 'payments/' . $payment_id, array()); |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | ///// Request a Payment ///// |
293 | 293 | |
294 | 294 | /** |
295 | - * @param array single PaymentRequest object. |
|
296 | - * @return array single PaymentRequest object. |
|
297 | - */ |
|
295 | + * @param array single PaymentRequest object. |
|
296 | + * @return array single PaymentRequest object. |
|
297 | + */ |
|
298 | 298 | public function paymentRequestCreate(array $payment_request) |
299 | 299 | { |
300 | 300 | $response = $this->api_call('POST', 'payment-requests', $payment_request); |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
305 | - * @param string id as provided by paymentRequestCreate, paymentRequestsList, webhook or redirect. |
|
306 | - * @return array single PaymentRequest object. |
|
307 | - */ |
|
305 | + * @param string id as provided by paymentRequestCreate, paymentRequestsList, webhook or redirect. |
|
306 | + * @return array single PaymentRequest object. |
|
307 | + */ |
|
308 | 308 | public function paymentRequestStatus($id) |
309 | 309 | { |
310 | 310 | $response = $this->api_call('GET', 'payment-requests/' . $id, array()); |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
315 | - * @param string id as provided by paymentRequestCreate, paymentRequestsList, webhook or redirect. |
|
316 | - * @param string payment_id as received with the redirection URL or webhook. |
|
317 | - * @return array single PaymentRequest object. |
|
318 | - */ |
|
315 | + * @param string id as provided by paymentRequestCreate, paymentRequestsList, webhook or redirect. |
|
316 | + * @param string payment_id as received with the redirection URL or webhook. |
|
317 | + * @return array single PaymentRequest object. |
|
318 | + */ |
|
319 | 319 | public function paymentRequestPaymentStatus($id, $payment_id) |
320 | 320 | { |
321 | 321 | $response = $this->api_call('GET', 'payment-requests/' . $id . '/' . $payment_id, array()); |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | |
325 | 325 | |
326 | 326 | /** |
327 | - * @param array datetime_limits containing datetime data with keys 'max_created_at', 'min_created_at', |
|
328 | - * 'min_modified_at' and 'max_modified_at' in ISO 8601 format(optional). |
|
329 | - * @return array containing list of PaymentRequest objects. |
|
330 | - * For more information on the allowed date formats check the |
|
331 | - * docs: https://www.instamojo.com/developers/request-a-payment-api/#toc-filtering-payment-requests |
|
332 | - */ |
|
327 | + * @param array datetime_limits containing datetime data with keys 'max_created_at', 'min_created_at', |
|
328 | + * 'min_modified_at' and 'max_modified_at' in ISO 8601 format(optional). |
|
329 | + * @return array containing list of PaymentRequest objects. |
|
330 | + * For more information on the allowed date formats check the |
|
331 | + * docs: https://www.instamojo.com/developers/request-a-payment-api/#toc-filtering-payment-requests |
|
332 | + */ |
|
333 | 333 | public function paymentRequestsList($datetime_limits=null) |
334 | 334 | { |
335 | 335 | $endpoint = 'payment-requests'; |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | ///// Refunds ///// |
350 | 350 | |
351 | 351 | /** |
352 | - * @param array single Refund object. |
|
353 | - * @return array single Refund object. |
|
354 | - */ |
|
352 | + * @param array single Refund object. |
|
353 | + * @return array single Refund object. |
|
354 | + */ |
|
355 | 355 | public function refundCreate(array $refund) |
356 | 356 | { |
357 | 357 | $response = $this->api_call('POST', 'refunds', $refund); |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
362 | - * @param string id as provided by refundCreate or refundsList. |
|
363 | - * @return array single Refund object. |
|
364 | - */ |
|
362 | + * @param string id as provided by refundCreate or refundsList. |
|
363 | + * @return array single Refund object. |
|
364 | + */ |
|
365 | 365 | public function refundDetail($id) |
366 | 366 | { |
367 | 367 | $response = $this->api_call('GET', 'refunds/' . $id, array()); |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | - * @return array containing list of Refund objects. |
|
373 | - */ |
|
372 | + * @return array containing list of Refund objects. |
|
373 | + */ |
|
374 | 374 | public function refundsList() |
375 | 375 | { |
376 | 376 | $response = $this->api_call('GET', 'refunds', array()); |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | class InstamojoServiceProvider extends \Illuminate\Support\ServiceProvider |
4 | 4 | { |
5 | 5 | /** |
6 | - * Bootstrap services. |
|
7 | - * |
|
8 | - * @return void |
|
9 | - */ |
|
6 | + * Bootstrap services. |
|
7 | + * |
|
8 | + * @return void |
|
9 | + */ |
|
10 | 10 | public function boot() |
11 | 11 | { |
12 | 12 | $this->loadRoutesFrom(__DIR__.'/routes/web.php'); |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
17 | - * Register services. |
|
18 | - * |
|
19 | - * @return void |
|
20 | - */ |
|
17 | + * Register services. |
|
18 | + * |
|
19 | + * @return void |
|
20 | + */ |
|
21 | 21 | public function register() |
22 | 22 | { |
23 | 23 | // register our controller |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | class CreateInstamojoPaymentTable extends Migration |
8 | 8 | { |
9 | 9 | /** |
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | 14 | public function up() |
15 | 15 | { |
16 | 16 | Schema::create('instamojo_payment', function (Blueprint $table) { |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | - * Reverse the migrations. |
|
45 | - * |
|
46 | - * @return void |
|
47 | - */ |
|
44 | + * Reverse the migrations. |
|
45 | + * |
|
46 | + * @return void |
|
47 | + */ |
|
48 | 48 | public function down() |
49 | 49 | { |
50 | 50 | Schema::dropIfExists('instamojo_payment'); |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | class CreateInstamojoRefundTable extends Migration |
8 | 8 | { |
9 | 9 | /** |
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | 14 | public function up() |
15 | 15 | { |
16 | 16 | Schema::create('instamojo_refund', function (Blueprint $table) { |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Reverse the migrations. |
|
39 | - * |
|
40 | - * @return void |
|
41 | - */ |
|
38 | + * Reverse the migrations. |
|
39 | + * |
|
40 | + * @return void |
|
41 | + */ |
|
42 | 42 | public function down() |
43 | 43 | { |
44 | 44 | Schema::dropIfExists('instamojo_refund'); |