chargebee 2.40.0 → 3.0.0-beta.1

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 (118) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/LICENSE +1 -1
  3. package/README.md +90 -172
  4. package/cjs/RequestWrapper.js +81 -0
  5. package/cjs/asyncApiSupport.js +39 -0
  6. package/cjs/chargebee.cjs.js +13 -0
  7. package/cjs/chargebee.cjs.worker.js +9 -0
  8. package/cjs/chargebeeError.js +17 -0
  9. package/cjs/coreCommon.js +72 -0
  10. package/cjs/createChargebee.js +92 -0
  11. package/cjs/environment.js +18 -0
  12. package/cjs/filter.js +1 -0
  13. package/cjs/net/ClientInterface.js +40 -0
  14. package/cjs/net/FetchClient.js +86 -0
  15. package/cjs/net/NodeClient.js +61 -0
  16. package/cjs/package.json +1 -0
  17. package/cjs/resources/api_endpoints.js +1086 -0
  18. package/cjs/util.js +218 -0
  19. package/esm/RequestWrapper.js +77 -0
  20. package/esm/asyncApiSupport.js +35 -0
  21. package/esm/chargebee.esm.js +9 -0
  22. package/esm/chargebee.esm.worker.js +5 -0
  23. package/esm/chargebeeError.js +13 -0
  24. package/esm/coreCommon.js +67 -0
  25. package/esm/createChargebee.js +88 -0
  26. package/esm/environment.js +15 -0
  27. package/esm/filter.js +1 -0
  28. package/esm/net/ClientInterface.js +35 -0
  29. package/esm/net/FetchClient.js +81 -0
  30. package/esm/net/NodeClient.js +56 -0
  31. package/esm/package.json +1 -0
  32. package/esm/resources/api_endpoints.js +1083 -0
  33. package/esm/util.js +202 -0
  34. package/package.json +69 -38
  35. package/types/core.d.ts +558 -89
  36. package/types/index.d.ts +91 -54
  37. package/types/resources/Address.d.ts +57 -272
  38. package/types/resources/AdvanceInvoiceSchedule.d.ts +21 -94
  39. package/types/resources/AttachedItem.d.ts +91 -329
  40. package/types/resources/Attribute.d.ts +5 -5
  41. package/types/resources/BusinessEntity.d.ts +49 -69
  42. package/types/resources/BusinessEntityTransfer.d.ts +11 -17
  43. package/types/resources/Card.d.ts +146 -424
  44. package/types/resources/Comment.d.ts +72 -189
  45. package/types/resources/Contact.d.ts +12 -64
  46. package/types/resources/ContractTerm.d.ts +15 -96
  47. package/types/resources/Coupon.d.ts +282 -758
  48. package/types/resources/CouponCode.d.ts +56 -52
  49. package/types/resources/CouponSet.d.ts +92 -234
  50. package/types/resources/CreditNote.d.ts +588 -1758
  51. package/types/resources/CreditNoteEstimate.d.ts +131 -157
  52. package/types/resources/Currency.d.ts +75 -62
  53. package/types/resources/Customer.d.ts +892 -835
  54. package/types/resources/CustomerEntitlement.d.ts +36 -0
  55. package/types/resources/DifferentialPrice.d.ts +116 -314
  56. package/types/resources/Discount.d.ts +20 -125
  57. package/types/resources/Download.d.ts +6 -22
  58. package/types/resources/Entitlement.d.ts +51 -160
  59. package/types/resources/EntitlementOverride.d.ts +58 -139
  60. package/types/resources/Estimate.d.ts +1178 -527
  61. package/types/resources/Event.d.ts +67 -178
  62. package/types/resources/Export.d.ts +563 -723
  63. package/types/resources/Feature.d.ts +117 -433
  64. package/types/resources/GatewayErrorDetail.d.ts +16 -72
  65. package/types/resources/Gift.d.ts +265 -432
  66. package/types/resources/Hierarchy.d.ts +8 -36
  67. package/types/resources/HostedPage.d.ts +1017 -1153
  68. package/types/resources/ImpactedItem.d.ts +13 -50
  69. package/types/resources/ImpactedItemPrice.d.ts +13 -15
  70. package/types/resources/ImpactedSubscription.d.ts +13 -45
  71. package/types/resources/InAppSubscription.d.ts +93 -389
  72. package/types/resources/Installment.d.ts +35 -110
  73. package/types/resources/InstallmentConfig.d.ts +54 -155
  74. package/types/resources/InstallmentDetail.d.ts +19 -27
  75. package/types/resources/Invoice.d.ts +1574 -3157
  76. package/types/resources/InvoiceEstimate.d.ts +131 -161
  77. package/types/resources/Item.d.ts +133 -611
  78. package/types/resources/ItemEntitlement.d.ts +78 -215
  79. package/types/resources/ItemFamily.d.ts +69 -178
  80. package/types/resources/ItemPrice.d.ts +291 -1203
  81. package/types/resources/Metadata.d.ts +3 -5
  82. package/types/resources/Order.d.ts +538 -1471
  83. package/types/resources/PaymentIntent.d.ts +163 -347
  84. package/types/resources/PaymentReferenceNumber.d.ts +7 -29
  85. package/types/resources/PaymentSource.d.ts +476 -1272
  86. package/types/resources/PaymentVoucher.d.ts +87 -306
  87. package/types/resources/PortalSession.d.ts +71 -207
  88. package/types/resources/PriceVariant.d.ts +91 -279
  89. package/types/resources/PricingPageSession.d.ts +92 -41
  90. package/types/resources/PromotionalCredit.d.ts +90 -346
  91. package/types/resources/Purchase.d.ts +185 -315
  92. package/types/resources/Quote.d.ts +1406 -887
  93. package/types/resources/QuoteLineGroup.d.ts +125 -452
  94. package/types/resources/QuotedCharge.d.ts +45 -274
  95. package/types/resources/QuotedSubscription.d.ts +100 -488
  96. package/types/resources/Ramp.d.ts +233 -724
  97. package/types/resources/ResourceMigration.d.ts +25 -80
  98. package/types/resources/SiteMigrationDetail.d.ts +34 -112
  99. package/types/resources/Subscription.d.ts +2390 -4335
  100. package/types/resources/SubscriptionEntitlement.d.ts +59 -160
  101. package/types/resources/SubscriptionEstimate.d.ts +51 -75
  102. package/types/resources/TaxWithheld.d.ts +15 -40
  103. package/types/resources/ThirdPartyPaymentMethod.d.ts +7 -29
  104. package/types/resources/TimeMachine.d.ts +43 -97
  105. package/types/resources/Token.d.ts +15 -85
  106. package/types/resources/Transaction.d.ts +278 -900
  107. package/types/resources/UnbilledCharge.d.ts +189 -164
  108. package/types/resources/Usage.d.ts +89 -279
  109. package/types/resources/VirtualBankAccount.d.ts +103 -255
  110. package/types/resources/filter.d.ts +52 -0
  111. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -81
  112. package/.github/ISSUE_TEMPLATE/config.yml +0 -6
  113. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -34
  114. package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
  115. package/lib/chargebee.js +0 -512
  116. package/lib/resources/api_endpoints.js +0 -2912
  117. package/types/resources/NonSubscription.d.ts +0 -30
  118. package/types/resources/Session.d.ts +0 -41
@@ -1,751 +1,260 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+ ///<reference path='./filter.d.ts'/>
2
4
  declare module 'chargebee' {
3
5
  export interface Ramp {
4
-
5
- /**
6
- * @description A unique and immutable identifier for the ramp.
7
-
8
- */
9
-
10
- id:string;
11
-
12
- /**
13
- * @description A brief summary of the pricing changes applied with this ramp.
14
-
15
- */
16
-
17
- description?:string;
18
-
19
- /**
20
- * @description The ID of the subscription for which this ramp was created.
21
-
22
- */
23
-
24
- subscription_id:string;
25
-
26
- /**
27
- * @description Specifies the time when the changes to the subscription will be applied by executing the ramp.
28
-
29
- */
30
-
31
- effective_from:number;
32
-
33
- /**
34
- * @description The execution status of the ramp \* succeeded - The ramp completed successfully. \* scheduled - The ramp has been created and scheduled for execution.
35
- **Note**
36
-
37
- Excluding deleted ramps, a subscription can have a maximum of 12 ramps in the &#x60;scheduled&#x60; &#x60;status&#x60;.
38
- \* failed - The ramp did not complete because of an error.
39
-
40
- */
41
-
42
- status:'scheduled' | 'succeeded' | 'failed';
43
-
44
- /**
45
- * @description Timestamp indicating when this resource was created.
46
-
47
- */
48
-
49
- created_at:number;
50
-
51
- /**
52
- * @description Version number of this resource. The &#x60;resource_version&#x60; is updated with a new timestamp in milliseconds for every change made to the resource.
53
-
54
- */
55
-
56
- resource_version?:number;
57
-
58
- /**
59
- * @description Timestamp indicating when this resource was last updated.
60
-
61
- */
62
-
63
- updated_at?:number;
64
-
65
- /**
66
- * @description List of [item prices](item_prices) removed from the subscription through this ramp.
67
-
68
- */
69
-
70
- items_to_remove?:string[];
71
-
72
- /**
73
- * @description List of &lt;coupons&gt; removed from the subscription through this ramp.
74
-
75
- */
76
-
77
- coupons_to_remove?:string[];
78
-
79
- /**
80
- * @description List of &lt;discounts&gt; removed from the subscription through this ramp.
81
-
82
- */
83
-
84
- discounts_to_remove?:string[];
85
-
86
- /**
87
- * @description Indicates that this resource has been deleted.
88
-
89
- */
90
-
91
- deleted:boolean;
92
-
93
- /**
94
- * @description Details about the [item prices](/docs/api/item_prices?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
95
-
96
- */
97
-
98
- items_to_add?:Ramp.ItemsToAdd[];
99
-
100
- /**
101
- * @description Details about the [item prices](item_prices) updated in the subscription through this ramp.
102
-
103
- */
104
-
105
- items_to_update?:Ramp.ItemsToUpdate[];
106
-
107
- /**
108
- * @description Details about the &lt;coupons&gt; added to the subscription through this ramp.
109
-
110
- */
111
-
112
- coupons_to_add?:Ramp.CouponsToAdd[];
113
-
114
- /**
115
- * @description Details about the [discounts](/docs/api/discounts?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
116
-
117
- */
118
-
119
- discounts_to_add?:Ramp.DiscountsToAdd[];
120
-
121
- /**
122
- * @description **Note**
123
-
124
- Allowed only when both of these conditions are met:
125
-
126
- * [Price overriding](https://www.chargebee.com/docs/2.0/price-override.html) is enabled for the site.
127
- * &#x60;pricing_model&#x60; of the item price is either &#x60;tiered&#x60;, &#x60;volume&#x60;, or &#x60;stairstep&#x60;.
128
-
129
- Overrides the [item_tiers](subscriptions#subscription_item_tiers) for specific &#x60;item_prices&#x60; of the subscription.
130
-
131
- */
132
-
133
- item_tiers?:Ramp.ItemTier[];
134
-
135
- status_transition_reason?:Ramp.StatusTransitionReason;
6
+ id: string;
7
+ description?: string;
8
+ subscription_id: string;
9
+ effective_from: number;
10
+ status: 'scheduled' | 'succeeded' | 'failed' | 'draft';
11
+ created_at: number;
12
+ resource_version?: number;
13
+ updated_at?: number;
14
+ items_to_add?: Ramp.ItemsToAdd[];
15
+ items_to_update?: Ramp.ItemsToUpdate[];
16
+ coupons_to_add?: Ramp.CouponsToAdd[];
17
+ discounts_to_add?: Ramp.DiscountsToAdd[];
18
+ item_tiers?: Ramp.ItemTier[];
19
+ items_to_remove?: string[];
20
+ coupons_to_remove?: string[];
21
+ discounts_to_remove?: string[];
22
+ deleted: boolean;
23
+ status_transition_reason?: Ramp.StatusTransitionReason;
136
24
  }
137
- export namespace Ramp {
138
- export class RampResource {
139
- /**
140
- * @description Creates a ramp for a subscription.
141
- **Note**
142
-
143
- * **Subscription status** : You cannot create ramps for subscriptions in the &#x60;paused&#x60; or &#x60;cancelled&#x60; [status](subscriptions?prod_cat_ver&#x3D;2#subscription_status).
144
- * **Advance invoice** : You cannot create a ramps for subscriptions that have an [advance invoice](https://www.chargebee.com/docs/2.0/advance-invoices.html) or an [advance invoice schedule](advance_invoice_schedules?prod_cat_ver&#x3D;2).
145
- * **Upcoming ramps limit** : A subscription can have a maximum of 12 upcoming ramps at any given time, excluding deleted ramps. Upcoming ramps are ramps with &#x60;status&#x60; as [scheduled](ramps#ramp_status).
146
- * **Total ramps limit**: A subscription can have a maximum of 100 ramps at any given time, excluding deleted ramps.
147
25
 
148
- */
149
-
150
- create_for_subscription(subscription_id:string, input:CreateForSubscriptionInputParam):ChargebeeRequest<CreateForSubscriptionResponse>;
151
-
152
- /**
153
- * @description Retrieves a specific subscription ramp.
26
+ export namespace Ramp {
27
+ export class RampResource {
28
+ createForSubscription(
29
+ subscription_id: string,
30
+ input: CreateForSubscriptionInputParam,
31
+ headers?: ChargebeeRequestHeader,
32
+ ): Promise<ChargebeeResponse<CreateForSubscriptionResponse>>;
33
+
34
+ update(
35
+ ramp_id: string,
36
+ input: UpdateInputParam,
37
+ headers?: ChargebeeRequestHeader,
38
+ ): Promise<ChargebeeResponse<UpdateResponse>>;
39
+
40
+ retrieve(
41
+ ramp_id: string,
42
+ headers?: ChargebeeRequestHeader,
43
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
44
+
45
+ delete(
46
+ ramp_id: string,
47
+ headers?: ChargebeeRequestHeader,
48
+ ): Promise<ChargebeeResponse<DeleteResponse>>;
49
+
50
+ list(
51
+ input: ListInputParam,
52
+ headers?: ChargebeeRequestHeader,
53
+ ): Promise<ChargebeeResponse<ListResponse>>;
54
+ }
154
55
 
155
- */
156
-
157
- retrieve(subscription_schedule_id:string):ChargebeeRequest<RetrieveResponse>;
158
-
159
- /**
160
- * @description Deletes the specified subscription ramp. However, Chargebee only allows deleting a ramp if it does not conflict with future ramps on the subscription. The following checks are performed to ensure compatibility:
56
+ export interface CreateForSubscriptionResponse {
57
+ ramp: Ramp;
58
+ }
161
59
 
162
- | Condition | Restriction |
163
- |----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
164
- | The ramp contains &#x60;items_to_add[]&#x60; | The ramp cannot be deleted if any of the items in &#x60;items_to_add[]&#x60; are scheduled to be updated or removed in a subsequent ramp. |
165
- | The ramp contains &#x60;coupons_to_add[]&#x60; | The ramp cannot be deleted if any of the coupons in &#x60;coupons_to_add[]&#x60; are scheduled to be removed in a subsequent ramp. |
166
- | The ramp contains &#x60;discounts_to_add[]&#x60; | The ramp cannot be deleted if any of the discounts in &#x60;discounts_to_add[]&#x60; are scheduled to be removed in a subsequent ramp. |
60
+ export interface UpdateResponse {
61
+ ramp: Ramp;
62
+ }
167
63
 
64
+ export interface RetrieveResponse {
65
+ ramp: Ramp;
66
+ }
168
67
 
169
- */
170
-
171
- delete(subscription_schedule_id:string):ChargebeeRequest<DeleteResponse>;
172
-
173
- /**
174
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
175
- **Note**
68
+ export interface DeleteResponse {
69
+ ramp: Ramp;
70
+ }
176
71
 
177
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
72
+ export interface ListResponse {
73
+ list: { ramp: Ramp }[];
74
+ next_offset?: string;
75
+ }
178
76
 
179
- */
180
-
181
- list(input:ListInputParam):ChargebeeRequest<ListResponse>;
77
+ export interface ItemsToAdd {
78
+ item_price_id: string;
79
+ item_type: 'plan' | 'addon' | 'charge';
80
+ quantity?: number;
81
+ quantity_in_decimal?: string;
82
+ unit_price?: number;
83
+ unit_price_in_decimal?: string;
84
+ amount?: number;
85
+ amount_in_decimal?: string;
86
+ free_quantity?: number;
87
+ free_quantity_in_decimal?: string;
88
+ billing_cycles?: number;
89
+ service_period_days?: number;
90
+ metered_quantity?: string;
182
91
  }
183
- export interface CreateForSubscriptionResponse {
184
- ramp:Ramp;
92
+ export interface ItemsToUpdate {
93
+ item_price_id: string;
94
+ item_type: 'plan' | 'addon' | 'charge';
95
+ quantity?: number;
96
+ quantity_in_decimal?: string;
97
+ unit_price?: number;
98
+ unit_price_in_decimal?: string;
99
+ amount?: number;
100
+ amount_in_decimal?: string;
101
+ free_quantity?: number;
102
+ free_quantity_in_decimal?: string;
103
+ billing_cycles?: number;
104
+ service_period_days?: number;
105
+ metered_quantity?: string;
185
106
  }
186
- export interface CreateForSubscriptionInputParam {
187
-
188
- /**
189
- * @description The time when this ramp takes effect.
190
- **Caution**
191
-
192
- * Ensure the time is within **five** years from the current time.
193
- * Ensure there is a minimum 24-hour interval between &#x60;effective_from&#x60; of two consecutive ramps.
194
- * If the subscription is scheduled to be paused or canceled in the future, ensure the time is not on or after [pause_date](subscriptions?prod_cat_ver&#x3D;2#subscription_pause_date) or [cancelled_at](subscriptions?prod_cat_ver&#x3D;2#subscription_cancelled_at).
195
-
196
- */
197
-
198
- effective_from:number;
199
-
200
- /**
201
- * @description A brief summary of the pricing changes applied with this ramp.
202
-
203
- */
204
-
205
- description?:string;
206
-
207
- /**
208
- * @description List of &lt;coupons&gt; removed from the subscription through this ramp.
209
- **Caution**
210
-
211
- Ensure this list does **not** include:
212
-
213
- * Coupons being added through this ramp.
214
- * Coupons already removed by a previous ramp.
215
-
216
- */
217
-
218
- coupons_to_remove?:string[];
219
-
220
- /**
221
- * @description List of &lt;discounts&gt; removed from the subscription through this ramp.
222
- **Caution**
223
-
224
- Ensure this list does not include discounts already removed by a previous ramp.
225
-
226
- */
227
-
228
- discounts_to_remove?:string[];
229
-
230
- /**
231
- * @description List of [item prices](item_prices) removed from the subscription through this ramp.
232
- **Caution**
233
-
234
- Ensure this list does **not** include:
235
-
236
- * Item prices being added or updated through this ramp.
237
- * Item prices already removed by a previous ramp.
238
-
239
- */
240
-
241
- items_to_remove?:string[];
242
-
243
- /**
244
- * @description Details about the [item prices](/docs/api/item_prices?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
245
-
246
- */
247
-
248
- items_to_add:{billing_cycles?:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[];
249
-
250
- /**
251
- * @description Details about the [item prices](item_prices) updated in the subscription through this ramp.
252
-
253
- */
254
-
255
- items_to_update:{billing_cycles?:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[];
256
-
257
- /**
258
- * @description **Note**
259
-
260
- Allowed only when both of these conditions are met:
261
-
262
- * Price overriding is enabled for the site.
263
- * pricing_model of the item price is either tiered, volume, or stairstep.
264
-
265
- Replaces the existing item_tiers for specific &#x60;item_price&#x60;s within the subscription. You must provide the complete tier set for any &#x60;item_price&#x60;, even if you&#x27;re changing the price for only one tier.
266
-
267
- */
268
-
269
- item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
270
-
271
- /**
272
- * @description Details about the &lt;coupons&gt; added to the subscription through this ramp.
273
-
274
- */
275
-
276
- coupons_to_add?:{apply_till?:number,coupon_id?:string}[];
277
-
278
- /**
279
- * @description Details about the [discounts](/docs/api/discounts?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
280
-
281
- */
282
-
283
- discounts_to_add:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[];
107
+ export interface CouponsToAdd {
108
+ coupon_id: string;
109
+ apply_till?: number;
284
110
  }
285
- export interface RetrieveResponse {
286
- ramp:Ramp;
111
+ export interface DiscountsToAdd {
112
+ id: string;
113
+ invoice_name?: string;
114
+ type: 'fixed_amount' | 'percentage';
115
+ percentage?: number;
116
+ amount?: number;
117
+ duration_type: 'one_time' | 'forever' | 'limited_period';
118
+ period?: number;
119
+ period_unit?: 'day' | 'week' | 'month' | 'year';
120
+ included_in_mrr: boolean;
121
+ apply_on: 'invoice_amount' | 'specific_item_price';
122
+ item_price_id?: string;
123
+ created_at: number;
287
124
  }
288
-
289
- export interface DeleteResponse {
290
- ramp:Ramp;
125
+ export interface ItemTier {
126
+ item_price_id: string;
127
+ starting_unit: number;
128
+ ending_unit?: number;
129
+ price: number;
130
+ starting_unit_in_decimal?: string;
131
+ ending_unit_in_decimal?: string;
132
+ price_in_decimal?: string;
133
+ index: number;
291
134
  }
292
-
293
- export interface ListResponse {
294
- /**
295
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
296
- **Note**
297
-
298
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
299
-
300
- */
301
-
302
- list:{ramp:Ramp}[];
303
-
304
- /**
305
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
306
- **Note**
307
-
308
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
135
+ export interface StatusTransitionReason {
136
+ code?: string;
137
+ message?: string;
138
+ }
139
+ // REQUEST PARAMS
140
+ //---------------
309
141
 
310
- */
311
-
312
- next_offset?:string;
142
+ export interface CreateForSubscriptionInputParam {
143
+ effective_from: number;
144
+ description?: string;
145
+ coupons_to_remove?: string[];
146
+ discounts_to_remove?: string[];
147
+ items_to_remove?: string[];
148
+ items_to_add?: ItemsToAddCreateForSubscriptionInputParam[];
149
+ items_to_update?: ItemsToUpdateCreateForSubscriptionInputParam[];
150
+ item_tiers?: ItemTiersCreateForSubscriptionInputParam[];
151
+ coupons_to_add?: CouponsToAddCreateForSubscriptionInputParam[];
152
+ discounts_to_add?: DiscountsToAddCreateForSubscriptionInputParam[];
153
+ }
154
+ export interface UpdateInputParam {
155
+ effective_from: number;
156
+ description?: string;
157
+ coupons_to_remove?: string[];
158
+ discounts_to_remove?: string[];
159
+ items_to_remove?: string[];
160
+ items_to_add?: ItemsToAddUpdateInputParam[];
161
+ items_to_update?: ItemsToUpdateUpdateInputParam[];
162
+ item_tiers?: ItemTiersUpdateInputParam[];
163
+ coupons_to_add?: CouponsToAddUpdateInputParam[];
164
+ discounts_to_add?: DiscountsToAddUpdateInputParam[];
313
165
  }
314
166
  export interface ListInputParam {
315
- [key : string]: any;
316
- /**
317
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
318
- **Note**
319
-
320
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
321
-
322
- */
323
-
324
- limit?:number;
325
-
326
- /**
327
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
328
- **Note**
329
-
330
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
331
-
332
- */
333
-
334
- offset?:string;
335
-
336
- /**
337
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
338
- **Note**
339
-
340
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
341
-
342
- */
343
-
344
- include_deleted?:boolean;
345
-
346
- /**
347
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
348
- **Note**
349
-
350
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
351
-
352
- */
353
-
354
- status?:{in?:string,is?:'scheduled' | 'succeeded' | 'failed'};
355
-
356
- /**
357
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
358
- **Note**
359
-
360
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
361
-
362
- */
363
-
364
- subscription_id:{in?:string,is?:string};
365
-
366
- /**
367
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
368
- **Note**
369
-
370
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
371
-
372
- */
373
-
374
- effective_from?:{after?:string,before?:string,between?:string,on?:string};
375
-
376
- /**
377
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
378
- **Note**
379
-
380
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
381
-
382
- */
383
-
384
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
385
-
386
- /**
387
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
388
- **Note**
389
-
390
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
391
-
392
- */
393
-
394
- sort_by?:{asc?:'effective_from' | 'updated_at',desc?:'effective_from' | 'updated_at'};
167
+ limit?: number;
168
+ offset?: string;
169
+ include_deleted?: boolean;
170
+ status?: filter.Enum;
171
+ subscription_id: filter.String;
172
+ effective_from?: filter.Timestamp;
173
+ updated_at?: filter.Timestamp;
174
+ 'sort_by[asc]'?: string;
175
+ 'sort_by[desc]'?: string;
395
176
  }
396
- export interface ItemsToAdd {
397
- /**
398
- * @description The unique identifier of the item price.
399
-
400
- */
401
-
402
- item_price_id:string;
403
-
404
- /**
405
- * @description The type of item. There must be one and only one item of type &#x60;plan&#x60; in this list. \* charge - Charge \* plan - Plan \* addon - Addon
406
-
407
- */
408
-
409
- item_type:'plan' | 'addon' | 'charge';
410
-
411
- /**
412
- * @description The quantity of the item purchased
413
-
414
- */
415
-
416
- quantity?:number;
417
-
418
- /**
419
- * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
420
-
421
- */
422
-
423
- quantity_in_decimal?:string;
424
-
425
- /**
426
- * @description The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the item price is used. This is only applicable when the &#x60;pricing_model&#x60; of the item price is &#x60;flat_fee&#x60; or &#x60;per_unit&#x60;. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the [type of currency](currencies#handling_currency_units).
427
-
428
- */
429
-
430
- unit_price?:number;
431
-
432
- /**
433
- * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
434
-
435
- */
436
-
437
- unit_price_in_decimal?:string;
438
-
439
- /**
440
- * @description The total amount for the item as determined from &#x60;unit_price&#x60;, &#x60;free_quantity&#x60;, &#x60;quantity&#x60; and &#x60;item_tiers&#x60; as applicable. The value depends on the [type of currency](currencies#handling_currency_units).
441
-
442
- */
443
-
444
- amount?:number;
445
-
446
- /**
447
- * @description The decimal representation of the total amount for the item, in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
448
-
449
- */
450
-
451
- amount_in_decimal?:string;
452
-
453
- /**
454
- * @description The quantity of the item price that is available for free. Only the quantity more than this will be charged for the subscription. This is the same as [item_price.free_quantity](item_prices#item_price_free_quantity).
455
-
456
- */
457
-
458
- free_quantity?:number;
459
-
460
- /**
461
- * @description The &#x60;free_quantity_in_decimal&#x60; as set for the item price. Returned for quantity-based item prices when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
462
-
463
- */
464
-
465
- free_quantity_in_decimal?:string;
466
-
467
- /**
468
- * @description For the plan-item price:
469
- the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the plan-item price is used.
470
-
471
- For addon-item prices:
472
- If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](./attached_items?prod_cat_ver&#x3D;2#attached_item_attributes) is used. Further, if that value is not provided, then [the value set for the addon-item price](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) is used.
473
-
474
- */
475
-
476
- billing_cycles?:number;
477
-
478
- /**
479
- * @description The service period of the item in days from the day of charge.
480
-
481
- */
482
-
483
- service_period_days?:number;
484
-
485
- /**
486
- * @description This field represents the number of quantities recorded against this subscription item in the current term
487
-
488
- */
489
-
490
- metered_quantity?:string;
177
+ export interface ItemsToAddCreateForSubscriptionInputParam {
178
+ item_price_id: string;
179
+ quantity?: number;
180
+ quantity_in_decimal?: string;
181
+ unit_price?: number;
182
+ unit_price_in_decimal?: string;
183
+ billing_cycles?: number;
184
+ service_period_days?: number;
491
185
  }
492
- export interface ItemsToUpdate {
493
- /**
494
- * @description The unique identifier of the item price.
495
-
496
- */
497
-
498
- item_price_id:string;
499
-
500
- /**
501
- * @description The type of item. There must be one and only one item of type &#x60;plan&#x60; in this list. \* addon - Addon \* charge - Charge \* plan - Plan
502
-
503
- */
504
-
505
- item_type:'plan' | 'addon' | 'charge';
506
-
507
- /**
508
- * @description The quantity of the item purchased
509
-
510
- */
511
-
512
- quantity?:number;
513
-
514
- /**
515
- * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
516
-
517
- */
518
-
519
- quantity_in_decimal?:string;
520
-
521
- /**
522
- * @description The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the item price is used. This is only applicable when the &#x60;pricing_model&#x60; of the item price is &#x60;flat_fee&#x60; or &#x60;per_unit&#x60;. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the [type of currency](currencies#handling_currency_units).
523
-
524
- */
525
-
526
- unit_price?:number;
527
-
528
- /**
529
- * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
530
-
531
- */
532
-
533
- unit_price_in_decimal?:string;
534
-
535
- /**
536
- * @description The total amount for the item as determined from &#x60;unit_price&#x60;, &#x60;free_quantity&#x60;, &#x60;quantity&#x60; and &#x60;item_tiers&#x60; as applicable. The value depends on the [type of currency](currencies#handling_currency_units).
537
-
538
- */
539
-
540
- amount?:number;
541
-
542
- /**
543
- * @description The decimal representation of the total amount for the item, in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
544
-
545
- */
546
-
547
- amount_in_decimal?:string;
548
-
549
- /**
550
- * @description The quantity of the item price that is available for free. Only the quantity more than this will be charged for the subscription. This is the same as [item_price.free_quantity](item_prices#item_price_free_quantity)..
551
-
552
- */
553
-
554
- free_quantity?:number;
555
-
556
- /**
557
- * @description The &#x60;free_quantity_in_decimal&#x60; as set for the item price. Returned for quantity-based item prices when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled.
558
-
559
- */
560
-
561
- free_quantity_in_decimal?:string;
562
-
563
- /**
564
- * @description For the plan-item price:
565
- the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) for the plan-item price is used.
566
-
567
- For addon-item prices:
568
- If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](./attached_items?prod_cat_ver&#x3D;2#attached_item_attributes) is used. Further, if that value is not provided, then [the value set for the addon-item price](./item_prices?prod_cat_ver&#x3D;2#item_price_attributes) is used.
569
-
570
- */
571
-
572
- billing_cycles?:number;
573
-
574
- /**
575
- * @description The service period of the item in days from the day of charge.
576
-
577
- */
578
-
579
- service_period_days?:number;
580
-
581
- /**
582
- * @description This field represents the number of quantities recorded against this subscription item in the current term
583
-
584
- */
585
-
586
- metered_quantity?:string;
186
+ export interface CouponsToAddCreateForSubscriptionInputParam {
187
+ coupon_id?: string;
188
+ apply_till?: number;
587
189
  }
588
- export interface CouponsToAdd {
589
- /**
590
- * @description Unique ID of the coupon to be added.
591
-
592
- */
593
-
594
- coupon_id:string;
595
-
596
- /**
597
- * @description The date till when the coupon can be applied. Applicable for &#x60;limited_period&#x60; [coupons](./coupons?prod_cat_ver&#x3D;2) only.
598
-
599
- */
600
-
601
- apply_till?:number;
190
+ export interface ItemTiersCreateForSubscriptionInputParam {
191
+ item_price_id?: string;
192
+ starting_unit?: number;
193
+ ending_unit?: number;
194
+ price?: number;
195
+ starting_unit_in_decimal?: string;
196
+ ending_unit_in_decimal?: string;
197
+ price_in_decimal?: string;
602
198
  }
603
- export interface DiscountsToAdd {
604
- /**
605
- * @description An immutable unique id for the discount. It is always auto-generated.
606
-
607
- */
608
-
609
- id:string;
610
-
611
- /**
612
- * @description The name of the discount as it should appear on customer-facing pages and documents such as [invoices](/docs/api/invoices?prod_cat_ver&#x3D;2) and [hosted pages](/docs/api/hosted_pages?prod_cat_ver&#x3D;2). This is auto-generated based on the &#x60;type&#x60;, &#x60;amount&#x60;, and &#x60;currency_code&#x60; of the discount. For example, it can be &#x60;10% off&#x60; or &#x60;10$ off&#x60;.
613
-
614
- */
615
-
616
- invoice_name?:string;
617
-
618
- /**
619
- * @description The type of discount. Possible value are: \* fixed_amount - The specified amount will be given as discount. \* percentage - The specified percentage will be given as discount.
620
-
621
- */
622
-
623
- type:'fixed_amount' | 'percentage';
624
-
625
- /**
626
- * @description The percentage of the original amount that should be deducted from it. Only applicable when &#x60;discount.type&#x60; is percentage.
627
-
628
- */
629
-
630
- percentage?:number;
631
-
632
- /**
633
- * @description The value of the discount. [The format of this value](https://apidocs.chargebee.com/docs/api?prod_cat_ver&#x3D;2#currencies) depends on the kind of currency. This is only applicable when &#x60;discount.type&#x60; is &#x60;fixed_amount&#x60;.
634
-
635
- */
636
-
637
- amount?:number;
638
-
639
- /**
640
- * @description Specifies the time duration for which this discount is attached to the subscription. \* one_time - The discount stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* forever - The discount is attached to the subscription and applied on the invoices till it is [explicitly removed](/docs/api/subscriptions?prod_cat_ver&#x3D;2#update_subscription_for_items_discounts_operation_type). \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by &#x60;period&#x60; and &#x60;period_unit&#x60;.
641
-
642
- */
643
-
644
- duration_type:'one_time' | 'forever' | 'limited_period';
645
-
646
- /**
647
- * @description The duration of time for which the discount is attached to the subscription, in &#x60;period_units&#x60;. Applicable only when &#x60;duration_type&#x60; is &#x60;limited_period&#x60;.
648
-
649
- */
650
-
651
- period?:number;
652
-
653
- /**
654
- * @description The unit of time for &#x60;period&#x60;. Applicable only when &#x60;duration_type&#x60; is &#x60;limited_period&#x60;. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. \* month - A period of 1 calendar month.
655
-
656
- */
657
-
658
- period_unit?:'day' | 'week' | 'month' | 'year';
659
-
660
- /**
661
- * @description The discount is included in MRR calculations for your site. This attribute is only applicable when &#x60;duration_type&#x60; is &#x60;one_time&#x60; and when the [feature is enabled](https://www.chargebee.com/docs/reporting.html#dashboards_flexible-mrr-calculation) in Chargebee. Also, If the [site-level setting](https://www.chargebee.com/docs/reporting.html#chart_flexible-mrr-calculation) is to exclude one-time discounts from MRR calculations, this value is always returned &#x60;false&#x60;.
662
-
663
- */
664
-
665
- included_in_mrr:boolean;
666
-
667
- /**
668
- * @description The amount on the invoice to which the discount is applied. \* invoice_amount - The discount is applied to the invoice &#x60;sub_total&#x60;. \* specific_item_price - The discount is applied to the &#x60;invoice.line_item.amount&#x60; that corresponds to the item price specified by &#x60;item_price_id&#x60;.
669
-
670
- */
671
-
672
- apply_on:'invoice_amount' | 'specific_item_price';
673
-
674
- /**
675
- * @description The [id of the item price](/docs/api/subscriptions?prod_cat_ver&#x3D;2#subscription_subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when &#x60;apply_on&#x60; &#x3D; &#x60;specific_item_price&#x60;.
676
-
677
- */
678
-
679
- item_price_id?:string;
680
-
681
- /**
682
- * @description Timestamp indicating when this discount is created.
683
-
684
- */
685
-
686
- created_at:number;
199
+ export interface ItemsToUpdateCreateForSubscriptionInputParam {
200
+ item_price_id: string;
201
+ quantity?: number;
202
+ quantity_in_decimal?: string;
203
+ unit_price?: number;
204
+ unit_price_in_decimal?: string;
205
+ billing_cycles?: number;
206
+ service_period_days?: number;
687
207
  }
688
- export interface ItemTier {
689
- /**
690
- * @description The id of the item price to which this tier belongs.
691
-
692
- */
693
-
694
- item_price_id:string;
695
-
696
- /**
697
- * @description The lowest value in the quantity tier.
698
-
699
- */
700
-
701
- starting_unit:number;
702
-
703
- /**
704
- * @description The highest value in the quantity tier.
705
-
706
- */
707
-
708
- ending_unit?:number;
709
-
710
- /**
711
- * @description The per-unit price for the tier when the &#x60;pricing_model&#x60; is &#x60;tiered&#x60; or &#x60;volume&#x60;. The total cost for the item price when the &#x60;pricing_model&#x60; is &#x60;stairstep&#x60;. The value is in the minor unit of the currency.
712
-
713
- */
714
-
715
- price:number;
716
-
717
- /**
718
- * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as &#x60;ending_unit_in_decimal&#x60; of the next lower tier. Returned only when the pricing_model is &#x60;tiered&#x60;, &#x60;volume&#x60; or &#x60;stairstep&#x60; and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
719
-
720
- */
721
-
722
- starting_unit_in_decimal?:string;
723
-
724
- /**
725
- * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the &#x60;starting_unit_in_decimal&#x60; of the next higher tier. Returned only when the pricing_model is &#x60;tiered&#x60;, &#x60;volume&#x60; or &#x60;stairstep&#x60; and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
726
-
727
- */
728
-
729
- ending_unit_in_decimal?:string;
730
-
731
- /**
732
- * @description The decimal representation of the per-unit price for the tier when the &#x60;pricing_model&#x60; is &#x60;tiered&#x60; or &#x60;volume&#x60;. When the &#x60;pricing_model&#x60; is &#x60;stairstep&#x60;, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api/currencies#handling_currency_units) is enabled.
733
-
734
- */
735
-
736
- price_in_decimal?:string;
737
-
738
- /**
739
- * @description Not used.
740
-
741
- */
742
-
743
- index:number;
208
+ export interface DiscountsToAddCreateForSubscriptionInputParam {
209
+ apply_on: ApplyOn;
210
+ duration_type: DurationType;
211
+ percentage?: number;
212
+ amount?: number;
213
+ period?: number;
214
+ period_unit?: PeriodUnit;
215
+ included_in_mrr?: boolean;
216
+ item_price_id?: string;
217
+ }
218
+ export interface ItemsToAddUpdateInputParam {
219
+ item_price_id: string;
220
+ quantity?: number;
221
+ quantity_in_decimal?: string;
222
+ unit_price?: number;
223
+ unit_price_in_decimal?: string;
224
+ billing_cycles?: number;
225
+ service_period_days?: number;
226
+ }
227
+ export interface CouponsToAddUpdateInputParam {
228
+ coupon_id?: string;
229
+ apply_till?: number;
230
+ }
231
+ export interface ItemTiersUpdateInputParam {
232
+ item_price_id?: string;
233
+ starting_unit?: number;
234
+ ending_unit?: number;
235
+ price?: number;
236
+ starting_unit_in_decimal?: string;
237
+ ending_unit_in_decimal?: string;
238
+ price_in_decimal?: string;
239
+ }
240
+ export interface ItemsToUpdateUpdateInputParam {
241
+ item_price_id: string;
242
+ quantity?: number;
243
+ quantity_in_decimal?: string;
244
+ unit_price?: number;
245
+ unit_price_in_decimal?: string;
246
+ billing_cycles?: number;
247
+ service_period_days?: number;
744
248
  }
745
- export interface StatusTransitionReason {
746
- code?:string;
747
-
748
- message?:string;
249
+ export interface DiscountsToAddUpdateInputParam {
250
+ apply_on: ApplyOn;
251
+ duration_type: DurationType;
252
+ percentage?: number;
253
+ amount?: number;
254
+ period?: number;
255
+ period_unit?: PeriodUnit;
256
+ included_in_mrr?: boolean;
257
+ item_price_id?: string;
749
258
  }
750
259
  }
751
- }
260
+ }