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.

Create update-partner-country.ts

Steven Teyf5559a6025f7
diff --git a/apps/web/scripts/partners/update-partner-country.ts b/apps/web/scripts/partners/update-partner-country.ts
new file mode 100644
index 0000000000..f8229febac
--- /dev/null
+++ b/apps/web/scripts/partners/update-partner-country.ts
@@ -0,0 +1,43 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+import Stripe from "stripe";
+
+export const stripe = new Stripe(`${process.env.STRIPE_CONNECT_WRITE_KEY}`, {
+ apiVersion: "2022-11-15",
+ appInfo: {
+ name: "Dub.co",
+ version: "0.1.0",
+ },
+});
+
+const email = "xxx";
+
+// update partner country
+async function main() {
+ const partner = await prisma.partner.update({
+ where: {
+ email,
+ },
+ data: {
+ country: "US",
+ },
+ });
+
+ if (partner.stripeConnectId) {
+ const res = await stripe.accounts.del(partner.stripeConnectId);
+ console.log("res", res);
+
+ if (res.deleted) {
+ await prisma.partner.update({
+ where: {
+ email,
+ },
+ data: {
+ stripeConnectId: null,
+ },
+ });
+ }
+ }
+}
+
+main();