Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

improve

Kiran K1c09b7aa45c0
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/[invoiceId]/route.tsx b/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/[invoiceId]/route.tsx
index 2b24dd2755..94eb4f1776 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/[invoiceId]/route.tsx
+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/[invoiceId]/route.tsx
@@ -80,7 +80,7 @@ export const GET = withWorkspace(async ({ workspace, params }) => {
const invoiceMetadata = [
{
- label: "Invoice #",
+ label: "Invoice number",
value: invoice.number,
},
{
@@ -117,6 +117,32 @@ export const GET = withWorkspace(async ({ workspace, params }) => {
},
];
+ const addresses = [
+ {
+ title: "From",
+ address: {
+ name: "Dub Technologies, Inc.",
+ line1: "2261 Market Street STE 5906",
+ city: "San Francisco",
+ state: "CA",
+ postalCode: "94114",
+ email: "[email protected]",
+ },
+ },
+ {
+ title: "Bill to",
+ address: {
+ name: customer.shipping?.name,
+ line1: customerAddress?.line1,
+ line2: customerAddress?.line2,
+ city: customerAddress?.city,
+ state: customerAddress?.state,
+ postalCode: customerAddress?.postal_code,
+ email: customer.email,
+ },
+ },
+ ];
+
const pdf = await renderToBuffer(
<Document>
<Page size="A4" style={tw("p-20")}>
@@ -143,30 +169,9 @@ export const GET = withWorkspace(async ({ workspace, params }) => {
</View>
<View style={tw("flex-row justify-between mb-10 ")}>
- <Address
- title="From"
- address={{
- name: "Dub Technologies, Inc.",
- line1: "2261 Market Street STE 5906",
- city: "San Francisco",
- state: "CA",
- postalCode: "94114",
- email: "[email protected]",
- }}
- />
-
- <Address
- title="Bill to"
- address={{
- name: customer.shipping?.name,
- line1: customerAddress?.line1,
- line2: customerAddress?.line2,
- city: customerAddress?.city,
- state: customerAddress?.state,
- postalCode: customerAddress?.postal_code,
- email: customer.email,
- }}
- />
+ {addresses.map(({ title, address }, index) => (
+ <Address title={title} address={address} key={index} />
+ ))}
</View>
<View
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/route.ts
index b317814b27..9a92bd1a81 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/route.ts
@@ -67,7 +67,10 @@ const payoutInvoices = async (workspaceId: string) => {
return {
...invoice,
description: "Dub Partner payout",
- pdfUrl: `${APP_DOMAIN}/api/workspaces/ws_${workspaceId}/billing/invoices/${invoice.id}`,
+ pdfUrl:
+ invoice.status === "completed"
+ ? `${APP_DOMAIN}/api/workspaces/ws_${workspaceId}/billing/invoices/${invoice.id}`
+ : null,
};
});
};
diff --git a/apps/web/lib/actions/partners/confirm-payouts.ts b/apps/web/lib/actions/partners/confirm-payouts.ts
index c98214d61c..f222acb414 100644
--- a/apps/web/lib/actions/partners/confirm-payouts.ts
+++ b/apps/web/lib/actions/partners/confirm-payouts.ts
@@ -89,7 +89,7 @@ export const confirmPayoutsAction = authActionClient
const newNumber = parseInt(lastNumber) + 1;
number = `${workspace.invoicePrefix}-${newNumber}`;
} else {
- number = `${workspace.invoicePrefix}-1`;
+ number = `${workspace.invoicePrefix}-1000`;
}
const invoice = await tx.invoice.create({