import type Stripe from 'stripe'; import { type BillableModel } from './contracts.js'; import type Subscription from './models/subscription.js'; import type SubscriptionItem from './models/subscription_item.js'; import { type NormalizeConstructor } from '@poppinss/utils/types'; import { type Secret } from '@adonisjs/core/helpers'; export type Constructor = new (...args: any[]) => T; export declare class Empty { } export type LazyImport = () => Promise<{ default: DefaultExport; }>; export type ShopkeeperConfig = { /** * The Stripe publishable key. */ key: Secret; /** * The Stripe secret key. */ secret: Secret; /** * Webhook configuration. */ webhook: { /** * Signing secret. * Webhooks are not validated when this option is not defined. * * In production, this is a required parameter. */ secret?: Secret; /** * Signature timing shift tolerance. */ tolerance: number; /** * List of events that will be configured on the generated webhook using `node ace shopkeeper:webhook`. */ events?: StripeEventTypes[]; /** * Enforce webhook secret to be defined. */ enforceSecret: boolean; }; /** * The default currency that will be used when generating charges from you application. */ currency: string; /** * The default currency locale that will be used when generating charges from you application. */ currencyLocale: string; /** * Models configuration. */ models: { /** * Configures your Billable model. * * @example () => import('#models/user') */ customerModel: LazyImport; /** * The Subscription model import. * * @example () => import('#models/subscription') */ subscriptionModel: LazyImport>; /** * The SubscriptionItem model import. * * @example () => import('#models/subscription_item') */ subscriptionItemModel: LazyImport>; }; /** * Enables automatic tax calculation. */ calculateTaxes: boolean; /** * Keep incomplete subscriptions active. */ keepIncompleteSubscriptionsActive: boolean; /** * Keep past due subscriptions active. */ keepPastDueSubscriptionsActive: boolean; /** * Enables the routes registration like the webhook handler. */ registerRoutes: boolean; /** * Defines the configuration used to create the Stripe SDK Instance. */ stripe?: Stripe.StripeConfig; }; export interface ResolvedConfig extends Omit { models: { customerModel: BillableModel; subscriptionModel: NormalizeConstructor; subscriptionItemModel: NormalizeConstructor; }; } export type StripeEventTypes = Stripe.Event['type']; type RelaxedStripeEventList = { [key in `stripe:${StripeEventTypes}` | `stripe:${StripeEventTypes}:handled`]: any; }; declare module '@adonisjs/core/types' { interface EventsList extends RelaxedStripeEventList { } } export {};