mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-06 08:06:01 +08:00
Update credit_billing.ts
This commit is contained in:
parent
e5ca4364ba
commit
1805d901a9
@ -199,8 +199,13 @@ export async function supaCheckTeamCredits(team_id: string, credits: number) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(subscriptionError) {
|
||||||
|
Logger.error(`Subscription error: ${subscriptionError}`);
|
||||||
|
throw new Error(`Subscription error: ${subscriptionError}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Free credits, no coupons
|
// Free credits, no coupons
|
||||||
if (subscriptionError || !subscription) {
|
if (!subscription) {
|
||||||
// If there is no active subscription but there are available coupons
|
// If there is no active subscription but there are available coupons
|
||||||
if (couponCredits >= credits) {
|
if (couponCredits >= credits) {
|
||||||
return { success: true, message: "Sufficient credits available", remainingCredits: couponCredits };
|
return { success: true, message: "Sufficient credits available", remainingCredits: couponCredits };
|
||||||
@ -214,6 +219,7 @@ export async function supaCheckTeamCredits(team_id: string, credits: number) {
|
|||||||
.eq("team_id", team_id);
|
.eq("team_id", team_id);
|
||||||
|
|
||||||
if (creditUsageError) {
|
if (creditUsageError) {
|
||||||
|
Logger.error(`Credit usage error: ${creditUsageError}`);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to retrieve credit usage for team_id: ${team_id}`
|
`Failed to retrieve credit usage for team_id: ${team_id}`
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user