MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / isOrgCustomer

Function isOrgCustomer

web/src/app/api/stripe/webhook/_helpers.ts:16–31  ·  view source on GitHub ↗
(stripeCustomerId: string)

Source from the content-addressed store, hash-verified

14 * which may not be populated yet when early invoice events arrive).
15 */
16export async function isOrgCustomer(stripeCustomerId: string): Promise<boolean> {
17 try {
18 const orgs = await db
19 .select({ id: schema.org.id })
20 .from(schema.org)
21 .where(eq(schema.org.stripe_customer_id, stripeCustomerId))
22 .limit(1)
23 return orgs.length > 0
24 } catch (error) {
25 logger.error(
26 { stripeCustomerId, error },
27 'Failed to check if customer is an org - defaulting to false',
28 )
29 return false
30 }
31}
32
33/**
34 * BILLING_DISABLED: Checks if a Stripe event is related to organization billing.

Callers 3

webhookHandlerFunction · 0.90
isOrgBillingEventFunction · 0.85

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected