@@ -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); |
@@ -9,196 +9,196 @@ |
||
9 | 9 | |
10 | 10 | class Mojo |
11 | 11 | { |
12 | - /* |
|
12 | + /* |
|
13 | 13 | * Accepts the order details and creates a |
14 | 14 | * payment request at Instamojo's end |
15 | 15 | * returning the payment form URL |
16 | 16 | */ |
17 | 17 | |
18 | - public static function giveMeFormUrl(User $user, $amount, $purpose, $phone = null) |
|
19 | - { |
|
20 | - self::checkConfigValues(); |
|
18 | + public static function giveMeFormUrl(User $user, $amount, $purpose, $phone = null) |
|
19 | + { |
|
20 | + self::checkConfigValues(); |
|
21 | 21 | |
22 | - $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
22 | + $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
23 | 23 | |
24 | - $curl = self::setupCURL("https://{$sub}.instamojo.com/api/1.1/payment-requests/"); |
|
24 | + $curl = self::setupCURL("https://{$sub}.instamojo.com/api/1.1/payment-requests/"); |
|
25 | 25 | |
26 | - $payload = self::createPaymentPayload($user, $amount, $purpose, $phone); |
|
26 | + $payload = self::createPaymentPayload($user, $amount, $purpose, $phone); |
|
27 | 27 | |
28 | - $response = self::closeCurl($curl, $payload); |
|
28 | + $response = self::closeCurl($curl, $payload); |
|
29 | 29 | |
30 | - $finalResponse = json_decode($response); |
|
30 | + $finalResponse = json_decode($response); |
|
31 | 31 | |
32 | - return $finalResponse->payment_request->longurl; |
|
33 | - } |
|
32 | + return $finalResponse->payment_request->longurl; |
|
33 | + } |
|
34 | 34 | |
35 | - /* |
|
35 | + /* |
|
36 | 36 | * After the payment via Instamojo, it |
37 | 37 | * returns that payment's details |
38 | 38 | * after redirection |
39 | 39 | */ |
40 | 40 | |
41 | - public static function giveMePaymentDetails() |
|
42 | - { |
|
43 | - $payment_id = filter_input(INPUT_GET, 'payment_id'); |
|
44 | - $payment_request_id = filter_input(INPUT_GET, 'payment_request_id'); |
|
45 | - $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
41 | + public static function giveMePaymentDetails() |
|
42 | + { |
|
43 | + $payment_id = filter_input(INPUT_GET, 'payment_id'); |
|
44 | + $payment_request_id = filter_input(INPUT_GET, 'payment_request_id'); |
|
45 | + $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
46 | 46 | |
47 | - $curl = self::setupCURL("https://{$sub}.instamojo.com/api/1.1/payment-requests/{$payment_request_id}/{$payment_id}/"); |
|
47 | + $curl = self::setupCURL("https://{$sub}.instamojo.com/api/1.1/payment-requests/{$payment_request_id}/{$payment_id}/"); |
|
48 | 48 | |
49 | - $response = curl_exec($curl); |
|
50 | - curl_close($curl); |
|
49 | + $response = curl_exec($curl); |
|
50 | + curl_close($curl); |
|
51 | 51 | |
52 | - $decoded_response = json_decode($response); |
|
53 | - return $decoded_response->payment_request; |
|
54 | - } |
|
52 | + $decoded_response = json_decode($response); |
|
53 | + return $decoded_response->payment_request; |
|
54 | + } |
|
55 | 55 | |
56 | - /* |
|
56 | + /* |
|
57 | 57 | * To process the refund's |
58 | 58 | */ |
59 | 59 | |
60 | - public static function refund($payment_id, $type, $reason) |
|
61 | - { |
|
62 | - $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
60 | + public static function refund($payment_id, $type, $reason) |
|
61 | + { |
|
62 | + $sub = config('laravelmojo.subdomain_for_endpoints'); |
|
63 | 63 | |
64 | - $curl = static::setupCURL("https://{$sub}.instamojo.com/api/1.1/refunds/"); |
|
64 | + $curl = static::setupCURL("https://{$sub}.instamojo.com/api/1.1/refunds/"); |
|
65 | 65 | |
66 | - $payload = ['payment_id' => $payment_id, |
|
67 | - 'type' => $type, |
|
68 | - 'body' => $reason ]; |
|
66 | + $payload = ['payment_id' => $payment_id, |
|
67 | + 'type' => $type, |
|
68 | + 'body' => $reason ]; |
|
69 | 69 | |
70 | - $response = self::closeCurl($curl, $payload); |
|
71 | - $afterDecoding = json_decode($response); |
|
72 | - $refund = $afterDecoding->refund; |
|
70 | + $response = self::closeCurl($curl, $payload); |
|
71 | + $afterDecoding = json_decode($response); |
|
72 | + $refund = $afterDecoding->refund; |
|
73 | 73 | |
74 | - $transaction = MojoPaymentDetails::where('payment_id', $payment_id)->first(); |
|
75 | - $user_id = $transaction->user_id; |
|
74 | + $transaction = MojoPaymentDetails::where('payment_id', $payment_id)->first(); |
|
75 | + $user_id = $transaction->user_id; |
|
76 | 76 | |
77 | - $refund_record = self::createRefundInDB($user_id, $refund, $payment_id); |
|
77 | + $refund_record = self::createRefundInDB($user_id, $refund, $payment_id); |
|
78 | 78 | |
79 | - return $refund_record; |
|
80 | - } |
|
81 | - |
|
82 | - private static function checkConfigValues() |
|
83 | - { |
|
84 | - if (!config('laravelmojo.key')) { |
|
85 | - throw new Exception('Please set the Instamojo API key in your env file'); |
|
86 | - } elseif (!config('laravelmojo.token')) { |
|
87 | - throw new Exception('Please set the Instamojo token in your env file'); |
|
88 | - } elseif (!config('laravelmojo.redirect_url_after_payment')) { |
|
89 | - throw new Exception('Please set the redirect url in your env file'); |
|
90 | - } elseif (!config('laravelmojo.subdomain_for_endpoints')) { |
|
91 | - throw new Exception('Please set the subdomain for Instamojo api endpoint in your env file'); |
|
92 | - } elseif (!config('laravelmojo.webhook_url')) { |
|
93 | - throw new Exception('Please set the webhook url in your env file'); |
|
94 | - } elseif (!config('laravelmojo.salt')) { |
|
95 | - throw new Exception('Please set the instamojo salt in your env file'); |
|
96 | - } else { |
|
97 | - return true; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - private static function setupCURL($apiEndpoint) |
|
102 | - { |
|
103 | - if (extension_loaded("curl")) { |
|
104 | - $ch = curl_init(); |
|
105 | - $api_key = config('laravelmojo.key'); |
|
106 | - $api_token = config('laravelmojo.token'); |
|
107 | - |
|
108 | - curl_setopt($ch, CURLOPT_URL, "$apiEndpoint"); |
|
109 | - curl_setopt($ch, CURLOPT_HEADER, false); |
|
110 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
111 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
112 | - curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-Api-Key:{$api_key}", |
|
113 | - "X-Auth-Token:{$api_token}"]); |
|
114 | - return $ch; |
|
115 | - } else { |
|
116 | - throw new Exception('CURL extension is not loaded'); |
|
117 | - } |
|
118 | - } |
|
119 | - |
|
120 | - private static function closeCurl($curl, $payload) |
|
121 | - { |
|
122 | - curl_setopt($curl, CURLOPT_POST, true); |
|
123 | - curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payload)); |
|
124 | - $response = curl_exec($curl); |
|
125 | - curl_close($curl); |
|
126 | - |
|
127 | - return $response; |
|
128 | - } |
|
129 | - |
|
130 | - private static function createPaymentPayload(User $user, $amount, $purpose, $phone = null) |
|
131 | - { |
|
132 | - if (is_null($phone)) { |
|
133 | - $phone = $user->phone; |
|
134 | - } |
|
135 | - |
|
136 | - $payload = ['purpose' => $purpose, |
|
137 | - 'amount' => $amount, |
|
138 | - 'phone' => $phone, |
|
139 | - 'buyer_name' => $user->name, |
|
140 | - 'redirect_url' => config('laravelmojo.redirect_url_after_payment'), |
|
141 | - 'send_email' => false, |
|
142 | - 'webhook' => config('laravelmojo.webhook_url'), |
|
143 | - 'send_sms' => false, |
|
144 | - 'email' => $user->email, |
|
145 | - 'allow_repeated_payments' => false ]; |
|
146 | - |
|
147 | - return $payload; |
|
148 | - } |
|
149 | - |
|
150 | - private static function createRefundInDB($user_id, \stdClass $refund, $payment_id) |
|
151 | - { |
|
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 | - ]); |
|
161 | - |
|
162 | - return $refund_record; |
|
163 | - } |
|
164 | - |
|
165 | - public static function allPayments() |
|
166 | - { |
|
167 | - return MojoPaymentDetails::all(); |
|
168 | - } |
|
169 | - public static function allPaymentsFor(User $user) |
|
170 | - { |
|
171 | - return MojoPaymentDetails::where('user_id', $user->id)->get(); |
|
172 | - } |
|
173 | - public static function failedPayments() |
|
174 | - { |
|
175 | - return MojoPaymentDetails::where('payment_status', '!=', 'credit')->get(); |
|
176 | - } |
|
177 | - public static function successfulPayments() |
|
178 | - { |
|
179 | - return MojoPaymentDetails::where('payment_status', 'credit')->get(); |
|
180 | - } |
|
181 | - public static function myAndMojosIncome() |
|
182 | - { |
|
183 | - return MojoPaymentDetails::sum('amount'); |
|
184 | - } |
|
185 | - public static function myIncome() |
|
186 | - { |
|
187 | - $a = MojoPaymentDetails::sum('amount'); |
|
188 | - $f = MojoPaymentDetails::sum('fees'); |
|
189 | - return $a - $f; |
|
190 | - } |
|
191 | - public static function mojosIncome() |
|
192 | - { |
|
193 | - return MojoPaymentDetails::sum('fees'); |
|
194 | - } |
|
195 | - |
|
196 | - public static function allRefunds() |
|
197 | - { |
|
198 | - return MojoRefundDetails::all(); |
|
199 | - } |
|
200 | - public static function allRefundsFor(User $user) |
|
201 | - { |
|
202 | - return MojoRefundDetails::where('user_id', $user->id)->get(); |
|
203 | - } |
|
79 | + return $refund_record; |
|
80 | + } |
|
81 | + |
|
82 | + private static function checkConfigValues() |
|
83 | + { |
|
84 | + if (!config('laravelmojo.key')) { |
|
85 | + throw new Exception('Please set the Instamojo API key in your env file'); |
|
86 | + } elseif (!config('laravelmojo.token')) { |
|
87 | + throw new Exception('Please set the Instamojo token in your env file'); |
|
88 | + } elseif (!config('laravelmojo.redirect_url_after_payment')) { |
|
89 | + throw new Exception('Please set the redirect url in your env file'); |
|
90 | + } elseif (!config('laravelmojo.subdomain_for_endpoints')) { |
|
91 | + throw new Exception('Please set the subdomain for Instamojo api endpoint in your env file'); |
|
92 | + } elseif (!config('laravelmojo.webhook_url')) { |
|
93 | + throw new Exception('Please set the webhook url in your env file'); |
|
94 | + } elseif (!config('laravelmojo.salt')) { |
|
95 | + throw new Exception('Please set the instamojo salt in your env file'); |
|
96 | + } else { |
|
97 | + return true; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + private static function setupCURL($apiEndpoint) |
|
102 | + { |
|
103 | + if (extension_loaded("curl")) { |
|
104 | + $ch = curl_init(); |
|
105 | + $api_key = config('laravelmojo.key'); |
|
106 | + $api_token = config('laravelmojo.token'); |
|
107 | + |
|
108 | + curl_setopt($ch, CURLOPT_URL, "$apiEndpoint"); |
|
109 | + curl_setopt($ch, CURLOPT_HEADER, false); |
|
110 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
111 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
112 | + curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-Api-Key:{$api_key}", |
|
113 | + "X-Auth-Token:{$api_token}"]); |
|
114 | + return $ch; |
|
115 | + } else { |
|
116 | + throw new Exception('CURL extension is not loaded'); |
|
117 | + } |
|
118 | + } |
|
119 | + |
|
120 | + private static function closeCurl($curl, $payload) |
|
121 | + { |
|
122 | + curl_setopt($curl, CURLOPT_POST, true); |
|
123 | + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payload)); |
|
124 | + $response = curl_exec($curl); |
|
125 | + curl_close($curl); |
|
126 | + |
|
127 | + return $response; |
|
128 | + } |
|
129 | + |
|
130 | + private static function createPaymentPayload(User $user, $amount, $purpose, $phone = null) |
|
131 | + { |
|
132 | + if (is_null($phone)) { |
|
133 | + $phone = $user->phone; |
|
134 | + } |
|
135 | + |
|
136 | + $payload = ['purpose' => $purpose, |
|
137 | + 'amount' => $amount, |
|
138 | + 'phone' => $phone, |
|
139 | + 'buyer_name' => $user->name, |
|
140 | + 'redirect_url' => config('laravelmojo.redirect_url_after_payment'), |
|
141 | + 'send_email' => false, |
|
142 | + 'webhook' => config('laravelmojo.webhook_url'), |
|
143 | + 'send_sms' => false, |
|
144 | + 'email' => $user->email, |
|
145 | + 'allow_repeated_payments' => false ]; |
|
146 | + |
|
147 | + return $payload; |
|
148 | + } |
|
149 | + |
|
150 | + private static function createRefundInDB($user_id, \stdClass $refund, $payment_id) |
|
151 | + { |
|
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 | + ]); |
|
161 | + |
|
162 | + return $refund_record; |
|
163 | + } |
|
164 | + |
|
165 | + public static function allPayments() |
|
166 | + { |
|
167 | + return MojoPaymentDetails::all(); |
|
168 | + } |
|
169 | + public static function allPaymentsFor(User $user) |
|
170 | + { |
|
171 | + return MojoPaymentDetails::where('user_id', $user->id)->get(); |
|
172 | + } |
|
173 | + public static function failedPayments() |
|
174 | + { |
|
175 | + return MojoPaymentDetails::where('payment_status', '!=', 'credit')->get(); |
|
176 | + } |
|
177 | + public static function successfulPayments() |
|
178 | + { |
|
179 | + return MojoPaymentDetails::where('payment_status', 'credit')->get(); |
|
180 | + } |
|
181 | + public static function myAndMojosIncome() |
|
182 | + { |
|
183 | + return MojoPaymentDetails::sum('amount'); |
|
184 | + } |
|
185 | + public static function myIncome() |
|
186 | + { |
|
187 | + $a = MojoPaymentDetails::sum('amount'); |
|
188 | + $f = MojoPaymentDetails::sum('fees'); |
|
189 | + return $a - $f; |
|
190 | + } |
|
191 | + public static function mojosIncome() |
|
192 | + { |
|
193 | + return MojoPaymentDetails::sum('fees'); |
|
194 | + } |
|
195 | + |
|
196 | + public static function allRefunds() |
|
197 | + { |
|
198 | + return MojoRefundDetails::all(); |
|
199 | + } |
|
200 | + public static function allRefundsFor(User $user) |
|
201 | + { |
|
202 | + return MojoRefundDetails::where('user_id', $user->id)->get(); |
|
203 | + } |
|
204 | 204 | } |
@@ -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 | } |
@@ -6,16 +6,16 @@ |
||
6 | 6 | |
7 | 7 | class MojoServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - public function boot() |
|
10 | - { |
|
11 | - $this->loadMigrationsFrom(__DIR__.'/../migrations'); |
|
9 | + public function boot() |
|
10 | + { |
|
11 | + $this->loadMigrationsFrom(__DIR__.'/../migrations'); |
|
12 | 12 | |
13 | - $this->publishes([ |
|
14 | - __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
15 | - ]); |
|
16 | - } |
|
17 | - public function register() |
|
18 | - { |
|
19 | - // Nothing yet to be registered |
|
20 | - } |
|
13 | + $this->publishes([ |
|
14 | + __DIR__.'/config/laravelmojo.php' => config_path('laravelmojo.php'), |
|
15 | + ]); |
|
16 | + } |
|
17 | + public function register() |
|
18 | + { |
|
19 | + // Nothing yet to be registered |
|
20 | + } |
|
21 | 21 | } |
@@ -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,50 +8,50 @@ |
||
8 | 8 | |
9 | 9 | class WebhookController extends Controller |
10 | 10 | { |
11 | - public function handleWebhook() |
|
12 | - { |
|
13 | - $data = $_POST; |
|
14 | - $mac_provided = $data['mac']; |
|
15 | - unset($data['mac']); |
|
16 | - $ver = explode('.', phpversion()); |
|
17 | - $major = (int) $ver[0]; |
|
18 | - $minor = (int) $ver[1]; |
|
19 | - if ($major >= 5 && $minor >= 4) { |
|
20 | - ksort($data, SORT_STRING | SORT_FLAG_CASE); |
|
21 | - } else { |
|
22 | - uksort($data, 'strcasecmp'); |
|
23 | - } |
|
11 | + public function handleWebhook() |
|
12 | + { |
|
13 | + $data = $_POST; |
|
14 | + $mac_provided = $data['mac']; |
|
15 | + unset($data['mac']); |
|
16 | + $ver = explode('.', phpversion()); |
|
17 | + $major = (int) $ver[0]; |
|
18 | + $minor = (int) $ver[1]; |
|
19 | + if ($major >= 5 && $minor >= 4) { |
|
20 | + ksort($data, SORT_STRING | SORT_FLAG_CASE); |
|
21 | + } else { |
|
22 | + uksort($data, 'strcasecmp'); |
|
23 | + } |
|
24 | 24 | |
25 | - $mac_calculated = hash_hmac("sha1", implode("|", $data), config('laravelmojo.salt')); |
|
26 | - if ($mac_provided == $mac_calculated) { |
|
27 | - if ($data['status'] == "Credit") { |
|
28 | - $this->updateDB($data); |
|
29 | - } else { |
|
30 | - $this->updateDB($data); |
|
31 | - } |
|
32 | - } else { |
|
33 | - echo "MAC mismatch"; |
|
34 | - } |
|
35 | - } |
|
25 | + $mac_calculated = hash_hmac("sha1", implode("|", $data), config('laravelmojo.salt')); |
|
26 | + if ($mac_provided == $mac_calculated) { |
|
27 | + if ($data['status'] == "Credit") { |
|
28 | + $this->updateDB($data); |
|
29 | + } else { |
|
30 | + $this->updateDB($data); |
|
31 | + } |
|
32 | + } else { |
|
33 | + echo "MAC mismatch"; |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - public function updateDB($data) |
|
38 | - { |
|
39 | - $user = User::where('email', $data['buyer'])->first(); |
|
40 | - $user_id = $user->id; |
|
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 | - ]); |
|
56 | - } |
|
37 | + public function updateDB($data) |
|
38 | + { |
|
39 | + $user = User::where('email', $data['buyer'])->first(); |
|
40 | + $user_id = $user->id; |
|
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 | + ]); |
|
56 | + } |
|
57 | 57 | } |
@@ -6,8 +6,8 @@ |
||
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 | } |
@@ -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 | } |
@@ -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 | ]; |