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.

update processing payout check

Pedro Ladeira781273c9b077
diff --git a/apps/web/lib/actions/partners/update-partner-profile.ts b/apps/web/lib/actions/partners/update-partner-profile.ts
index 2aba1cbc08..47e0a85d8a 100644
--- a/apps/web/lib/actions/partners/update-partner-profile.ts
+++ b/apps/web/lib/actions/partners/update-partner-profile.ts
@@ -107,6 +107,22 @@ export const updatePartnerProfileAction = authPartnerActionClient
if (!country || !Object.hasOwn(COUNTRIES, country)) {
throw new Error("Select a valid country.");
}
+
+ const processingPayout = await prisma.payout.findFirst({
+ where: {
+ partnerId: partner.id,
+ status: "processing",
+ },
+ select: {
+ id: true,
+ },
+ });
+
+ if (processingPayout) {
+ throw new Error(
+ "Your country cannot be changed while a payout is being processed.",
+ );
+ }
}
await updatedComplianceFieldsChecks({