penambahan durasi pengecekan VA

This commit is contained in:
Baghiz Zuhdi Adzin 2026-02-03 11:55:22 +07:00
parent 1b08664079
commit 8c1b5f8ffa
3 changed files with 7 additions and 23 deletions

View File

@ -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'),

View File

@ -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([

View File

@ -131,8 +131,7 @@
<th class="bg-light">{{ get_phrase('Expired At') }}</th>
<td class="{{ \Carbon\Carbon::now()->gt($vaPayment->expired_at) ? 'text-danger' : '' }}">
<i class="bi bi-clock me-1"></i>
{{ \Carbon\Carbon::parse($vaPayment->expired_at)->translatedFormat('l, d F Y H:i') }}
@if(\Carbon\Carbon::now()->gt($vaPayment->expired_at))
@if(\Carbon\Carbon::now()->gt(\Carbon\Carbon::parse($vaPayment->expired_at)->addMinutes(45)))
<span class="badge bg-danger ms-2">{{ get_phrase('Expired') }}</span>
@endif
</td>
@ -169,6 +168,7 @@
<li>{{ get_phrase('Enter the VA number above') }}</li>
<li>{{ get_phrase('Confirm the amount and complete the payment') }}</li>
<li>{{ get_phrase('Payment confirmation will be processed automatically') }}</li>
<li>{{ get_phrase('Payment verification takes approximately 30 minutes after the transaction') }}</li>
</ol>
</div>
@ -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: '<?= get_phrase('Checking Payment Status') ?>',
allowOutsideClick: false,
didOpen: () => Swal.showLoading()
});