(credentialSetId: string)
| 53 | } |
| 54 | |
| 55 | async function verifyCredentialSetBilling(credentialSetId: string): Promise<{ |
| 56 | valid: boolean |
| 57 | error?: string |
| 58 | }> { |
| 59 | if (!isProd) { |
| 60 | return { valid: true } |
| 61 | } |
| 62 | |
| 63 | const [set] = await db |
| 64 | .select({ organizationId: credentialSet.organizationId }) |
| 65 | .from(credentialSet) |
| 66 | .where(eq(credentialSet.id, credentialSetId)) |
| 67 | .limit(1) |
| 68 | |
| 69 | if (!set) { |
| 70 | return { valid: false, error: 'Credential set not found' } |
| 71 | } |
| 72 | |
| 73 | const hasTeamPlan = await isOrganizationOnTeamOrEnterprisePlan(set.organizationId) |
| 74 | if (!hasTeamPlan) { |
| 75 | return { |
| 76 | valid: false, |
| 77 | error: 'Credential sets require a Team or Enterprise plan. Please upgrade to continue.', |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | return { valid: true } |
| 82 | } |
| 83 | |
| 84 | const WEBHOOK_BODY_LABEL = 'Webhook request body' |
| 85 |
no test coverage detected