chargebee 2.41.0 → 3.0.0-beta.2

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 +11 -15
  2. package/LICENSE +1 -1
  3. package/README.md +90 -170
  4. package/cjs/RequestWrapper.js +84 -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 +80 -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 +90 -55
  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 +24 -35
  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 +230 -747
  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 -4336
  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 +276 -911
  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 -2935
  117. package/types/resources/NonSubscription.d.ts +0 -30
  118. package/types/resources/Session.d.ts +0 -41
@@ -1,777 +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.
154
-
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:
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
+ }
161
55
 
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. |
56
+ export interface CreateForSubscriptionResponse {
57
+ ramp: Ramp;
58
+ }
167
59
 
60
+ export interface UpdateResponse {
61
+ ramp: Ramp;
62
+ }
168
63
 
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**
64
+ export interface RetrieveResponse {
65
+ ramp: Ramp;
66
+ }
176
67
 
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).
68
+ export interface DeleteResponse {
69
+ ramp: Ramp;
70
+ }
178
71
 
179
- */
180
-
181
- list(input:ListInputParam):ChargebeeRequest<ListResponse>;
72
+ export interface ListResponse {
73
+ list: { ramp: Ramp }[];
74
+ next_offset?: string;
75
+ }
182
76
 
183
- update(ramp_id:string, input:UpdateInputParam):ChargebeeRequest<UpdateResponse>;
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;
184
91
  }
185
- export interface CreateForSubscriptionResponse {
186
- 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;
187
106
  }
188
- export interface CreateForSubscriptionInputParam {
189
-
190
- /**
191
- * @description The time when this ramp takes effect.
192
- **Caution**
193
-
194
- * Ensure the time is within **five** years from the current time.
195
- * Ensure there is a minimum 24-hour interval between &#x60;effective_from&#x60; of two consecutive ramps.
196
- * 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).
197
-
198
- */
199
-
200
- effective_from:number;
201
-
202
- /**
203
- * @description A brief summary of the pricing changes applied with this ramp.
204
-
205
- */
206
-
207
- description?:string;
208
-
209
- /**
210
- * @description List of &lt;coupons&gt; removed from the subscription through this ramp.
211
- **Caution**
212
-
213
- Ensure this list does **not** include:
214
-
215
- * Coupons being added through this ramp.
216
- * Coupons already removed by a previous ramp.
217
-
218
- */
219
-
220
- coupons_to_remove?:string[];
221
-
222
- /**
223
- * @description List of &lt;discounts&gt; removed from the subscription through this ramp.
224
- **Caution**
225
-
226
- Ensure this list does not include discounts already removed by a previous ramp.
227
-
228
- */
229
-
230
- discounts_to_remove?:string[];
231
-
232
- /**
233
- * @description List of [item prices](item_prices) removed from the subscription through this ramp.
234
- **Caution**
235
-
236
- Ensure this list does **not** include:
237
-
238
- * Item prices being added or updated through this ramp.
239
- * Item prices already removed by a previous ramp.
240
-
241
- */
242
-
243
- items_to_remove?:string[];
244
-
245
- /**
246
- * @description Details about the [item prices](/docs/api/item_prices?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
247
-
248
- */
249
-
250
- 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}[];
251
-
252
- /**
253
- * @description Details about the [item prices](item_prices) updated in the subscription through this ramp.
254
-
255
- */
256
-
257
- 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}[];
258
-
259
- /**
260
- * @description **Note**
261
-
262
- Allowed only when both of these conditions are met:
263
-
264
- * Price overriding is enabled for the site.
265
- * pricing_model of the item price is either tiered, volume, or stairstep.
266
-
267
- 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.
268
-
269
- */
270
-
271
- 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}[];
272
-
273
- /**
274
- * @description Details about the &lt;coupons&gt; added to the subscription through this ramp.
275
-
276
- */
277
-
278
- coupons_to_add?:{apply_till?:number,coupon_id?:string}[];
279
-
280
- /**
281
- * @description Details about the [discounts](/docs/api/discounts?prod_cat_ver&#x3D;2) added to the subscription through this ramp.
282
-
283
- */
284
-
285
- 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;
286
110
  }
287
- export interface RetrieveResponse {
288
- 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;
289
124
  }
290
- export interface UpdateResponse {
291
- 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;
292
134
  }
293
- export interface DeleteResponse {
294
- ramp:Ramp;
135
+ export interface StatusTransitionReason {
136
+ code?: string;
137
+ message?: string;
295
138
  }
296
-
297
- export interface ListResponse {
298
- /**
299
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
300
- **Note**
139
+ // REQUEST PARAMS
140
+ //---------------
301
141
 
302
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
303
-
304
- */
305
-
306
- list:{ramp:Ramp}[];
307
-
308
- /**
309
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
310
- **Note**
311
-
312
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
313
-
314
- */
315
-
316
- 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[];
317
153
  }
318
154
  export interface UpdateInputParam {
319
-
320
- 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}[];
321
-
322
- 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}[];
323
-
324
- 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}[];
325
-
326
- coupons_to_add?:{apply_till?:number,coupon_id?:string}[];
327
-
328
- 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}[];
329
-
330
- effective_from:number;
331
-
332
- description?:string;
333
-
334
- coupons_to_remove?:string[];
335
-
336
- discounts_to_remove?:string[];
337
-
338
- items_to_remove?:string[];
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[];
339
165
  }
340
166
  export interface ListInputParam {
341
- [key : string]: any;
342
- /**
343
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
344
- **Note**
345
-
346
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
347
-
348
- */
349
-
350
- limit?:number;
351
-
352
- /**
353
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
354
- **Note**
355
-
356
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
357
-
358
- */
359
-
360
- offset?:string;
361
-
362
- /**
363
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
364
- **Note**
365
-
366
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
367
-
368
- */
369
-
370
- include_deleted?:boolean;
371
-
372
- /**
373
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
374
- **Note**
375
-
376
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
377
-
378
- */
379
-
380
- status?:{in?:string,is?:'scheduled' | 'succeeded' | 'failed'};
381
-
382
- /**
383
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
384
- **Note**
385
-
386
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
387
-
388
- */
389
-
390
- subscription_id:{in?:string,is?:string};
391
-
392
- /**
393
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
394
- **Note**
395
-
396
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
397
-
398
- */
399
-
400
- effective_from?:{after?:string,before?:string,between?:string,on?:string};
401
-
402
- /**
403
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
404
- **Note**
405
-
406
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
407
-
408
- */
409
-
410
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
411
-
412
- /**
413
- * @description Lists the subscription ramps that match the criteria provided in the filter parameters.
414
- **Note**
415
-
416
- By default, the ramps are returned [sorted](ramps#list_ramps_sort_by) in descending order (latest first) by [updated_at](ramps#ramp_updated_at).
417
-
418
- */
419
-
420
- 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;
421
176
  }
422
- export interface ItemsToAdd {
423
- /**
424
- * @description The unique identifier of the item price.
425
-
426
- */
427
-
428
- item_price_id:string;
429
-
430
- /**
431
- * @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
432
-
433
- */
434
-
435
- item_type:'plan' | 'addon' | 'charge';
436
-
437
- /**
438
- * @description The quantity of the item purchased
439
-
440
- */
441
-
442
- quantity?:number;
443
-
444
- /**
445
- * @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.
446
-
447
- */
448
-
449
- quantity_in_decimal?:string;
450
-
451
- /**
452
- * @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).
453
-
454
- */
455
-
456
- unit_price?:number;
457
-
458
- /**
459
- * @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.
460
-
461
- */
462
-
463
- unit_price_in_decimal?:string;
464
-
465
- /**
466
- * @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).
467
-
468
- */
469
-
470
- amount?:number;
471
-
472
- /**
473
- * @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.
474
-
475
- */
476
-
477
- amount_in_decimal?:string;
478
-
479
- /**
480
- * @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).
481
-
482
- */
483
-
484
- free_quantity?:number;
485
-
486
- /**
487
- * @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.
488
-
489
- */
490
-
491
- free_quantity_in_decimal?:string;
492
-
493
- /**
494
- * @description For the plan-item price:
495
- 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.
496
-
497
- For addon-item prices:
498
- 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.
499
-
500
- */
501
-
502
- billing_cycles?:number;
503
-
504
- /**
505
- * @description The service period of the item in days from the day of charge.
506
-
507
- */
508
-
509
- service_period_days?:number;
510
-
511
- /**
512
- * @description This field represents the number of quantities recorded against this subscription item in the current term
513
-
514
- */
515
-
516
- 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;
517
185
  }
518
- export interface ItemsToUpdate {
519
- /**
520
- * @description The unique identifier of the item price.
521
-
522
- */
523
-
524
- item_price_id:string;
525
-
526
- /**
527
- * @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
528
-
529
- */
530
-
531
- item_type:'plan' | 'addon' | 'charge';
532
-
533
- /**
534
- * @description The quantity of the item purchased
535
-
536
- */
537
-
538
- quantity?:number;
539
-
540
- /**
541
- * @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.
542
-
543
- */
544
-
545
- quantity_in_decimal?:string;
546
-
547
- /**
548
- * @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).
549
-
550
- */
551
-
552
- unit_price?:number;
553
-
554
- /**
555
- * @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.
556
-
557
- */
558
-
559
- unit_price_in_decimal?:string;
560
-
561
- /**
562
- * @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).
563
-
564
- */
565
-
566
- amount?:number;
567
-
568
- /**
569
- * @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.
570
-
571
- */
572
-
573
- amount_in_decimal?:string;
574
-
575
- /**
576
- * @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)..
577
-
578
- */
579
-
580
- free_quantity?:number;
581
-
582
- /**
583
- * @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.
584
-
585
- */
586
-
587
- free_quantity_in_decimal?:string;
588
-
589
- /**
590
- * @description For the plan-item price:
591
- 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.
592
-
593
- For addon-item prices:
594
- 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.
595
-
596
- */
597
-
598
- billing_cycles?:number;
599
-
600
- /**
601
- * @description The service period of the item in days from the day of charge.
602
-
603
- */
604
-
605
- service_period_days?:number;
606
-
607
- /**
608
- * @description This field represents the number of quantities recorded against this subscription item in the current term
609
-
610
- */
611
-
612
- metered_quantity?:string;
186
+ export interface CouponsToAddCreateForSubscriptionInputParam {
187
+ coupon_id?: string;
188
+ apply_till?: number;
613
189
  }
614
- export interface CouponsToAdd {
615
- /**
616
- * @description Unique ID of the coupon to be added.
617
-
618
- */
619
-
620
- coupon_id:string;
621
-
622
- /**
623
- * @description The date till when the coupon can be applied. Applicable for &#x60;limited_period&#x60; [coupons](./coupons?prod_cat_ver&#x3D;2) only.
624
-
625
- */
626
-
627
- 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;
628
198
  }
629
- export interface DiscountsToAdd {
630
- /**
631
- * @description An immutable unique id for the discount. It is always auto-generated.
632
-
633
- */
634
-
635
- id:string;
636
-
637
- /**
638
- * @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;.
639
-
640
- */
641
-
642
- invoice_name?:string;
643
-
644
- /**
645
- * @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.
646
-
647
- */
648
-
649
- type:'fixed_amount' | 'percentage';
650
-
651
- /**
652
- * @description The percentage of the original amount that should be deducted from it. Only applicable when &#x60;discount.type&#x60; is percentage.
653
-
654
- */
655
-
656
- percentage?:number;
657
-
658
- /**
659
- * @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;.
660
-
661
- */
662
-
663
- amount?:number;
664
-
665
- /**
666
- * @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;.
667
-
668
- */
669
-
670
- duration_type:'one_time' | 'forever' | 'limited_period';
671
-
672
- /**
673
- * @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;.
674
-
675
- */
676
-
677
- period?:number;
678
-
679
- /**
680
- * @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.
681
-
682
- */
683
-
684
- period_unit?:'day' | 'week' | 'month' | 'year';
685
-
686
- /**
687
- * @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;.
688
-
689
- */
690
-
691
- included_in_mrr:boolean;
692
-
693
- /**
694
- * @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;.
695
-
696
- */
697
-
698
- apply_on:'invoice_amount' | 'specific_item_price';
699
-
700
- /**
701
- * @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;.
702
-
703
- */
704
-
705
- item_price_id?:string;
706
-
707
- /**
708
- * @description Timestamp indicating when this discount is created.
709
-
710
- */
711
-
712
- 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;
713
207
  }
714
- export interface ItemTier {
715
- /**
716
- * @description The id of the item price to which this tier belongs.
717
-
718
- */
719
-
720
- item_price_id:string;
721
-
722
- /**
723
- * @description The lowest value in the quantity tier.
724
-
725
- */
726
-
727
- starting_unit:number;
728
-
729
- /**
730
- * @description The highest value in the quantity tier.
731
-
732
- */
733
-
734
- ending_unit?:number;
735
-
736
- /**
737
- * @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.
738
-
739
- */
740
-
741
- price:number;
742
-
743
- /**
744
- * @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.
745
-
746
- */
747
-
748
- starting_unit_in_decimal?:string;
749
-
750
- /**
751
- * @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.
752
-
753
- */
754
-
755
- ending_unit_in_decimal?:string;
756
-
757
- /**
758
- * @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.
759
-
760
- */
761
-
762
- price_in_decimal?:string;
763
-
764
- /**
765
- * @description Not used.
766
-
767
- */
768
-
769
- 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;
770
248
  }
771
- export interface StatusTransitionReason {
772
- code?:string;
773
-
774
- 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;
775
258
  }
776
259
  }
777
- }
260
+ }