Update credit_billing.ts
This commit is contained in:
@@ -308,7 +308,7 @@ export async function supaCheckTeamCredits(team_id: string, credits: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. Compare the total credits used with the credits allowed by the plan.
|
// 5. Compare the total credits used with the credits allowed by the plan.
|
||||||
if (totalCreditsUsed > FREE_CREDITS) {
|
if (totalCreditsUsed >= FREE_CREDITS) {
|
||||||
// Send email notification for insufficient credits
|
// Send email notification for insufficient credits
|
||||||
await sendNotification(
|
await sendNotification(
|
||||||
team_id,
|
team_id,
|
||||||
@@ -405,7 +405,7 @@ export async function supaCheckTeamCredits(team_id: string, credits: number) {
|
|||||||
const creditUsagePercentage = adjustedCreditsUsed / creditLimit;
|
const creditUsagePercentage = adjustedCreditsUsed / creditLimit;
|
||||||
|
|
||||||
// Compare the adjusted total credits used with the credits allowed by the plan
|
// Compare the adjusted total credits used with the credits allowed by the plan
|
||||||
if (adjustedCreditsUsed > price.credits) {
|
if (adjustedCreditsUsed >= price.credits) {
|
||||||
await sendNotification(
|
await sendNotification(
|
||||||
team_id,
|
team_id,
|
||||||
NotificationType.LIMIT_REACHED,
|
NotificationType.LIMIT_REACHED,
|
||||||
|
|||||||
Reference in New Issue
Block a user