@bagou/payment-stripe 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/StripeAnalytics.ts", "src/StripeClient.ts", "src/StripeCheckout.ts", "src/StripeCustomer.ts", "src/StripeCustomerPortal.ts", "src/StripeDiscount.ts", "src/StripeProducts.ts", "src/StripeProvider.ts", "src/StripeWebhookEvent.ts", "src/types.ts"],
4
+ "sourcesContent": [
5
+ "import { inject, injectable } from \"@ooneex/container\";\nimport { StripeClient } from \"./StripeClient\";\nimport type { StripeAnalyticsOptionsType, StripeAnalyticsSummaryType } from \"./types\";\n\n@injectable()\nexport class StripeAnalytics {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async get(options: StripeAnalyticsOptionsType): Promise<StripeAnalyticsSummaryType> {\n const startTimestamp = Math.floor(options.startDate.getTime() / 1000);\n const endTimestamp = Math.floor(options.endDate.getTime() / 1000);\n\n const [charges, subscriptions] = await Promise.all([\n this.client.sdk.charges.list({\n created: { gte: startTimestamp, lte: endTimestamp },\n limit: options.limit ?? 100,\n }),\n this.client.sdk.subscriptions.list({\n created: { gte: startTimestamp, lte: endTimestamp },\n limit: 100,\n }),\n ]);\n\n let totalRevenue = 0;\n let totalTransactions = 0;\n const periodsMap = new Map<string, { revenue: number; count: number; currency: string }>();\n\n for (const charge of charges.data) {\n if (charge.status !== \"succeeded\") continue;\n if (options.currency && charge.currency !== options.currency) continue;\n\n totalRevenue += charge.amount;\n totalTransactions++;\n\n const date = new Date(charge.created * 1000).toISOString().split(\"T\")[0] as string;\n const existing = periodsMap.get(date);\n\n if (existing) {\n existing.revenue += charge.amount;\n existing.count++;\n } else {\n periodsMap.set(date, { revenue: charge.amount, count: 1, currency: charge.currency });\n }\n }\n\n const periods = Array.from(periodsMap.entries())\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([date, data]) => ({\n date,\n revenue: data.revenue,\n currency: data.currency,\n transactionCount: data.count,\n }));\n\n let activeSubscriptions = 0;\n let newSubscriptions = 0;\n let canceledSubscriptions = 0;\n\n for (const sub of subscriptions.data) {\n if (sub.status === \"active\") activeSubscriptions++;\n if (sub.status === \"canceled\") canceledSubscriptions++;\n if (sub.created >= startTimestamp && sub.created <= endTimestamp) newSubscriptions++;\n }\n\n const currency = options.currency ?? charges.data[0]?.currency ?? \"usd\";\n\n return {\n totalRevenue,\n totalTransactions,\n currency,\n periods,\n activeSubscriptions,\n newSubscriptions,\n canceledSubscriptions,\n };\n }\n}\n",
6
+ "import { injectable } from \"@ooneex/container\";\nimport Stripe from \"stripe\";\nimport { PaymentException } from \"@ooneex/payment\";\n\n@injectable()\nexport class StripeClient {\n private readonly client: Stripe;\n\n constructor() {\n const apiKey = Bun.env.STRIPE_SECRET_KEY;\n\n if (!apiKey) {\n throw new PaymentException(\n \"Stripe secret key is required. Please set the STRIPE_SECRET_KEY environment variable.\",\n \"TOKEN_REQUIRED\",\n );\n }\n\n this.client = new Stripe(apiKey, {\n apiVersion: (Bun.env.STRIPE_API_VERSION ?? \"2025-06-30.basil\") as Stripe.LatestApiVersion,\n });\n }\n\n public get sdk(): Stripe {\n return this.client;\n }\n}\n",
7
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type Stripe from \"stripe\";\nimport { StripeClient } from \"./StripeClient\";\nimport type { CheckoutSessionCreateType, CheckoutSessionType } from \"./types\";\n\n@injectable()\nexport class StripeCheckoutSession {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async create(data: CheckoutSessionCreateType): Promise<CheckoutSessionType> {\n const params: Stripe.Checkout.SessionCreateParams = {\n line_items: data.lineItems.map((item) => ({\n price: item.price,\n quantity: item.quantity ?? 1,\n })),\n mode: data.mode,\n success_url: data.successUrl,\n };\n\n if (data.cancelUrl) {\n params.cancel_url = data.cancelUrl;\n }\n\n if (data.customerId) {\n params.customer = data.customerId;\n } else if (data.customerEmail) {\n params.customer_email = data.customerEmail;\n }\n\n if (data.metadata) {\n params.metadata = data.metadata;\n }\n\n const session = await this.client.sdk.checkout.sessions.create(params);\n\n return this.mapSession(session);\n }\n\n public async get(id: string): Promise<CheckoutSessionType> {\n const session = await this.client.sdk.checkout.sessions.retrieve(id);\n\n return this.mapSession(session);\n }\n\n private mapSession(session: Stripe.Checkout.Session): CheckoutSessionType {\n return {\n id: session.id,\n url: session.url,\n status: session.status ?? null,\n paymentStatus: session.payment_status,\n customerId: typeof session.customer === \"string\" ? session.customer : (session.customer?.id ?? null),\n customerEmail: session.customer_email ?? session.customer_details?.email ?? null,\n amountTotal: session.amount_total,\n currency: session.currency,\n metadata: (session.metadata as Record<string, string>) ?? {},\n };\n }\n}\n",
8
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type Stripe from \"stripe\";\nimport { StripeClient } from \"./StripeClient\";\nimport type {\n StripeCustomerAddressType,\n StripeCustomerCreateType,\n StripeCustomerListOptionsType,\n StripeCustomerListResultType,\n StripeCustomerType,\n StripeCustomerUpdateType,\n} from \"./types\";\n\n@injectable()\nexport class StripeCustomer {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async create(data: StripeCustomerCreateType): Promise<StripeCustomerType> {\n const params: Stripe.CustomerCreateParams = {\n email: data.email,\n };\n\n if (data.name) params.name = data.name;\n if (data.phone) params.phone = data.phone;\n if (data.metadata) params.metadata = data.metadata;\n if (data.billingAddress) params.address = this.toStripeAddress(data.billingAddress);\n\n const customer = await this.client.sdk.customers.create(params);\n\n return this.mapCustomer(customer);\n }\n\n public async update(id: string, data: StripeCustomerUpdateType): Promise<StripeCustomerType> {\n const params: Stripe.CustomerUpdateParams = {};\n\n if (data.email) params.email = data.email;\n if (data.name !== undefined) params.name = data.name ?? \"\";\n if (data.phone !== undefined) params.phone = data.phone;\n if (data.metadata) params.metadata = data.metadata;\n if (data.billingAddress) params.address = this.toStripeAddress(data.billingAddress);\n\n const customer = await this.client.sdk.customers.update(id, params);\n\n return this.mapCustomer(customer);\n }\n\n public async remove(id: string): Promise<void> {\n await this.client.sdk.customers.del(id);\n }\n\n public async get(id: string): Promise<StripeCustomerType> {\n const customer = await this.client.sdk.customers.retrieve(id);\n\n if (customer.deleted) {\n throw new Error(`Customer ${id} has been deleted`);\n }\n\n return this.mapCustomer(customer);\n }\n\n public async list(options?: StripeCustomerListOptionsType): Promise<StripeCustomerListResultType> {\n const params: Stripe.CustomerListParams = {\n limit: options?.limit ?? 10,\n };\n\n if (options?.email) params.email = options.email;\n if (options?.startingAfter) params.starting_after = options.startingAfter;\n\n const response = await this.client.sdk.customers.list(params);\n\n return {\n items: response.data.map((c) => this.mapCustomer(c)),\n hasMore: response.has_more,\n };\n }\n\n private toStripeAddress(address: StripeCustomerAddressType): Stripe.AddressParam {\n return {\n line1: address.line1 ?? \"\",\n line2: address.line2,\n city: address.city,\n state: address.state,\n postal_code: address.postalCode,\n country: address.country,\n };\n }\n\n private mapCustomer(customer: Stripe.Customer): StripeCustomerType {\n const result: StripeCustomerType = {\n id: customer.id,\n email: customer.email ?? \"\",\n };\n\n if (customer.name) result.name = customer.name;\n if (customer.phone) result.phone = customer.phone;\n if (customer.metadata) result.metadata = customer.metadata as Record<string, string>;\n if (customer.created) result.createdAt = new Date(customer.created * 1000);\n\n if (customer.address) {\n const addr: StripeCustomerAddressType = {};\n if (customer.address.line1) addr.line1 = customer.address.line1;\n if (customer.address.line2) addr.line2 = customer.address.line2;\n if (customer.address.city) addr.city = customer.address.city;\n if (customer.address.state) addr.state = customer.address.state;\n if (customer.address.postal_code) addr.postalCode = customer.address.postal_code;\n if (customer.address.country) addr.country = customer.address.country;\n result.billingAddress = addr;\n }\n\n return result;\n }\n}\n",
9
+ "import { inject, injectable } from \"@ooneex/container\";\nimport { StripeClient } from \"./StripeClient\";\nimport type { StripeCustomerPortalCreateType, StripeCustomerPortalType } from \"./types\";\n\n@injectable()\nexport class StripeCustomerPortal {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async create(data: StripeCustomerPortalCreateType): Promise<StripeCustomerPortalType> {\n const session = await this.client.sdk.billingPortal.sessions.create({\n customer: data.customerId,\n return_url: data.returnUrl,\n });\n\n return {\n id: session.id,\n url: session.url,\n returnUrl: session.return_url ?? data.returnUrl,\n createdAt: new Date(session.created * 1000),\n };\n }\n}\n",
10
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type Stripe from \"stripe\";\nimport { StripeClient } from \"./StripeClient\";\nimport type {\n StripeDiscountCreateType,\n StripeDiscountDurationType,\n StripeDiscountListOptionsType,\n StripeDiscountListResultType,\n StripeDiscountType,\n StripeDiscountTypeType,\n StripeDiscountUpdateType,\n} from \"./types\";\n\n@injectable()\nexport class StripeDiscount {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async create(data: StripeDiscountCreateType): Promise<StripeDiscountType> {\n const params: Stripe.CouponCreateParams = {\n name: data.name,\n duration: data.duration,\n };\n\n if (data.type === \"percentage\") {\n params.percent_off = data.amount;\n } else {\n params.amount_off = data.amount;\n params.currency = data.currency ?? \"usd\";\n }\n\n if (data.duration === \"repeating\") {\n params.duration_in_months = data.durationInMonths;\n }\n\n if (data.maxRedemptions) params.max_redemptions = data.maxRedemptions;\n if (data.redeemBy) params.redeem_by = Math.floor(data.redeemBy.getTime() / 1000);\n if (data.metadata) params.metadata = data.metadata;\n if (data.appliesTo) params.applies_to = { products: data.appliesTo };\n\n const coupon = await this.client.sdk.coupons.create(params);\n\n if (data.code) {\n await this.client.sdk.promotionCodes.create({\n coupon: coupon.id,\n code: data.code,\n max_redemptions: data.maxRedemptions,\n expires_at: data.redeemBy ? Math.floor(data.redeemBy.getTime() / 1000) : undefined,\n });\n }\n\n return this.mapCoupon(coupon);\n }\n\n public async update(id: string, data: StripeDiscountUpdateType): Promise<StripeDiscountType> {\n const coupon = await this.client.sdk.coupons.update(id, {\n name: data.name,\n metadata: data.metadata,\n });\n\n return this.mapCoupon(coupon);\n }\n\n public async remove(id: string): Promise<void> {\n await this.client.sdk.coupons.del(id);\n }\n\n public async get(id: string): Promise<StripeDiscountType> {\n const coupon = await this.client.sdk.coupons.retrieve(id);\n\n return this.mapCoupon(coupon);\n }\n\n public async list(options?: StripeDiscountListOptionsType): Promise<StripeDiscountListResultType> {\n const response = await this.client.sdk.coupons.list({\n limit: options?.limit ?? 10,\n starting_after: options?.startingAfter,\n });\n\n return {\n items: response.data.map((c) => this.mapCoupon(c)),\n hasMore: response.has_more,\n };\n }\n\n private mapCoupon(coupon: Stripe.Coupon): StripeDiscountType {\n const result: StripeDiscountType = {\n id: coupon.id,\n name: coupon.name ?? \"\",\n type: (coupon.percent_off !== null ? \"percentage\" : \"fixed\") as StripeDiscountTypeType,\n amount: coupon.percent_off !== null ? (coupon.percent_off ?? 0) : (coupon.amount_off ?? 0),\n duration: coupon.duration as StripeDiscountDurationType,\n timesRedeemed: coupon.times_redeemed,\n isValid: coupon.valid,\n };\n\n if (coupon.currency) result.currency = coupon.currency;\n if (coupon.duration_in_months) result.durationInMonths = coupon.duration_in_months;\n if (coupon.max_redemptions) result.maxRedemptions = coupon.max_redemptions;\n if (coupon.redeem_by) result.redeemBy = new Date(coupon.redeem_by * 1000);\n if (coupon.metadata) result.metadata = coupon.metadata as Record<string, string>;\n if (coupon.created) result.createdAt = new Date(coupon.created * 1000);\n\n return result;\n }\n}\n",
11
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type Stripe from \"stripe\";\nimport { StripeClient } from \"./StripeClient\";\nimport type {\n StripePriceCreateType,\n StripePriceListOptionsType,\n StripePriceListResultType,\n StripePriceType,\n StripeProductCreateType,\n StripeProductListOptionsType,\n StripeProductListResultType,\n StripeProductType,\n StripeProductUpdateType,\n} from \"./types\";\n\n@injectable()\nexport class StripeProducts {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async create(data: StripeProductCreateType): Promise<StripeProductType> {\n const params: Stripe.ProductCreateParams = {\n name: data.name,\n };\n\n if (data.description) params.description = data.description;\n if (data.images) params.images = data.images;\n if (data.metadata) params.metadata = data.metadata;\n if (data.active !== undefined) params.active = data.active;\n\n const product = await this.client.sdk.products.create(params);\n\n return this.mapProduct(product);\n }\n\n public async update(id: string, data: StripeProductUpdateType): Promise<StripeProductType> {\n const params: Stripe.ProductUpdateParams = {};\n\n if (data.name) params.name = data.name;\n if (data.description !== undefined) params.description = data.description;\n if (data.images) params.images = data.images;\n if (data.metadata) params.metadata = data.metadata;\n if (data.active !== undefined) params.active = data.active;\n\n const product = await this.client.sdk.products.update(id, params);\n\n return this.mapProduct(product);\n }\n\n public async remove(id: string): Promise<void> {\n await this.client.sdk.products.del(id);\n }\n\n public async get(id: string): Promise<StripeProductType> {\n const product = await this.client.sdk.products.retrieve(id);\n\n return this.mapProduct(product);\n }\n\n public async list(options?: StripeProductListOptionsType): Promise<StripeProductListResultType> {\n const params: Stripe.ProductListParams = {\n limit: options?.limit ?? 10,\n };\n\n if (options?.active !== undefined) params.active = options.active;\n if (options?.startingAfter) params.starting_after = options.startingAfter;\n\n const response = await this.client.sdk.products.list(params);\n\n return {\n items: response.data.map((p) => this.mapProduct(p)),\n hasMore: response.has_more,\n };\n }\n\n public async createPrice(data: StripePriceCreateType): Promise<StripePriceType> {\n const params: Stripe.PriceCreateParams = {\n product: data.productId,\n currency: data.currency,\n unit_amount: data.unitAmount,\n };\n\n if (data.type === \"recurring\" && data.interval) {\n params.recurring = {\n interval: data.interval,\n interval_count: data.intervalCount ?? 1,\n };\n }\n\n if (data.metadata) params.metadata = data.metadata;\n\n const price = await this.client.sdk.prices.create(params);\n\n return this.mapPrice(price);\n }\n\n public async getPrice(id: string): Promise<StripePriceType> {\n const price = await this.client.sdk.prices.retrieve(id);\n\n return this.mapPrice(price);\n }\n\n public async listPrices(productId: string, options?: StripePriceListOptionsType): Promise<StripePriceListResultType> {\n const response = await this.client.sdk.prices.list({\n product: productId,\n limit: options?.limit ?? 10,\n active: options?.active,\n });\n\n return {\n items: response.data.map((p) => this.mapPrice(p)),\n hasMore: response.has_more,\n };\n }\n\n private mapProduct(product: Stripe.Product): StripeProductType {\n const result: StripeProductType = {\n id: product.id,\n name: product.name,\n active: product.active,\n };\n\n if (product.description) result.description = product.description;\n if (product.images?.length) result.images = product.images;\n if (product.metadata) result.metadata = product.metadata as Record<string, string>;\n if (product.created) result.createdAt = new Date(product.created * 1000);\n if (product.updated) result.updatedAt = new Date(product.updated * 1000);\n\n return result;\n }\n\n private mapPrice(price: Stripe.Price): StripePriceType {\n const result: StripePriceType = {\n id: price.id,\n productId: typeof price.product === \"string\" ? price.product : price.product.id,\n currency: price.currency,\n unitAmount: price.unit_amount,\n type: price.type,\n active: price.active,\n };\n\n if (price.recurring) {\n result.interval = price.recurring.interval;\n result.intervalCount = price.recurring.interval_count;\n }\n\n if (price.metadata) result.metadata = price.metadata as Record<string, string>;\n if (price.created) result.createdAt = new Date(price.created * 1000);\n\n return result;\n }\n}\n",
12
+ "import { inject, injectable } from \"@ooneex/container\";\nimport { StripeCheckoutSession } from \"./StripeCheckout\";\nimport { StripeWebhookEvent } from \"./StripeWebhookEvent\";\nimport type {\n CheckoutSessionCreateType,\n CheckoutSessionType,\n IPaymentProvider,\n WebhookEventType,\n} from \"./types\";\n\n@injectable()\nexport class StripeProvider implements IPaymentProvider {\n constructor(\n @inject(StripeCheckoutSession) private readonly checkoutSession: StripeCheckoutSession,\n @inject(StripeWebhookEvent) private readonly webhookEvent: StripeWebhookEvent,\n ) {}\n\n public createCheckoutSession(data: CheckoutSessionCreateType): Promise<CheckoutSessionType> {\n return this.checkoutSession.create(data);\n }\n\n public retrieveSession(id: string): Promise<CheckoutSessionType> {\n return this.checkoutSession.get(id);\n }\n\n public constructWebhookEvent(\n payload: string | Buffer,\n signature: string,\n secret: string,\n ): Promise<WebhookEventType> {\n return this.webhookEvent.construct(payload, signature, secret);\n }\n}\n",
13
+ "import { inject, injectable } from \"@ooneex/container\";\nimport type Stripe from \"stripe\";\nimport { StripeClient } from \"./StripeClient\";\nimport { PaymentException } from \"@ooneex/payment\";\nimport {\n EStripeEvent,\n type CheckoutSessionCompletedDataType,\n type CheckoutSessionCompletedEventType,\n type CustomerSubscriptionDeletedDataType,\n type CustomerSubscriptionDeletedEventType,\n type CustomerSubscriptionUpdatedDataType,\n type CustomerSubscriptionUpdatedEventType,\n type InvoicePaidDataType,\n type InvoicePaidEventType,\n type PaymentIntentPaymentFailedDataType,\n type PaymentIntentPaymentFailedEventType,\n type WebhookEventType,\n} from \"./types\";\n\n@injectable()\nexport class StripeWebhookEvent {\n constructor(@inject(StripeClient) private readonly client: StripeClient) {}\n\n public async construct(\n payload: string | Buffer,\n signature: string,\n secret: string,\n ): Promise<WebhookEventType> {\n let raw: Stripe.Event;\n\n try {\n raw = await this.client.sdk.webhooks.constructEventAsync(payload, signature, secret);\n } catch (err) {\n throw new PaymentException(\n `Webhook signature verification failed: ${err instanceof Error ? err.message : String(err)}`,\n \"WEBHOOK_SIGNATURE_INVALID\",\n );\n }\n\n const created = new Date(raw.created * 1000);\n\n switch (raw.type) {\n case EStripeEvent.CheckoutSessionCompleted: {\n const obj = raw.data.object as Stripe.Checkout.Session;\n const data: CheckoutSessionCompletedDataType = {\n id: obj.id,\n customerId: typeof obj.customer === \"string\" ? obj.customer : (obj.customer?.id ?? null),\n customerEmail: obj.customer_email ?? obj.customer_details?.email ?? null,\n amountTotal: obj.amount_total,\n currency: obj.currency,\n paymentStatus: obj.payment_status,\n subscriptionId: typeof obj.subscription === \"string\" ? obj.subscription : (obj.subscription?.id ?? null),\n metadata: (obj.metadata as Record<string, string>) ?? {},\n };\n return { type: EStripeEvent.CheckoutSessionCompleted, id: raw.id, created, data } satisfies CheckoutSessionCompletedEventType;\n }\n\n case EStripeEvent.InvoicePaid: {\n const obj = raw.data.object as Stripe.Invoice;\n const data: InvoicePaidDataType = {\n id: obj.id ?? \"\",\n customerId: typeof obj.customer === \"string\" ? obj.customer : (obj.customer?.id ?? null),\n subscriptionId: typeof obj.subscription === \"string\" ? obj.subscription : (obj.subscription?.id ?? null),\n amountPaid: obj.amount_paid,\n currency: obj.currency,\n status: obj.status ?? null,\n hostedInvoiceUrl: obj.hosted_invoice_url ?? null,\n };\n return { type: EStripeEvent.InvoicePaid, id: raw.id, created, data } satisfies InvoicePaidEventType;\n }\n\n case EStripeEvent.CustomerSubscriptionDeleted: {\n const obj = raw.data.object as Stripe.Subscription;\n const data: CustomerSubscriptionDeletedDataType = {\n id: obj.id,\n customerId: typeof obj.customer === \"string\" ? obj.customer : (obj.customer?.id ?? null),\n status: obj.status,\n currentPeriodEnd: new Date(obj.current_period_end * 1000),\n canceledAt: obj.canceled_at ? new Date(obj.canceled_at * 1000) : null,\n metadata: (obj.metadata as Record<string, string>) ?? {},\n };\n return { type: EStripeEvent.CustomerSubscriptionDeleted, id: raw.id, created, data } satisfies CustomerSubscriptionDeletedEventType;\n }\n\n case EStripeEvent.CustomerSubscriptionUpdated: {\n const obj = raw.data.object as Stripe.Subscription;\n const data: CustomerSubscriptionUpdatedDataType = {\n id: obj.id,\n customerId: typeof obj.customer === \"string\" ? obj.customer : (obj.customer?.id ?? null),\n status: obj.status,\n currentPeriodEnd: new Date(obj.current_period_end * 1000),\n cancelAtPeriodEnd: obj.cancel_at_period_end,\n metadata: (obj.metadata as Record<string, string>) ?? {},\n };\n return { type: EStripeEvent.CustomerSubscriptionUpdated, id: raw.id, created, data } satisfies CustomerSubscriptionUpdatedEventType;\n }\n\n case EStripeEvent.PaymentIntentPaymentFailed: {\n const obj = raw.data.object as Stripe.PaymentIntent;\n const data: PaymentIntentPaymentFailedDataType = {\n id: obj.id,\n customerId: typeof obj.customer === \"string\" ? obj.customer : (obj.customer?.id ?? null),\n amount: obj.amount,\n currency: obj.currency,\n lastPaymentErrorMessage: obj.last_payment_error?.message ?? null,\n };\n return { type: EStripeEvent.PaymentIntentPaymentFailed, id: raw.id, created, data } satisfies PaymentIntentPaymentFailedEventType;\n }\n\n default:\n throw new PaymentException(\n `Unsupported webhook event type: ${raw.type}`,\n \"UNSUPPORTED_EVENT_TYPE\",\n );\n }\n }\n}\n",
14
+ "export enum EStripeEvent {\n CheckoutSessionCompleted = \"checkout.session.completed\",\n InvoicePaid = \"invoice.paid\",\n CustomerSubscriptionDeleted = \"customer.subscription.deleted\",\n CustomerSubscriptionUpdated = \"customer.subscription.updated\",\n PaymentIntentPaymentFailed = \"payment_intent.payment_failed\",\n}\n\nexport type StripeEventType = `${EStripeEvent}`;\n\n// ─── Checkout Session ──────────────────────────────────────────────────────\n\nexport type LineItemType = {\n price: string;\n quantity?: number;\n};\n\nexport type CheckoutSessionCreateType = {\n lineItems: LineItemType[];\n mode: \"payment\" | \"subscription\" | \"setup\";\n successUrl: string;\n cancelUrl?: string;\n customerId?: string;\n customerEmail?: string;\n metadata?: Record<string, string>;\n};\n\nexport type CheckoutSessionType = {\n id: string;\n url: string | null;\n status: string | null;\n paymentStatus: string;\n customerId: string | null;\n customerEmail: string | null;\n amountTotal: number | null;\n currency: string | null;\n metadata: Record<string, string>;\n};\n\n// ─── Webhook Event Data ────────────────────────────────────────────────────\n\nexport type CheckoutSessionCompletedDataType = {\n id: string;\n customerId: string | null;\n customerEmail: string | null;\n amountTotal: number | null;\n currency: string | null;\n paymentStatus: string;\n subscriptionId: string | null;\n metadata: Record<string, string>;\n};\n\nexport type InvoicePaidDataType = {\n id: string;\n customerId: string | null;\n subscriptionId: string | null;\n amountPaid: number;\n currency: string;\n status: string | null;\n hostedInvoiceUrl: string | null;\n};\n\nexport type CustomerSubscriptionDeletedDataType = {\n id: string;\n customerId: string | null;\n status: string;\n currentPeriodEnd: Date;\n canceledAt: Date | null;\n metadata: Record<string, string>;\n};\n\nexport type CustomerSubscriptionUpdatedDataType = {\n id: string;\n customerId: string | null;\n status: string;\n currentPeriodEnd: Date;\n cancelAtPeriodEnd: boolean;\n metadata: Record<string, string>;\n};\n\nexport type PaymentIntentPaymentFailedDataType = {\n id: string;\n customerId: string | null;\n amount: number;\n currency: string;\n lastPaymentErrorMessage: string | null;\n};\n\n// ─── Webhook Event Union ───────────────────────────────────────────────────\n\nexport type CheckoutSessionCompletedEventType = {\n type: EStripeEvent.CheckoutSessionCompleted;\n id: string;\n created: Date;\n data: CheckoutSessionCompletedDataType;\n};\n\nexport type InvoicePaidEventType = {\n type: EStripeEvent.InvoicePaid;\n id: string;\n created: Date;\n data: InvoicePaidDataType;\n};\n\nexport type CustomerSubscriptionDeletedEventType = {\n type: EStripeEvent.CustomerSubscriptionDeleted;\n id: string;\n created: Date;\n data: CustomerSubscriptionDeletedDataType;\n};\n\nexport type CustomerSubscriptionUpdatedEventType = {\n type: EStripeEvent.CustomerSubscriptionUpdated;\n id: string;\n created: Date;\n data: CustomerSubscriptionUpdatedDataType;\n};\n\nexport type PaymentIntentPaymentFailedEventType = {\n type: EStripeEvent.PaymentIntentPaymentFailed;\n id: string;\n created: Date;\n data: PaymentIntentPaymentFailedDataType;\n};\n\nexport type WebhookEventType =\n | CheckoutSessionCompletedEventType\n | InvoicePaidEventType\n | CustomerSubscriptionDeletedEventType\n | CustomerSubscriptionUpdatedEventType\n | PaymentIntentPaymentFailedEventType;\n\n// ─── Provider Interface ────────────────────────────────────────────────────\n\nexport interface IPaymentProvider {\n createCheckoutSession(data: CheckoutSessionCreateType): Promise<CheckoutSessionType>;\n retrieveSession(id: string): Promise<CheckoutSessionType>;\n constructWebhookEvent(\n payload: string | Buffer,\n signature: string,\n secret: string,\n ): Promise<WebhookEventType>;\n}\n\n// ─── Customer ─────────────────────────────────────────────────────────────\n\nexport type StripeCustomerAddressType = {\n line1?: string;\n line2?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n};\n\nexport type StripeCustomerCreateType = {\n email: string;\n name?: string;\n phone?: string;\n billingAddress?: StripeCustomerAddressType;\n metadata?: Record<string, string>;\n};\n\nexport type StripeCustomerUpdateType = {\n email?: string;\n name?: string;\n phone?: string;\n billingAddress?: StripeCustomerAddressType;\n metadata?: Record<string, string>;\n};\n\nexport type StripeCustomerType = {\n id: string;\n email: string;\n name?: string;\n phone?: string;\n billingAddress?: StripeCustomerAddressType;\n metadata?: Record<string, string>;\n createdAt?: Date;\n};\n\nexport type StripeCustomerListOptionsType = {\n email?: string;\n limit?: number;\n startingAfter?: string;\n};\n\nexport type StripeCustomerListResultType = {\n items: StripeCustomerType[];\n hasMore: boolean;\n};\n\n// ─── Customer Portal ───────────────────────────────────────────────────────\n\nexport type StripeCustomerPortalCreateType = {\n customerId: string;\n returnUrl: string;\n};\n\nexport type StripeCustomerPortalType = {\n id: string;\n url: string;\n returnUrl: string;\n createdAt?: Date;\n};\n\n// ─── Discount / Coupon ────────────────────────────────────────────────────\n\nexport enum EStripeDiscountType {\n PERCENTAGE = \"percentage\",\n FIXED = \"fixed\",\n}\n\nexport type StripeDiscountTypeType = `${EStripeDiscountType}`;\n\nexport enum EStripeDiscountDuration {\n ONCE = \"once\",\n REPEATING = \"repeating\",\n FOREVER = \"forever\",\n}\n\nexport type StripeDiscountDurationType = `${EStripeDiscountDuration}`;\n\nexport type StripeDiscountCreateType = {\n name: string;\n type: StripeDiscountTypeType;\n amount: number;\n currency?: string;\n duration: StripeDiscountDurationType;\n durationInMonths?: number;\n code?: string;\n maxRedemptions?: number;\n redeemBy?: Date;\n metadata?: Record<string, string>;\n appliesTo?: string[];\n};\n\nexport type StripeDiscountUpdateType = {\n name?: string;\n metadata?: Record<string, string>;\n};\n\nexport type StripeDiscountType = {\n id: string;\n name: string;\n type: StripeDiscountTypeType;\n amount: number;\n currency?: string;\n duration: StripeDiscountDurationType;\n durationInMonths?: number;\n code?: string;\n maxRedemptions?: number;\n timesRedeemed?: number;\n redeemBy?: Date;\n isValid?: boolean;\n metadata?: Record<string, string>;\n createdAt?: Date;\n};\n\nexport type StripeDiscountListOptionsType = {\n limit?: number;\n startingAfter?: string;\n};\n\nexport type StripeDiscountListResultType = {\n items: StripeDiscountType[];\n hasMore: boolean;\n};\n\n// ─── Products ─────────────────────────────────────────────────────────────\n\nexport type StripeProductCreateType = {\n name: string;\n description?: string;\n images?: string[];\n metadata?: Record<string, string>;\n active?: boolean;\n};\n\nexport type StripeProductUpdateType = {\n name?: string;\n description?: string;\n images?: string[];\n metadata?: Record<string, string>;\n active?: boolean;\n};\n\nexport type StripeProductType = {\n id: string;\n name: string;\n description?: string;\n images?: string[];\n active?: boolean;\n metadata?: Record<string, string>;\n createdAt?: Date;\n updatedAt?: Date;\n};\n\nexport type StripeProductListOptionsType = {\n limit?: number;\n active?: boolean;\n startingAfter?: string;\n};\n\nexport type StripeProductListResultType = {\n items: StripeProductType[];\n hasMore: boolean;\n};\n\nexport enum EStripePriceType {\n ONE_TIME = \"one_time\",\n RECURRING = \"recurring\",\n}\n\nexport type StripePriceTypeType = `${EStripePriceType}`;\n\nexport enum EStripePriceInterval {\n DAY = \"day\",\n WEEK = \"week\",\n MONTH = \"month\",\n YEAR = \"year\",\n}\n\nexport type StripePriceIntervalType = `${EStripePriceInterval}`;\n\nexport type StripePriceCreateType = {\n productId: string;\n currency: string;\n unitAmount: number;\n type?: StripePriceTypeType;\n interval?: StripePriceIntervalType;\n intervalCount?: number;\n metadata?: Record<string, string>;\n};\n\nexport type StripePriceType = {\n id: string;\n productId: string;\n currency: string;\n unitAmount: number | null;\n type: StripePriceTypeType;\n interval?: StripePriceIntervalType;\n intervalCount?: number;\n active?: boolean;\n metadata?: Record<string, string>;\n createdAt?: Date;\n};\n\nexport type StripePriceListOptionsType = {\n limit?: number;\n active?: boolean;\n};\n\nexport type StripePriceListResultType = {\n items: StripePriceType[];\n hasMore: boolean;\n};\n\n// ─── Analytics ────────────────────────────────────────────────────────────\n\nexport type StripeAnalyticsOptionsType = {\n startDate: Date;\n endDate: Date;\n limit?: number;\n currency?: string;\n};\n\nexport type StripeAnalyticsPeriodType = {\n date: string;\n revenue: number;\n currency: string;\n transactionCount: number;\n};\n\nexport type StripeAnalyticsSummaryType = {\n totalRevenue: number;\n totalTransactions: number;\n currency: string;\n periods: StripeAnalyticsPeriodType[];\n activeSubscriptions?: number;\n newSubscriptions?: number;\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;AAAA,GAAM;;;ADTN,MAAM,eAA2C;AAAA,EAEJ;AAAA,EACH;AAAA,EAF/C,WAAW,CACuC,iBACH,cAC7C;AAAA,IAFgD;AAAA,IACH;AAAA;AAAA,EAGxC,qBAAqB,CAAC,MAA+D;AAAA,IAC1F,OAAO,KAAK,gBAAgB,OAAO,IAAI;AAAA;AAAA,EAGlC,eAAe,CAAC,IAA0C;AAAA,IAC/D,OAAO,KAAK,gBAAgB,IAAI,EAAE;AAAA;AAAA,EAG7B,qBAAqB,CAC1B,SACA,WACA,QAC2B;AAAA,IAC3B,OAAO,KAAK,aAAa,UAAU,SAAS,WAAW,MAAM;AAAA;AAEjE;AArBa,iBAAN;AAAA,EADN,YAAW;AAAA,EAGP,mCAAO,qBAAqB;AAAA,EAC5B,mCAAO,kBAAkB;AAAA,EAHvB;AAAA;AAAA;AAAA;AAAA,GAAM;",
17
+ "debugId": "F73E4879FAD14F2B64756E2164756E21",
18
+ "names": []
19
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@bagou/payment-stripe",
3
+ "version": "0.0.1",
4
+ "description": "Stripe payment abstractions (StripeClient, CheckoutSession, WebhookEvent) for bagou-packages",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "LICENSE",
10
+ "README.md",
11
+ "package.json"
12
+ ],
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "scripts": {
25
+ "test": "bun test tests",
26
+ "build": "bunup",
27
+ "lint": "tsgo --noEmit && bunx biome lint",
28
+ "npm:publish": "bun publish --tolerate-republish --force --production --access public"
29
+ },
30
+ "dependencies": {
31
+ "@ooneex/container": "^1.5.1",
32
+ "@ooneex/payment": "^1.1.11",
33
+ "stripe": "^17.7.0"
34
+ },
35
+ "devDependencies": {
36
+ "@ooneex/currencies": "^1.1.12",
37
+ "@ooneex/types": "^1.3.7"
38
+ },
39
+ "keywords": [
40
+ "bagou",
41
+ "bun",
42
+ "checkout",
43
+ "payment",
44
+ "stripe",
45
+ "subscription",
46
+ "typescript",
47
+ "webhook"
48
+ ]
49
+ }