penambahan durasi pengecekan VA
This commit is contained in:
parent
1b08664079
commit
8c1b5f8ffa
@ -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'),
|
||||
|
||||
@ -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([
|
||||
|
||||
@ -131,9 +131,8 @@
|
||||
<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))
|
||||
<span class="badge bg-danger ms-2">{{ get_phrase('Expired') }}</span>
|
||||
@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>
|
||||
</tr>
|
||||
@ -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()
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user