@startsimpli/billing 0.4.7 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,20 +9,20 @@ export interface ProductOffer {
9
9
  id: string;
10
10
  name: string;
11
11
  slug: string;
12
- unit_price: string; // Decimal as string from DRF
12
+ unitPrice: string; // Decimal as string from DRF
13
13
  currency: string;
14
- pricing_model: "flat" | "per_seat" | "tiered" | "volume" | "usage";
15
- interval_unit: "day" | "week" | "month" | "year" | null;
16
- interval_count: number | null;
17
- interval_display: string;
18
- is_recurring: boolean;
19
- is_free: boolean;
14
+ pricingModel: "flat" | "per_seat" | "tiered" | "volume" | "usage";
15
+ intervalUnit: "day" | "week" | "month" | "year" | null;
16
+ intervalCount: number | null;
17
+ intervalDisplay: string;
18
+ isRecurring: boolean;
19
+ isFree: boolean;
20
20
  features: OfferFeature[];
21
- is_active: boolean;
22
- is_featured: boolean;
23
- trial_days: number;
24
- sort_order: number;
25
- cta_text: string;
21
+ isActive: boolean;
22
+ isFeatured: boolean;
23
+ trialDays: number;
24
+ sortOrder: number;
25
+ ctaText: string;
26
26
  }
27
27
 
28
28
  export interface OfferFeature {
@@ -43,12 +43,12 @@ export interface BillingProduct {
43
43
  }
44
44
 
45
45
  export interface CheckoutResult {
46
- session_id: string;
46
+ sessionId: string;
47
47
  url: string;
48
48
  }
49
49
 
50
50
  export interface FreeSubscriptionResult {
51
- subscription_id: string;
51
+ subscriptionId: string;
52
52
  status: string;
53
53
  }
54
54
 
@@ -60,10 +60,10 @@ export interface SubscriptionInfo {
60
60
  id: string;
61
61
  offer: ProductOffer;
62
62
  status: "active" | "trialing" | "past_due" | "cancelled" | "incomplete" | "incomplete_expired" | "unpaid";
63
- current_period_start: string | null;
64
- current_period_end: string | null;
65
- cancel_at_period_end: boolean;
66
- trial_end: string | null;
63
+ currentPeriodStart: string | null;
64
+ currentPeriodEnd: string | null;
65
+ cancelAtPeriodEnd: boolean;
66
+ trialEnd: string | null;
67
67
  }
68
68
 
69
69
  export interface PaymentMethod {
@@ -72,19 +72,19 @@ export interface PaymentMethod {
72
72
  }
73
73
 
74
74
  export interface CachedSubscriptionState {
75
- subscription_id: string | null;
76
- provider_subscription_id: string | null;
75
+ subscriptionId: string | null;
76
+ providerSubscriptionId: string | null;
77
77
  status: string;
78
- customer_id: string | null;
79
- price_id: string | null;
80
- offer_id: string | null;
81
- product_slug: string | null;
82
- offer_slug: string | null;
83
- current_period_start: number | null;
84
- current_period_end: number | null;
85
- cancel_at_period_end: boolean;
86
- trial_end: number | null;
87
- payment_method: PaymentMethod | null;
78
+ customerId: string | null;
79
+ priceId: string | null;
80
+ offerId: string | null;
81
+ productSlug: string | null;
82
+ offerSlug: string | null;
83
+ currentPeriodStart: number | null;
84
+ currentPeriodEnd: number | null;
85
+ cancelAtPeriodEnd: boolean;
86
+ trialEnd: number | null;
87
+ paymentMethod: PaymentMethod | null;
88
88
  }
89
89
 
90
90
  export interface BillingConfig {
@@ -49,7 +49,7 @@ describe("BillingApiClient", () => {
49
49
  mockFetch.mockResolvedValue({
50
50
  ok: true,
51
51
  json: () =>
52
- Promise.resolve({ session_id: "cs_1", url: "https://pay.com" }),
52
+ Promise.resolve({ sessionId: "cs_1", url: "https://pay.com" }),
53
53
  });
54
54
 
55
55
  const client = createClient();
@@ -59,7 +59,7 @@ describe("BillingApiClient", () => {
59
59
  cancelUrl: "https://nope.com",
60
60
  });
61
61
 
62
- expect(result.session_id).toBe("cs_1");
62
+ expect(result.sessionId).toBe("cs_1");
63
63
  expect(mockFetch).toHaveBeenCalledWith(
64
64
  "/api/billing/offer-checkout/",
65
65
  expect.objectContaining({
@@ -75,7 +75,7 @@ describe("BillingApiClient", () => {
75
75
  mockFetch.mockResolvedValue({
76
76
  ok: true,
77
77
  json: () =>
78
- Promise.resolve({ session_id: "cs_1", url: "https://pay.com" }),
78
+ Promise.resolve({ sessionId: "cs_1", url: "https://pay.com" }),
79
79
  });
80
80
 
81
81
  const client = createClient();