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.

address coderabbit feedback

Steven Tey52fa2b15d8a7
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
index fb7ee7a901..4bb0515bad 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
@@ -22,7 +22,6 @@ import {
import { prisma } from "@dub/prisma";
import { Customer, WorkflowTrigger } from "@dub/prisma/client";
import { COUNTRIES_TO_CONTINENTS, nanoid } from "@dub/utils";
-import { REGION_CODE_LOOKUP } from "@dub/utils/src/constants/regions";
import { waitUntil } from "@vercel/functions";
import type Stripe from "stripe";
import { getConnectedCustomer } from "./utils/get-connected-customer";
@@ -565,9 +564,7 @@ async function attributeViaPromoCode({
? COUNTRIES_TO_CONTINENTS[customerAddress.country]
: "Unknown",
country: customerAddress?.country ?? "Unknown",
- region: customerAddress?.state
- ? REGION_CODE_LOOKUP[customerAddress.state]
- : "Unknown",
+ region: customerAddress?.state ?? "Unknown",
},
});
@@ -578,6 +575,7 @@ async function attributeViaPromoCode({
customerDetails?.name || customerDetails?.email || generateRandomName(),
email: customerDetails?.email,
externalId: clickEvent.click_id,
+ stripeCustomerId: charge.customer as string,
linkId: clickEvent.link_id,
clickId: clickEvent.click_id,
clickedAt: new Date(clickEvent.timestamp + "Z"),
diff --git a/packages/utils/src/constants/regions.ts b/packages/utils/src/constants/regions.ts
index 44c736fb36..31afcf8808 100644
--- a/packages/utils/src/constants/regions.ts
+++ b/packages/utils/src/constants/regions.ts
@@ -3485,7 +3485,3 @@ export const REGIONS: { [key: string]: string } = {
};
export const REGION_CODES = Object.keys(REGIONS) as [string, ...string[]];
-
-export const REGION_CODE_LOOKUP = Object.fromEntries(
- Object.entries(REGIONS).map(([key, value]) => [value, key]),
-) as Record<string, string>;