ok
Direktori : /home2/selectio/www/ecommerce-website/website/app/Http/Controllers/ |
Current File : /home2/selectio/www/ecommerce-website/website/app/Http/Controllers/SenangPayController.php |
<?php namespace App\Http\Controllers; use App\CPU\CartManager; use App\CPU\Helpers; use App\CPU\OrderManager; use App\Http\Controllers\Controller; use App\Model\Order; use Brian2694\Toastr\Facades\Toastr; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class SenangPayController extends Controller { public function return_senang_pay(Request $request) { if ($request['status_id'] == 1) { $unique_id = OrderManager::gen_unique_id(); $order_ids = []; foreach (CartManager::get_cart_group_ids() as $group_id) { $data = [ 'payment_method' => 'senang_pay', 'order_status' => 'confirmed', 'payment_status' => 'paid', 'transaction_ref' => $unique_id, 'order_group_id' => $unique_id, 'cart_group_id' => $group_id ]; $order_id = OrderManager::generate_order($data); array_push($order_ids, $order_id); } CartManager::cart_clean(); if (session()->has('payment_mode') && session('payment_mode') == 'app') { return redirect()->route('payment-success'); } return view('web-views.checkout-complete'); } if (session()->has('payment_mode') && session('payment_mode') == 'app') { return redirect()->route('payment-fail'); } Toastr::error('Payment process failed'); return back(); } }