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.

include VAT reverse charge + update script

Steven Tey30fda1cad977
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.tsx
index faac4b89d3..06b12021b6 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
@@ -145,6 +145,19 @@ export const GET = withPartnerProfile(async ({ partner, params }) => {
},
]
: []),
+ ...(partner.country &&
+ (EU_COUNTRY_CODES.includes(partner.country) || partner.country === "AU")
+ ? [
+ {
+ label: `${partner.country === "AU" ? "GST" : "VAT"} reverse charge`,
+ value: (
+ <Text style={tw("text-neutral-800 w-2/3")}>
+ Tax to be paid on reverse charge basis.
+ </Text>
+ ),
+ },
+ ]
+ : []),
];
const supportEmail = payout.program.supportEmail || "[email protected]";
diff --git a/apps/web/scripts/test-paypal-payouts.ts b/apps/web/scripts/send-paypal-payouts.ts
similarity index 69%
rename from apps/web/scripts/test-paypal-payouts.ts
rename to apps/web/scripts/send-paypal-payouts.ts
index 42c42f8bf6..9e201e3332 100644
--- a/apps/web/scripts/test-paypal-payouts.ts
+++ b/apps/web/scripts/send-paypal-payouts.ts
@@ -1,40 +1,29 @@
+import { prisma } from "@dub/prisma";
import "dotenv-flow/config";
-import { createId } from "../lib/api/create-id";
import { createPaypalToken } from "../lib/paypal/create-paypal-token";
import { paypalEnv } from "../lib/paypal/env";
-const payouts = [
- {
- id: createId({ prefix: "po_" }),
- partner: {
- paypalEmail: "[email protected]",
- },
- program: {
- name: "Dub",
- },
- amount: 1000,
- },
- {
- id: createId({ prefix: "po_" }),
- partner: {
- paypalEmail: "[email protected]",
+async function main() {
+ const payouts = await prisma.payout.findMany({
+ where: {
+ id: "po_xxxxx",
},
- program: {
- name: "Dub",
+ include: {
+ partner: true,
+ program: true,
},
- amount: 1000,
- },
-];
+ });
-async function main() {
+ // DON'T FORGET TO CHANGE TO PROD ENVS BEFORE RUNNING THIS SCRIPT
const paypalAccessToken = await createPaypalToken();
+
console.log({ paypalAccessToken });
console.log("Creating PayPal batch payout with env", paypalEnv);
const body = {
sender_batch_header: {
- sender_batch_id: "test_another",
+ sender_batch_id: payouts[0].id,
},
items: payouts.map((payout) => ({
recipient_type: "EMAIL",
@@ -48,7 +37,10 @@ async function main() {
})),
};
- console.log("Creating PayPal batch payout with body", body);
+ console.log(
+ "Creating PayPal batch payout with body",
+ JSON.stringify(body, null, 2),
+ );
const response = await fetch(
`${paypalEnv.PAYPAL_API_HOST}/v1/payments/payouts`,