Completed
Push — master ( 365f31...a64093 )
by Harish
02:03
created
src/MojoServiceProvider.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,17 +8,17 @@
 block discarded – undo
8 8
 {
9 9
 	public function boot()
10 10
 	{
11
-	    $this->publishes([
12
-		        __DIR__ . '/migrations' => $this->app->databasePath() . '/migrations'
13
-		    ], 'migrations');
11
+		$this->publishes([
12
+				__DIR__ . '/migrations' => $this->app->databasePath() . '/migrations'
13
+			], 'migrations');
14 14
 
15
-	    $this->publishes([
16
-		        __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'),
17
-		    ], 'config');
15
+		$this->publishes([
16
+				__DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'),
17
+			], 'config');
18 18
 	}
19 19
 
20
-    public function register()
21
-    {
22
-        $this->app->make('Lubus\Mojo\Mojo');
23
-    }
20
+	public function register()
21
+	{
22
+		$this->app->make('Lubus\Mojo\Mojo');
23
+	}
24 24
 }
Please login to merge, or discard this patch.
src/Mojo.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 			$ch = static::setupCURL("https://$sub.instamojo.com/api/1.1/payment-requests/",config('laravelmojo.key'),config('laravelmojo.token'));
21 21
 
22 22
 			$details = ['purpose' => $purpose,
23
-					    'amount' => $amount,
24
-					    'phone' => $user->phone,
25
-					    'buyer_name' => $user->name,
26
-					    'redirect_url' => config('laravelmojo.redirect_url_after_payment'),
27
-					    'send_email' => false,
28
-					    'webhook' => '',
29
-					    'send_sms' => false,
30
-					    'email' => $user->email,
31
-					    'allow_repeated_payments' => false ];
23
+						'amount' => $amount,
24
+						'phone' => $user->phone,
25
+						'buyer_name' => $user->name,
26
+						'redirect_url' => config('laravelmojo.redirect_url_after_payment'),
27
+						'send_email' => false,
28
+						'webhook' => '',
29
+						'send_sms' => false,
30
+						'email' => $user->email,
31
+						'allow_repeated_payments' => false ];
32 32
 
33 33
 			curl_setopt($ch, CURLOPT_POST, true);
34 34
 			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($details));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			$user = User::where('email',$details->email)->first();
90 90
 			$user_id = $user->id;
91 91
 
92
-	    	MojoPaymentDetails::create(['user_id' => $user_id,
92
+			MojoPaymentDetails::create(['user_id' => $user_id,
93 93
 									   'buyer_email' => $details->email,
94 94
 									   'buyer_name' => $details->buyer_name,
95 95
 									   'buyer_phone' => $details->phone,
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 									   'request_status' => $details->status,
105 105
 									   'payment_status' => $details->payment->status,
106 106
 									 ]);
107
-	    	DB::commit();
108
-	    	return true;
107
+			DB::commit();
108
+			return true;
109 109
 		}
110 110
 
111 111
 		catch(Exception $e)
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 				curl_setopt($c_init, CURLOPT_RETURNTRANSFER, TRUE);
128 128
 				curl_setopt($c_init, CURLOPT_FOLLOWLOCATION, TRUE);
129 129
 				curl_setopt($c_init, CURLOPT_HTTPHEADER,[
130
-				                   "X-Api-Key: $key",
131
-				                   "X-Auth-Token: $token"]
132
-				            );
130
+								   "X-Api-Key: $key",
131
+								   "X-Auth-Token: $token"]
132
+							);
133 133
 
134 134
 				return $c_init;
135 135
 			} 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 			$ch = static::setupCURL("https://$sub.instamojo.com/api/1.1/refunds/",config('laravelmojo.key'),config('laravelmojo.token'));
187 187
 
188 188
 			$details = ['payment_id' => $payment_id,
189
-					    'type' => $type,
190
-					    'body' => $reason ];
189
+						'type' => $type,
190
+						'body' => $reason ];
191 191
 
192 192
 			curl_setopt($ch, CURLOPT_POST, true);
193 193
 			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($details));
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$inst = MojoPaymentDetails::where('payment_id',$payment_id)->first();
201 201
 			$user_id = $inst->user_id;
202 202
 
203
-	    	$refund_record = MojoRefundDetails::create(['user_id' => $user_id,
203
+			$refund_record = MojoRefundDetails::create(['user_id' => $user_id,
204 204
 													   'refund_id' => $refund->refund_id,
205 205
 													   'payment_id' => $payment_id,
206 206
 													   'status' => $refund->status,
Please login to merge, or discard this patch.
src/config/laravelmojo.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,22 +2,22 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /* Specify your Private AUTH Token provided by Instamojo in the
5
+	/* Specify your Private AUTH Token provided by Instamojo in the
6 6
      * API & Plugins section of your integration page.
7 7
      */
8 8
     
9
-    'key' => '',
9
+	'key' => '',
10 10
 
11
-    /*
11
+	/*
12 12
      * Specify your Private AUTH Token provided by Instamojo in the 
13 13
      * API & Plugins section of your integration page.
14 14
      * Also I haven't watched a single episode of Game of thrones yet, please
15 15
      * don't judge me for that. It's on my list.
16 16
      */
17 17
     
18
-    'token' => '', 
18
+	'token' => '', 
19 19
 
20
-    /*
20
+	/*
21 21
      * The URL of your app to which the user will be redirected after the  
22 22
      * payment process at Instamojo's end.
23 23
      * Tip : If you are testing on localhost , create a alias in your host
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      * as you base URL. And add it to your routes.
26 26
      */
27 27
 
28
-    'redirect_url_after_payment' => '',
28
+	'redirect_url_after_payment' => '',
29 29
 
30
-    /*
30
+	/*
31 31
      * These took me an hour to figure out , for testing purposers you will  
32 32
      * most probably use the instamojo sandbox testing account , if thats
33 33
      * the case, then the subdomain for all your endpoints will be "test"
@@ -36,5 +36,5 @@  discard block
 block discarded – undo
36 36
      * then it will be "www"  
37 37
      */
38 38
 
39
-    'subdomain_for_endpoints' => 'test',
39
+	'subdomain_for_endpoints' => 'test',
40 40
 ];
Please login to merge, or discard this patch.
src/models/MojoPaymentDetails.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 class MojoPaymentDetails extends Model
8 8
 {
9
-    protected $table = 'mojo_payment_details';
9
+	protected $table = 'mojo_payment_details';
10 10
 
11
-    protected $fillable = ['user_id','buyer_email','buyer_name','buyer_phone','currency','amount','fees','longurl','payment_id',
12
-    					   'payment_request_id','purpose','shorturl','request_status','payment_status',];
11
+	protected $fillable = ['user_id','buyer_email','buyer_name','buyer_phone','currency','amount','fees','longurl','payment_id',
12
+						   'payment_request_id','purpose','shorturl','request_status','payment_status',];
13 13
 }
Please login to merge, or discard this patch.
src/models/MojoRefundDetails.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 class MojoRefundDetails extends Model
8 8
 {
9
-    protected $table = 'mojo_refund_details';
9
+	protected $table = 'mojo_refund_details';
10 10
 
11
-    protected $fillable = ['user_id','refund_id','payment_id','status','type','body','refund_amount','total_amount',];
11
+	protected $fillable = ['user_id','refund_id','payment_id','status','type','body','refund_amount','total_amount',];
12 12
 }
Please login to merge, or discard this patch.
src/migrations/0000_00_00_000000_create_mojo_payment_details_table.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -8,41 +8,41 @@
 block discarded – undo
8 8
 
9 9
 class CreateMojoPaymentDetailsTable extends Migration
10 10
 {
11
-    /**
12
-     * Run the migrations.
13
-     *
14
-     * @return void
15
-     */
16
-    public function up()
17
-    {
18
-        Schema::create('mojo_payment_details', function (Blueprint $table) {
19
-            $table->increments('id');
20
-            $table->integer('user_id')->unsigned();
21
-            $table->foreign('user_id')->references('id')->on('users');
22
-            $table->string('buyer_email');
23
-            $table->string('buyer_name');
24
-            $table->string('buyer_phone');
25
-            $table->string('currency');
26
-            $table->string('amount');
27
-            $table->string('fees');
28
-            $table->string('longurl');
29
-            $table->string('payment_id');
30
-            $table->string('payment_request_id');
31
-            $table->string('purpose');
32
-            $table->string('shorturl')->nullable();
33
-            $table->string('request_status');
34
-            $table->string('payment_status');
35
-            $table->timestamps();
36
-        });
37
-    }
11
+	/**
12
+	 * Run the migrations.
13
+	 *
14
+	 * @return void
15
+	 */
16
+	public function up()
17
+	{
18
+		Schema::create('mojo_payment_details', function (Blueprint $table) {
19
+			$table->increments('id');
20
+			$table->integer('user_id')->unsigned();
21
+			$table->foreign('user_id')->references('id')->on('users');
22
+			$table->string('buyer_email');
23
+			$table->string('buyer_name');
24
+			$table->string('buyer_phone');
25
+			$table->string('currency');
26
+			$table->string('amount');
27
+			$table->string('fees');
28
+			$table->string('longurl');
29
+			$table->string('payment_id');
30
+			$table->string('payment_request_id');
31
+			$table->string('purpose');
32
+			$table->string('shorturl')->nullable();
33
+			$table->string('request_status');
34
+			$table->string('payment_status');
35
+			$table->timestamps();
36
+		});
37
+	}
38 38
 
39
-    /**
40
-     * Reverse the migrations.
41
-     *
42
-     * @return void
43
-     */
44
-    public function down()
45
-    {
46
-        Schema::dropIfExists('mojo_payment_details');
47
-    }
39
+	/**
40
+	 * Reverse the migrations.
41
+	 *
42
+	 * @return void
43
+	 */
44
+	public function down()
45
+	{
46
+		Schema::dropIfExists('mojo_payment_details');
47
+	}
48 48
 }
Please login to merge, or discard this patch.
src/migrations/0000_00_00_000000_create_mojo_refund_details_table.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -8,35 +8,35 @@
 block discarded – undo
8 8
 
9 9
 class CreateMojoRefundDetailsTable extends Migration
10 10
 {
11
-    /**
12
-     * Run the migrations.
13
-     *
14
-     * @return void
15
-     */
16
-    public function up()
17
-    {
18
-        Schema::create('mojo_refund_details', function (Blueprint $table) {
19
-            $table->increments('id');
20
-            $table->integer('user_id')->unsigned();
21
-            $table->foreign('user_id')->references('id')->on('users');
22
-            $table->string('refund_id');
23
-            $table->string('payment_id');
24
-            $table->string('status');
25
-            $table->string('type');
26
-            $table->string('body');
27
-            $table->string('refund_amount');
28
-            $table->string('total_amount');
29
-            $table->timestamps();
30
-        });
31
-    }
11
+	/**
12
+	 * Run the migrations.
13
+	 *
14
+	 * @return void
15
+	 */
16
+	public function up()
17
+	{
18
+		Schema::create('mojo_refund_details', function (Blueprint $table) {
19
+			$table->increments('id');
20
+			$table->integer('user_id')->unsigned();
21
+			$table->foreign('user_id')->references('id')->on('users');
22
+			$table->string('refund_id');
23
+			$table->string('payment_id');
24
+			$table->string('status');
25
+			$table->string('type');
26
+			$table->string('body');
27
+			$table->string('refund_amount');
28
+			$table->string('total_amount');
29
+			$table->timestamps();
30
+		});
31
+	}
32 32
 
33
-    /**
34
-     * Reverse the migrations.
35
-     *
36
-     * @return void
37
-     */
38
-    public function down()
39
-    {
40
-        Schema::dropIfExists('mojo_refund_details');
41
-    }
33
+	/**
34
+	 * Reverse the migrations.
35
+	 *
36
+	 * @return void
37
+	 */
38
+	public function down()
39
+	{
40
+		Schema::dropIfExists('mojo_refund_details');
41
+	}
42 42
 }
Please login to merge, or discard this patch.