diff --git a/app/Http/Controllers/student/PurchaseController.php b/app/Http/Controllers/student/PurchaseController.php index a6bc411..41fa84a 100644 --- a/app/Http/Controllers/student/PurchaseController.php +++ b/app/Http/Controllers/student/PurchaseController.php @@ -35,11 +35,11 @@ class PurchaseController extends Controller DB::raw('payment_histories.id as invoice_id') ); - // 2. Query untuk Unpaid menggunakan Model VAPayment + // 2. Query untuk Unpaid menggunakan Model VAPayment -> dikurangi 30 menit karena mengantisipasi delay saat pembayaran $unpaid = VAPayment::query() ->where('user_id', $userId) ->where('status', 0) - ->where('expired_at', '>=', now()) + ->where('expired_at', '>=', now()->subMinutes(45)) ->select( 'id', DB::raw('"Virtual Account BTN" as title'), diff --git a/app/Http/Controllers/student/VAPaymentController.php b/app/Http/Controllers/student/VAPaymentController.php index f5d0f9c..1b6cc08 100644 --- a/app/Http/Controllers/student/VAPaymentController.php +++ b/app/Http/Controllers/student/VAPaymentController.php @@ -193,7 +193,7 @@ class VAPaymentController extends Controller ]); } - if (now()->greaterThan($payment->expired_at)) { + if (now()->subMinutes(45)->greaterThan($payment->expired_at)) { $payment->update(['status' => 2]); return response()->json([ diff --git a/resources/views/payment/va_show.blade.php b/resources/views/payment/va_show.blade.php index 21a39ab..53a4438 100644 --- a/resources/views/payment/va_show.blade.php +++ b/resources/views/payment/va_show.blade.php @@ -131,9 +131,8 @@ {{ get_phrase('Expired At') }} - {{ \Carbon\Carbon::parse($vaPayment->expired_at)->translatedFormat('l, d F Y H:i') }} - @if(\Carbon\Carbon::now()->gt($vaPayment->expired_at)) - {{ get_phrase('Expired') }} + @if(\Carbon\Carbon::now()->gt(\Carbon\Carbon::parse($vaPayment->expired_at)->addMinutes(45))) + {{ get_phrase('Expired') }} @endif @@ -169,6 +168,7 @@
  • {{ get_phrase('Enter the VA number above') }}
  • {{ get_phrase('Confirm the amount and complete the payment') }}
  • {{ get_phrase('Payment confirmation will be processed automatically') }}
  • +
  • {{ get_phrase('Payment verification takes approximately 30 minutes after the transaction') }}
  • @@ -261,22 +261,6 @@ }); } - function checkPaymentStatus() { - Swal.fire({ - title: 'Checking Payment Status', - text: 'Please wait...', - allowOutsideClick: false, - didOpen: () => { - Swal.showLoading(); - - // Simulate API call - replace with actual API endpoint - setTimeout(() => { - window.location.reload(); - }, 1500); - } - }); - } - // Auto refresh page every 60 seconds if payment is still unpaid @if($vaPayment->status == 0 && \Carbon\Carbon::now()->lt($vaPayment->expired_at)) setTimeout(function() { @@ -323,7 +307,7 @@ if (manual) { Swal.fire({ - title: 'Checking payment status...', + title: '', allowOutsideClick: false, didOpen: () => Swal.showLoading() });