(userId: string)
| 204 | } |
| 205 | |
| 206 | export async function canPurchaseCredits(userId: string): Promise<boolean> { |
| 207 | const subscription = await getHighestPrioritySubscription(userId) |
| 208 | if (!subscription) { |
| 209 | return false |
| 210 | } |
| 211 | const billingStatus = await getEffectiveBillingStatus(userId) |
| 212 | if (!hasUsableSubscriptionAccess(subscription.status, billingStatus.billingBlocked)) { |
| 213 | return false |
| 214 | } |
| 215 | // Enterprise users must contact support to purchase credits |
| 216 | return isPro(subscription.plan) || isTeam(subscription.plan) |
| 217 | } |
no test coverage detected