mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
- Move PAID_STATUSES/FAILED_STATUSES from Balance.tsx and TopUpResult.tsx to src/utils/paymentStatus.ts - Eliminates code duplication between the two pages
32 lines
555 B
TypeScript
32 lines
555 B
TypeScript
export const PAID_STATUSES = new Set([
|
|
'succeeded',
|
|
'success',
|
|
'paid',
|
|
'paid_over',
|
|
'overpaid',
|
|
'completed',
|
|
'confirmed',
|
|
'closed',
|
|
]);
|
|
|
|
export const FAILED_STATUSES = new Set([
|
|
'fail',
|
|
'failed',
|
|
'error',
|
|
'canceled',
|
|
'cancelled',
|
|
'declined',
|
|
'expired',
|
|
'cancel',
|
|
'system_fail',
|
|
'refund_paid',
|
|
]);
|
|
|
|
export function isPaidStatus(status: string): boolean {
|
|
return PAID_STATUSES.has(status.toLowerCase());
|
|
}
|
|
|
|
export function isFailedStatus(status: string): boolean {
|
|
return FAILED_STATUSES.has(status.toLowerCase());
|
|
}
|