@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $payload = self::createPaymentPayload($user, $amount, $purpose, $phone); |
| 28 | 28 | |
| 29 | - $response = self::closeCurl($curl,$payload); |
|
| 29 | + $response = self::closeCurl($curl,$payload); |
|
| 30 | 30 | |
| 31 | 31 | $finalResponse = json_decode($response); |
| 32 | 32 | |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | $curl = static::setupCURL("https://{$sub}.instamojo.com/api/1.1/refunds/"); |
| 67 | 67 | |
| 68 | 68 | $payload = ['payment_id' => $payment_id, |
| 69 | - 'type' => $type, |
|
| 70 | - 'body' => $reason ]; |
|
| 69 | + 'type' => $type, |
|
| 70 | + 'body' => $reason ]; |
|
| 71 | 71 | |
| 72 | 72 | $response = self::closeCurl($curl,$payload); |
| 73 | 73 | $afterDecoding = json_decode($response); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
| 126 | 126 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
| 127 | 127 | curl_setopt($ch, CURLOPT_HTTPHEADER,["X-Api-Key:{$api_key}", |
| 128 | - "X-Auth-Token:{$api_token}"]); |
|
| 128 | + "X-Auth-Token:{$api_token}"]); |
|
| 129 | 129 | return $ch; |
| 130 | 130 | |
| 131 | 131 | } |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | $major = (int) $ver[0]; |
| 20 | 20 | $minor = (int) $ver[1]; |
| 21 | 21 | if($major >= 5 and $minor >= 4){ |
| 22 | - ksort($data, SORT_STRING | SORT_FLAG_CASE); |
|
| 22 | + ksort($data, SORT_STRING | SORT_FLAG_CASE); |
|
| 23 | 23 | } |
| 24 | 24 | else{ |
| 25 | - uksort($data, 'strcasecmp'); |
|
| 25 | + uksort($data, 'strcasecmp'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $mac_calculated = hash_hmac("sha1", implode("|", $data), config('laravelmojo.salt')); |
| 29 | 29 | if($mac_provided == $mac_calculated){ |
| 30 | - if($data['status'] == "Credit"){ |
|
| 30 | + if($data['status'] == "Credit"){ |
|
| 31 | 31 | |
| 32 | - $user = User::where('email',$data['buyer'])->first(); |
|
| 32 | + $user = User::where('email',$data['buyer'])->first(); |
|
| 33 | 33 | $user_id = $user->id; |
| 34 | - MojoPaymentDetails::create(['user_id' => $user_id, |
|
| 34 | + MojoPaymentDetails::create(['user_id' => $user_id, |
|
| 35 | 35 | 'buyer_email' => $data['buyer'], |
| 36 | 36 | 'buyer_name' => $data['buyer_name'], |
| 37 | 37 | 'buyer_phone' => $data['buyer_phone'], |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | 'request_status' => 'completed', |
| 47 | 47 | 'payment_status' => $data['status'], |
| 48 | 48 | ]); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - else{ |
|
| 51 | + else{ |
|
| 52 | 52 | |
| 53 | - $user = User::where('email',$data['buyer'])->first(); |
|
| 53 | + $user = User::where('email',$data['buyer'])->first(); |
|
| 54 | 54 | $user_id = $user->id; |
| 55 | - MojoPaymentDetails::create(['user_id' => $user_id, |
|
| 55 | + MojoPaymentDetails::create(['user_id' => $user_id, |
|
| 56 | 56 | 'buyer_email' => $data['buyer'], |
| 57 | 57 | 'buyer_name' => $data['buyer_name'], |
| 58 | 58 | 'buyer_phone' => $data['buyer_phone'], |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | 'payment_status' => $data['status'], |
| 69 | 69 | ]); |
| 70 | 70 | |
| 71 | - } |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | else{ |
| 74 | - echo "MAC mismatch"; |
|
| 74 | + echo "MAC mismatch"; |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function boot() |
| 10 | 10 | { |
| 11 | - $this->loadMigrationsFrom(__DIR__.'/../migrations'); |
|
| 11 | + $this->loadMigrationsFrom(__DIR__.'/../migrations'); |
|
| 12 | 12 | |
| 13 | - $this->publishes([ |
|
| 14 | - __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
| 15 | - ]); |
|
| 13 | + $this->publishes([ |
|
| 14 | + __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
| 15 | + ]); |
|
| 16 | 16 | } |
| 17 | - public function register() |
|
| 18 | - { |
|
| 17 | + public function register() |
|
| 18 | + { |
|
| 19 | 19 | |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -2,24 +2,24 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /* |
|
| 5 | + /* |
|
| 6 | 6 | * Specify the Private AUTH KEY in your .env file provided |
| 7 | 7 | * by Instamojo in the API & Plugin's section |
| 8 | 8 | * of your account's integration page. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | - 'key' => env('INSTAMOJO_KEY', null), |
|
| 11 | + 'key' => env('INSTAMOJO_KEY', null), |
|
| 12 | 12 | |
| 13 | - /* |
|
| 13 | + /* |
|
| 14 | 14 | * Specify your Private AUTH TOKEN in your .env file provided by Instamojo in the |
| 15 | 15 | * API & Plugins section of your integration page. |
| 16 | 16 | * Also I haven't watched a single episode of FRIENDS yet, please |
| 17 | 17 | * don't judge me for that. It's on my list. |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | - 'token' => env('INSTAMOJO_TOKEN', null), |
|
| 20 | + 'token' => env('INSTAMOJO_TOKEN', null), |
|
| 21 | 21 | |
| 22 | - /* |
|
| 22 | + /* |
|
| 23 | 23 | * The URL of your app to which the user will be redirected after the |
| 24 | 24 | * payment process at Instamojo's part will end. |
| 25 | 25 | * Tip : If you are testing on localhost , create a alias in your host |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | * as your base URL. And add it to your routes. |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | - 'redirect_url_after_payment' => env('INSTAMOJO_REDIRECT_URL', null), |
|
| 30 | + 'redirect_url_after_payment' => env('INSTAMOJO_REDIRECT_URL', null), |
|
| 31 | 31 | |
| 32 | - /* |
|
| 32 | + /* |
|
| 33 | 33 | * These took me an hour to figure out , for testing purposers you will |
| 34 | 34 | * most probably use the instamojo sandbox testing account , if thats |
| 35 | 35 | * the case, then the subdomain for all your endpoints will be "test" |
@@ -38,23 +38,23 @@ discard block |
||
| 38 | 38 | * then it will be "www" |
| 39 | 39 | */ |
| 40 | 40 | |
| 41 | - 'subdomain_for_endpoints' => env('INSTAMOJO_SUBDOMAIN', null), |
|
| 41 | + 'subdomain_for_endpoints' => env('INSTAMOJO_SUBDOMAIN', null), |
|
| 42 | 42 | |
| 43 | - /* |
|
| 43 | + /* |
|
| 44 | 44 | * WEBHOOK is your app's URL to which Instamojo sends |
| 45 | 45 | * payment details as a POST request. This package |
| 46 | 46 | * handles everything , you just have to define |
| 47 | 47 | * the POST route & add it your route's file |
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | - 'webhook_url' => env('INSTAMOJO_WEBHOOK_URL', null), |
|
| 50 | + 'webhook_url' => env('INSTAMOJO_WEBHOOK_URL', null), |
|
| 51 | 51 | |
| 52 | - /* |
|
| 52 | + /* |
|
| 53 | 53 | * Specify the Private SALT in your .env file provided |
| 54 | 54 | * by Instamojo in the API & Plugin's section |
| 55 | 55 | * of your account's integration page. |
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | - 'salt' => env('INSTAMOJO_SALT', null), |
|
| 58 | + 'salt' => env('INSTAMOJO_SALT', null), |
|
| 59 | 59 | |
| 60 | 60 | ]; |