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') 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() $unpaid = VAPayment::query()
->where('user_id', $userId) ->where('user_id', $userId)
->where('status', 0) ->where('status', 0)
->where('expired_at', '>=', now()) ->where('expired_at', '>=', now()->subMinutes(45))
->select( ->select(
'id', 'id',
DB::raw('"Virtual Account BTN" as title'), 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]); $payment->update(['status' => 2]);
return response()->json([ return response()->json([

View File

@ -131,8 +131,7 @@
<th class="bg-light">{{ get_phrase('Expired At') }}</th> <th class="bg-light">{{ get_phrase('Expired At') }}</th>
<td class="{{ \Carbon\Carbon::now()->gt($vaPayment->expired_at) ? 'text-danger' : '' }}"> <td class="{{ \Carbon\Carbon::now()->gt($vaPayment->expired_at) ? 'text-danger' : '' }}">
<i class="bi bi-clock me-1"></i> <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(\Carbon\Carbon::parse($vaPayment->expired_at)->addMinutes(45)))
@if(\Carbon\Carbon::now()->gt($vaPayment->expired_at))
<span class="badge bg-danger ms-2">{{ get_phrase('Expired') }}</span> <span class="badge bg-danger ms-2">{{ get_phrase('Expired') }}</span>
@endif @endif
</td> </td>
@ -169,6 +168,7 @@
<li>{{ get_phrase('Enter the VA number above') }}</li> <li>{{ get_phrase('Enter the VA number above') }}</li>
<li>{{ get_phrase('Confirm the amount and complete the payment') }}</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 confirmation will be processed automatically') }}</li>
<li>{{ get_phrase('Payment verification takes approximately 30 minutes after the transaction') }}</li>
</ol> </ol>
</div> </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 // Auto refresh page every 60 seconds if payment is still unpaid
@if($vaPayment->status == 0 && \Carbon\Carbon::now()->lt($vaPayment->expired_at)) @if($vaPayment->status == 0 && \Carbon\Carbon::now()->lt($vaPayment->expired_at))
setTimeout(function() { setTimeout(function() {
@ -323,7 +307,7 @@
if (manual) { if (manual) {
Swal.fire({ Swal.fire({
title: 'Checking payment status...', title: '<?= get_phrase('Checking Payment Status') ?>',
allowOutsideClick: false, allowOutsideClick: false,
didOpen: () => Swal.showLoading() didOpen: () => Swal.showLoading()
}); });