/** * Subtrak Angular SDK - Type Definitions * * These types match the Subtrak V5 API structure */ export declare enum BillingInterval { DAILY = "DAILY", WEEKLY = "WEEKLY", MONTHLY = "MONTHLY", QUARTERLY = "QUARTERLY", ANNUAL = "ANNUAL" } export declare enum PriceType { RECURRING = "RECURRING", ONE_TIME = "ONE_TIME", METERED = "METERED" } export declare enum PricingScheme { FLAT = "FLAT", PER_UNIT = "PER_UNIT", TIERED = "TIERED", VOLUME = "VOLUME" } export declare enum EntitlementType { BOOLEAN = "BOOLEAN", NUMERIC = "NUMERIC", ENUM = "ENUM", METERED = "METERED" } export declare enum EntitlementCategory { FEATURE = "FEATURE", LIMIT = "LIMIT", QUOTA = "QUOTA", ADDON = "ADDON" } export declare enum EntitlementScope { GLOBAL = "GLOBAL", PER_LOCATION = "PER_LOCATION", PER_USER = "PER_USER" } export declare enum ResetPeriod { NEVER = "NEVER", BILLING_PERIOD = "BILLING_PERIOD", MONTHLY = "MONTHLY", ANNUALLY = "ANNUALLY" } export declare enum SubscriptionStatus { FREE = "FREE", TRIAL = "TRIAL", PENDING = "PENDING", ACTIVE = "ACTIVE", PAST_DUE = "PAST_DUE", SUSPENDED = "SUSPENDED", CANCELLED = "CANCELLED", EXPIRED = "EXPIRED" } export declare enum InvoiceStatus { DRAFT = "DRAFT", OPEN = "OPEN", PAID = "PAID", VOID = "VOID", UNCOLLECTIBLE = "UNCOLLECTIBLE" } export declare enum PaymentProvider { STRIPE = "STRIPE", PAYMOB = "PAYMOB",// Legacy PAYMOB_EGYPT = "PAYMOB_EGYPT", PAYMOB_KSA = "PAYMOB_KSA", PAYMOB_UAE = "PAYMOB_UAE", PAYMOB_OMAN = "PAYMOB_OMAN", PAYMOB_PAKISTAN = "PAYMOB_PAKISTAN", PAYPAL = "PAYPAL", RAZORPAY = "RAZORPAY", PADDLE = "PADDLE", SQUARE = "SQUARE" } export declare enum PaymentStatus { PENDING = "PENDING", PROCESSING = "PROCESSING", SUCCEEDED = "SUCCEEDED", FAILED = "FAILED", REFUNDED = "REFUNDED", PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED" } export interface Country { id: string; code: string; name: string; currency: string; defaultTaxRate: string | null; defaultTaxName: string | null; isActive: boolean; flag?: string; } export interface Product { id: string; tenantId: string; name: string; slug: string; description: string | null; createdAt: string; updatedAt: string; } export interface Customer { id: string; tenantId: string; countryCode: string; name: string; email: string; phone: string | null; billingAddressLine1: string | null; billingAddressLine2: string | null; billingCity: string | null; billingState: string | null; billingPostalCode: string | null; billingCountry: string | null; createdAt: string; updatedAt: string; } export interface Entitlement { id: string; tenantId: string; productId: string | null; code: string; name: string; description: string | null; type: EntitlementType; category: EntitlementCategory; scope: EntitlementScope | null; unit: string | null; resetPeriod: ResetPeriod | null; meterId: string | null; allowedValues: string[] | null; isActive: boolean; createdAt: string; updatedAt: string; } /** * Entitlement with its resolved value for a specific subscription/customer */ export interface EntitlementValue { id: string; code: string; name: string; description: string | null; type: EntitlementType; category: EntitlementCategory; scope: EntitlementScope | null; unit: string | null; resetPeriod: ResetPeriod | null; value: boolean | number | string | null; allowedValues?: string[]; } export interface Meter { id: string; tenantId: string; productId: string; code: string; name: string; description: string | null; eventName: string; aggregationType: string; valueProperty: string | null; groupBy: string | null; isActive: boolean; createdAt: string; updatedAt: string; } export interface UsageSummary { id: string; subscriptionId: string; meterId: string; periodStart: string; periodEnd: string; totalUsage: string; includedUnits: string | null; billableUnits: string; usageByGroup: Record | null; createdAt: string; } export interface PriceTier { upTo: number; unitAmount: string; } export interface Price { id: string; tenantId: string; productId: string; nickname: string; description: string | null; type: PriceType; billingInterval: BillingInterval | null; billingIntervalCount: number | null; unitAmount: string | null; currency: string; pricingScheme: PricingScheme; tiers: PriceTier[] | null; countryCode: string; trialPeriodDays: number | null; isFreePlan?: boolean; isTrialPlan?: boolean; isActive: boolean; createdAt: string; updatedAt: string; } export interface PriceWithEntitlements extends Price { product?: Pick; entitlements: EntitlementValue[]; } export interface PlanOption { name: string; description: string | null; prices: PriceWithEntitlements[]; } export interface Subscription { id: string; customerId: string; priceId: string; quantity: number; status: SubscriptionStatus; trialStart: string | null; trialEnd: string | null; currentPeriodStart: string; currentPeriodEnd: string | null; cancelAtPeriodEnd: boolean; cancelledAt: string | null; priceSnapshot: Record; createdAt: string; updatedAt: string; } export interface SubscriptionWithRelations extends Subscription { customer: Pick; price: { id: string; nickname: string; currency: string; unitAmount: string | null; product: Pick; }; } export interface InvoiceLineItem { description: string; quantity: number; unitAmount: string; amount: string; type: 'RECURRING' | 'METERED' | 'OVERAGE' | 'PRORATION'; metadata?: Record; } export interface Invoice { id: string; customerId: string; invoiceNumber: string; subtotal: string; tax: string; total: string; amountPaid: string; amountDue: string; lineItems: InvoiceLineItem[]; currency: string; issueDate: string; dueDate: string; paidAt: string | null; status: InvoiceStatus; pdfUrl: string | null; createdAt: string; updatedAt: string; } export interface InvoiceWithRelations extends Invoice { customer: Pick; payments?: any[]; notes?: string | null; } export interface PaymentMethod { id: string; customerId: string; provider: PaymentProvider; providerMethodId: string; type: string; cardBrand: string | null; cardLast4: string | null; cardExpMonth: number | null; cardExpYear: number | null; isDefault: boolean; createdAt: string; updatedAt: string; } export interface PaymentProviderConfig { provider: PaymentProvider; publishableKey: string; supportedCountries: string[]; isActive: boolean; } export interface AddPaymentMethodResult { paymentMethod: PaymentMethod; setupIntent?: any; } export interface PaginationParams { page?: number; limit?: number; } export interface PaginatedResponse { data: T[]; pagination: { total: number; pages: number; currentPage: number; perPage: number; }; } export interface ApiErrorResponse { error: string; message?: string; details?: Record; } export interface CreateSubscriptionInput { customerId: string; priceId: string; quantity?: number; trialEnd?: string; metadata?: Record; } export interface UpdateSubscriptionInput { priceId?: string; quantity?: number; entitlementOverrides?: Record; cancelAtPeriodEnd?: boolean; metadata?: Record; } export interface ProrationDetails { credit: string; charge: string; net: string; currency: string; } export interface PreviewUpdateResponse { proration: ProrationDetails; effectiveDate: string; newPriceId: string; newQuantity: number; } export interface CreateSubscriptionResult { subscription: Subscription; requiresPayment: boolean; clientSecret?: string; paymentUrl?: string; iframeId?: string; provider?: PaymentProvider; invoiceId?: string; paymentId?: string; paymentLinkId?: string; error?: string; } export type PaymentMode = 'new-window' | 'redirect' | 'iframe'; export interface SubscriptionPaymentLinkWithDetails { id: string; token: string; subscriptionId: string; expiresAt: string; isUsed: boolean; usedAt?: string; createdAt: string; updatedAt: string; paymentUrl?: string; subscription?: any; invoice?: any; } export interface OneTimePaymentLinkWithDetails { id: string; tenantId: string; customerId: string; name: string; description?: string; amount: string; currency: string; token: string; expiresAt: string; isUsed: boolean; usedAt?: string; paymentId?: string; paymentUrl?: string; metadata?: Record; createdAt: string; updatedAt: string; customer?: any; payment?: any; } export interface PaymentLinkSummary { count: number; totalAmount: number; currency: string; links: (SubscriptionPaymentLinkWithDetails | OneTimePaymentLinkWithDetails)[]; } export interface PaymentUrlReadyEvent { paymentUrl: string; iframeId?: string; subscriptionId?: string; amount: number; currency: string; } export interface PaymentCompletedEvent { token: string; success: boolean; subscriptionId?: string; } export interface RecordUsageInput { meterId: string; subscriptionId?: string; customerId: string; eventName: string; properties: Record; value?: number; timestamp?: string; } export interface ListSubscriptionsParams extends PaginationParams { customerId?: string; status?: SubscriptionStatus | SubscriptionStatus[]; priceId?: string; productId?: string; } export interface ListInvoicesParams extends PaginationParams { customerId?: string; subscriptionId?: string; status?: InvoiceStatus | InvoiceStatus[]; dateFrom?: string; dateTo?: string; } export interface ListProductsParams extends PaginationParams { countryCode?: string; isActive?: boolean; }