orb-billing 5.37.2 → 5.40.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +1 -1
  3. package/README.md +4 -1
  4. package/index.d.mts +7 -4
  5. package/index.d.ts +7 -4
  6. package/index.d.ts.map +1 -1
  7. package/index.js +5 -0
  8. package/index.js.map +1 -1
  9. package/index.mjs +7 -2
  10. package/index.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/credit-blocks.d.ts +59 -0
  13. package/resources/credit-blocks.d.ts.map +1 -0
  14. package/resources/credit-blocks.js +38 -0
  15. package/resources/credit-blocks.js.map +1 -0
  16. package/resources/credit-blocks.mjs +34 -0
  17. package/resources/credit-blocks.mjs.map +1 -0
  18. package/resources/index.d.ts +3 -2
  19. package/resources/index.d.ts.map +1 -1
  20. package/resources/index.js +5 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs +3 -2
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/invoices.d.ts +439 -2
  25. package/resources/invoices.d.ts.map +1 -1
  26. package/resources/invoices.js +28 -1
  27. package/resources/invoices.js.map +1 -1
  28. package/resources/invoices.mjs +26 -0
  29. package/resources/invoices.mjs.map +1 -1
  30. package/resources/plans/index.d.ts +1 -0
  31. package/resources/plans/index.d.ts.map +1 -1
  32. package/resources/plans/index.js +4 -1
  33. package/resources/plans/index.js.map +1 -1
  34. package/resources/plans/index.mjs +1 -0
  35. package/resources/plans/index.mjs.map +1 -1
  36. package/resources/plans/migrations.d.ts +47 -0
  37. package/resources/plans/migrations.d.ts.map +1 -0
  38. package/resources/plans/migrations.js +36 -0
  39. package/resources/plans/migrations.js.map +1 -0
  40. package/resources/plans/migrations.mjs +31 -0
  41. package/resources/plans/migrations.mjs.map +1 -0
  42. package/resources/plans/plans.d.ts +4 -0
  43. package/resources/plans/plans.d.ts.map +1 -1
  44. package/resources/plans/plans.js +5 -0
  45. package/resources/plans/plans.js.map +1 -1
  46. package/resources/plans/plans.mjs +5 -0
  47. package/resources/plans/plans.mjs.map +1 -1
  48. package/resources/prices/prices.d.ts +1 -91
  49. package/resources/prices/prices.d.ts.map +1 -1
  50. package/resources/prices/prices.js.map +1 -1
  51. package/resources/prices/prices.mjs.map +1 -1
  52. package/resources/shared.d.ts +3 -273
  53. package/resources/shared.d.ts.map +1 -1
  54. package/resources/shared.js.map +1 -1
  55. package/resources/shared.mjs.map +1 -1
  56. package/resources/subscription-changes.d.ts +96 -1
  57. package/resources/subscription-changes.d.ts.map +1 -1
  58. package/resources/subscription-changes.js +15 -1
  59. package/resources/subscription-changes.js.map +1 -1
  60. package/resources/subscription-changes.mjs +13 -0
  61. package/resources/subscription-changes.mjs.map +1 -1
  62. package/resources/subscriptions.d.ts +1 -91
  63. package/resources/subscriptions.d.ts.map +1 -1
  64. package/resources/subscriptions.js.map +1 -1
  65. package/resources/subscriptions.mjs.map +1 -1
  66. package/src/index.ts +19 -0
  67. package/src/resources/credit-blocks.ts +81 -0
  68. package/src/resources/index.ts +7 -0
  69. package/src/resources/invoices.ts +557 -1
  70. package/src/resources/plans/index.ts +8 -0
  71. package/src/resources/plans/migrations.ts +105 -0
  72. package/src/resources/plans/plans.ts +21 -0
  73. package/src/resources/prices/prices.ts +1 -91
  74. package/src/resources/shared.ts +3 -273
  75. package/src/resources/subscription-changes.ts +142 -0
  76. package/src/resources/subscriptions.ts +1 -91
  77. package/src/version.ts +1 -1
  78. package/version.d.ts +1 -1
  79. package/version.js +1 -1
  80. package/version.mjs +1 -1
@@ -6,6 +6,7 @@ import * as Core from '../core';
6
6
  import * as Shared from './shared';
7
7
  import * as CustomersAPI from './customers/customers';
8
8
  import * as PlansAPI from './plans/plans';
9
+ import { Page, type PageParams } from '../pagination';
9
10
 
10
11
  export class SubscriptionChanges extends APIResource {
11
12
  /**
@@ -26,6 +27,31 @@ export class SubscriptionChanges extends APIResource {
26
27
  return this._client.get(`/subscription_changes/${subscriptionChangeId}`, options);
27
28
  }
28
29
 
30
+ /**
31
+ * This endpoint returns a list of pending subscription changes for a customer. Use
32
+ * the [Fetch Subscription Change](fetch-subscription-change) endpoint to retrieve
33
+ * the expected subscription state after the pending change is applied.
34
+ */
35
+ list(
36
+ query?: SubscriptionChangeListParams,
37
+ options?: Core.RequestOptions,
38
+ ): Core.PagePromise<SubscriptionChangeListResponsesPage, SubscriptionChangeListResponse>;
39
+ list(
40
+ options?: Core.RequestOptions,
41
+ ): Core.PagePromise<SubscriptionChangeListResponsesPage, SubscriptionChangeListResponse>;
42
+ list(
43
+ query: SubscriptionChangeListParams | Core.RequestOptions = {},
44
+ options?: Core.RequestOptions,
45
+ ): Core.PagePromise<SubscriptionChangeListResponsesPage, SubscriptionChangeListResponse> {
46
+ if (isRequestOptions(query)) {
47
+ return this.list({}, query);
48
+ }
49
+ return this._client.getAPIList('/subscription_changes', SubscriptionChangeListResponsesPage, {
50
+ query,
51
+ ...options,
52
+ });
53
+ }
54
+
29
55
  /**
30
56
  * Apply a subscription change to perform the intended action. If a positive amount
31
57
  * is passed with a request to this endpoint, any eligible invoices that were
@@ -64,6 +90,8 @@ export class SubscriptionChanges extends APIResource {
64
90
  }
65
91
  }
66
92
 
93
+ export class SubscriptionChangeListResponsesPage extends Page<SubscriptionChangeListResponse> {}
94
+
67
95
  export interface MutatedSubscription {
68
96
  id: string;
69
97
 
@@ -236,6 +264,11 @@ export interface MutatedSubscription {
236
264
  export interface SubscriptionChangeRetrieveResponse {
237
265
  id: string;
238
266
 
267
+ /**
268
+ * The type of change (e.g., 'schedule_plan_change', 'create_subscription').
269
+ */
270
+ change_type: string;
271
+
239
272
  /**
240
273
  * Subscription change will be cancelled at this time and can no longer be applied.
241
274
  */
@@ -250,6 +283,50 @@ export interface SubscriptionChangeRetrieveResponse {
250
283
  */
251
284
  applied_at?: string | null;
252
285
 
286
+ /**
287
+ * Billing cycle alignment for plan changes.
288
+ */
289
+ billing_cycle_alignment?: string | null;
290
+
291
+ /**
292
+ * When this change was cancelled.
293
+ */
294
+ cancelled_at?: string | null;
295
+
296
+ /**
297
+ * How the change is scheduled (e.g., 'immediate', 'end_of_subscription_term',
298
+ * 'requested_date').
299
+ */
300
+ change_option?: string | null;
301
+
302
+ /**
303
+ * When this change will take effect.
304
+ */
305
+ effective_date?: string | null;
306
+
307
+ /**
308
+ * The target plan ID for plan changes.
309
+ */
310
+ plan_id?: string | null;
311
+ }
312
+
313
+ export interface SubscriptionChangeListResponse {
314
+ id: string;
315
+
316
+ /**
317
+ * Subscription change will be cancelled at this time and can no longer be applied.
318
+ */
319
+ expiration_time: string;
320
+
321
+ status: 'pending' | 'applied' | 'cancelled';
322
+
323
+ subscription_id: string | null;
324
+
325
+ /**
326
+ * When this change was applied.
327
+ */
328
+ applied_at?: string | null;
329
+
253
330
  /**
254
331
  * When this change was cancelled.
255
332
  */
@@ -265,6 +342,11 @@ export interface SubscriptionChangeRetrieveResponse {
265
342
  export interface SubscriptionChangeApplyResponse {
266
343
  id: string;
267
344
 
345
+ /**
346
+ * The type of change (e.g., 'schedule_plan_change', 'create_subscription').
347
+ */
348
+ change_type: string;
349
+
268
350
  /**
269
351
  * Subscription change will be cancelled at this time and can no longer be applied.
270
352
  */
@@ -279,10 +361,31 @@ export interface SubscriptionChangeApplyResponse {
279
361
  */
280
362
  applied_at?: string | null;
281
363
 
364
+ /**
365
+ * Billing cycle alignment for plan changes.
366
+ */
367
+ billing_cycle_alignment?: string | null;
368
+
282
369
  /**
283
370
  * When this change was cancelled.
284
371
  */
285
372
  cancelled_at?: string | null;
373
+
374
+ /**
375
+ * How the change is scheduled (e.g., 'immediate', 'end_of_subscription_term',
376
+ * 'requested_date').
377
+ */
378
+ change_option?: string | null;
379
+
380
+ /**
381
+ * When this change will take effect.
382
+ */
383
+ effective_date?: string | null;
384
+
385
+ /**
386
+ * The target plan ID for plan changes.
387
+ */
388
+ plan_id?: string | null;
286
389
  }
287
390
 
288
391
  /**
@@ -294,6 +397,11 @@ export interface SubscriptionChangeApplyResponse {
294
397
  export interface SubscriptionChangeCancelResponse {
295
398
  id: string;
296
399
 
400
+ /**
401
+ * The type of change (e.g., 'schedule_plan_change', 'create_subscription').
402
+ */
403
+ change_type: string;
404
+
297
405
  /**
298
406
  * Subscription change will be cancelled at this time and can no longer be applied.
299
407
  */
@@ -308,10 +416,39 @@ export interface SubscriptionChangeCancelResponse {
308
416
  */
309
417
  applied_at?: string | null;
310
418
 
419
+ /**
420
+ * Billing cycle alignment for plan changes.
421
+ */
422
+ billing_cycle_alignment?: string | null;
423
+
311
424
  /**
312
425
  * When this change was cancelled.
313
426
  */
314
427
  cancelled_at?: string | null;
428
+
429
+ /**
430
+ * How the change is scheduled (e.g., 'immediate', 'end_of_subscription_term',
431
+ * 'requested_date').
432
+ */
433
+ change_option?: string | null;
434
+
435
+ /**
436
+ * When this change will take effect.
437
+ */
438
+ effective_date?: string | null;
439
+
440
+ /**
441
+ * The target plan ID for plan changes.
442
+ */
443
+ plan_id?: string | null;
444
+ }
445
+
446
+ export interface SubscriptionChangeListParams extends PageParams {
447
+ customer_id?: string | null;
448
+
449
+ external_customer_id?: string | null;
450
+
451
+ status?: 'pending' | 'applied' | 'cancelled' | null;
315
452
  }
316
453
 
317
454
  export interface SubscriptionChangeApplyParams {
@@ -350,12 +487,17 @@ export interface SubscriptionChangeApplyParams {
350
487
  previously_collected_amount?: string | null;
351
488
  }
352
489
 
490
+ SubscriptionChanges.SubscriptionChangeListResponsesPage = SubscriptionChangeListResponsesPage;
491
+
353
492
  export declare namespace SubscriptionChanges {
354
493
  export {
355
494
  type MutatedSubscription as MutatedSubscription,
356
495
  type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse,
496
+ type SubscriptionChangeListResponse as SubscriptionChangeListResponse,
357
497
  type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse,
358
498
  type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse,
499
+ SubscriptionChangeListResponsesPage as SubscriptionChangeListResponsesPage,
500
+ type SubscriptionChangeListParams as SubscriptionChangeListParams,
359
501
  type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams,
360
502
  };
361
503
  }
@@ -1438,9 +1438,6 @@ export namespace NewSubscriptionCumulativeGroupedBulkPrice {
1438
1438
  */
1439
1439
  dimension_values: Array<CumulativeGroupedBulkConfig.DimensionValue>;
1440
1440
 
1441
- /**
1442
- * Grouping key name
1443
- */
1444
1441
  group: string;
1445
1442
  }
1446
1443
 
@@ -1701,9 +1698,6 @@ export namespace NewSubscriptionGroupedTieredPackagePrice {
1701
1698
  */
1702
1699
  grouping_key: string;
1703
1700
 
1704
- /**
1705
- * Package size
1706
- */
1707
1701
  package_size: string;
1708
1702
 
1709
1703
  /**
@@ -1719,13 +1713,10 @@ export namespace NewSubscriptionGroupedTieredPackagePrice {
1719
1713
  */
1720
1714
  export interface Tier {
1721
1715
  /**
1722
- * Price per package
1716
+ * Per package
1723
1717
  */
1724
1718
  per_unit: string;
1725
1719
 
1726
- /**
1727
- * Tier lower bound
1728
- */
1729
1720
  tier_lower_bound: string;
1730
1721
  }
1731
1722
  }
@@ -1854,9 +1845,6 @@ export namespace NewSubscriptionGroupedTieredPrice {
1854
1845
  * Configuration for a single tier
1855
1846
  */
1856
1847
  export interface Tier {
1857
- /**
1858
- * Tier lower bound
1859
- */
1860
1848
  tier_lower_bound: string;
1861
1849
 
1862
1850
  /**
@@ -2011,14 +1999,8 @@ export namespace NewSubscriptionGroupedWithMeteredMinimumPrice {
2011
1999
  * Configuration for a scaling factor
2012
2000
  */
2013
2001
  export interface ScalingFactor {
2014
- /**
2015
- * Scaling factor
2016
- */
2017
2002
  scaling_factor: string;
2018
2003
 
2019
- /**
2020
- * Scaling value
2021
- */
2022
2004
  scaling_value: string;
2023
2005
  }
2024
2006
 
@@ -2026,9 +2008,6 @@ export namespace NewSubscriptionGroupedWithMeteredMinimumPrice {
2026
2008
  * Configuration for a unit amount
2027
2009
  */
2028
2010
  export interface UnitAmount {
2029
- /**
2030
- * Pricing value
2031
- */
2032
2011
  pricing_value: string;
2033
2012
 
2034
2013
  /**
@@ -2615,9 +2594,6 @@ export namespace NewSubscriptionMaxGroupTieredPackagePrice {
2615
2594
  */
2616
2595
  grouping_key: string;
2617
2596
 
2618
- /**
2619
- * Package size
2620
- */
2621
2597
  package_size: string;
2622
2598
 
2623
2599
  /**
@@ -2631,9 +2607,6 @@ export namespace NewSubscriptionMaxGroupTieredPackagePrice {
2631
2607
  * Configuration for a single tier
2632
2608
  */
2633
2609
  export interface Tier {
2634
- /**
2635
- * Tier lower bound
2636
- */
2637
2610
  tier_lower_bound: string;
2638
2611
 
2639
2612
  /**
@@ -2969,19 +2942,10 @@ export namespace NewSubscriptionPackageWithAllocationPrice {
2969
2942
  * Configuration for package_with_allocation pricing
2970
2943
  */
2971
2944
  export interface PackageWithAllocationConfig {
2972
- /**
2973
- * Usage allocation
2974
- */
2975
2945
  allocation: string;
2976
2946
 
2977
- /**
2978
- * Price per package
2979
- */
2980
2947
  package_amount: string;
2981
2948
 
2982
- /**
2983
- * Package size
2984
- */
2985
2949
  package_size: string;
2986
2950
  }
2987
2951
  }
@@ -3102,9 +3066,6 @@ export namespace NewSubscriptionScalableMatrixWithTieredPricingPrice {
3102
3066
  */
3103
3067
  matrix_scaling_factors: Array<ScalableMatrixWithTieredPricingConfig.MatrixScalingFactor>;
3104
3068
 
3105
- /**
3106
- * Tier pricing structure
3107
- */
3108
3069
  tiers: Array<ScalableMatrixWithTieredPricingConfig.Tier>;
3109
3070
 
3110
3071
  /**
@@ -3118,19 +3079,10 @@ export namespace NewSubscriptionScalableMatrixWithTieredPricingPrice {
3118
3079
  * Configuration for a single matrix scaling factor
3119
3080
  */
3120
3081
  export interface MatrixScalingFactor {
3121
- /**
3122
- * First dimension value
3123
- */
3124
3082
  first_dimension_value: string;
3125
3083
 
3126
- /**
3127
- * Scaling factor
3128
- */
3129
3084
  scaling_factor: string;
3130
3085
 
3131
- /**
3132
- * Second dimension value (optional)
3133
- */
3134
3086
  second_dimension_value?: string | null;
3135
3087
  }
3136
3088
 
@@ -3138,14 +3090,8 @@ export namespace NewSubscriptionScalableMatrixWithTieredPricingPrice {
3138
3090
  * Configuration for a single tier entry with business logic
3139
3091
  */
3140
3092
  export interface Tier {
3141
- /**
3142
- * Tier lower bound
3143
- */
3144
3093
  tier_lower_bound: string;
3145
3094
 
3146
- /**
3147
- * Per unit amount
3148
- */
3149
3095
  unit_amount: string;
3150
3096
  }
3151
3097
  }
@@ -3288,19 +3234,10 @@ export namespace NewSubscriptionScalableMatrixWithUnitPricingPrice {
3288
3234
  * Configuration for a single matrix scaling factor
3289
3235
  */
3290
3236
  export interface MatrixScalingFactor {
3291
- /**
3292
- * First dimension value
3293
- */
3294
3237
  first_dimension_value: string;
3295
3238
 
3296
- /**
3297
- * Scaling factor
3298
- */
3299
3239
  scaling_factor: string;
3300
3240
 
3301
- /**
3302
- * Second dimension value (optional)
3303
- */
3304
3241
  second_dimension_value?: string | null;
3305
3242
  }
3306
3243
  }
@@ -3429,9 +3366,6 @@ export namespace NewSubscriptionThresholdTotalAmountPrice {
3429
3366
  * Configuration for a single threshold
3430
3367
  */
3431
3368
  export interface ConsumptionTable {
3432
- /**
3433
- * Quantity threshold
3434
- */
3435
3369
  threshold: string;
3436
3370
 
3437
3371
  /**
@@ -3548,9 +3482,6 @@ export namespace NewSubscriptionTieredPackagePrice {
3548
3482
  * Configuration for tiered_package pricing
3549
3483
  */
3550
3484
  export interface TieredPackageConfig {
3551
- /**
3552
- * Package size
3553
- */
3554
3485
  package_size: string;
3555
3486
 
3556
3487
  /**
@@ -3572,9 +3503,6 @@ export namespace NewSubscriptionTieredPackagePrice {
3572
3503
  */
3573
3504
  per_unit: string;
3574
3505
 
3575
- /**
3576
- * Tier lower bound
3577
- */
3578
3506
  tier_lower_bound: string;
3579
3507
  }
3580
3508
  }
@@ -3686,9 +3614,6 @@ export namespace NewSubscriptionTieredPackageWithMinimumPrice {
3686
3614
  * Configuration for tiered_package_with_minimum pricing
3687
3615
  */
3688
3616
  export interface TieredPackageWithMinimumConfig {
3689
- /**
3690
- * Package size
3691
- */
3692
3617
  package_size: number;
3693
3618
 
3694
3619
  /**
@@ -3703,19 +3628,10 @@ export namespace NewSubscriptionTieredPackageWithMinimumPrice {
3703
3628
  * Configuration for a single tier
3704
3629
  */
3705
3630
  export interface Tier {
3706
- /**
3707
- * Minimum amount
3708
- */
3709
3631
  minimum_amount: string;
3710
3632
 
3711
- /**
3712
- * Price per package
3713
- */
3714
3633
  per_unit: string;
3715
3634
 
3716
- /**
3717
- * Tier lower bound
3718
- */
3719
3635
  tier_lower_bound: string;
3720
3636
  }
3721
3637
  }
@@ -3950,14 +3866,8 @@ export namespace NewSubscriptionTieredWithMinimumPrice {
3950
3866
  * Configuration for a single tier
3951
3867
  */
3952
3868
  export interface Tier {
3953
- /**
3954
- * Minimum amount
3955
- */
3956
3869
  minimum_amount: string;
3957
3870
 
3958
- /**
3959
- * Tier lower bound
3960
- */
3961
3871
  tier_lower_bound: string;
3962
3872
 
3963
3873
  /**
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '5.37.2'; // x-release-please-version
1
+ export const VERSION = '5.40.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.37.2";
1
+ export declare const VERSION = "5.40.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '5.37.2'; // x-release-please-version
4
+ exports.VERSION = '5.40.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '5.37.2'; // x-release-please-version
1
+ export const VERSION = '5.40.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map