The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
include tax ID in invoices
Steven Tey69f34a12f6bd
diff --git a/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/route.tsx b/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/route.tsxindex 2f4cc91bb2..3e64fa4852 100644--- a/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/route.tsx+++ b/apps/web/app/(ee)/app.dub.co/invoices/[invoiceId]/route.tsx@@ -93,9 +93,9 @@ export const GET = withSession(async ({ session, params }) => {if (invoice.workspace.stripeId) {try {- customer = (await stripe.customers.retrieve(- invoice.workspace.stripeId!,- )) as Stripe.Customer;+ customer = (await stripe.customers.retrieve(invoice.workspace.stripeId!, {+ expand: ["tax_ids"],+ })) as Stripe.Customer;} catch (error) {console.error(error);}@@ -127,6 +127,12 @@ export const GET = withSession(async ({ session, params }) => {},];+ const EU_CUSTOMER =+ customer?.address?.country &&+ EU_COUNTRY_CODES.includes(customer.address.country);+ const AU_CUSTOMER =+ customer?.address?.country && customer.address.country === "AU";+const invoiceSummaryDetails = [{label: "Invoice amount",@@ -149,19 +155,20 @@ export const GET = withSession(async ({ session, params }) => {maximumFractionDigits: 2,}),},- // if customer is in EU, add VAT reverse charge note:- // Reverse charge: VAT to be accounted for by the recipient under Article 196 of Directive 2006/112/EC.- ...(customer?.address?.country &&- EU_COUNTRY_CODES.includes(customer.address.country)+ // if customer is in EU or AU, add VAT/GST reverse charge note+ ...(EU_CUSTOMER || AU_CUSTOMER? [{- label: "VAT reverse charge",+ label: `${AU_CUSTOMER ? "GST" : "VAT"} reverse charge`,value: "Tax to be paid on reverse charge basis.",},]: []),];+ // Get the first tax ID if available+ const primaryTaxId = customer?.tax_ids?.data?.[0];+const addresses = [{title: "From",@@ -185,6 +192,7 @@ export const GET = withSession(async ({ session, params }) => {state: customer?.shipping?.address?.state,postalCode: customer?.shipping?.address?.postal_code,email: customer?.email,+ taxId: primaryTaxId ? `Tax ID: ${primaryTaxId}` : undefined,},},];@@ -227,6 +235,7 @@ export const GET = withSession(async ({ session, params }) => {address.line1,address.line2,cityStatePostal,+ address.taxId,address.email,].filter((record) => record && record.length > 0);diff --git a/apps/web/app/(ee)/partners.dub.co/invoices/[payoutId]/route.tsx b/apps/web/app/(ee)/partners.dub.co/invoices/[payoutId]/route.tsxindex d6ecebbd77..32fff7f06f 100644--- a/apps/web/app/(ee)/partners.dub.co/invoices/[payoutId]/route.tsx+++ b/apps/web/app/(ee)/partners.dub.co/invoices/[payoutId]/route.tsx@@ -69,6 +69,10 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {});}+ const EU_PARTNER =+ partner.country && EU_COUNTRY_CODES.includes(partner.country);+ const AU_PARTNER = partner.country && partner.country === "AU";+const invoiceMetadata = [{label: "Program",@@ -120,11 +124,11 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {label: "Payout reference number",value: <Text style={tw("text-neutral-800 w-2/3")}>{payout.id}</Text>,},- // if partner is in EU, add VAT reverse charge note:- ...(partner.country && EU_COUNTRY_CODES.includes(partner.country)+ // if partner is in EU or AU, add VAT/GST reverse charge note+ ...(EU_PARTNER || AU_PARTNER? [{- label: "VAT",+ label: `${AU_PARTNER ? "GST" : "VAT"} reverse charge`,value: (<Text style={tw("text-neutral-800 w-2/3")}>Tax to be paid on reverse charge basis.