mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
fix: cover all payment provider statuses in TopUpResult
Add overpaid (PAL24) to PAID_STATUSES, system_fail and refund_paid (Heleket) to FAILED_STATUSES. Harmonize Balance.tsx redirect detection with the same full status sets and case-insensitive matching.
This commit is contained in:
@@ -64,14 +64,32 @@ export default function Balance() {
|
|||||||
if (paymentHandledRef.current) return;
|
if (paymentHandledRef.current) return;
|
||||||
|
|
||||||
const paymentStatus = searchParams.get('payment') || searchParams.get('status');
|
const paymentStatus = searchParams.get('payment') || searchParams.get('status');
|
||||||
const isSuccess =
|
const paidSet = new Set([
|
||||||
paymentStatus === 'success' ||
|
'succeeded',
|
||||||
paymentStatus === 'paid' ||
|
'success',
|
||||||
paymentStatus === 'completed' ||
|
'paid',
|
||||||
searchParams.get('success') === 'true';
|
'paid_over',
|
||||||
|
'overpaid',
|
||||||
|
'completed',
|
||||||
|
'confirmed',
|
||||||
|
'closed',
|
||||||
|
]);
|
||||||
|
const failedSet = new Set([
|
||||||
|
'fail',
|
||||||
|
'failed',
|
||||||
|
'error',
|
||||||
|
'canceled',
|
||||||
|
'cancelled',
|
||||||
|
'declined',
|
||||||
|
'expired',
|
||||||
|
'cancel',
|
||||||
|
'system_fail',
|
||||||
|
'refund_paid',
|
||||||
|
]);
|
||||||
|
|
||||||
const isFailed =
|
const normalised = paymentStatus?.toLowerCase() ?? '';
|
||||||
paymentStatus === 'failed' || paymentStatus === 'error' || paymentStatus === 'canceled';
|
const isSuccess = paidSet.has(normalised) || searchParams.get('success') === 'true';
|
||||||
|
const isFailed = failedSet.has(normalised);
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
paymentHandledRef.current = true;
|
paymentHandledRef.current = true;
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ const PAID_STATUSES = new Set([
|
|||||||
'success',
|
'success',
|
||||||
'paid',
|
'paid',
|
||||||
'paid_over',
|
'paid_over',
|
||||||
|
'overpaid',
|
||||||
'completed',
|
'completed',
|
||||||
'confirmed',
|
'confirmed',
|
||||||
'closed',
|
'closed',
|
||||||
@@ -197,6 +198,8 @@ const FAILED_STATUSES = new Set([
|
|||||||
'declined',
|
'declined',
|
||||||
'expired',
|
'expired',
|
||||||
'cancel',
|
'cancel',
|
||||||
|
'system_fail',
|
||||||
|
'refund_paid',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function isPaidStatus(status: string): boolean {
|
function isPaidStatus(status: string): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user