{"version":3,"sources":["../src/utils/metadata.utils.ts","../src/utils/error.utils.ts","../src/utils/retry.utils.ts","../src/adapters/customer.adapter.ts","../src/adapters/subscription.adapter.ts","../src/utils/currency.utils.ts","../src/adapters/payment.adapter.ts","../src/adapters/checkout.adapter.ts","../src/adapters/price.adapter.ts","../src/adapters/webhook.adapter.ts","../src/adapters/vendor.adapter.ts","../src/adapters/setup-intent.adapter.ts","../src/stripe.adapter.ts","../src/services/saved-card.service.ts"],"names":["QZPayErrorCode","subscription","Stripe"],"mappings":";;;;;;;;;;;AAiBO,IAAM,sBAAA,GAAyB;AAAA,EAClC,QAAA,EAAU,EAAA;AAAA,EACV,gBAAA,EAAkB;AACtB;AAsBO,SAAS,iBAAiB,QAAA,EAA2D;AACxF,EAAA,MAAM,SAAiC,EAAC;AACxC,EAAA,IAAI,QAAA,GAAW,CAAA;AAEf,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAEjD,IAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AACvC,MAAA;AAAA,IACJ;AAEA,IAAA,QAAA,EAAA;AAGA,IAAA,IAAI,QAAA,GAAW,uBAAuB,QAAA,EAAU;AAC5C,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,iCAAA,EAAoC,sBAAA,CAAuB,QAAQ,CAAA,KAAA,CAAO,CAAA;AAAA,IAC9F;AAGA,IAAA,MAAM,WAAA,GAAc,OAAO,KAAK,CAAA;AAGhC,IAAA,IAAI,WAAA,CAAY,MAAA,GAAS,sBAAA,CAAuB,gBAAA,EAAkB;AAC9D,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,2BAA2B,GAAG,CAAA,0BAAA,EAA6B,uBAAuB,gBAAgB,CAAA,sBAAA,EACjF,YAAY,MAAM,CAAA,CAAA;AAAA,OACvC;AAAA,IACJ;AAEA,IAAA,MAAA,CAAO,GAAG,CAAA,G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AAqB,MAAA,CAAO,QAAQ,CAAA,mBAAA,CAAqB,CAAA;AAAA,EAC7E;AAEA,EAAA,OAAO,IAAI,uBAAuB,MAAM,CAAA;AAC5C","file":"index.cjs","sourcesContent":["/**\n * Stripe Metadata Utilities\n *\n * Utilities for handling Stripe metadata with proper validation and limits\n *\n * STRIPE METADATA LIMITS:\n * - Maximum 50 keys per object\n * - Maximum 500 characters per value (after conversion to string)\n * - Keys must be strings\n * - Values are automatically converted to strings by Stripe\n *\n * Reference: https://docs.stripe.com/api/metadata\n */\n\n/**\n * Stripe metadata constraints\n */\nexport const STRIPE_METADATA_LIMITS = {\n    MAX_KEYS: 50,\n    MAX_VALUE_LENGTH: 500\n} as const;\n\n/**\n * Converts QZPay metadata to Stripe-compatible format\n *\n * - Filters out undefined and null values\n * - Converts all values to strings\n * - Validates against Stripe metadata limits\n *\n * @param metadata - The metadata object to convert\n * @returns Stripe-compatible metadata object\n * @throws {Error} If metadata exceeds Stripe limits\n *\n * @example\n * ```ts\n * toStripeMetadata({ userId: 123, plan: 'premium' })\n * // Returns: { userId: '123', plan: 'premium' }\n *\n * toStripeMetadata({ active: true, createdAt: new Date() })\n * // Returns: { active: 'true', createdAt: '2025-01-15T...' }\n * ```\n */\nexport function toStripeMetadata(metadata: Record<string, unknown>): Record<string, string> {\n    const result: Record<string, string> = {};\n    let keyCount = 0;\n\n    for (const [key, value] of Object.entries(metadata)) {\n        // Skip undefined and null values\n        if (value === undefined || value === null) {\n            continue;\n        }\n\n        keyCount++;\n\n        // Validate key count\n        if (keyCount > STRIPE_METADATA_LIMITS.MAX_KEYS) {\n            throw new Error(`Metadata exceeds Stripe limit of ${STRIPE_METADATA_LIMITS.MAX_KEYS} keys`);\n        }\n\n        // Convert value to string\n        const stringValue = String(value);\n\n        // Validate value length\n        if (stringValue.length > STRIPE_METADATA_LIMITS.MAX_VALUE_LENGTH) {\n            throw new Error(\n                `Metadata value for key '${key}' exceeds Stripe limit of ${STRIPE_METADATA_LIMITS.MAX_VALUE_LENGTH} characters ` +\n                    `(current: ${stringValue.length})`\n            );\n        }\n\n        result[key] = stringValue;\n    }\n\n    return result;\n}\n\n/**\n * Validates metadata against Stripe limits without conversion\n *\n * @param metadata - The metadata object to validate\n * @throws {Error} If metadata exceeds Stripe limits\n *\n * @example\n * ```ts\n * validateStripeMetadata({ userId: '123', plan: 'premium' }) // No error\n * validateStripeMetadata({ ...51 keys }) // Throws error\n * ```\n */\nexport function validateStripeMetadata(metadata: Record<string, unknown>): void {\n    toStripeMetadata(metadata);\n}\n","/**\n * Stripe Error Mapping Utilities\n *\n * Maps Stripe-specific errors to QZPay error types for consistent error handling\n */\nimport type Stripe from 'stripe';\n\n/**\n * QZPay error codes\n */\nexport enum QZPayErrorCode {\n    // Card errors\n    CARD_DECLINED = 'card_declined',\n    INSUFFICIENT_FUNDS = 'insufficient_funds',\n    EXPIRED_CARD = 'expired_card',\n    INCORRECT_CVC = 'incorrect_cvc',\n    INCORRECT_NUMBER = 'incorrect_number',\n    INVALID_EXPIRY = 'invalid_expiry',\n    PROCESSING_ERROR = 'processing_error',\n\n    // Validation errors\n    INVALID_REQUEST = 'invalid_request',\n    RESOURCE_NOT_FOUND = 'resource_not_found',\n    INVALID_PARAMETER = 'invalid_parameter',\n\n    // Rate limiting\n    RATE_LIMIT_EXCEEDED = 'rate_limit_exceeded',\n\n    // API errors\n    API_ERROR = 'api_error',\n    CONNECTION_ERROR = 'connection_error',\n    TIMEOUT_ERROR = 'timeout_error',\n\n    // Authentication\n    AUTHENTICATION_REQUIRED = 'authentication_required',\n    AUTHENTICATION_FAILED = 'authentication_failed',\n\n    // Generic\n    UNKNOWN_ERROR = 'unknown_error'\n}\n\n/**\n * QZPay error class\n */\nexport class QZPayError extends Error {\n    constructor(\n        public code: QZPayErrorCode,\n        message: string,\n        public statusCode = 500,\n        public originalError?: unknown\n    ) {\n        super(message);\n        this.name = 'QZPayError';\n    }\n}\n\n/**\n * Check if error is a Stripe error\n */\nfunction isStripeError(error: unknown): error is Stripe.StripeRawError {\n    return typeof error === 'object' && error !== null && 'type' in error && typeof (error as { type: unknown }).type === 'string';\n}\n\n/**\n * Map Stripe error to QZPay error\n */\nexport function mapStripeError(error: unknown): QZPayError {\n    // Handle non-Stripe errors\n    if (!isStripeError(error)) {\n        if (error instanceof Error) {\n            // Check for timeout errors\n            if (error.name === 'TimeoutError' || error.message.toLowerCase().includes('timeout')) {\n                return new QZPayError(QZPayErrorCode.TIMEOUT_ERROR, error.message, 408, error);\n            }\n            return new QZPayError(QZPayErrorCode.UNKNOWN_ERROR, error.message, 500, error);\n        }\n        return new QZPayError(QZPayErrorCode.UNKNOWN_ERROR, 'An unknown error occurred', 500, error);\n    }\n\n    const stripeError = error;\n    const errorType = stripeError.type as string;\n    const errorCode = stripeError.code;\n    const message = stripeError.message || 'An error occurred';\n\n    // Map Stripe error types to QZPay error codes\n    if (errorType === 'card_error') {\n        return mapCardError(errorCode, message, stripeError);\n    }\n    if (errorType === 'rate_limit_error') {\n        return new QZPayError(QZPayErrorCode.RATE_LIMIT_EXCEEDED, message, 429, stripeError);\n    }\n    if (errorType === 'invalid_request_error') {\n        return mapInvalidRequestError(errorCode, message, stripeError);\n    }\n    if (errorType === 'api_error') {\n        return new QZPayError(QZPayErrorCode.API_ERROR, message, 500, stripeError);\n    }\n    if (errorType === 'authentication_error') {\n        return new QZPayError(QZPayErrorCode.AUTHENTICATION_FAILED, message, 401, stripeError);\n    }\n    if (errorType === 'idempotency_error') {\n        return new QZPayError(QZPayErrorCode.INVALID_REQUEST, message, 400, stripeError);\n    }\n\n    // Handle connection errors (no specific type in Stripe, check by name or message)\n    if (message.toLowerCase().includes('connection')) {\n        return new QZPayError(QZPayErrorCode.CONNECTION_ERROR, message, 503, stripeError);\n    }\n\n    return new QZPayError(QZPayErrorCode.UNKNOWN_ERROR, message, 500, stripeError);\n}\n\n/**\n * Map Stripe card errors\n */\nfunction mapCardError(code: string | undefined, message: string, originalError: Stripe.StripeRawError): QZPayError {\n    const codeMap: Record<string, QZPayErrorCode> = {\n        card_declined: QZPayErrorCode.CARD_DECLINED,\n        insufficient_funds: QZPayErrorCode.INSUFFICIENT_FUNDS,\n        expired_card: QZPayErrorCode.EXPIRED_CARD,\n        incorrect_cvc: QZPayErrorCode.INCORRECT_CVC,\n        incorrect_number: QZPayErrorCode.INCORRECT_NUMBER,\n        invalid_expiry_month: QZPayErrorCode.INVALID_EXPIRY,\n        invalid_expiry_year: QZPayErrorCode.INVALID_EXPIRY,\n        invalid_expiry_month_past: QZPayErrorCode.INVALID_EXPIRY,\n        invalid_expiry_year_past: QZPayErrorCode.INVALID_EXPIRY,\n        processing_error: QZPayErrorCode.PROCESSING_ERROR,\n        card_velocity_exceeded: QZPayErrorCode.RATE_LIMIT_EXCEEDED,\n        authentication_required: QZPayErrorCode.AUTHENTICATION_REQUIRED\n    };\n\n    const qzpayCode = (code && codeMap[code]) || QZPayErrorCode.CARD_DECLINED;\n    return new QZPayError(qzpayCode, message, 402, originalError);\n}\n\n/**\n * Map Stripe invalid request errors\n */\nfunction mapInvalidRequestError(code: string | undefined, message: string, originalError: Stripe.StripeRawError): QZPayError {\n    // Check if it's a not found error\n    if (message.toLowerCase().includes('no such')) {\n        return new QZPayError(QZPayErrorCode.RESOURCE_NOT_FOUND, message, 404, originalError);\n    }\n\n    // Check if it's a parameter error\n    if (code === 'parameter_invalid_empty' || code === 'parameter_invalid_integer' || code === 'parameter_missing') {\n        return new QZPayError(QZPayErrorCode.INVALID_PARAMETER, message, 400, originalError);\n    }\n\n    return new QZPayError(QZPayErrorCode.INVALID_REQUEST, message, 400, originalError);\n}\n\n/**\n * Wrap async function with error mapping\n */\nexport function withErrorMapping<T extends (...args: never[]) => Promise<unknown>>(\n    fn: T\n): (...args: Parameters<T>) => Promise<ReturnType<T>> {\n    return async (...args: Parameters<T>): Promise<ReturnType<T>> => {\n        try {\n            return (await fn(...args)) as ReturnType<T>;\n        } catch (error) {\n            throw mapStripeError(error);\n        }\n    };\n}\n","/**\n * Retry Utilities with Exponential Backoff\n *\n * Provides retry logic for transient errors with configurable exponential backoff.\n * Only retries on errors that are likely to succeed on retry (network, rate limiting, server errors).\n */\n\nimport { QZPayError, QZPayErrorCode } from './error.utils.js';\n\n/**\n * Retry configuration options\n */\nexport interface RetryConfig {\n    /**\n     * Enable or disable retry logic\n     * @default true\n     */\n    enabled: boolean;\n\n    /**\n     * Maximum number of retry attempts\n     * @default 3\n     */\n    maxAttempts: number;\n\n    /**\n     * Initial delay in milliseconds before first retry\n     * @default 1000 (1 second)\n     */\n    initialDelayMs: number;\n\n    /**\n     * Maximum delay in milliseconds between retries\n     * @default 8000 (8 seconds)\n     */\n    maxDelayMs: number;\n\n    /**\n     * Backoff multiplier (delay doubles each retry by default)\n     * @default 2\n     */\n    backoffMultiplier: number;\n\n    /**\n     * Custom logger function for retry attempts\n     */\n    logger?: (message: string, context: Record<string, unknown>) => void;\n}\n\n/**\n * Default retry configuration\n */\nexport const DEFAULT_RETRY_CONFIG: RetryConfig = {\n    enabled: true,\n    maxAttempts: 3,\n    initialDelayMs: 1000,\n    maxDelayMs: 8000,\n    backoffMultiplier: 2\n};\n\n/**\n * Check if error is retriable (transient error that might succeed on retry)\n *\n * Retriable errors:\n * - Network errors / timeouts\n * - Rate limiting (429)\n * - Server errors (5xx)\n *\n * Non-retriable errors:\n * - Validation errors (400)\n * - Authentication (401, 403)\n * - Not found (404)\n * - Card errors\n */\nexport function isRetriableError(error: unknown): boolean {\n    // Handle QZPay errors\n    if (error instanceof QZPayError) {\n        const retriableCodes: QZPayErrorCode[] = [\n            QZPayErrorCode.RATE_LIMIT_EXCEEDED,\n            QZPayErrorCode.API_ERROR,\n            QZPayErrorCode.CONNECTION_ERROR,\n            QZPayErrorCode.TIMEOUT_ERROR\n        ];\n\n        return retriableCodes.includes(error.code);\n    }\n\n    // Handle native errors\n    if (error instanceof Error) {\n        const message = error.message.toLowerCase();\n        const errorName = error.name.toLowerCase();\n\n        // Network and timeout errors\n        if (\n            message.includes('timeout') ||\n            message.includes('network') ||\n            message.includes('econnreset') ||\n            message.includes('econnrefused') ||\n            message.includes('etimedout') ||\n            errorName.includes('timeout')\n        ) {\n            return true;\n        }\n\n        // Rate limiting\n        if (message.includes('rate limit') || message.includes('too many requests')) {\n            return true;\n        }\n\n        // Server errors\n        if (message.includes('internal server error') || message.includes('service unavailable')) {\n            return true;\n        }\n    }\n\n    // Handle errors with status codes\n    if (error && typeof error === 'object' && 'statusCode' in error) {\n        const statusCode = (error as { statusCode: number }).statusCode;\n\n        // Retry on:\n        // - 429 (Rate Limit)\n        // - 500 (Internal Server Error)\n        // - 502 (Bad Gateway)\n        // - 503 (Service Unavailable)\n        // - 504 (Gateway Timeout)\n        return statusCode === 429 || (statusCode >= 500 && statusCode < 600);\n    }\n\n    return false;\n}\n\n/**\n * Calculate delay for exponential backoff\n */\nfunction calculateDelay(attempt: number, config: RetryConfig): number {\n    const delay = config.initialDelayMs * config.backoffMultiplier ** (attempt - 1);\n    return Math.min(delay, config.maxDelayMs);\n}\n\n/**\n * Sleep for specified milliseconds\n */\nfunction sleep(ms: number): Promise<void> {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Execute operation with retry logic\n *\n * @param operation - Async operation to execute\n * @param config - Retry configuration\n * @param context - Context string for logging (e.g., \"Create payment\")\n * @returns Result of the operation\n * @throws Last error if all retries fail\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n *     () => stripe.paymentIntents.create(params),\n *     { maxAttempts: 3, initialDelayMs: 1000 },\n *     \"Create PaymentIntent\"\n * );\n * ```\n */\nexport async function withRetry<T>(operation: () => Promise<T>, config: Partial<RetryConfig> = {}, context = 'Operation'): Promise<T> {\n    const finalConfig: RetryConfig = {\n        ...DEFAULT_RETRY_CONFIG,\n        ...config\n    };\n\n    // If retry is disabled, execute once\n    if (!finalConfig.enabled) {\n        return operation();\n    }\n\n    let lastError: unknown;\n    let attempt = 0;\n\n    while (attempt < finalConfig.maxAttempts) {\n        attempt++;\n\n        try {\n            return await operation();\n        } catch (error) {\n            lastError = error;\n\n            // Check if we should retry\n            const shouldRetry = isRetriableError(error);\n            const isLastAttempt = attempt >= finalConfig.maxAttempts;\n\n            if (!shouldRetry || isLastAttempt) {\n                // Log final failure\n                if (finalConfig.logger) {\n                    finalConfig.logger(`${context} failed after ${attempt} attempt(s)`, {\n                        attempt,\n                        error: error instanceof Error ? error.message : String(error),\n                        retriable: shouldRetry\n                    });\n                }\n                throw error;\n            }\n\n            // Calculate delay and retry\n            const delay = calculateDelay(attempt, finalConfig);\n\n            // Log retry attempt\n            if (finalConfig.logger) {\n                finalConfig.logger(`${context} failed, retrying in ${delay}ms`, {\n                    attempt,\n                    maxAttempts: finalConfig.maxAttempts,\n                    delay,\n                    error: error instanceof Error ? error.message : String(error)\n                });\n            }\n\n            await sleep(delay);\n        }\n    }\n\n    // This should never be reached, but TypeScript requires it\n    throw lastError;\n}\n\n/**\n * Create a retry wrapper function with preset configuration\n *\n * @param config - Default retry configuration\n * @returns Function to execute operations with retry\n *\n * @example\n * ```typescript\n * const retryFn = createRetryWrapper({ maxAttempts: 5 });\n * const result = await retryFn(() => apiCall(), \"API Call\");\n * ```\n */\nexport function createRetryWrapper(config: Partial<RetryConfig> = {}) {\n    return <T>(operation: () => Promise<T>, context?: string): Promise<T> => {\n        return withRetry(operation, config, context);\n    };\n}\n","import type { QZPayPaymentCustomerAdapter, QZPayProviderCreateCustomerInput, QZPayProviderCustomer } from '@qazuor/qzpay-core';\n/**\n * Stripe Customer Adapter\n *\n * Implements QZPayPaymentCustomerAdapter for Stripe\n */\nimport type Stripe from 'stripe';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\nimport { type RetryConfig, withRetry } from '../utils/retry.utils.js';\n\nexport class QZPayStripeCustomerAdapter implements QZPayPaymentCustomerAdapter {\n    constructor(\n        private readonly stripe: Stripe,\n        private readonly retryConfig?: Partial<RetryConfig>\n    ) {}\n\n    /**\n     * Create a customer in Stripe\n     */\n    async create(input: QZPayProviderCreateCustomerInput): Promise<string> {\n        return withRetry(\n            async () => {\n                const params: Stripe.CustomerCreateParams = {\n                    email: input.email\n                };\n\n                if (input.name) {\n                    params.name = input.name;\n                }\n\n                // Build metadata with externalId\n                const metadata: Record<string, string> = {};\n\n                // Add externalId to metadata if provided\n                if ('externalId' in input && input.externalId) {\n                    // biome-ignore lint/complexity/useLiteralKeys: Index signature requires bracket notation\n                    metadata['qzpay_external_id'] = input.externalId;\n                }\n\n                // Merge with custom metadata\n                if (input.metadata) {\n                    Object.assign(metadata, toStripeMetadata(input.metadata));\n                }\n\n                if (Object.keys(metadata).length > 0) {\n                    params.metadata = metadata;\n                }\n\n                const customer = await this.stripe.customers.create(params);\n\n                return customer.id;\n            },\n            this.retryConfig,\n            'Create customer'\n        );\n    }\n\n    /**\n     * Update a customer in Stripe\n     */\n    async update(providerCustomerId: string, input: Partial<QZPayProviderCreateCustomerInput>): Promise<void> {\n        return withRetry(\n            async () => {\n                const params: Stripe.CustomerUpdateParams = {};\n\n                if (input.email !== undefined) {\n                    params.email = input.email;\n                }\n\n                if (input.name !== undefined && input.name !== null) {\n                    params.name = input.name;\n                }\n\n                if (input.metadata !== undefined) {\n                    params.metadata = toStripeMetadata(input.metadata);\n                }\n\n                await this.stripe.customers.update(providerCustomerId, params);\n            },\n            this.retryConfig,\n            'Update customer'\n        );\n    }\n\n    /**\n     * Delete a customer in Stripe\n     */\n    async delete(providerCustomerId: string): Promise<void> {\n        return withRetry(\n            async () => {\n                await this.stripe.customers.del(providerCustomerId);\n            },\n            this.retryConfig,\n            'Delete customer'\n        );\n    }\n\n    /**\n     * Retrieve a customer from Stripe\n     */\n    async retrieve(providerCustomerId: string): Promise<QZPayProviderCustomer> {\n        return withRetry(\n            async () => {\n                const customer = await this.stripe.customers.retrieve(providerCustomerId);\n\n                if (customer.deleted) {\n                    throw new Error(`Customer ${providerCustomerId} has been deleted`);\n                }\n\n                return {\n                    id: customer.id,\n                    email: customer.email ?? '',\n                    name: customer.name ?? null,\n                    metadata: (customer.metadata as Record<string, string>) ?? {}\n                };\n            },\n            this.retryConfig,\n            'Retrieve customer'\n        );\n    }\n}\n","import type {\n    QZPayPaymentSubscriptionAdapter,\n    QZPayProviderCreateSubscriptionInput,\n    QZPayProviderSubscription,\n    QZPayUpdateSubscriptionInput\n} from '@qazuor/qzpay-core';\n/**\n * Stripe Subscription Adapter\n *\n * Implements QZPayPaymentSubscriptionAdapter for Stripe\n *\n * LIMITATION: Stripe subscriptions support multiple items, but this adapter\n * currently handles only single-item subscriptions (1 price per subscription).\n * Multi-item subscriptions will be supported in a future version.\n */\nimport type Stripe from 'stripe';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\nimport { type RetryConfig, withRetry } from '../utils/retry.utils.js';\n\nexport class QZPayStripeSubscriptionAdapter implements QZPayPaymentSubscriptionAdapter {\n    constructor(\n        private readonly stripe: Stripe,\n        private readonly retryConfig?: Partial<RetryConfig>\n    ) {}\n\n    /**\n     * Create a subscription in Stripe.\n     *\n     * Reads `providerCustomerId`, `providerPriceId`, and the original\n     * `input.quantity` / `input.trialDays` / `input.metadata` from the\n     * orchestrator-resolved input. Fields specific to MercadoPago preapprovals\n     * (`backUrl`, `notificationUrl`, `freeTrialDays`, etc.) are intentionally\n     * ignored — Stripe handles those differently (default payment method on\n     * customer, webhook endpoints configured at account level, trial via\n     * `trial_period_days`).\n     */\n    async create(providerInput: QZPayProviderCreateSubscriptionInput): Promise<QZPayProviderSubscription> {\n        return withRetry(\n            async () => {\n                if (!providerInput.providerPriceId) {\n                    throw new Error('Stripe subscription create requires providerPriceId');\n                }\n                // Stripe's `customer` field is required at the API boundary —\n                // core no longer gates this globally (the MercadoPago adapter\n                // does not need it), so each adapter that needs it validates\n                // here. See `QZPayProviderCreateSubscriptionInput.providerCustomerId`\n                // JSDoc for the convention.\n                if (!providerInput.providerCustomerId) {\n                    throw new Error(\n                        'Stripe subscription create requires providerCustomerId (the local customer must have providerCustomerIds[\"stripe\"] populated)'\n                    );\n                }\n                const params: Stripe.SubscriptionCreateParams = {\n                    customer: providerInput.providerCustomerId,\n                    items: [{ price: providerInput.providerPriceId, quantity: providerInput.input.quantity ?? 1 }],\n                    metadata: providerInput.input.metadata ? toStripeMetadata(providerInput.input.metadata) : {}\n                };\n\n                if (providerInput.input.trialDays !== undefined && providerInput.input.trialDays > 0) {\n                    params.trial_period_days = providerInput.input.trialDays;\n                }\n\n                const subscription = await this.stripe.subscriptions.create(params);\n\n                return this.mapSubscription(subscription);\n            },\n            this.retryConfig,\n            'Create subscription'\n        );\n    }\n\n    /**\n     * Update a subscription in Stripe\n     */\n    async update(providerSubscriptionId: string, input: QZPayUpdateSubscriptionInput): Promise<QZPayProviderSubscription> {\n        return withRetry(\n            async () => {\n                const params: Stripe.SubscriptionUpdateParams = {};\n\n                if (input.metadata !== undefined) {\n                    params.metadata = toStripeMetadata(input.metadata);\n                }\n\n                if (input.prorationBehavior !== undefined) {\n                    params.proration_behavior = input.prorationBehavior;\n                }\n\n                if (input.cancelAt !== undefined) {\n                    params.cancel_at = Math.floor(input.cancelAt.getTime() / 1000);\n                }\n\n                // Handle plan change\n                if (input.planId !== undefined) {\n                    const subscription = await this.stripe.subscriptions.retrieve(providerSubscriptionId);\n\n                    // Validate that subscription has items\n                    if (!subscription.items.data.length) {\n                        throw new Error('Subscription has no items to update');\n                    }\n\n                    const currentItem = subscription.items.data[0];\n                    if (!currentItem) {\n                        throw new Error('Subscription has no items to update');\n                    }\n\n                    params.items = [\n                        {\n                            id: currentItem.id,\n                            price: input.planId, // planId maps to priceId in Stripe\n                            quantity: input.quantity ?? currentItem.quantity ?? 1\n                        }\n                    ];\n                }\n\n                const subscription = await this.stripe.subscriptions.update(providerSubscriptionId, params);\n\n                return this.mapSubscription(subscription);\n            },\n            this.retryConfig,\n            'Update subscription'\n        );\n    }\n\n    /**\n     * Cancel a subscription in Stripe\n     */\n    async cancel(providerSubscriptionId: string, cancelAtPeriodEnd: boolean): Promise<void> {\n        return withRetry(\n            async () => {\n                if (cancelAtPeriodEnd) {\n                    await this.stripe.subscriptions.update(providerSubscriptionId, {\n                        cancel_at_period_end: true\n                    });\n                } else {\n                    await this.stripe.subscriptions.cancel(providerSubscriptionId);\n                }\n            },\n            this.retryConfig,\n            'Cancel subscription'\n        );\n    }\n\n    /**\n     * Pause a subscription in Stripe\n     * Note: Stripe uses \"pause_collection\" to pause billing\n     */\n    async pause(providerSubscriptionId: string): Promise<void> {\n        return withRetry(\n            async () => {\n                await this.stripe.subscriptions.update(providerSubscriptionId, {\n                    pause_collection: {\n                        behavior: 'void'\n                    }\n                });\n            },\n            this.retryConfig,\n            'Pause subscription'\n        );\n    }\n\n    /**\n     * Resume a paused subscription in Stripe\n     */\n    async resume(providerSubscriptionId: string): Promise<void> {\n        return withRetry(\n            async () => {\n                await this.stripe.subscriptions.update(providerSubscriptionId, {\n                    pause_collection: ''\n                });\n            },\n            this.retryConfig,\n            'Resume subscription'\n        );\n    }\n\n    /**\n     * Reverse a period-end soft-cancel in Stripe: clear `cancel_at_period_end`.\n     *\n     * The exact inverse of {@link cancel}(id, true) (which sets\n     * `cancel_at_period_end: true`), so Stripe no longer terminates the\n     * subscription at period end. This is a DIFFERENT axis from\n     * {@link pause}/{@link resume} (which use `pause_collection`), so `uncancel`\n     * must not be conflated with `resume`.\n     */\n    async uncancel(providerSubscriptionId: string): Promise<void> {\n        return withRetry(\n            async () => {\n                await this.stripe.subscriptions.update(providerSubscriptionId, {\n                    cancel_at_period_end: false\n                });\n            },\n            this.retryConfig,\n            'Uncancel subscription'\n        );\n    }\n\n    /**\n     * Retrieve a subscription from Stripe\n     */\n    async retrieve(providerSubscriptionId: string): Promise<QZPayProviderSubscription> {\n        return withRetry(\n            async () => {\n                const subscription = await this.stripe.subscriptions.retrieve(providerSubscriptionId);\n                return this.mapSubscription(subscription);\n            },\n            this.retryConfig,\n            'Retrieve subscription'\n        );\n    }\n\n    /**\n     * Map Stripe subscription to QZPay provider subscription\n     */\n    private mapSubscription(subscription: Stripe.Subscription): QZPayProviderSubscription {\n        return {\n            id: subscription.id,\n            status: subscription.status,\n            currentPeriodStart: new Date(subscription.current_period_start * 1000),\n            currentPeriodEnd: new Date(subscription.current_period_end * 1000),\n            cancelAtPeriodEnd: subscription.cancel_at_period_end,\n            canceledAt: subscription.canceled_at ? new Date(subscription.canceled_at * 1000) : null,\n            trialStart: subscription.trial_start ? new Date(subscription.trial_start * 1000) : null,\n            trialEnd: subscription.trial_end ? new Date(subscription.trial_end * 1000) : null,\n            metadata: (subscription.metadata as Record<string, string>) ?? {}\n        };\n    }\n}\n","/**\n * Stripe Currency Utilities\n *\n * Validation utilities for Stripe-supported currencies\n */\n\n/**\n * List of currencies supported by Stripe\n *\n * Reference: https://docs.stripe.com/currencies\n * Last updated: January 2025\n */\nexport const STRIPE_SUPPORTED_CURRENCIES = new Set([\n    'usd',\n    'aed',\n    'afn',\n    'all',\n    'amd',\n    'ang',\n    'aoa',\n    'ars',\n    'aud',\n    'awg',\n    'azn',\n    'bam',\n    'bbd',\n    'bdt',\n    'bgn',\n    'bif',\n    'bmd',\n    'bnd',\n    'bob',\n    'brl',\n    'bsd',\n    'bwp',\n    'byn',\n    'bzd',\n    'cad',\n    'cdf',\n    'chf',\n    'clp',\n    'cny',\n    'cop',\n    'crc',\n    'cve',\n    'czk',\n    'djf',\n    'dkk',\n    'dop',\n    'dzd',\n    'egp',\n    'etb',\n    'eur',\n    'fjd',\n    'fkp',\n    'gbp',\n    'gel',\n    'gip',\n    'gmd',\n    'gnf',\n    'gtq',\n    'gyd',\n    'hkd',\n    'hnl',\n    'hrk',\n    'htg',\n    'huf',\n    'idr',\n    'ils',\n    'inr',\n    'isk',\n    'jmd',\n    'jpy',\n    'kes',\n    'kgs',\n    'khr',\n    'kmf',\n    'krw',\n    'kyd',\n    'kzt',\n    'lak',\n    'lbp',\n    'lkr',\n    'lrd',\n    'lsl',\n    'mad',\n    'mdl',\n    'mga',\n    'mkd',\n    'mmk',\n    'mnt',\n    'mop',\n    'mro',\n    'mur',\n    'mvr',\n    'mwk',\n    'mxn',\n    'myr',\n    'mzn',\n    'nad',\n    'ngn',\n    'nio',\n    'nok',\n    'npr',\n    'nzd',\n    'pab',\n    'pen',\n    'pgk',\n    'php',\n    'pkr',\n    'pln',\n    'pyg',\n    'qar',\n    'ron',\n    'rsd',\n    'rub',\n    'rwf',\n    'sar',\n    'sbd',\n    'scr',\n    'sek',\n    'sgd',\n    'shp',\n    'sle',\n    'sll',\n    'sos',\n    'srd',\n    'std',\n    'szl',\n    'thb',\n    'tjs',\n    'tnd',\n    'top',\n    'try',\n    'ttd',\n    'twd',\n    'tzs',\n    'uah',\n    'ugx',\n    'uyu',\n    'uzs',\n    'vnd',\n    'vuv',\n    'wst',\n    'xaf',\n    'xcd',\n    'xof',\n    'xpf',\n    'yer',\n    'zar',\n    'zmw'\n]);\n\n/**\n * Validates if a currency code is supported by Stripe\n *\n * @param currency - The currency code to validate (e.g., 'USD', 'EUR')\n * @returns True if the currency is supported, false otherwise\n *\n * @example\n * ```ts\n * isValidStripeCurrency('USD') // true\n * isValidStripeCurrency('EUR') // true\n * isValidStripeCurrency('XYZ') // false\n * ```\n */\nexport function isValidStripeCurrency(currency: string): boolean {\n    return STRIPE_SUPPORTED_CURRENCIES.has(currency.toLowerCase());\n}\n\n/**\n * Validates a currency and throws an error if not supported\n *\n * @param currency - The currency code to validate\n * @throws {Error} If the currency is not supported by Stripe\n *\n * @example\n * ```ts\n * validateStripeCurrency('USD') // No error\n * validateStripeCurrency('XYZ') // Throws error\n * ```\n */\nexport function validateStripeCurrency(currency: string): void {\n    if (!isValidStripeCurrency(currency)) {\n        throw new Error(\n            `Currency '${currency}' is not supported by Stripe. See https://docs.stripe.com/currencies for supported currencies.`\n        );\n    }\n}\n","import type {\n    QZPayCreatePaymentInput,\n    QZPayPaymentPaymentAdapter,\n    QZPayProviderPayment,\n    QZPayProviderRefund,\n    QZPayRefundInput\n} from '@qazuor/qzpay-core';\n/**\n * Stripe Payment Adapter\n *\n * Implements QZPayPaymentPaymentAdapter for Stripe\n */\nimport type Stripe from 'stripe';\nimport { validateStripeCurrency } from '../utils/currency.utils.js';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\nimport { type RetryConfig, withRetry } from '../utils/retry.utils.js';\n\nexport class QZPayStripePaymentAdapter implements QZPayPaymentPaymentAdapter {\n    constructor(\n        private readonly stripe: Stripe,\n        private readonly retryConfig?: Partial<RetryConfig>\n    ) {}\n\n    /**\n     * Create a payment (PaymentIntent) in Stripe\n     */\n    async create(providerCustomerId: string, input: QZPayCreatePaymentInput): Promise<QZPayProviderPayment> {\n        return withRetry(\n            async () => {\n                // Validate currency is supported by Stripe\n                validateStripeCurrency(input.currency);\n\n                const params: Stripe.PaymentIntentCreateParams = {\n                    customer: providerCustomerId,\n                    amount: input.amount,\n                    currency: input.currency.toLowerCase(),\n                    metadata: input.metadata ? toStripeMetadata(input.metadata) : {}\n                };\n\n                // Set payment method if provided\n                if (input.paymentMethodId) {\n                    params.payment_method = input.paymentMethodId;\n                    params.confirm = true;\n\n                    // Explicitly set payment method types to card only\n                    // This prevents Stripe from using automatic_payment_methods which may include redirect-based methods\n                    params.payment_method_types = ['card'];\n\n                    // Configure 3DS behavior\n                    params.payment_method_options = {\n                        card: {\n                            request_three_d_secure: 'automatic'\n                        }\n                    };\n\n                    // Return URL for 3DS redirect (if needed for hosted 3DS)\n                    // biome-ignore lint/complexity/useLiteralKeys: Index signature requires bracket notation\n                    if (input.metadata?.['return_url']) {\n                        // biome-ignore lint/complexity/useLiteralKeys: Index signature requires bracket notation\n                        params.return_url = input.metadata['return_url'] as string;\n                    }\n                }\n\n                const paymentIntent = await this.stripe.paymentIntents.create(params);\n\n                return this.mapPaymentIntent(paymentIntent);\n            },\n            this.retryConfig,\n            'Create payment'\n        );\n    }\n\n    /**\n     * Capture a payment in Stripe\n     */\n    async capture(providerPaymentId: string): Promise<QZPayProviderPayment> {\n        return withRetry(\n            async () => {\n                const paymentIntent = await this.stripe.paymentIntents.capture(providerPaymentId);\n                return this.mapPaymentIntent(paymentIntent);\n            },\n            this.retryConfig,\n            'Capture payment'\n        );\n    }\n\n    /**\n     * Cancel a payment in Stripe\n     */\n    async cancel(providerPaymentId: string): Promise<void> {\n        return withRetry(\n            async () => {\n                await this.stripe.paymentIntents.cancel(providerPaymentId);\n            },\n            this.retryConfig,\n            'Cancel payment'\n        );\n    }\n\n    /**\n     * Create a refund in Stripe\n     */\n    async refund(input: QZPayRefundInput, providerPaymentId: string): Promise<QZPayProviderRefund> {\n        return withRetry(\n            async () => {\n                const params: Stripe.RefundCreateParams = {\n                    payment_intent: providerPaymentId\n                };\n\n                // Set refund amount if partial\n                if (input.amount !== undefined) {\n                    params.amount = input.amount;\n                }\n\n                // Set reason if provided\n                if (input.reason) {\n                    params.reason = this.mapRefundReason(input.reason);\n                }\n\n                const refund = await this.stripe.refunds.create(params);\n\n                return {\n                    id: refund.id,\n                    status: refund.status ?? 'pending',\n                    amount: refund.amount\n                };\n            },\n            this.retryConfig,\n            'Refund payment'\n        );\n    }\n\n    /**\n     * Retrieve a payment from Stripe\n     */\n    async retrieve(providerPaymentId: string): Promise<QZPayProviderPayment> {\n        return withRetry(\n            async () => {\n                const paymentIntent = await this.stripe.paymentIntents.retrieve(providerPaymentId);\n                return this.mapPaymentIntent(paymentIntent);\n            },\n            this.retryConfig,\n            'Retrieve payment'\n        );\n    }\n\n    /**\n     * Map Stripe PaymentIntent to QZPay provider payment\n     */\n    private mapPaymentIntent(paymentIntent: Stripe.PaymentIntent): QZPayProviderPayment {\n        const result: QZPayProviderPayment = {\n            id: paymentIntent.id,\n            status: this.mapPaymentIntentStatus(paymentIntent.status),\n            amount: paymentIntent.amount,\n            currency: paymentIntent.currency.toUpperCase(),\n            metadata: (paymentIntent.metadata as Record<string, string>) ?? {}\n        };\n\n        // Include client secret for 3DS authentication\n        if (paymentIntent.status === 'requires_action' || paymentIntent.status === 'requires_confirmation') {\n            if (paymentIntent.client_secret) {\n                result.clientSecret = paymentIntent.client_secret;\n            }\n\n            // Include next action details if available\n            if (paymentIntent.next_action) {\n                const nextActionType = paymentIntent.next_action.type;\n                const nextAction: { type: string; redirectUrl?: string } = {\n                    type: nextActionType\n                };\n\n                if (nextActionType === 'redirect_to_url' && paymentIntent.next_action.redirect_to_url?.url) {\n                    nextAction.redirectUrl = paymentIntent.next_action.redirect_to_url.url;\n                }\n\n                result.nextAction = nextAction;\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * Map Stripe PaymentIntent status to string\n     */\n    private mapPaymentIntentStatus(status: Stripe.PaymentIntent.Status): string {\n        const statusMap: Record<Stripe.PaymentIntent.Status, string> = {\n            requires_payment_method: 'requires_payment_method',\n            requires_confirmation: 'requires_confirmation',\n            requires_action: 'requires_action',\n            processing: 'processing',\n            requires_capture: 'requires_capture',\n            canceled: 'canceled',\n            succeeded: 'succeeded'\n        };\n\n        return statusMap[status] ?? status;\n    }\n\n    /**\n     * Map QZPay refund reason to Stripe reason\n     */\n    private mapRefundReason(reason: string): Stripe.RefundCreateParams.Reason {\n        const reasonMap: Record<string, Stripe.RefundCreateParams.Reason> = {\n            duplicate: 'duplicate',\n            fraudulent: 'fraudulent',\n            requested_by_customer: 'requested_by_customer'\n        };\n\n        return reasonMap[reason] ?? 'requested_by_customer';\n    }\n}\n","import type { QZPayPaymentCheckoutAdapter, QZPayProviderCheckout, QZPayProviderCreateCheckoutInput } from '@qazuor/qzpay-core';\n/**\n * Stripe Checkout Adapter\n *\n * Implements QZPayPaymentCheckoutAdapter for Stripe Checkout Sessions\n */\nimport type Stripe from 'stripe';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\n\nexport class QZPayStripeCheckoutAdapter implements QZPayPaymentCheckoutAdapter {\n    constructor(private readonly stripe: Stripe) {}\n\n    /**\n     * Create a Checkout Session in Stripe\n     */\n    async create(roro: QZPayProviderCreateCheckoutInput): Promise<QZPayProviderCheckout> {\n        const { input } = roro;\n        const lineItems: Stripe.Checkout.SessionCreateParams.LineItem[] = roro.resolvedLineItems.map((resolved, index) => {\n            const quantity = input.lineItems[index]?.quantity ?? 1;\n            if (resolved.providerPriceId) {\n                return { price: resolved.providerPriceId, quantity };\n            }\n            // Inline-amount path: Stripe lets callers build price_data on the fly\n            // for one-time line items without a pre-registered price object.\n            return {\n                quantity,\n                price_data: {\n                    currency: resolved.currency,\n                    product_data: { name: resolved.title },\n                    unit_amount: resolved.unitAmount\n                }\n            };\n        });\n\n        const params: Stripe.Checkout.SessionCreateParams = {\n            line_items: lineItems,\n            mode: input.mode === 'subscription' ? 'subscription' : 'payment',\n            success_url: input.successUrl,\n            cancel_url: input.cancelUrl,\n            metadata: input.metadata ? toStripeMetadata(input.metadata) : {}\n        };\n\n        // External reference correlates webhooks back to the local checkout\n        // UUID set by billing.checkout.create().\n        if (roro.externalReference) {\n            params.client_reference_id = roro.externalReference;\n        }\n\n        // Set customer from the resolved record when available, falling back to\n        // raw input fields for adapter-direct callers.\n        const providerCustomerId = roro.customer?.providerCustomerId ?? input.customerId;\n        const customerEmail = roro.customer?.email ?? input.customerEmail;\n        if (providerCustomerId) {\n            params.customer = providerCustomerId;\n        } else if (customerEmail) {\n            params.customer_email = customerEmail;\n        }\n\n        // Set expires at if provided (in minutes from now)\n        if (input.expiresInMinutes !== undefined && input.expiresInMinutes > 0) {\n            const expiresAt = Math.floor(Date.now() / 1000) + input.expiresInMinutes * 60;\n            params.expires_at = expiresAt;\n        }\n\n        // Enable promotion codes if allowed\n        if (input.allowPromoCodes) {\n            params.allow_promotion_codes = true;\n        }\n\n        const session = await this.stripe.checkout.sessions.create(params);\n\n        return this.mapSession(session);\n    }\n\n    /**\n     * Retrieve a Checkout Session from Stripe\n     */\n    async retrieve(providerSessionId: string): Promise<QZPayProviderCheckout> {\n        const session = await this.stripe.checkout.sessions.retrieve(providerSessionId, {\n            expand: ['payment_intent', 'subscription']\n        });\n\n        return this.mapSession(session);\n    }\n\n    /**\n     * Expire a Checkout Session in Stripe\n     */\n    async expire(providerSessionId: string): Promise<void> {\n        await this.stripe.checkout.sessions.expire(providerSessionId);\n    }\n\n    /**\n     * Map Stripe Checkout Session to QZPay provider checkout\n     */\n    private mapSession(session: Stripe.Checkout.Session): QZPayProviderCheckout {\n        let paymentIntentId: string | null = null;\n        let subscriptionId: string | null = null;\n\n        if (session.payment_intent) {\n            paymentIntentId = typeof session.payment_intent === 'string' ? session.payment_intent : session.payment_intent.id;\n        }\n\n        if (session.subscription) {\n            subscriptionId = typeof session.subscription === 'string' ? session.subscription : session.subscription.id;\n        }\n\n        return {\n            id: session.id,\n            url: session.url ?? '',\n            status: session.status ?? 'open',\n            paymentIntentId,\n            subscriptionId,\n            customerId: typeof session.customer === 'string' ? session.customer : (session.customer?.id ?? null),\n            metadata: (session.metadata as Record<string, string>) ?? {}\n        };\n    }\n}\n","import type { QZPayCreatePriceInput, QZPayPaymentPriceAdapter, QZPayProviderPrice } from '@qazuor/qzpay-core';\n/**\n * Stripe Price Adapter\n *\n * Implements QZPayPaymentPriceAdapter for Stripe Products and Prices\n */\nimport type Stripe from 'stripe';\nimport { validateStripeCurrency } from '../utils/currency.utils.js';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\n\nexport class QZPayStripePriceAdapter implements QZPayPaymentPriceAdapter {\n    constructor(private readonly stripe: Stripe) {}\n\n    /**\n     * Create a price in Stripe\n     */\n    async create(input: QZPayCreatePriceInput, providerProductId: string): Promise<string> {\n        // Validate currency is supported by Stripe\n        validateStripeCurrency(input.currency);\n\n        const params: Stripe.PriceCreateParams = {\n            product: providerProductId,\n            unit_amount: input.unitAmount,\n            currency: input.currency.toLowerCase(),\n            metadata: input.metadata ? toStripeMetadata(input.metadata) : {}\n        };\n\n        // Set recurring based on billing interval\n        if (input.billingInterval) {\n            params.recurring = {\n                interval: this.mapInterval(input.billingInterval),\n                interval_count: input.intervalCount ?? 1\n            };\n        }\n\n        // Set nickname if provided\n        if (input.nickname) {\n            params.nickname = input.nickname;\n        }\n\n        const price = await this.stripe.prices.create(params);\n\n        return price.id;\n    }\n\n    /**\n     * Archive a price in Stripe\n     */\n    async archive(providerPriceId: string): Promise<void> {\n        await this.stripe.prices.update(providerPriceId, { active: false });\n    }\n\n    /**\n     * Retrieve a price from Stripe\n     */\n    async retrieve(providerPriceId: string): Promise<QZPayProviderPrice> {\n        const price = await this.stripe.prices.retrieve(providerPriceId);\n\n        return this.mapPrice(price);\n    }\n\n    /**\n     * Create a product in Stripe\n     */\n    async createProduct(name: string, description?: string): Promise<string> {\n        const params: Stripe.ProductCreateParams = {\n            name\n        };\n\n        if (description) {\n            params.description = description;\n        }\n\n        const product = await this.stripe.products.create(params);\n\n        return product.id;\n    }\n\n    /**\n     * Map Stripe price to QZPay provider price\n     */\n    private mapPrice(price: Stripe.Price): QZPayProviderPrice {\n        return {\n            id: price.id,\n            active: price.active,\n            unitAmount: price.unit_amount ?? 0,\n            currency: price.currency.toUpperCase(),\n            recurring: price.recurring\n                ? {\n                      interval: price.recurring.interval,\n                      intervalCount: price.recurring.interval_count\n                  }\n                : null\n        };\n    }\n\n    /**\n     * Map QZPay interval to Stripe interval\n     */\n    private mapInterval(interval: string): Stripe.PriceCreateParams.Recurring.Interval {\n        const intervalMap: Record<string, Stripe.PriceCreateParams.Recurring.Interval> = {\n            day: 'day',\n            week: 'week',\n            month: 'month',\n            year: 'year'\n        };\n\n        return intervalMap[interval] ?? 'month';\n    }\n}\n","import type { QZPayPaymentWebhookAdapter, QZPayWebhookEvent } from '@qazuor/qzpay-core';\n/**\n * Stripe Webhook Adapter\n *\n * Implements QZPayPaymentWebhookAdapter for Stripe webhooks\n */\nimport type Stripe from 'stripe';\nimport type { RetryConfig } from '../utils/retry.utils.js';\n\nexport class QZPayStripeWebhookAdapter implements QZPayPaymentWebhookAdapter {\n    constructor(\n        private readonly stripe: Stripe,\n        private readonly webhookSecret: string,\n        _retryConfig?: Partial<RetryConfig>\n    ) {}\n\n    /**\n     * Construct and verify a webhook event from Stripe\n     *\n     * Note: This method does not use retry logic because:\n     * 1. Signature verification is deterministic (succeeds or fails immediately)\n     * 2. Webhook payloads should be processed exactly once\n     * 3. Stripe will retry failed webhooks automatically\n     */\n    constructEvent(payload: string | Buffer, signature: string): QZPayWebhookEvent {\n        const event = this.stripe.webhooks.constructEvent(payload, signature, this.webhookSecret);\n\n        return {\n            id: event.id,\n            type: event.type,\n            data: event.data.object,\n            created: new Date(event.created * 1000)\n        };\n    }\n\n    /**\n     * Verify webhook signature\n     */\n    verifySignature(payload: string | Buffer, signature: string): boolean {\n        try {\n            this.stripe.webhooks.constructEvent(payload, signature, this.webhookSecret);\n            return true;\n        } catch {\n            return false;\n        }\n    }\n}\n\n/**\n * Map Stripe webhook event type to QZPay billing event\n */\nexport function mapStripeEventToQZPayEvent(stripeEventType: string): string | null {\n    const eventMap: Record<string, string> = {\n        // Customer events\n        'customer.created': 'customer.created',\n        'customer.updated': 'customer.updated',\n        'customer.deleted': 'customer.deleted',\n\n        // Subscription events\n        'customer.subscription.created': 'subscription.created',\n        'customer.subscription.updated': 'subscription.updated',\n        'customer.subscription.deleted': 'subscription.canceled',\n        'customer.subscription.paused': 'subscription.paused',\n        'customer.subscription.resumed': 'subscription.resumed',\n        'customer.subscription.trial_will_end': 'subscription.trial_ending',\n        'customer.subscription.pending_update_applied': 'subscription.pending_update_applied',\n        'customer.subscription.pending_update_expired': 'subscription.pending_update_expired',\n\n        // Invoice events\n        'invoice.created': 'invoice.created',\n        'invoice.finalized': 'invoice.finalized',\n        'invoice.paid': 'invoice.paid',\n        'invoice.payment_failed': 'invoice.payment_failed',\n        'invoice.payment_action_required': 'invoice.payment_action_required',\n        'invoice.voided': 'invoice.voided',\n        'invoice.marked_uncollectible': 'invoice.marked_uncollectible',\n        'invoice.upcoming': 'invoice.upcoming',\n\n        // Payment Intent events (including 3DS/SCA)\n        'payment_intent.created': 'payment.created',\n        'payment_intent.succeeded': 'payment.succeeded',\n        'payment_intent.payment_failed': 'payment.failed',\n        'payment_intent.canceled': 'payment.canceled',\n        'payment_intent.requires_action': 'payment.requires_action',\n        'payment_intent.processing': 'payment.processing',\n        'payment_intent.amount_capturable_updated': 'payment.amount_capturable_updated',\n        'payment_intent.partially_funded': 'payment.partially_funded',\n\n        // Setup Intent events (3DS for payment method setup)\n        'setup_intent.created': 'setup_intent.created',\n        'setup_intent.requires_action': 'setup_intent.requires_action',\n        'setup_intent.succeeded': 'setup_intent.succeeded',\n        'setup_intent.setup_failed': 'setup_intent.failed',\n        'setup_intent.canceled': 'setup_intent.canceled',\n\n        // Charge events\n        'charge.succeeded': 'charge.succeeded',\n        'charge.failed': 'charge.failed',\n        'charge.pending': 'charge.pending',\n        'charge.captured': 'charge.captured',\n        'charge.expired': 'charge.expired',\n        'charge.updated': 'charge.updated',\n\n        // Refund events\n        'charge.refunded': 'refund.created',\n        'charge.refund.updated': 'refund.updated',\n        'refund.created': 'refund.created',\n        'refund.updated': 'refund.updated',\n        'refund.failed': 'refund.failed',\n\n        // Dispute events\n        'charge.dispute.created': 'dispute.created',\n        'charge.dispute.updated': 'dispute.updated',\n        'charge.dispute.closed': 'dispute.closed',\n        'charge.dispute.funds_reinstated': 'dispute.funds_reinstated',\n        'charge.dispute.funds_withdrawn': 'dispute.funds_withdrawn',\n\n        // Checkout events\n        'checkout.session.completed': 'checkout.completed',\n        'checkout.session.expired': 'checkout.expired',\n        'checkout.session.async_payment_succeeded': 'checkout.async_payment_succeeded',\n        'checkout.session.async_payment_failed': 'checkout.async_payment_failed',\n\n        // Payment method events\n        'payment_method.attached': 'payment_method.attached',\n        'payment_method.detached': 'payment_method.detached',\n        'payment_method.updated': 'payment_method.updated',\n        'payment_method.automatically_updated': 'payment_method.automatically_updated',\n\n        // Mandate events (for SEPA, ACH, etc.)\n        'mandate.updated': 'mandate.updated',\n\n        // Radar (fraud) events\n        'radar.early_fraud_warning.created': 'fraud_warning.created',\n        'radar.early_fraud_warning.updated': 'fraud_warning.updated',\n\n        // Connect/Marketplace events\n        'account.updated': 'vendor.updated',\n        'account.application.authorized': 'vendor.application_authorized',\n        'account.application.deauthorized': 'vendor.application_deauthorized',\n        'payout.paid': 'payout.paid',\n        'payout.failed': 'payout.failed',\n        'payout.canceled': 'payout.canceled',\n        'payout.created': 'payout.created',\n        'payout.updated': 'payout.updated',\n        'transfer.created': 'transfer.created',\n        'transfer.updated': 'transfer.updated',\n        'transfer.reversed': 'transfer.reversed',\n\n        // Billing portal events\n        'billing_portal.session.created': 'billing_portal.session_created',\n        'billing_portal.configuration.created': 'billing_portal.configuration_created',\n        'billing_portal.configuration.updated': 'billing_portal.configuration_updated',\n\n        // Customer balance events\n        'customer.balance.updated': 'customer.balance_updated',\n\n        // Tax ID events\n        'customer.tax_id.created': 'customer.tax_id_created',\n        'customer.tax_id.deleted': 'customer.tax_id_deleted',\n        'customer.tax_id.updated': 'customer.tax_id_updated',\n\n        // Source events (legacy)\n        'source.chargeable': 'source.chargeable',\n        'source.failed': 'source.failed',\n        'source.canceled': 'source.canceled'\n    };\n\n    return eventMap[stripeEventType] ?? null;\n}\n\n/**\n * Extract relevant data from Stripe webhook event\n */\nexport function extractStripeEventData(event: QZPayWebhookEvent): {\n    entityType: string;\n    entityId: string;\n    customerId?: string;\n    subscriptionId?: string;\n    invoiceId?: string;\n    paymentIntentId?: string;\n} {\n    const data = event.data as Record<string, unknown>;\n    const eventType = event.type;\n\n    // Determine entity type from event\n    const entityType = eventType.split('.')[0] ?? 'unknown';\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const entityId = (data['id'] as string) ?? '';\n\n    const result: {\n        entityType: string;\n        entityId: string;\n        customerId?: string;\n        subscriptionId?: string;\n        invoiceId?: string;\n        paymentIntentId?: string;\n    } = {\n        entityType,\n        entityId\n    };\n\n    // Extract customer ID\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const customer = data['customer'];\n    if (customer) {\n        result.customerId = typeof customer === 'string' ? customer : (customer as { id: string })?.id;\n    }\n\n    // Extract subscription ID\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const subscription = data['subscription'];\n    if (subscription) {\n        result.subscriptionId = typeof subscription === 'string' ? subscription : (subscription as { id: string })?.id;\n    }\n\n    // Extract invoice ID\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const invoice = data['invoice'];\n    if (invoice) {\n        result.invoiceId = typeof invoice === 'string' ? invoice : (invoice as { id: string })?.id;\n    }\n\n    // Extract payment intent ID\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const paymentIntent = data['payment_intent'];\n    if (paymentIntent) {\n        result.paymentIntentId = typeof paymentIntent === 'string' ? paymentIntent : (paymentIntent as { id: string })?.id;\n    }\n\n    return result;\n}\n\n// ==================== 3DS/SCA Event Utilities ====================\n\n/**\n * 3DS authentication status\n */\nexport type QZPayStripe3DSStatus = 'not_required' | 'required' | 'succeeded' | 'failed' | 'processing' | 'unknown';\n\n/**\n * 3DS authentication result\n */\nexport interface QZPayStripe3DSResult {\n    status: QZPayStripe3DSStatus;\n    paymentIntentId: string;\n    clientSecret?: string;\n    nextActionUrl?: string;\n    nextActionType?: string;\n    authenticationFlow?: string;\n    outcome?: {\n        networkStatus?: string;\n        riskLevel?: string;\n        riskScore?: number;\n        sellerMessage?: string;\n    };\n}\n\n/**\n * Check if a payment intent requires 3DS authentication\n */\nexport function isPaymentRequires3DS(event: QZPayWebhookEvent): boolean {\n    if (!event.type.includes('payment_intent') && !event.type.includes('setup_intent')) {\n        return false;\n    }\n    const data = event.data as Record<string, unknown>;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const status = data['status'] as string | undefined;\n    return status === 'requires_action' || status === 'requires_confirmation';\n}\n\n/**\n * Extract 3DS authentication details from payment intent event\n */\nexport function extract3DSDetails(event: QZPayWebhookEvent): QZPayStripe3DSResult {\n    const data = event.data as Record<string, unknown>;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const id = (data['id'] as string) ?? '';\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const status = data['status'] as string | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const clientSecret = data['client_secret'] as string | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const nextAction = data['next_action'] as Record<string, unknown> | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const charges = data['charges'] as { data?: Array<Record<string, unknown>> } | undefined;\n\n    const result: QZPayStripe3DSResult = {\n        status: map3DSStatus(status),\n        paymentIntentId: id\n    };\n\n    if (clientSecret) {\n        result.clientSecret = clientSecret;\n    }\n\n    if (nextAction) {\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        const nextActionType = nextAction['type'] as string | undefined;\n        if (nextActionType) {\n            result.nextActionType = nextActionType;\n        }\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        const redirectToUrl = nextAction['redirect_to_url'] as { url?: string } | undefined;\n        if (redirectToUrl?.url) {\n            result.nextActionUrl = redirectToUrl.url;\n        }\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        const useStripeSdk = nextAction['use_stripe_sdk'] as Record<string, unknown> | undefined;\n        if (useStripeSdk) {\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            const authFlow = useStripeSdk['type'] as string | undefined;\n            if (authFlow) {\n                result.authenticationFlow = authFlow;\n            }\n        }\n    }\n\n    // Extract outcome from the charge if available\n    if (charges?.data?.[0]) {\n        const charge = charges.data[0];\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        const outcome = charge['outcome'] as Record<string, unknown> | undefined;\n        if (outcome) {\n            const outcomeResult: QZPayStripe3DSResult['outcome'] = {};\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            const networkStatus = outcome['network_status'] as string | undefined;\n            if (networkStatus) {\n                outcomeResult.networkStatus = networkStatus;\n            }\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            const riskLevel = outcome['risk_level'] as string | undefined;\n            if (riskLevel) {\n                outcomeResult.riskLevel = riskLevel;\n            }\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            const riskScore = outcome['risk_score'] as number | undefined;\n            if (riskScore !== undefined) {\n                outcomeResult.riskScore = riskScore;\n            }\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            const sellerMessage = outcome['seller_message'] as string | undefined;\n            if (sellerMessage) {\n                outcomeResult.sellerMessage = sellerMessage;\n            }\n            result.outcome = outcomeResult;\n        }\n    }\n\n    return result;\n}\n\nfunction map3DSStatus(stripeStatus: string | undefined): QZPayStripe3DSStatus {\n    switch (stripeStatus) {\n        case 'requires_action':\n        case 'requires_confirmation':\n            return 'required';\n        case 'succeeded':\n            return 'succeeded';\n        case 'canceled':\n        case 'requires_payment_method':\n            return 'failed';\n        case 'processing':\n            return 'processing';\n        default:\n            return 'unknown';\n    }\n}\n\n// ==================== Dispute Event Utilities ====================\n\n/**\n * Dispute status\n */\nexport type QZPayStripeDisputeStatus =\n    | 'warning_needs_response'\n    | 'warning_under_review'\n    | 'warning_closed'\n    | 'needs_response'\n    | 'under_review'\n    | 'charge_refunded'\n    | 'won'\n    | 'lost';\n\n/**\n * Dispute reason categories\n */\nexport type QZPayStripeDisputeReason =\n    | 'bank_cannot_process'\n    | 'check_returned'\n    | 'credit_not_processed'\n    | 'customer_initiated'\n    | 'debit_not_authorized'\n    | 'duplicate'\n    | 'fraudulent'\n    | 'general'\n    | 'incorrect_account_details'\n    | 'insufficient_funds'\n    | 'product_not_received'\n    | 'product_unacceptable'\n    | 'subscription_canceled'\n    | 'unrecognized';\n\n/**\n * Dispute details extracted from webhook event\n */\nexport interface QZPayStripeDisputeDetails {\n    disputeId: string;\n    chargeId: string;\n    paymentIntentId?: string;\n    amount: number;\n    currency: string;\n    status: QZPayStripeDisputeStatus;\n    reason: QZPayStripeDisputeReason;\n    isChargeRefundable: boolean;\n    hasEvidence: boolean;\n    evidenceDueBy?: Date;\n    created: Date;\n    metadata?: Record<string, string>;\n}\n\n/**\n * Check if event is a dispute event\n */\nexport function isDisputeEvent(event: QZPayWebhookEvent): boolean {\n    return event.type.includes('dispute');\n}\n\n/**\n * Extract dispute details from webhook event\n */\nexport function extractDisputeDetails(event: QZPayWebhookEvent): QZPayStripeDisputeDetails {\n    const data = event.data as Record<string, unknown>;\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const charge = data['charge'] as string | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const paymentIntent = data['payment_intent'] as string | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const evidenceDetails = data['evidence_details'] as Record<string, unknown> | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const metadata = data['metadata'] as Record<string, string> | undefined;\n\n    const result: QZPayStripeDisputeDetails = {\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        disputeId: (data['id'] as string) ?? '',\n        chargeId: charge ?? '',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        amount: (data['amount'] as number) ?? 0,\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        currency: (data['currency'] as string) ?? 'usd',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        status: (data['status'] as QZPayStripeDisputeStatus) ?? 'needs_response',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        reason: (data['reason'] as QZPayStripeDisputeReason) ?? 'general',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        isChargeRefundable: (data['is_charge_refundable'] as boolean) ?? false,\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        hasEvidence: (data['has_evidence'] as boolean) ?? false,\n        created: event.created\n    };\n\n    if (paymentIntent) {\n        result.paymentIntentId = paymentIntent;\n    }\n    if (evidenceDetails) {\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        const dueBy = evidenceDetails['due_by'] as number | undefined;\n        if (dueBy) {\n            result.evidenceDueBy = new Date(dueBy * 1000);\n        }\n    }\n    if (metadata) {\n        result.metadata = metadata;\n    }\n\n    return result;\n}\n\n// ==================== Subscription Pending Update Utilities ====================\n\n/**\n * Pending update details\n */\nexport interface QZPayStripePendingUpdate {\n    subscriptionId: string;\n    expiresAt?: Date;\n    subscriptionItems?: Array<{\n        id: string;\n        priceId: string;\n        quantity: number;\n    }>;\n    billingCycleAnchor?: Date;\n    prorationBehavior?: 'create_prorations' | 'none' | 'always_invoice';\n    trialEnd?: Date;\n}\n\n/**\n * Check if event is a pending update event\n */\nexport function isPendingUpdateEvent(event: QZPayWebhookEvent): boolean {\n    return event.type.includes('pending_update');\n}\n\n/**\n * Extract pending update details from subscription event\n */\nexport function extractPendingUpdateDetails(event: QZPayWebhookEvent): QZPayStripePendingUpdate | null {\n    const data = event.data as Record<string, unknown>;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const pendingUpdate = data['pending_update'] as Record<string, unknown> | undefined;\n\n    if (!pendingUpdate) {\n        return null;\n    }\n\n    const result: QZPayStripePendingUpdate = {\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        subscriptionId: (data['id'] as string) ?? ''\n    };\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const expiresAt = pendingUpdate['expires_at'] as number | undefined;\n    if (expiresAt) {\n        result.expiresAt = new Date(expiresAt * 1000);\n    }\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const items = pendingUpdate['subscription_items'] as Array<Record<string, unknown>> | undefined;\n    if (items) {\n        result.subscriptionItems = items.map((item) => ({\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            id: (item['id'] as string) ?? '',\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            priceId: (item['price'] as string) ?? '',\n            // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n            quantity: (item['quantity'] as number) ?? 1\n        }));\n    }\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const billingCycleAnchor = pendingUpdate['billing_cycle_anchor'] as number | undefined;\n    if (billingCycleAnchor) {\n        result.billingCycleAnchor = new Date(billingCycleAnchor * 1000);\n    }\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const prorationBehavior = pendingUpdate['proration_behavior'] as QZPayStripePendingUpdate['prorationBehavior'] | undefined;\n    if (prorationBehavior) {\n        result.prorationBehavior = prorationBehavior;\n    }\n\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const trialEnd = pendingUpdate['trial_end'] as number | undefined;\n    if (trialEnd) {\n        result.trialEnd = new Date(trialEnd * 1000);\n    }\n\n    return result;\n}\n\n// ==================== Fraud Warning Utilities ====================\n\n/**\n * Early fraud warning details\n */\nexport interface QZPayStripeFraudWarning {\n    warningId: string;\n    chargeId: string;\n    paymentIntentId?: string;\n    fraudType: string;\n    actionable: boolean;\n    created: Date;\n}\n\n/**\n * Check if event is a fraud warning event\n */\nexport function isFraudWarningEvent(event: QZPayWebhookEvent): boolean {\n    return event.type.includes('radar') || event.type.includes('fraud_warning');\n}\n\n/**\n * Extract fraud warning details\n */\nexport function extractFraudWarningDetails(event: QZPayWebhookEvent): QZPayStripeFraudWarning {\n    const data = event.data as Record<string, unknown>;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const charge = data['charge'] as string | Record<string, unknown> | undefined;\n    // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n    const paymentIntent = data['payment_intent'] as string | undefined;\n\n    const result: QZPayStripeFraudWarning = {\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        warningId: (data['id'] as string) ?? '',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        chargeId: typeof charge === 'string' ? charge : ((charge?.['id'] as string) ?? ''),\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        fraudType: (data['fraud_type'] as string) ?? 'unknown',\n        // biome-ignore lint/complexity/useLiteralKeys: index signature requires bracket notation\n        actionable: (data['actionable'] as boolean) ?? true,\n        created: event.created\n    };\n\n    if (paymentIntent) {\n        result.paymentIntentId = paymentIntent;\n    }\n\n    return result;\n}\n\n// ==================== Webhook Event Classification ====================\n\n/**\n * Event categories for routing\n */\nexport type QZPayStripeEventCategory =\n    | 'customer'\n    | 'subscription'\n    | 'payment'\n    | 'invoice'\n    | 'checkout'\n    | 'dispute'\n    | 'refund'\n    | 'vendor'\n    | 'fraud'\n    | 'billing_portal'\n    | 'other';\n\n/**\n * Classify a webhook event into a category\n */\nexport function classifyStripeEvent(eventType: string): QZPayStripeEventCategory {\n    if (eventType.startsWith('customer.subscription')) return 'subscription';\n    if (eventType.startsWith('customer.')) return 'customer';\n    if (eventType.startsWith('invoice.')) return 'invoice';\n    if (\n        eventType.startsWith('payment_intent.') ||\n        (eventType.startsWith('charge.') && !eventType.includes('dispute') && !eventType.includes('refund'))\n    )\n        return 'payment';\n    if (eventType.includes('dispute')) return 'dispute';\n    if (eventType.includes('refund')) return 'refund';\n    if (eventType.startsWith('checkout.')) return 'checkout';\n    if (eventType.startsWith('account.') || eventType.startsWith('payout.') || eventType.startsWith('transfer.')) return 'vendor';\n    if (eventType.startsWith('radar.')) return 'fraud';\n    if (eventType.startsWith('billing_portal.')) return 'billing_portal';\n    return 'other';\n}\n\n/**\n * Check if event requires immediate action\n */\nexport function requiresImmediateAction(event: QZPayWebhookEvent): boolean {\n    const urgentEvents = [\n        'payment_intent.requires_action',\n        'setup_intent.requires_action',\n        'invoice.payment_action_required',\n        'charge.dispute.created',\n        'radar.early_fraud_warning.created',\n        'invoice.payment_failed'\n    ];\n    return urgentEvents.includes(event.type);\n}\n","import type { QZPayPaymentVendorAdapter, QZPayProviderPayout, QZPayVendor } from '@qazuor/qzpay-core';\n/**\n * Stripe Vendor/Connect Adapter\n *\n * Implements QZPayPaymentVendorAdapter for Stripe Connect\n */\nimport type Stripe from 'stripe';\nimport { validateStripeCurrency } from '../utils/currency.utils.js';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\n\nexport class QZPayStripeVendorAdapter implements QZPayPaymentVendorAdapter {\n    constructor(private readonly stripe: Stripe) {}\n\n    /**\n     * Create a Connect account in Stripe\n     */\n    async createAccount(vendor: QZPayVendor): Promise<string> {\n        const params: Stripe.AccountCreateParams = {\n            type: 'express',\n            email: vendor.email,\n            metadata: {\n                qzpay_vendor_id: vendor.id,\n                ...toStripeMetadata(vendor.metadata)\n            },\n            capabilities: {\n                card_payments: { requested: true },\n                transfers: { requested: true }\n            }\n        };\n\n        // Set business profile if available\n        if (vendor.name) {\n            params.business_profile = {\n                name: vendor.name\n            };\n        }\n\n        const account = await this.stripe.accounts.create(params);\n\n        return account.id;\n    }\n\n    /**\n     * Update a Connect account in Stripe\n     */\n    async updateAccount(providerAccountId: string, vendor: Partial<QZPayVendor>): Promise<void> {\n        const params: Stripe.AccountUpdateParams = {};\n\n        if (vendor.email !== undefined) {\n            params.email = vendor.email;\n        }\n\n        if (vendor.name !== undefined) {\n            params.business_profile = {\n                name: vendor.name\n            };\n        }\n\n        if (vendor.metadata !== undefined) {\n            params.metadata = toStripeMetadata(vendor.metadata);\n        }\n\n        await this.stripe.accounts.update(providerAccountId, params);\n    }\n\n    /**\n     * Delete a Connect account in Stripe\n     */\n    async deleteAccount(providerAccountId: string): Promise<void> {\n        await this.stripe.accounts.del(providerAccountId);\n    }\n\n    /**\n     * Create a payout to a Connect account\n     */\n    async createPayout(providerAccountId: string, amount: number, currency: string): Promise<string> {\n        // Validate currency is supported by Stripe\n        validateStripeCurrency(currency);\n\n        const payout = await this.stripe.payouts.create(\n            {\n                amount,\n                currency: currency.toLowerCase()\n            },\n            {\n                stripeAccount: providerAccountId\n            }\n        );\n\n        return payout.id;\n    }\n\n    /**\n     * Retrieve a payout from Stripe\n     */\n    async retrievePayout(providerPayoutId: string): Promise<QZPayProviderPayout> {\n        const payout = await this.stripe.payouts.retrieve(providerPayoutId);\n\n        return {\n            id: payout.id,\n            status: payout.status,\n            amount: payout.amount,\n            currency: payout.currency.toUpperCase(),\n            arrivalDate: new Date(payout.arrival_date * 1000)\n        };\n    }\n\n    /**\n     * Create a transfer to a Connect account\n     */\n    async createTransfer(providerAccountId: string, amount: number, currency: string, paymentId: string): Promise<string> {\n        // Validate currency is supported by Stripe\n        validateStripeCurrency(currency);\n\n        const transfer = await this.stripe.transfers.create({\n            amount,\n            currency: currency.toLowerCase(),\n            destination: providerAccountId,\n            source_transaction: paymentId\n        });\n\n        return transfer.id;\n    }\n\n    /**\n     * Create an account link for onboarding\n     */\n    async createAccountLink(\n        providerAccountId: string,\n        refreshUrl: string,\n        returnUrl: string,\n        type: 'account_onboarding' | 'account_update' = 'account_onboarding'\n    ): Promise<string> {\n        const accountLink = await this.stripe.accountLinks.create({\n            account: providerAccountId,\n            refresh_url: refreshUrl,\n            return_url: returnUrl,\n            type\n        });\n\n        return accountLink.url;\n    }\n\n    /**\n     * Create a login link for an Express account\n     */\n    async createLoginLink(providerAccountId: string): Promise<string> {\n        const loginLink = await this.stripe.accounts.createLoginLink(providerAccountId);\n\n        return loginLink.url;\n    }\n\n    /**\n     * Retrieve account details\n     */\n    async retrieveAccount(providerAccountId: string): Promise<{\n        id: string;\n        chargesEnabled: boolean;\n        payoutsEnabled: boolean;\n        detailsSubmitted: boolean;\n    }> {\n        const account = await this.stripe.accounts.retrieve(providerAccountId);\n\n        return {\n            id: account.id,\n            chargesEnabled: account.charges_enabled ?? false,\n            payoutsEnabled: account.payouts_enabled ?? false,\n            detailsSubmitted: account.details_submitted ?? false\n        };\n    }\n}\n","/**\n * Stripe Setup Intent Adapter\n *\n * Implements QZPaySetupIntentAdapter for Stripe.\n * Allows saving payment methods for future use without charging immediately.\n */\nimport type {\n    QZPayConfirmSetupIntentInput,\n    QZPayCreateSetupIntentInput,\n    QZPayProviderSetupIntent,\n    QZPaySetupIntentAdapter\n} from '@qazuor/qzpay-core';\nimport type Stripe from 'stripe';\nimport { toStripeMetadata } from '../utils/metadata.utils.js';\n\nexport class QZPayStripeSetupIntentAdapter implements QZPaySetupIntentAdapter {\n    constructor(private readonly stripe: Stripe) {}\n\n    /**\n     * Create a new Setup Intent in Stripe\n     */\n    async create(input: QZPayCreateSetupIntentInput): Promise<QZPayProviderSetupIntent> {\n        const params: Stripe.SetupIntentCreateParams = {\n            customer: input.customerId,\n            usage: input.usage ?? 'off_session',\n            metadata: input.metadata ? toStripeMetadata(input.metadata) : {}\n        };\n\n        // Set payment method types if provided\n        if (input.paymentMethodTypes?.length) {\n            params.payment_method_types = input.paymentMethodTypes;\n        } else {\n            // Default to card payments\n            params.payment_method_types = ['card'];\n        }\n\n        // Set description if provided\n        if (input.description) {\n            params.description = input.description;\n        }\n\n        const setupIntent = await this.stripe.setupIntents.create(params);\n\n        return this.mapSetupIntent(setupIntent);\n    }\n\n    /**\n     * Retrieve an existing Setup Intent from Stripe\n     */\n    async retrieve(setupIntentId: string): Promise<QZPayProviderSetupIntent> {\n        const setupIntent = await this.stripe.setupIntents.retrieve(setupIntentId);\n\n        return this.mapSetupIntent(setupIntent);\n    }\n\n    /**\n     * Confirm a Setup Intent\n     */\n    async confirm(input: QZPayConfirmSetupIntentInput): Promise<QZPayProviderSetupIntent> {\n        const params: Stripe.SetupIntentConfirmParams = {};\n\n        // Set payment method if provided\n        if (input.paymentMethodId) {\n            params.payment_method = input.paymentMethodId;\n        }\n\n        // Set return URL for redirect-based payment methods\n        if (input.returnUrl) {\n            params.return_url = input.returnUrl;\n        }\n\n        const setupIntent = await this.stripe.setupIntents.confirm(input.setupIntentId, params);\n\n        return this.mapSetupIntent(setupIntent);\n    }\n\n    /**\n     * Cancel a Setup Intent\n     */\n    async cancel(setupIntentId: string): Promise<void> {\n        await this.stripe.setupIntents.cancel(setupIntentId);\n    }\n\n    /**\n     * Update a Setup Intent\n     */\n    async update(\n        setupIntentId: string,\n        updates: Partial<Pick<QZPayCreateSetupIntentInput, 'metadata' | 'description'>>\n    ): Promise<QZPayProviderSetupIntent> {\n        const params: Stripe.SetupIntentUpdateParams = {};\n\n        if (updates.metadata) {\n            params.metadata = toStripeMetadata(updates.metadata);\n        }\n\n        if (updates.description) {\n            params.description = updates.description;\n        }\n\n        const setupIntent = await this.stripe.setupIntents.update(setupIntentId, params);\n\n        return this.mapSetupIntent(setupIntent);\n    }\n\n    /**\n     * Map Stripe SetupIntent to QZPay provider setup intent\n     */\n    private mapSetupIntent(setupIntent: Stripe.SetupIntent): QZPayProviderSetupIntent {\n        // Extract payment method ID\n        let paymentMethodId: string | null = null;\n        if (setupIntent.payment_method) {\n            paymentMethodId = typeof setupIntent.payment_method === 'string' ? setupIntent.payment_method : setupIntent.payment_method.id;\n        }\n\n        return {\n            id: setupIntent.id,\n            clientSecret: setupIntent.client_secret ?? '',\n            status: setupIntent.status,\n            paymentMethodId,\n            raw: setupIntent\n        };\n    }\n}\n\n/**\n * Create a Stripe Setup Intent adapter instance\n */\nexport function createStripeSetupIntentAdapter(stripe: Stripe): QZPayStripeSetupIntentAdapter {\n    return new QZPayStripeSetupIntentAdapter(stripe);\n}\n","import type { QZPayPaymentAdapter } from '@qazuor/qzpay-core';\n/**\n * QZPay Stripe Adapter\n *\n * Main adapter class that implements QZPayPaymentAdapter for Stripe\n */\nimport Stripe from 'stripe';\nimport {\n    QZPayStripeCheckoutAdapter,\n    QZPayStripeCustomerAdapter,\n    QZPayStripePaymentAdapter,\n    QZPayStripePriceAdapter,\n    QZPayStripeSetupIntentAdapter,\n    QZPayStripeSubscriptionAdapter,\n    QZPayStripeVendorAdapter,\n    QZPayStripeWebhookAdapter\n} from './adapters/index.js';\nimport type { QZPayStripeConfig, QZPayStripeConnectConfig } from './types.js';\n\n/**\n * Stripe Payment Adapter for QZPay\n *\n * Provides full Stripe integration including:\n * - Customer management\n * - Subscription lifecycle\n * - One-time payments\n * - Checkout Sessions\n * - Products and Prices\n * - Webhook handling\n * - Connect/Marketplace (optional)\n *\n * @example\n * ```typescript\n * import { createQZPayStripeAdapter } from '@qazuor/qzpay-stripe';\n *\n * const stripeAdapter = createQZPayStripeAdapter({\n *   secretKey: process.env.STRIPE_SECRET_KEY!,\n *   webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!\n * });\n *\n * // Use with QZPay\n * const qzpay = new QZPay({\n *   paymentAdapter: stripeAdapter,\n *   storage: storageAdapter\n * });\n * ```\n */\nexport class QZPayStripeAdapter implements QZPayPaymentAdapter {\n    readonly provider = 'stripe' as const;\n\n    readonly customers: QZPayStripeCustomerAdapter;\n    readonly subscriptions: QZPayStripeSubscriptionAdapter;\n    readonly payments: QZPayStripePaymentAdapter;\n    readonly checkout: QZPayStripeCheckoutAdapter;\n    readonly prices: QZPayStripePriceAdapter;\n    readonly webhooks: QZPayStripeWebhookAdapter;\n    readonly setupIntents: QZPayStripeSetupIntentAdapter;\n    readonly vendors?: QZPayStripeVendorAdapter;\n\n    private readonly stripe: Stripe;\n\n    constructor(config: QZPayStripeConfig, connectConfig?: QZPayStripeConnectConfig) {\n        // Validate secret key format\n        if (!config.secretKey.startsWith('sk_')) {\n            throw new Error(\"Invalid Stripe secret key format. Expected key starting with 'sk_'\");\n        }\n\n        // Validate webhook secret format if provided\n        if (config.webhookSecret && !config.webhookSecret.startsWith('whsec_')) {\n            throw new Error(\"Invalid Stripe webhook secret format. Expected secret starting with 'whsec_'\");\n        }\n\n        // Initialize Stripe client with optional API version override\n        const stripeConfig: Stripe.StripeConfig = {\n            ...config.stripeOptions\n        };\n\n        // Only set apiVersion if explicitly provided\n        if (config.apiVersion) {\n            stripeConfig.apiVersion = config.apiVersion;\n        }\n\n        this.stripe = new Stripe(config.secretKey, stripeConfig);\n\n        // Initialize sub-adapters with retry configuration\n        const retryConfig = config.retry;\n        this.customers = new QZPayStripeCustomerAdapter(this.stripe, retryConfig);\n        this.subscriptions = new QZPayStripeSubscriptionAdapter(this.stripe, retryConfig);\n        this.payments = new QZPayStripePaymentAdapter(this.stripe, retryConfig);\n        this.checkout = new QZPayStripeCheckoutAdapter(this.stripe);\n        this.prices = new QZPayStripePriceAdapter(this.stripe);\n        this.webhooks = new QZPayStripeWebhookAdapter(this.stripe, config.webhookSecret, retryConfig);\n        this.setupIntents = new QZPayStripeSetupIntentAdapter(this.stripe);\n\n        // Initialize vendor adapter if Connect is configured\n        if (connectConfig) {\n            this.vendors = new QZPayStripeVendorAdapter(this.stripe);\n        }\n    }\n\n    /**\n     * Get the underlying Stripe client for advanced operations\n     */\n    getStripeClient(): Stripe {\n        return this.stripe;\n    }\n}\n\n/**\n * Create a QZPay Stripe adapter instance\n *\n * @param config - Stripe configuration options\n * @param connectConfig - Optional Stripe Connect configuration for marketplace\n * @returns Configured Stripe adapter\n *\n * @example\n * ```typescript\n * const adapter = createQZPayStripeAdapter({\n *   secretKey: 'sk_test_...',\n *   webhookSecret: 'whsec_...'\n * });\n * ```\n */\nexport function createQZPayStripeAdapter(config: QZPayStripeConfig, connectConfig?: QZPayStripeConnectConfig): QZPayStripeAdapter {\n    return new QZPayStripeAdapter(config, connectConfig);\n}\n","/**\n * Stripe Saved Card Service Implementation\n *\n * Implements the unified SavedCardService interface for Stripe.\n * Uses Stripe's PaymentMethod API to save and manage cards.\n */\nimport type { SaveCardInput, SavedCard, SavedCardService, SavedCardServiceConfig, SavedCardServiceStripeConfig } from '@qazuor/qzpay-core';\nimport Stripe from 'stripe';\n\n/**\n * Stripe implementation of SavedCardService\n */\nexport class StripeSavedCardService implements SavedCardService {\n    private readonly stripe: Stripe;\n    private readonly getProviderCustomerId: (customerId: string) => Promise<string>;\n\n    constructor(config: SavedCardServiceStripeConfig) {\n        this.stripe = new Stripe(config.stripeSecretKey);\n        this.getProviderCustomerId = config.getProviderCustomerId;\n    }\n\n    /**\n     * Save a payment method to a customer in Stripe\n     */\n    async save(input: SaveCardInput): Promise<SavedCard> {\n        if (!input.paymentMethodId) {\n            throw new Error('paymentMethodId is required for Stripe');\n        }\n\n        const stripeCustomerId = await this.getProviderCustomerId(input.customerId);\n\n        // Attach the PaymentMethod to the customer\n        await this.stripe.paymentMethods.attach(input.paymentMethodId, {\n            customer: stripeCustomerId\n        });\n\n        // Set metadata if provided\n        if (input.metadata) {\n            await this.stripe.paymentMethods.update(input.paymentMethodId, {\n                metadata: this.toStripeMetadata(input.metadata)\n            });\n        }\n\n        // Set as default if requested\n        if (input.setAsDefault) {\n            await this.stripe.customers.update(stripeCustomerId, {\n                invoice_settings: {\n                    default_payment_method: input.paymentMethodId\n                }\n            });\n        }\n\n        // Retrieve the PaymentMethod to get full details\n        const paymentMethod = await this.stripe.paymentMethods.retrieve(input.paymentMethodId);\n\n        return this.mapToSavedCard(paymentMethod, input.customerId, stripeCustomerId, input.setAsDefault ?? false);\n    }\n\n    /**\n     * List all saved cards for a customer in Stripe\n     */\n    async list(customerId: string): Promise<SavedCard[]> {\n        const stripeCustomerId = await this.getProviderCustomerId(customerId);\n\n        // Get the customer to check default payment method\n        const customer = await this.stripe.customers.retrieve(stripeCustomerId);\n\n        // Check if customer is deleted\n        if (customer.deleted) {\n            throw new Error(`Customer ${stripeCustomerId} has been deleted`);\n        }\n\n        const defaultPaymentMethodId = customer.invoice_settings?.default_payment_method\n            ? typeof customer.invoice_settings.default_payment_method === 'string'\n                ? customer.invoice_settings.default_payment_method\n                : customer.invoice_settings.default_payment_method.id\n            : null;\n\n        // List all PaymentMethods of type 'card' for this customer\n        const paymentMethods = await this.stripe.paymentMethods.list({\n            customer: stripeCustomerId,\n            type: 'card'\n        });\n\n        return paymentMethods.data.map((pm) => this.mapToSavedCard(pm, customerId, stripeCustomerId, pm.id === defaultPaymentMethodId));\n    }\n\n    /**\n     * Remove a saved card from a customer in Stripe\n     */\n    async remove(customerId: string, cardId: string): Promise<void> {\n        // Verify the customer owns this payment method\n        const stripeCustomerId = await this.getProviderCustomerId(customerId);\n\n        // Retrieve the PaymentMethod to verify it belongs to this customer\n        const paymentMethod = await this.stripe.paymentMethods.retrieve(cardId);\n\n        if (paymentMethod.customer !== stripeCustomerId) {\n            throw new Error(`PaymentMethod ${cardId} does not belong to customer ${customerId}`);\n        }\n\n        // Detach the PaymentMethod from the customer\n        await this.stripe.paymentMethods.detach(cardId);\n    }\n\n    /**\n     * Set a card as the default payment method in Stripe\n     */\n    async setDefault(customerId: string, cardId: string): Promise<void> {\n        const stripeCustomerId = await this.getProviderCustomerId(customerId);\n\n        // Verify the PaymentMethod belongs to this customer\n        const paymentMethod = await this.stripe.paymentMethods.retrieve(cardId);\n\n        if (paymentMethod.customer !== stripeCustomerId) {\n            throw new Error(`PaymentMethod ${cardId} does not belong to customer ${customerId}`);\n        }\n\n        // Set as default payment method\n        await this.stripe.customers.update(stripeCustomerId, {\n            invoice_settings: {\n                default_payment_method: cardId\n            }\n        });\n    }\n\n    /**\n     * Map Stripe PaymentMethod to SavedCard\n     */\n    private mapToSavedCard(\n        paymentMethod: Stripe.PaymentMethod,\n        customerId: string,\n        providerCustomerId: string,\n        isDefault: boolean\n    ): SavedCard {\n        if (!paymentMethod.card) {\n            throw new Error(`PaymentMethod ${paymentMethod.id} is not a card`);\n        }\n\n        const card = paymentMethod.card;\n        const savedCard: SavedCard = {\n            id: paymentMethod.id,\n            customerId,\n            providerCustomerId,\n            provider: 'stripe',\n            last4: card.last4,\n            brand: card.brand,\n            expMonth: card.exp_month,\n            expYear: card.exp_year,\n            isDefault,\n            createdAt: new Date(paymentMethod.created * 1000)\n        };\n\n        // Add optional cardholder name if available\n        if (paymentMethod.billing_details?.name) {\n            savedCard.cardholderName = paymentMethod.billing_details.name;\n        }\n\n        return savedCard;\n    }\n\n    /**\n     * Convert metadata to Stripe-compatible format\n     */\n    private toStripeMetadata(metadata: Record<string, unknown>): Record<string, string> {\n        const result: Record<string, string> = {};\n        for (const [key, value] of Object.entries(metadata)) {\n            if (value !== undefined && value !== null) {\n                result[key] = String(value);\n            }\n        }\n        return result;\n    }\n}\n\n/**\n * Create a Stripe saved card service instance\n *\n * @param config - Stripe configuration\n * @returns SavedCardService instance for Stripe\n *\n * @example\n * ```typescript\n * const cardService = createSavedCardService({\n *   provider: 'stripe',\n *   stripeSecretKey: 'sk_test_xxx',\n *   getProviderCustomerId: async (customerId) => {\n *     const customer = await db.customers.findById(customerId);\n *     return customer.stripeCustomerId;\n *   },\n * });\n *\n * // Save a card\n * const card = await cardService.save({\n *   customerId: 'local_cus_123',\n *   paymentMethodId: 'pm_xxx',\n *   setAsDefault: true,\n * });\n * ```\n */\nexport function createSavedCardService(config: SavedCardServiceConfig): SavedCardService {\n    if (config.provider !== 'stripe') {\n        throw new Error(`Invalid provider: ${config.provider}. Expected 'stripe'`);\n    }\n\n    return new StripeSavedCardService(config);\n}\n"]}