* Add subscription start, trial end, and end dates to db * Add subscription start, trial end, and end date to db * Write subscription start date on new team subscriptions * Write subscription start date for new orgs * Fix typo in stripe billing service file (billling -> billing) * Use `StripeBillingService.extractSubscriptionDates` * Remove comments * Address comment * Fix typo in file import * Fix typo in file import * Add missing SubscriptionStatus enum values - Add INCOMPLETE, INCOMPLETE_EXPIRED, UNPAID, PAUSED enum values - These values are referenced in stripe-billing-service.ts status mapping - Fixes type errors in billing-related code Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
48 lines
1.0 KiB
TypeScript
48 lines
1.0 KiB
TypeScript
export enum Plan {
|
|
TEAM = "TEAM",
|
|
ORGANIZATION = "ORGANIZATION",
|
|
ENTERPRISE = "ENTERPRISE",
|
|
}
|
|
|
|
export enum SubscriptionStatus {
|
|
ACTIVE = "ACTIVE",
|
|
CANCELLED = "CANCELLED",
|
|
PAST_DUE = "PAST_DUE",
|
|
TRIALING = "TRIALING",
|
|
INCOMPLETE = "INCOMPLETE",
|
|
INCOMPLETE_EXPIRED = "INCOMPLETE_EXPIRED",
|
|
UNPAID = "UNPAID",
|
|
PAUSED = "PAUSED",
|
|
}
|
|
|
|
export interface BillingRecord {
|
|
id: string;
|
|
teamId: number;
|
|
subscriptionId: string;
|
|
subscriptionItemId: string;
|
|
customerId: string;
|
|
planName: Plan;
|
|
status: SubscriptionStatus;
|
|
}
|
|
|
|
export interface IBillingRepository {
|
|
create(args: IBillingRepositoryCreateArgs): Promise<BillingRecord>;
|
|
}
|
|
|
|
export interface IBillingRepositoryConstructorArgs {
|
|
teamId: number;
|
|
isOrganization: boolean;
|
|
}
|
|
|
|
export interface IBillingRepositoryCreateArgs {
|
|
teamId: number;
|
|
subscriptionId: string;
|
|
subscriptionItemId: string;
|
|
customerId: string;
|
|
planName: Plan;
|
|
status: SubscriptionStatus;
|
|
subscriptionStart?: Date;
|
|
subscriptionTrialEnd?: Date;
|
|
subscriptionEnd?: Date;
|
|
}
|