changed payment history api in visa/master payments
This commit is contained in:
1 parent
cbfb467651
commit
879ed77121
15 files changed
+1174
-190
No files matched your search
@@ -6,7 +6,7 @@ import { buildEnumOptions, getEnumLabel, isEnumValue, type EnumConfig, type Tran
|
||||
|
||||
// ─── Gateway status ───────────────────────────────────────────────────────────
|
||||
|
||||
export const GATEWAY_STATUS_VALUES = ["pending", "paid", "unpaid", "failed"] as const;
|
||||
export const GATEWAY_STATUS_VALUES = ["pending", "paid", "unpaid", "failed", "success", "completed"] as const;
|
||||
|
||||
export type GatewayStatusValue = (typeof GATEWAY_STATUS_VALUES)[number];
|
||||
|
||||
@@ -15,6 +15,8 @@ export const GATEWAY_STATUS_LABELS: Record<GatewayStatusValue, string> = {
|
||||
paid: "Paid",
|
||||
unpaid: "Unpaid",
|
||||
failed: "Failed",
|
||||
success: "Success",
|
||||
completed: "Completed",
|
||||
};
|
||||
|
||||
const GATEWAY_STATUS_ENUM: EnumConfig<GatewayStatusValue> = {
|
||||
@@ -28,6 +30,8 @@ export const GATEWAY_STATUS_BADGE_VARIANTS: Record<GatewayStatusValue, StatusBad
|
||||
paid: "success",
|
||||
unpaid: "default",
|
||||
failed: "error",
|
||||
success: "success",
|
||||
completed: "info",
|
||||
};
|
||||
|
||||
export const GATEWAY_STATUS_ICONS: Record<GatewayStatusValue, ComponentType> = {
|
||||
@@ -35,6 +39,8 @@ export const GATEWAY_STATUS_ICONS: Record<GatewayStatusValue, ComponentType> = {
|
||||
paid: CheckCircle2,
|
||||
unpaid: Clock,
|
||||
failed: XCircle,
|
||||
success: CheckCircle2,
|
||||
completed: CheckCircle2,
|
||||
};
|
||||
|
||||
// ─── Paid flag ────────────────────────────────────────────────────────────────
|
||||
@@ -82,6 +88,22 @@ export function getGatewayStatusOptions(t?: TranslateFn, prefix?: string): Selec
|
||||
return buildEnumOptions(withPrefix(GATEWAY_STATUS_ENUM, prefix), t);
|
||||
}
|
||||
|
||||
export const PAYMENT_HISTORY_STATUS_VALUES = ["failed", "pending", "success", "completed"] as const;
|
||||
|
||||
export function getPaymentHistoryStatusOptions(t?: TranslateFn, prefix?: string): SelectOption[] {
|
||||
return buildEnumOptions(
|
||||
withPrefix(
|
||||
{
|
||||
values: PAYMENT_HISTORY_STATUS_VALUES,
|
||||
labels: GATEWAY_STATUS_LABELS,
|
||||
prefix: "onlinePayments.gatewayStatus",
|
||||
},
|
||||
prefix,
|
||||
),
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
export function toPaidValue(paid: boolean): PaidValue {
|
||||
return paid ? "paid" : "unpaid";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user