Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/dashboard/src/lib/server/billing/autumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ export function purchaseProjectCredits(projectId: string, credits: number) {
});
}

const ISSUED_INVOICE_STATUSES = new Set(['open', 'paid', 'uncollectible']);

function isIssuedInvoice(invoice: { status: string }) {
return ISSUED_INVOICE_STATUSES.has(invoice.status.toLowerCase());
}

export async function getProjectInvoices(projectId: string) {
if (!isBillingConfigured()) return [];

Expand All @@ -516,7 +522,7 @@ export async function getProjectInvoices(projectId: string) {
expand: ['invoices']
});

return (customer.invoices ?? []).map((invoice) => ({
return (customer.invoices ?? []).filter(isIssuedInvoice).map((invoice) => ({
stripeId: invoice.stripeId,
status: invoice.status,
total: invoice.total,
Expand Down