fix(payments): curate /payments/me response — stop leaking internal columns, join plan name

getMyPayments returned the raw payment row, exposing internal fields
(adminNote, iyzicoPaymentId, bankAccountId, session/intent ids) to the
end user. Replace with an explicit projection that returns only what the
billing UI needs, joins planName from the subscription's plan (was always
"-"), and surfaces Stripe receipt availability as a hasStripeReceipt
boolean instead of the raw payment intent id. Frontend reads the boolean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 00:31:33 +03:00
parent d77face831
commit c633e846e2
2 changed files with 37 additions and 9 deletions

View File

@@ -28,9 +28,9 @@ interface Payment {
amount: number;
method: "stripe" | "eft";
status: "completed" | "pending" | "failed" | "refunded";
planName?: string;
eftReceiptUrl?: string;
stripePaymentIntentId?: string | null;
planName?: string | null;
eftReceiptUrl?: string | null;
hasStripeReceipt?: boolean;
createdAt: string;
}
@@ -307,9 +307,7 @@ function BillingPage() {
{t("billing.downloadReceipt")}
</a>
</Button>
) : payment.method === "stripe" &&
payment.status === "completed" &&
payment.stripePaymentIntentId ? (
) : payment.hasStripeReceipt ? (
<Button
variant="ghost"
size="sm"