fix(web): billing — correct cancelled status label and gate receipt button

- Subscription status is "cancelled" (and "pending") in the API; the i18n
  keys/variant map used "canceled", so the badge showed the raw
  billing.subStatus.cancelled key. Fix the spelling and add pending.
- Only show "View receipt" for Stripe payments that actually have a
  stripePaymentIntentId. Seeded/legacy completed payments have none, so
  the button used to appear and then toast "no receipt available".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 00:28:39 +03:00
parent 1b9492ba49
commit d77face831
3 changed files with 12 additions and 6 deletions

View File

@@ -30,6 +30,7 @@ interface Payment {
status: "completed" | "pending" | "failed" | "refunded";
planName?: string;
eftReceiptUrl?: string;
stripePaymentIntentId?: string | null;
createdAt: string;
}
@@ -119,8 +120,9 @@ function BillingPage() {
const subStatusVariant: Record<string, "default" | "secondary" | "destructive" | "outline"> = {
active: "default",
trial: "secondary",
canceled: "outline",
cancelled: "outline",
expired: "destructive",
pending: "secondary",
};
const endDateLabel =
subscription?.status === "trial" ? t("billing.summary.trialEnds") : t("billing.summary.ends");
@@ -305,7 +307,9 @@ function BillingPage() {
{t("billing.downloadReceipt")}
</a>
</Button>
) : payment.method === "stripe" && payment.status === "completed" ? (
) : payment.method === "stripe" &&
payment.status === "completed" &&
payment.stripePaymentIntentId ? (
<Button
variant="ghost"
size="sm"