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,303 +1,113 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
2
  ///<reference path='./../index.d.ts'/>
3
+ ///<reference path='./filter.d.ts'/>
3
4
  declare module 'chargebee' {
4
5
  export interface Usage {
5
-
6
- /**
7
- * @description A unique and immutable id for the usage. If not provided, it is autogenerated.
8
-
9
- */
10
-
11
- id?:string;
12
-
13
- /**
14
- * @description The time at which this usage occurred. Chargebee bills only those usages whose &#x60;usage_date&#x60; falls within a time when the subscription &#x60;status&#x60; was &#x60;active&#x60; or &#x60;non_renewing&#x60;. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver&#x3D;2#retrieve_a_usage).
15
- **Note:** If &#x60;usage_date&#x60; corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver&#x3D;2#regenerate_an_invoice).
16
-
17
- */
18
-
19
- usage_date:number;
20
-
21
- /**
22
- * @description The id of the [subscription](/docs/api/subscriptions?prod_cat_ver&#x3D;2) to which this usage record belongs.
23
-
24
- */
25
-
26
- subscription_id:string;
27
-
28
- /**
29
- * @description The id of the [item price](/docs/api/item_prices?prod_cat_ver&#x3D;2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically.
30
-
31
- */
32
-
33
- item_price_id:string;
34
-
35
- /**
36
- * @description When the usage has been invoiced, this is the &#x60;id&#x60; of the [invoice](/docs/api/invoices?prod_cat_ver&#x3D;2). This is cleared when the invoice is &#x60;voided&#x60; or deleted.
37
-
38
- */
39
-
40
- invoice_id?:string;
41
-
42
- /**
43
- * @description When the usage has been invoiced, this is the &#x60;id&#x60; of the [invoice.line_item](/docs/api/invoices?prod_cat_ver&#x3D;2#invoice_line_items) that the usage is for. This is cleared when the invoice is [voided](/docs/api/invoices?prod_cat_ver&#x3D;2#void_an_invoice) or [deleted](/docs/api/invoices?prod_cat_ver&#x3D;2#delete_an_invoice).
44
-
45
- */
46
-
47
- line_item_id?:string;
48
-
49
- /**
50
- * @description The quantity specified for this usage record.
51
-
52
- */
53
-
54
- quantity:string;
55
-
56
- /**
57
- * @description The source from which the usage record was created. \* admin_console - Operation made through the Chargebee admin UI \* api - Operation made through the API \* bulk_operation - Operation that are triggerd through bulk operation.
58
-
59
- */
60
-
61
- source?:Source;
62
-
63
- /**
64
- * @description A note for this usage record. This appears against the usage on the Chargebee UI. This note is not displayed on any customer-facing document or interface such as [invoice PDFs](/docs/api/invoices?prod_cat_ver&#x3D;2#retrieve_invoice_as_pdf) or [Hosted Pages](/docs/api/hosted_pages?prod_cat_ver&#x3D;2).
65
-
66
- */
67
-
68
- note?:string;
69
-
70
- /**
71
- * @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. This attribute will be present only if the resource has been updated after 2016-09-28.
72
-
73
- */
74
-
75
- resource_version?:number;
76
-
77
- /**
78
- * @description Timestamp indicating when this usage resource was last updated.
79
-
80
- */
81
-
82
- updated_at?:number;
83
-
84
- /**
85
- * @description Timestamp indicating when the item was created.
86
-
87
- */
88
-
89
- created_at:number;
6
+ id?: string;
7
+ usage_date: number;
8
+ subscription_id: string;
9
+ item_price_id: string;
10
+ invoice_id?: string;
11
+ line_item_id?: string;
12
+ quantity: string;
13
+ source?: Source;
14
+ note?: string;
15
+ resource_version?: number;
16
+ updated_at?: number;
17
+ created_at: number;
90
18
  }
91
- export namespace Usage {
92
- export class UsageResource {
93
- /**
94
- * @description Creates a usage record for an item price in a subscription. The item price must belong to a [metered](/docs/api/items?prod_cat_ver&#x3D;2#item_metered) item.
95
- **Max Usages**
96
- The maximum number of usages that can be recorded for the entire lifetime of a subscription is 5000. [Contact Support](https://chargebee.freshdesk.com/support/home) if you want this limit to be increased for your site.
97
-
98
- */
99
-
100
- create(subscription_id:string, input:CreateInputParam):ChargebeeRequest<CreateResponse>;
101
-
102
- /**
103
- * @description Retrieves a usage record of a specific subscription.
104
-
105
- */
106
-
107
- retrieve(subscription_id:string, input:RetrieveInputParam):ChargebeeRequest<RetrieveResponse>;
108
-
109
- /**
110
- * @description Deletes a usage record. This operation cannot be invoked for a usage record that has been [invoiced](usages?prod_cat_ver&#x3D;2#invoicing_usages).
111
19
 
112
- */
113
-
114
- delete(subscription_id:string, input:DeleteInputParam):ChargebeeRequest<DeleteResponse>;
115
-
116
- /**
117
- * @description Retrieves the list of usages.
118
-
119
- */
120
-
121
- list(input:ListInputParam):ChargebeeRequest<ListResponse>;
122
-
123
- /**
124
- * @description Retrieves usages record for an invoice in PDF file format.
20
+ export namespace Usage {
21
+ export class UsageResource {
22
+ create(
23
+ subscription_id: string,
24
+ input: CreateInputParam,
25
+ headers?: ChargebeeRequestHeader,
26
+ ): Promise<ChargebeeResponse<CreateResponse>>;
27
+
28
+ retrieve(
29
+ subscription_id: string,
30
+ input: RetrieveInputParam,
31
+ headers?: ChargebeeRequestHeader,
32
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
33
+
34
+ delete(
35
+ subscription_id: string,
36
+ input: DeleteInputParam,
37
+ headers?: ChargebeeRequestHeader,
38
+ ): Promise<ChargebeeResponse<DeleteResponse>>;
39
+
40
+ list(
41
+ input?: ListInputParam,
42
+ headers?: ChargebeeRequestHeader,
43
+ ): Promise<ChargebeeResponse<ListResponse>>;
44
+
45
+ pdf(
46
+ input: PdfInputParam,
47
+ headers?: ChargebeeRequestHeader,
48
+ ): Promise<ChargebeeResponse<PdfResponse>>;
49
+ }
125
50
 
126
- */
127
-
128
- pdf(input:PdfInputParam):ChargebeeRequest<PdfResponse>;
51
+ export interface CreateResponse {
52
+ usage: Usage;
129
53
  }
130
- export interface CreateResponse {
131
- usage:Usage;
54
+
55
+ export interface RetrieveResponse {
56
+ usage: Usage;
132
57
  }
133
- export interface CreateInputParam {
134
-
135
- /**
136
- * @description A unique and immutable id for the usage. If not provided, it is autogenerated.
137
58
 
138
- */
139
-
140
- id?:string;
141
-
142
- /**
143
- * @description The id of the [item price](/docs/api/item_prices?prod_cat_ver&#x3D;2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically.
59
+ export interface DeleteResponse {
60
+ usage: Usage;
61
+ }
144
62
 
145
- */
146
-
147
- item_price_id:string;
148
-
149
- /**
150
- * @description The quantity specified for this usage record.
63
+ export interface ListResponse {
64
+ list: { usage: Usage }[];
65
+ next_offset?: string;
66
+ }
151
67
 
152
- */
153
-
154
- quantity:string;
155
-
156
- /**
157
- * @description The time at which this usage occurred. Chargebee bills only those usages whose &#x60;usage_date&#x60; falls within a time when the subscription &#x60;status&#x60; was &#x60;active&#x60; or &#x60;non_renewing&#x60;. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver&#x3D;2#retrieve_a_usage).
158
- **Note:** If &#x60;usage_date&#x60; corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver&#x3D;2#regenerate_an_invoice).
68
+ export interface PdfResponse {
69
+ download: Download;
70
+ }
159
71
 
160
- */
161
-
162
- usage_date:number;
163
-
164
- /**
165
- * @description A note for this usage record. This appears against the usage on the Chargebee UI. This note is not displayed on any customer-facing document or interface such as [invoice PDFs](/docs/api/invoices?prod_cat_ver&#x3D;2#retrieve_invoice_as_pdf) or [Hosted Pages](/docs/api/hosted_pages?prod_cat_ver&#x3D;2).
72
+ // REQUEST PARAMS
73
+ //---------------
166
74
 
167
- */
168
-
169
- note?:string;
170
- }
171
- export interface RetrieveResponse {
172
- usage:Usage;
75
+ export interface CreateInputParam {
76
+ id?: string;
77
+ item_price_id: string;
78
+ quantity: string;
79
+ usage_date: number /**
80
+ * @deprecated Please refer API docs to use other attributes
81
+ */;
82
+
83
+ dedupe_option?: DedupeOption;
84
+ note?: string;
173
85
  }
174
86
  export interface RetrieveInputParam {
175
-
176
- /**
177
- * @description Retrieves a usage record of a specific subscription.
178
-
179
- */
180
-
181
- id:string;
182
- }
183
- export interface DeleteResponse {
184
- usage:Usage;
87
+ id: string;
185
88
  }
186
89
  export interface DeleteInputParam {
187
-
188
- /**
189
- * @description A unique and immutable id for the usage. If not provided, it is autogenerated.
190
-
191
- */
192
-
193
- id:string;
194
- }
195
- export interface ListResponse {
196
- /**
197
- * @description Retrieves the list of usages.
198
-
199
- */
200
-
201
- list:{usage:Usage}[];
202
-
203
- /**
204
- * @description Retrieves the list of usages.
205
-
206
- */
207
-
208
- next_offset?:string;
90
+ id: string;
209
91
  }
210
92
  export interface ListInputParam {
211
- [key : string]: any;
212
- /**
213
- * @description Retrieves the list of usages.
214
-
215
- */
216
-
217
- limit?:number;
218
-
219
- /**
220
- * @description Retrieves the list of usages.
221
-
222
- */
223
-
224
- offset?:string;
225
-
226
- /**
227
- * @description Retrieves the list of usages.
228
-
229
- */
230
-
231
- id?:{is?:string,is_not?:string,starts_with?:string};
232
-
233
- /**
234
- * @description Retrieves the list of usages.
235
-
236
- */
237
-
238
- subscription_id:{is?:string,is_not?:string,starts_with?:string};
239
-
240
- /**
241
- * @description Retrieves the list of usages.
242
-
243
- */
244
-
245
- usage_date?:{after?:string,before?:string,between?:string,on?:string};
246
-
247
- /**
248
- * @description Retrieves the list of usages.
249
-
250
- */
251
-
252
- item_price_id?:{is?:string,is_not?:string,starts_with?:string};
253
-
254
- /**
255
- * @description Retrieves the list of usages.
256
-
257
- */
258
-
259
- invoice_id?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string};
260
-
261
- /**
262
- * @description Retrieves the list of usages.
263
-
264
- */
265
-
266
- source?:{in?:string,is?:'admin_console' | 'bulk_operation' | 'api',is_not?:'admin_console' | 'bulk_operation' | 'api',not_in?:string};
267
-
268
- /**
269
- * @description Retrieves the list of usages.
270
-
271
- */
272
-
273
- sort_by?:{asc?:'usage_date',desc?:'usage_date'};
274
-
275
- /**
276
- * @description Indicates the date at which this credit note is last updated.
277
-
278
- */
279
-
280
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
281
- }
282
- export interface PdfResponse {
283
- download:Download;
93
+ limit?: number;
94
+ offset?: string;
95
+ id?: filter.String;
96
+ subscription_id?: filter.String;
97
+ usage_date?: filter.Timestamp;
98
+ updated_at?: filter.Timestamp;
99
+ item_price_id?: filter.String;
100
+ invoice_id?: filter.String;
101
+ source?: filter.Enum;
102
+ 'sort_by[asc]'?: string;
103
+ 'sort_by[desc]'?: string;
284
104
  }
285
105
  export interface PdfInputParam {
286
-
287
- /**
288
- * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser
289
-
290
- */
291
-
292
- disposition_type?:DispositionType;
293
-
294
- /**
295
- * @description Parameters for invoice
296
-
297
- */
298
-
299
- invoice:{id:string};
106
+ disposition_type?: DispositionType;
107
+ invoice?: InvoicePdfInputParam;
108
+ }
109
+ export interface InvoicePdfInputParam {
110
+ id: string;
300
111
  }
301
-
302
112
  }
303
- }
113
+ }