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 balance-available.ts

Kiran K06036e5c66bd
diff --git a/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts b/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts
index a2b831e0ae..1942e0faa8 100644
--- a/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts
+++ b/apps/web/app/(ee)/api/stripe/connect/webhook/balance-available.ts
@@ -101,8 +101,14 @@ export async function balanceAvailable(event: Stripe.Event) {
}
if (availableBalance <= 0) {
+ const adjustedBalanceInCents =
+ currency === "usd"
+ ? availableBalance
+ : availableBalance *
+ (ZERO_DECIMAL_CURRENCIES.includes(currency.toUpperCase()) ? 1 : 100);
+
console.log(
- `The available balance (${currencyFormatter(convertedUsdAmount / 100, { maximumFractionDigits: 2 })}) for partner ${partner.email} (${stripeAccount}) is less than or equal to 0. Skipping...`,
+ `The adjusted available balance (${currencyFormatter(adjustedBalanceInCents / 100, { maximumFractionDigits: 2 })}) for partner ${partner.email} (${stripeAccount}) is less than or equal to 0 after subtracting pending payouts. Skipping...`,
);
return;
}