orb-billing 5.38.0 → 5.41.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 (82) hide show
  1. package/CHANGELOG.md +40 -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/events/events.d.ts +1 -1
  19. package/resources/index.d.ts +3 -2
  20. package/resources/index.d.ts.map +1 -1
  21. package/resources/index.js +5 -1
  22. package/resources/index.js.map +1 -1
  23. package/resources/index.mjs +3 -2
  24. package/resources/index.mjs.map +1 -1
  25. package/resources/invoices.d.ts +439 -2
  26. package/resources/invoices.d.ts.map +1 -1
  27. package/resources/invoices.js +28 -1
  28. package/resources/invoices.js.map +1 -1
  29. package/resources/invoices.mjs +26 -0
  30. package/resources/invoices.mjs.map +1 -1
  31. package/resources/plans/index.d.ts +1 -0
  32. package/resources/plans/index.d.ts.map +1 -1
  33. package/resources/plans/index.js +4 -1
  34. package/resources/plans/index.js.map +1 -1
  35. package/resources/plans/index.mjs +1 -0
  36. package/resources/plans/index.mjs.map +1 -1
  37. package/resources/plans/migrations.d.ts +47 -0
  38. package/resources/plans/migrations.d.ts.map +1 -0
  39. package/resources/plans/migrations.js +36 -0
  40. package/resources/plans/migrations.js.map +1 -0
  41. package/resources/plans/migrations.mjs +31 -0
  42. package/resources/plans/migrations.mjs.map +1 -0
  43. package/resources/plans/plans.d.ts +4 -0
  44. package/resources/plans/plans.d.ts.map +1 -1
  45. package/resources/plans/plans.js +5 -0
  46. package/resources/plans/plans.js.map +1 -1
  47. package/resources/plans/plans.mjs +5 -0
  48. package/resources/plans/plans.mjs.map +1 -1
  49. package/resources/prices/prices.d.ts +6 -96
  50. package/resources/prices/prices.d.ts.map +1 -1
  51. package/resources/prices/prices.js.map +1 -1
  52. package/resources/prices/prices.mjs.map +1 -1
  53. package/resources/shared.d.ts +18 -288
  54. package/resources/shared.d.ts.map +1 -1
  55. package/resources/shared.js.map +1 -1
  56. package/resources/shared.mjs.map +1 -1
  57. package/resources/subscription-changes.d.ts +33 -1
  58. package/resources/subscription-changes.d.ts.map +1 -1
  59. package/resources/subscription-changes.js +15 -1
  60. package/resources/subscription-changes.js.map +1 -1
  61. package/resources/subscription-changes.mjs +13 -0
  62. package/resources/subscription-changes.mjs.map +1 -1
  63. package/resources/subscriptions.d.ts +6 -96
  64. package/resources/subscriptions.d.ts.map +1 -1
  65. package/resources/subscriptions.js.map +1 -1
  66. package/resources/subscriptions.mjs.map +1 -1
  67. package/src/index.ts +19 -0
  68. package/src/resources/credit-blocks.ts +81 -0
  69. package/src/resources/events/events.ts +1 -1
  70. package/src/resources/index.ts +7 -0
  71. package/src/resources/invoices.ts +602 -46
  72. package/src/resources/plans/index.ts +8 -0
  73. package/src/resources/plans/migrations.ts +105 -0
  74. package/src/resources/plans/plans.ts +21 -0
  75. package/src/resources/prices/prices.ts +6 -96
  76. package/src/resources/shared.ts +18 -288
  77. package/src/resources/subscription-changes.ts +64 -0
  78. package/src/resources/subscriptions.ts +6 -96
  79. package/src/version.ts +1 -1
  80. package/version.d.ts +1 -1
  81. package/version.js +1 -1
  82. 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
 
@@ -282,6 +310,29 @@ export interface SubscriptionChangeRetrieveResponse {
282
310
  plan_id?: string | null;
283
311
  }
284
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
+
330
+ /**
331
+ * When this change was cancelled.
332
+ */
333
+ cancelled_at?: string | null;
334
+ }
335
+
285
336
  /**
286
337
  * A subscription change represents a desired new subscription / pending change to
287
338
  * an existing subscription. It is a way to first preview the effects on the
@@ -392,6 +443,14 @@ export interface SubscriptionChangeCancelResponse {
392
443
  plan_id?: string | null;
393
444
  }
394
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;
452
+ }
453
+
395
454
  export interface SubscriptionChangeApplyParams {
396
455
  /**
397
456
  * Description to apply to the balance transaction representing this credit.
@@ -428,12 +487,17 @@ export interface SubscriptionChangeApplyParams {
428
487
  previously_collected_amount?: string | null;
429
488
  }
430
489
 
490
+ SubscriptionChanges.SubscriptionChangeListResponsesPage = SubscriptionChangeListResponsesPage;
491
+
431
492
  export declare namespace SubscriptionChanges {
432
493
  export {
433
494
  type MutatedSubscription as MutatedSubscription,
434
495
  type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse,
496
+ type SubscriptionChangeListResponse as SubscriptionChangeListResponse,
435
497
  type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse,
436
498
  type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse,
499
+ SubscriptionChangeListResponsesPage as SubscriptionChangeListResponsesPage,
500
+ type SubscriptionChangeListParams as SubscriptionChangeListParams,
437
501
  type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams,
438
502
  };
439
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
  /**
@@ -2656,14 +2629,14 @@ export interface NewSubscriptionMinimumCompositePrice {
2656
2629
  item_id: string;
2657
2630
 
2658
2631
  /**
2659
- * Configuration for minimum pricing
2632
+ * Configuration for minimum_composite pricing
2660
2633
  */
2661
- minimum_config: NewSubscriptionMinimumCompositePrice.MinimumConfig;
2634
+ minimum_composite_config: NewSubscriptionMinimumCompositePrice.MinimumCompositeConfig;
2662
2635
 
2663
2636
  /**
2664
2637
  * The pricing model type
2665
2638
  */
2666
- model_type: 'minimum';
2639
+ model_type: 'minimum_composite';
2667
2640
 
2668
2641
  /**
2669
2642
  * The name of the price.
@@ -2747,9 +2720,9 @@ export interface NewSubscriptionMinimumCompositePrice {
2747
2720
 
2748
2721
  export namespace NewSubscriptionMinimumCompositePrice {
2749
2722
  /**
2750
- * Configuration for minimum pricing
2723
+ * Configuration for minimum_composite pricing
2751
2724
  */
2752
- export interface MinimumConfig {
2725
+ export interface MinimumCompositeConfig {
2753
2726
  /**
2754
2727
  * The minimum amount to apply
2755
2728
  */
@@ -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.38.0'; // x-release-please-version
1
+ export const VERSION = '5.41.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.38.0";
1
+ export declare const VERSION = "5.41.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.38.0'; // x-release-please-version
4
+ exports.VERSION = '5.41.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '5.38.0'; // x-release-please-version
1
+ export const VERSION = '5.41.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map