Files
bedolaga-cabinet/src/utils/paymentStatus.ts
Fringg 6a9fdac75c refactor: extract shared payment status sets to utility module
- Move PAID_STATUSES/FAILED_STATUSES from Balance.tsx and TopUpResult.tsx
  to src/utils/paymentStatus.ts
- Eliminates code duplication between the two pages
2026-03-09 05:00:08 +03:00

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());
}