芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/tblonline.org/app/Http/Controllers/Gateway/Flutterwave/ProcessController.php
gateway->slug); $data['custom'] = $deposit->id; $data['view'] = 'backend.customer_portal.gateway.' . $deposit->gateway->slug; return json_encode($data); } /** * Callback function from Payment Gateway * * @return \Illuminate\Http\Response */ public function callback(Request $request) { @ini_set('max_execution_time', 0); @set_time_limit(0); if (!isset($request->transaction_id)) { return redirect()->route('deposit.automatic_methods')->with('error', _lang('Sorry, Payment not completed !')); } $transaction = Transaction::find($request->deposit_id); $secret_key = $transaction->gateway->parameters->secret_key; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.flutterwave.com/v3/transactions/" . $request->transaction_id . "/verify", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "Authorization: Bearer $secret_key", ), )); $response = json_decode(curl_exec($curl)); curl_close($curl); if ($response->status == 'success') { $amount = $response->data->amount; $converted_amount = convert_currency_2($transaction->gateway->exchange_rate, 1, $amount); //Update Transaction if (($transaction->amount + $transaction->fee) >= $converted_amount) { $transaction->status = 2; // Completed $transaction->save(); } //Trigger Deposit Money notifications try { $transaction->user->notify(new DepositMoney($transaction)); } catch (\Exception $e) {} return redirect()->route('dashboard.index')->with('success', _lang('Money Deposited Successfully')); } else { return redirect()->route('deposit.automatic_methods')->with('error', _lang('Sorry, Payment not completed !')); } } }