<?php
namespace App\Http\Middleware\User;
use Closure;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Models\TemporaryData;
class CheckoutVerification
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$identifier = $request->route('order_id');
$data = TemporaryData::where('identifier',$identifier)->first();
if(!$data) return back()->with(['error' => ['Data not found']]);
if (Carbon::parse($data->data->expiration) < Carbon::now()) {
$data->delete();
return redirect()->route('frontend.index')->with(['error'=> ['Sorry! Link is expired.']]);
}
if(!$data){
$smg = "Data not found!";
return redirect()->route("frontend.index")->with(['error' => [$smg]]);
}
return $next($request);
}
}
Save Cards
Simplify your payment experience by securely saving your card on our platform. After your initial transaction, you can choose to store your card details safely for future use. This feature eliminates the need to re-enter your payment information each time, making checkouts faster while keeping your data secure with advanced encryption and robust security measures.