diff --git a/components/topup-to-pay.tsx b/components/topup-to-pay.tsx index 65b51f9..8c81780 100644 --- a/components/topup-to-pay.tsx +++ b/components/topup-to-pay.tsx @@ -93,7 +93,7 @@ export default function TopupToPay({ topup, disabled }: { topup?: Topup, disable - Topup created at + Topup created {new Date(topup?.created_at ?? "").toLocaleDateString("en-US", { month: "short", @@ -106,22 +106,24 @@ export default function TopupToPay({ topup, disabled }: { topup?: Topup, disable - Topup expires at + Payment received - {new Date(topup?.expires_at ?? "").toLocaleDateString("en-US", { - month: "short", - day: "2-digit", - year: "numeric", - minute: "2-digit", - hour: "2-digit", - second: "2-digit", - })} + {topup?.paid_at + ? new Date(topup.paid_at).toLocaleDateString("en-US", { + month: "short", + day: "2-digit", + year: "numeric", + minute: "2-digit", + hour: "2-digit", + second: "2-digit", + }) + : "-"} MIB Reference - {topup?.mib_reference ? topup.mib_reference : "N/A"} + {topup?.mib_reference ? topup.mib_reference : "-"} diff --git a/components/topups-table.tsx b/components/topups-table.tsx index 9b01783..479c7a6 100644 --- a/components/topups-table.tsx +++ b/components/topups-table.tsx @@ -60,8 +60,7 @@ export async function TopupsTable({ Details - Expires at - Expired + Status Amount @@ -120,20 +119,10 @@ export async function TopupsTable({ - - - {new Date(topup.expires_at).toLocaleDateString("en-US", { - month: "short", - day: "2-digit", - year: "numeric", - minute: "2-digit", - hour: "2-digit", - })} - - + - {topup.is_expired ? Yes : No} + {topup.is_expired ? Expired : {topup.status}} diff --git a/lib/backend-types.ts b/lib/backend-types.ts index 1053660..a42e8f8 100644 --- a/lib/backend-types.ts +++ b/lib/backend-types.ts @@ -64,6 +64,8 @@ export interface Topup { name: string; }; paid: boolean; + status: "CANCELLED" | "PENDING" | "VERIFIED"; + paid_at: string | null; mib_reference: string | null; expires_at: string; is_expired: boolean;