import Stripe from "stripe"; import { StripeService } from "../../stripe/services/stripe.service"; /** * Stripe Customer API Service * * Manages Stripe customer operations including creation, retrieval, updates, and payment method management. * Provides a thin wrapper around Stripe's customer API with error handling and company metadata integration. * * @example * ```typescript * const customer = await stripeCustomerApiService.createCustomer({ * companyId: 'company_123', * email: 'user@example.com', * name: 'John Doe', * }); * ``` */ export declare class StripeCustomerApiService { private readonly stripeService; constructor(stripeService: StripeService); /** * Create a new Stripe customer * * @param params - Customer creation parameters * @param params.companyId - Internal company ID (stored in metadata) * @param params.email - Customer email address * @param params.name - Customer name * @param params.metadata - Additional metadata to store with the customer * @returns Promise resolving to the created Stripe customer * @throws {StripeError} If customer creation fails * * @example * ```typescript * const customer = await service.createCustomer({ * companyId: 'company_123', * email: 'user@example.com', * name: 'John Doe', * }); * ``` */ createCustomer(params: { companyId: string; email: string; name: string; metadata?: Record; }): Promise; /** * Retrieve a Stripe customer by ID * * @param stripeCustomerId - The Stripe customer ID * @returns Promise resolving to the Stripe customer object * @throws {Error} If the customer has been deleted * @throws {StripeError} If retrieval fails * * @example * ```typescript * const customer = await service.retrieveCustomer('cus_abc123'); * ``` */ retrieveCustomer(stripeCustomerId: string): Promise; /** * Update a Stripe customer's information * * @param params - Customer update parameters * @param params.stripeCustomerId - The Stripe customer ID * @param params.email - New email address (optional) * @param params.name - New name (optional) * @param params.defaultPaymentMethodId - New default payment method ID (optional) * @param params.metadata - Updated metadata (optional) * @returns Promise resolving to the updated Stripe customer * @throws {StripeError} If update fails * * @example * ```typescript * const customer = await service.updateCustomer({ * stripeCustomerId: 'cus_abc123', * email: 'newemail@example.com', * defaultPaymentMethodId: 'pm_xyz789', * }); * ``` */ updateCustomer(params: { stripeCustomerId: string; email?: string; name?: string; defaultPaymentMethodId?: string; metadata?: Record; }): Promise; /** * Delete a Stripe customer * * @param stripeCustomerId - The Stripe customer ID to delete * @returns Promise resolving to the deleted customer confirmation * @throws {StripeError} If deletion fails * * @example * ```typescript * const deleted = await service.deleteCustomer('cus_abc123'); * ``` * * @remarks * This is a permanent action. Consider deactivating or archiving the customer instead. */ deleteCustomer(stripeCustomerId: string): Promise; /** * List payment methods attached to a customer * * @param stripeCustomerId - The Stripe customer ID * @param type - Type of payment method to list (default: "card") * @returns Promise resolving to array of payment methods * @throws {StripeError} If listing fails * * @example * ```typescript * const paymentMethods = await service.listPaymentMethods('cus_abc123', 'card'); * ``` */ listPaymentMethods(stripeCustomerId: string, type?: Stripe.PaymentMethodListParams.Type): Promise; /** * Set the default payment method for a customer * * @param stripeCustomerId - The Stripe customer ID * @param paymentMethodId - The payment method ID to set as default * @returns Promise resolving to the updated customer * @throws {StripeError} If update fails * * @example * ```typescript * const customer = await service.setDefaultPaymentMethod('cus_abc123', 'pm_xyz789'); * ``` */ setDefaultPaymentMethod(stripeCustomerId: string, paymentMethodId: string): Promise; /** * Detach a payment method from its customer * * @param paymentMethodId - The payment method ID to detach * @returns Promise resolving to the detached payment method * @throws {StripeError} If detachment fails * * @example * ```typescript * const paymentMethod = await service.detachPaymentMethod('pm_xyz789'); * ``` */ detachPaymentMethod(paymentMethodId: string): Promise; } //# sourceMappingURL=stripe-customer-api.service.d.ts.map