@@ -8,5 +8,5 @@ |
||
8 | 8 | { |
9 | 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 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function up() |
17 | 17 | { |
18 | - Schema::create('mojo_refund_details', function (Blueprint $table) { |
|
18 | + Schema::create('mojo_refund_details', function(Blueprint $table) { |
|
19 | 19 | $table->increments('id'); |
20 | 20 | $table->integer('user_id')->unsigned(); |
21 | 21 | $table->foreign('user_id')->references('id')->on('users'); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function up() |
17 | 17 | { |
18 | - Schema::create('mojo_payment_details', function (Blueprint $table) { |
|
18 | + Schema::create('mojo_payment_details', function(Blueprint $table) { |
|
19 | 19 | $table->increments('id'); |
20 | 20 | $table->integer('user_id')->unsigned(); |
21 | 21 | $table->foreign('user_id')->references('id')->on('users'); |
@@ -117,6 +117,9 @@ |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | + /** |
|
121 | + * @param resource $curl |
|
122 | + */ |
|
120 | 123 | private static function closeCurl($curl, $payload) |
121 | 124 | { |
122 | 125 | curl_setopt($curl, CURLOPT_POST, true); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $payload = ['payment_id' => $payment_id, |
67 | 67 | 'type' => $type, |
68 | - 'body' => $reason ]; |
|
68 | + 'body' => $reason]; |
|
69 | 69 | |
70 | 70 | $response = self::closeCurl($curl, $payload); |
71 | 71 | $afterDecoding = json_decode($response); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'webhook' => config('laravelmojo.webhook_url'), |
143 | 143 | 'send_sms' => false, |
144 | 144 | 'email' => $user->email, |
145 | - 'allow_repeated_payments' => false ]; |
|
145 | + 'allow_repeated_payments' => false]; |
|
146 | 146 | |
147 | 147 | return $payload; |
148 | 148 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
111 | 111 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
112 | 112 | curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-Api-Key:{$api_key}", |
113 | - "X-Auth-Token:{$api_token}"]); |
|
113 | + "X-Auth-Token:{$api_token}"]); |
|
114 | 114 | return $ch; |
115 | 115 | } else { |
116 | 116 | throw new Exception('CURL extension is not loaded'); |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | private static function createRefundInDB($user_id, \stdClass $refund, $payment_id) |
151 | 151 | { |
152 | 152 | $refund_record = MojoRefundDetails::create(['user_id' => $user_id, |
153 | - 'refund_id' => $refund->id, |
|
154 | - 'payment_id' => $payment_id, |
|
155 | - 'status' => $refund->status, |
|
156 | - 'type' => $refund->type, |
|
157 | - 'body' => $refund->body, |
|
158 | - 'refund_amount' => $refund->refund_amount, |
|
159 | - 'total_amount' => $refund->total_amount, |
|
160 | - ]); |
|
153 | + 'refund_id' => $refund->id, |
|
154 | + 'payment_id' => $payment_id, |
|
155 | + 'status' => $refund->status, |
|
156 | + 'type' => $refund->type, |
|
157 | + 'body' => $refund->body, |
|
158 | + 'refund_amount' => $refund->refund_amount, |
|
159 | + 'total_amount' => $refund->total_amount, |
|
160 | + ]); |
|
161 | 161 | |
162 | 162 | return $refund_record; |
163 | 163 | } |
@@ -8,10 +8,10 @@ |
||
8 | 8 | { |
9 | 9 | public function boot() |
10 | 10 | { |
11 | - $this->loadMigrationsFrom(__DIR__.'/../migrations'); |
|
11 | + $this->loadMigrationsFrom(__DIR__ . '/../migrations'); |
|
12 | 12 | |
13 | 13 | $this->publishes([ |
14 | - __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
14 | + __DIR__ . '/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
15 | 15 | ]); |
16 | 16 | } |
17 | 17 | public function register() |
@@ -8,6 +8,6 @@ |
||
8 | 8 | { |
9 | 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 | } |
@@ -9,5 +9,5 @@ |
||
9 | 9 | protected $table = 'mojo_payment_details'; |
10 | 10 | |
11 | 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',]; |
|
12 | + 'payment_request_id','purpose','shorturl','request_status','payment_status',]; |
|
13 | 13 | } |
@@ -39,19 +39,19 @@ |
||
39 | 39 | $user = User::where('email', $data['buyer'])->first(); |
40 | 40 | $user_id = $user->id; |
41 | 41 | MojoPaymentDetails::create(['user_id' => $user_id, |
42 | - 'buyer_email' => $data['buyer'], |
|
43 | - 'buyer_name' => $data['buyer_name'], |
|
44 | - 'buyer_phone' => $data['buyer_phone'], |
|
45 | - 'currency' => $data['currency'], |
|
46 | - 'amount' => $data['amount'], |
|
47 | - 'fees' => $data['fees'], |
|
48 | - 'longurl' => $data['longurl'], |
|
49 | - 'payment_id' => $data['payment_id'], |
|
50 | - 'payment_request_id' => $data['payment_request_id'], |
|
51 | - 'purpose' => $data['purpose'], |
|
52 | - 'shorturl' => $data['shorturl'], |
|
53 | - 'request_status' => 'completed', |
|
54 | - 'payment_status' => $data['status'], |
|
55 | - ]); |
|
42 | + 'buyer_email' => $data['buyer'], |
|
43 | + 'buyer_name' => $data['buyer_name'], |
|
44 | + 'buyer_phone' => $data['buyer_phone'], |
|
45 | + 'currency' => $data['currency'], |
|
46 | + 'amount' => $data['amount'], |
|
47 | + 'fees' => $data['fees'], |
|
48 | + 'longurl' => $data['longurl'], |
|
49 | + 'payment_id' => $data['payment_id'], |
|
50 | + 'payment_request_id' => $data['payment_request_id'], |
|
51 | + 'purpose' => $data['purpose'], |
|
52 | + 'shorturl' => $data['shorturl'], |
|
53 | + 'request_status' => 'completed', |
|
54 | + 'payment_status' => $data['status'], |
|
55 | + ]); |
|
56 | 56 | } |
57 | 57 | } |