chargebee 3.15.1 → 3.17.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,49 @@
1
+ ### v3.17.0-beta.1 (2025-12-10)
2
+
3
+ ### Enhancements
4
+ * add webhook event handler to process chargebee-events.
5
+ * deprecated `WebhookContentType` class, added `WebhookEventType` class.
6
+
7
+ ### v3.16.0 (2025-12-01)
8
+ * * *
9
+
10
+ ### New Resources:
11
+ * Einvoice has been added.
12
+ * QuotedDeltaRamp has been added.
13
+
14
+ ### New Attributes:
15
+ * line_items_next_offset has been added to CreditNote.
16
+ * line_items_next_offset has been added to Invoice.
17
+ * credit_lines has been added to SalesOrder.
18
+ * billable_unit_price has been added to SalesOrder#LineItem.
19
+ * billable_quantity has been added to SalesOrder#LineItem.
20
+ * billable_amount has been added to SalesOrder#LineItem.
21
+
22
+ ### New Endpoint:
23
+ * move action has been added to ItemPrice.
24
+
25
+ ### New Parameters:
26
+ * line_items_limit has been added to CreditNote#RetrieveRequest.
27
+ * line_items_offset has been added to CreditNote#RetrieveRequest.
28
+ * line_items_limit has been added to Invoice#RetrieveRequest.
29
+ * line_items_offset has been added to Invoice#RetrieveRequest.
30
+ * item_tiers has been added to Estimate#GiftSubscriptionForItemsRequest.
31
+ * unit_price has been added to Estimate#SubscriptionItems#GiftSubscriptionForItemsRequest.
32
+ * unit_price_in_decimal has been added to Estimate#SubscriptionItems#GiftSubscriptionForItemsRequest.
33
+ * item_tiers has been added to Gift#CreateForItemsRequest.
34
+ * meta_data has been added to Gift#CreateForItemsRequest.
35
+ * unit_price has been added to Gift#SubscriptionItems#CreateForItemsRequest.
36
+ * unit_price_in_decimal has been added to Gift#SubscriptionItems#CreateForItemsRequest.
37
+ * item_tiers has been added to HostedPage#CheckoutGiftForItemsRequest.
38
+ * unit_price has been added to HostedPage#SubscriptionItems#CheckoutGiftForItemsRequest.
39
+ * unit_price_in_decimal has been added to HostedPage#SubscriptionItems#CheckoutGiftForItemsRequest.
40
+ * auto_select_local_currency has been added to PricingPageSession#CreateForNewSubscriptionRequest.
41
+
42
+ ### New Enums:
43
+ * EZIDEBIT has been added to GatewayEnum.
44
+ * BUSINESS_RULE has been added to EntityTypeEnum.
45
+ * RULESET has been added to EntityTypeEnum.
46
+
1
47
  ### v3.15.1 (2025-10-29)
2
48
  * * *
3
49
 
package/README.md CHANGED
@@ -148,6 +148,174 @@ const chargebeeSiteEU = new Chargebee({
148
148
  });
149
149
  ```
150
150
 
151
+ ### Handle webhooks
152
+
153
+ Use the webhook handlers to parse and route webhook payloads from Chargebee with full TypeScript support.
154
+
155
+ #### Quick Start: Using the default `webhook` instance
156
+
157
+ The simplest way to handle webhooks is using the pre-configured `webhook` instance:
158
+
159
+ ```typescript
160
+ import express from 'express';
161
+ import { webhook, type WebhookEvent } from 'chargebee';
162
+
163
+ const app = express();
164
+ app.use(express.json());
165
+
166
+ webhook.on('subscription_created', async (event: WebhookEvent) => {
167
+ console.log(`Subscription created: ${event.id}`);
168
+ const subscription = event.content.subscription;
169
+ console.log(`Customer: ${subscription.customer_id}`);
170
+ });
171
+
172
+ webhook.on('error', (err: Error) => {
173
+ console.error('Webhook error:', err.message);
174
+ });
175
+
176
+ app.post('/chargebee/webhooks', (req, res) => {
177
+ webhook.handle(req.body, req.headers);
178
+ res.status(200).send('OK');
179
+ });
180
+
181
+ app.listen(8080);
182
+ ```
183
+
184
+ **Auto-configured Basic Auth:** The default `webhook` instance automatically configures Basic Auth validation if the following environment variables are set:
185
+
186
+ - `CHARGEBEE_WEBHOOK_USERNAME` - The expected username
187
+ - `CHARGEBEE_WEBHOOK_PASSWORD` - The expected password
188
+
189
+ When both are present, incoming webhook requests will be validated against these credentials. If not set, no authentication is applied.
190
+
191
+ #### Creating custom `WebhookHandler` instances
192
+
193
+ For more control or multiple webhook endpoints, create your own instances:
194
+
195
+ ```typescript
196
+ import express from 'express';
197
+ import { WebhookHandler, basicAuthValidator } from 'chargebee';
198
+
199
+ const app = express();
200
+ app.use(express.json());
201
+
202
+ const handler = new WebhookHandler();
203
+
204
+ // Register event listeners using .on() - events are fully typed
205
+ handler.on('subscription_created', async (event) => {
206
+ console.log(`Subscription created: ${event.id}`);
207
+ const subscription = event.content.subscription;
208
+ console.log(`Customer: ${subscription.customer_id}`);
209
+ console.log(`Plan: ${subscription.plan_id}`);
210
+ });
211
+
212
+ handler.on('payment_succeeded', async (event) => {
213
+ console.log(`Payment succeeded: ${event.id}`);
214
+ const transaction = event.content.transaction;
215
+ const customer = event.content.customer;
216
+ console.log(`Amount: ${transaction.amount}, Customer: ${customer.email}`);
217
+ });
218
+
219
+ // Optional: Add request validator (e.g., Basic Auth)
220
+ handler.requestValidator = basicAuthValidator((username, password) => {
221
+ return username === 'admin' && password === 'secret';
222
+ });
223
+
224
+ app.post('/chargebee/webhooks', (req, res) => {
225
+ handler.handle(req.body, req.headers);
226
+ res.status(200).send('OK');
227
+ });
228
+
229
+ app.listen(8080);
230
+ ```
231
+
232
+ #### Low-level: Parse and handle events manually
233
+
234
+ For more control, you can parse webhook events manually:
235
+
236
+ ```typescript
237
+ import express from 'express';
238
+ import Chargebee, { type WebhookEvent } from 'chargebee';
239
+
240
+ const app = express();
241
+ app.use(express.json());
242
+
243
+ app.post('/chargebee/webhooks', async (req, res) => {
244
+ try {
245
+ const event = req.body as WebhookEvent;
246
+
247
+ switch (event.event_type) {
248
+ case 'subscription_created':
249
+ // Access event content with proper typing
250
+ const subscription = event.content.subscription;
251
+ console.log('Subscription created:', subscription.id);
252
+ break;
253
+
254
+ case 'payment_succeeded':
255
+ const transaction = event.content.transaction;
256
+ console.log('Payment succeeded:', transaction.amount);
257
+ break;
258
+
259
+ default:
260
+ console.log('Unhandled event type:', event.event_type);
261
+ }
262
+
263
+ res.status(200).send('OK');
264
+ } catch (err) {
265
+ console.error('Error processing webhook:', err);
266
+ res.status(500).send('Error processing webhook');
267
+ }
268
+ });
269
+
270
+ app.listen(8080);
271
+ ```
272
+
273
+ #### Handling Unhandled Events
274
+
275
+ By default, if an incoming webhook event type is not recognized or you haven't registered a corresponding callback handler, the SDK provides flexible options to handle these scenarios:
276
+
277
+ **Using the `unhandled_event` listener:**
278
+
279
+ ```typescript
280
+ import { WebhookHandler } from 'chargebee';
281
+
282
+ const handler = new WebhookHandler();
283
+
284
+ handler.on('subscription_created', async (event) => {
285
+ // Handle subscription created
286
+ });
287
+
288
+ // Gracefully handle events without registered listeners
289
+ handler.on('unhandled_event', async (event) => {
290
+ console.log(`Received unhandled event: ${event.event_type}`);
291
+ // Log for monitoring or store for later processing
292
+ });
293
+ ```
294
+
295
+ **Using the `error` listener for error handling:**
296
+
297
+ If an error occurs during webhook processing (e.g., invalid JSON, validator failure), the SDK will emit an `error` event:
298
+
299
+ ```typescript
300
+ const handler = new WebhookHandler();
301
+
302
+ handler.on('subscription_created', async (event) => {
303
+ // Handle subscription created
304
+ });
305
+
306
+ // Catch any errors during webhook processing
307
+ handler.on('error', (err) => {
308
+ console.error('Webhook processing error:', err);
309
+ // Log to monitoring service, alert team, etc.
310
+ });
311
+ ```
312
+
313
+ **Best Practices:**
314
+
315
+ - Use `unhandled_event` listener to acknowledge unknown events (return 200 OK) and log them
316
+ - Use `error` listener to catch and handle exceptions thrown during event processing
317
+ - Both listeners help ensure your webhook endpoint remains stable even when new event types are introduced by Chargebee
318
+
151
319
  ### Processing Webhooks - API Version Check
152
320
 
153
321
  An attribute `api_version` is added to the [Event](https://apidocs.chargebee.com/docs/api/events) resource, which indicates the API version based on which the event content is structured. In your webhook servers, ensure this `api_version` is the same as the [API version](https://apidocs.chargebee.com/docs/api#versions) used by your webhook server's client library.
@@ -38,7 +38,7 @@ class RequestWrapper {
38
38
  const env = _env;
39
39
  const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
40
40
  const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
41
- let params = this.apiCall.hasIdInUrl
41
+ const params = this.apiCall.hasIdInUrl
42
42
  ? this.args[1]
43
43
  : this.args[0];
44
44
  let headers = this.apiCall.hasIdInUrl ? this.args[2] : this.args[1];
@@ -52,20 +52,21 @@ class RequestWrapper {
52
52
  }
53
53
  const makeRequest = async (attempt = 0) => {
54
54
  let path = (0, util_js_1.getApiURL)(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam);
55
- if (typeof params === 'undefined' || params === null) {
56
- params = {};
55
+ let requestParams = params;
56
+ if (typeof requestParams === 'undefined' || requestParams === null) {
57
+ requestParams = {};
57
58
  }
58
59
  if (this.apiCall.httpMethod === 'GET') {
59
60
  const queryParam = this.apiCall.isListReq
60
- ? (0, util_js_1.encodeListParams)((0, util_js_1.serialize)(params))
61
- : (0, util_js_1.encodeParams)((0, util_js_1.serialize)(params));
61
+ ? (0, util_js_1.encodeListParams)((0, util_js_1.serialize)(requestParams))
62
+ : (0, util_js_1.encodeParams)((0, util_js_1.serialize)(requestParams));
62
63
  path += '?' + queryParam;
63
- params = {};
64
+ requestParams = {};
64
65
  }
65
66
  const jsonKeys = this.apiCall.jsonKeys;
66
67
  const data = this.apiCall.isJsonRequest
67
- ? JSON.stringify(params)
68
- : (0, util_js_1.encodeParams)(params, undefined, undefined, undefined, jsonKeys);
68
+ ? JSON.stringify(requestParams)
69
+ : (0, util_js_1.encodeParams)(requestParams, undefined, undefined, undefined, jsonKeys);
69
70
  const requestHeaders = Object.assign({}, this.httpHeaders);
70
71
  if (data.length) {
71
72
  (0, util_js_1.extend)(true, requestHeaders, {
@@ -2,8 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const createChargebee_js_1 = require("./createChargebee.js");
4
4
  const FetchClient_js_1 = require("./net/FetchClient.js");
5
+ const handler_js_1 = require("./resources/webhook/handler.js");
6
+ const handler_js_2 = require("./resources/webhook/handler.js");
7
+ const auth_js_1 = require("./resources/webhook/auth.js");
5
8
  const httpClient = new FetchClient_js_1.FetchHttpClient();
6
9
  const Chargebee = (0, createChargebee_js_1.CreateChargebee)(httpClient);
7
10
  module.exports = Chargebee;
8
11
  module.exports.Chargebee = Chargebee;
9
12
  module.exports.default = Chargebee;
13
+ // Export webhook modules
14
+ module.exports.WebhookHandler = handler_js_1.WebhookHandler;
15
+ module.exports.webhook = handler_js_2.default;
16
+ module.exports.basicAuthValidator = auth_js_1.basicAuthValidator;
@@ -11,7 +11,7 @@ exports.Environment = {
11
11
  hostSuffix: '.chargebee.com',
12
12
  apiPath: '/api/v2',
13
13
  timeout: DEFAULT_TIME_OUT,
14
- clientVersion: 'v3.15.1',
14
+ clientVersion: 'v3.16.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -1671,6 +1671,7 @@ exports.Endpoints = {
1671
1671
  ],
1672
1672
  paymentReferenceNumber: [],
1673
1673
  paymentSchedule: [],
1674
+ einvoice: [],
1674
1675
  taxWithheld: [],
1675
1676
  creditNote: [
1676
1677
  [
@@ -2051,6 +2052,7 @@ exports.Endpoints = {
2051
2052
  null,
2052
2053
  false,
2053
2054
  {
2055
+ meta_data: 0,
2054
2056
  additional_information: 1,
2055
2057
  },
2056
2058
  {
@@ -2951,6 +2953,7 @@ exports.Endpoints = {
2951
2953
  quotedSubscription: [],
2952
2954
  quotedCharge: [],
2953
2955
  quotedRamp: [],
2956
+ quotedDeltaRamp: [],
2954
2957
  billingConfiguration: [],
2955
2958
  quoteLineGroup: [],
2956
2959
  plan: [
@@ -3960,6 +3963,19 @@ exports.Endpoints = {
3960
3963
  {},
3961
3964
  {},
3962
3965
  ],
3966
+ [
3967
+ 'moveItemPrice',
3968
+ 'POST',
3969
+ '/item_prices',
3970
+ '/move',
3971
+ true,
3972
+ null,
3973
+ false,
3974
+ {},
3975
+ {
3976
+ isIdempotent: true,
3977
+ },
3978
+ ],
3963
3979
  ],
3964
3980
  attachedItem: [
3965
3981
  [
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.basicAuthValidator = void 0;
4
+ const basicAuthValidator = (validateCredentials) => {
5
+ return (headers) => {
6
+ const authHeader = headers['authorization'] || headers['Authorization'];
7
+ if (!authHeader) {
8
+ throw new Error('Invalid authorization header');
9
+ }
10
+ const authStr = Array.isArray(authHeader) ? authHeader[0] : authHeader;
11
+ if (!authStr) {
12
+ throw new Error('Invalid authorization header');
13
+ }
14
+ const parts = authStr.split(' ');
15
+ if (parts.length !== 2 || parts[0] !== 'Basic') {
16
+ throw new Error('Invalid authorization header');
17
+ }
18
+ const credentials = Buffer.from(parts[1], 'base64').toString().split(':');
19
+ if (credentials.length !== 2) {
20
+ throw new Error('Invalid credentials');
21
+ }
22
+ if (!validateCredentials(credentials[0], credentials[1])) {
23
+ throw new Error('Invalid credentials');
24
+ }
25
+ };
26
+ };
27
+ exports.basicAuthValidator = basicAuthValidator;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ ///<reference path='../../../types/index.d.ts'/>
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebhookHandler = void 0;
4
+ const node_events_1 = require("node:events");
5
+ const auth_js_1 = require("./auth.js");
6
+ class WebhookHandler extends node_events_1.EventEmitter {
7
+ constructor() {
8
+ super({ captureRejections: true });
9
+ }
10
+ handle(body, headers) {
11
+ try {
12
+ if (this.requestValidator && headers) {
13
+ this.requestValidator(headers);
14
+ }
15
+ const event = typeof body === 'string' ? JSON.parse(body) : body;
16
+ const eventType = event.event_type;
17
+ if (this.listenerCount(eventType) > 0) {
18
+ this.emit(eventType, event);
19
+ }
20
+ else {
21
+ this.emit('unhandled_event', event);
22
+ }
23
+ }
24
+ catch (err) {
25
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
26
+ }
27
+ }
28
+ }
29
+ exports.WebhookHandler = WebhookHandler;
30
+ const webhook = new WebhookHandler();
31
+ // Auto-configure basic auth if env vars are present
32
+ const username = process.env.CHARGEBEE_WEBHOOK_USERNAME;
33
+ const password = process.env.CHARGEBEE_WEBHOOK_PASSWORD;
34
+ if (username && password) {
35
+ webhook.requestValidator = (0, auth_js_1.basicAuthValidator)((u, p) => u === username && p === password);
36
+ }
37
+ exports.default = webhook;
@@ -35,7 +35,7 @@ export class RequestWrapper {
35
35
  const env = _env;
36
36
  const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
37
37
  const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
38
- let params = this.apiCall.hasIdInUrl
38
+ const params = this.apiCall.hasIdInUrl
39
39
  ? this.args[1]
40
40
  : this.args[0];
41
41
  let headers = this.apiCall.hasIdInUrl ? this.args[2] : this.args[1];
@@ -49,20 +49,21 @@ export class RequestWrapper {
49
49
  }
50
50
  const makeRequest = async (attempt = 0) => {
51
51
  let path = getApiURL(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam);
52
- if (typeof params === 'undefined' || params === null) {
53
- params = {};
52
+ let requestParams = params;
53
+ if (typeof requestParams === 'undefined' || requestParams === null) {
54
+ requestParams = {};
54
55
  }
55
56
  if (this.apiCall.httpMethod === 'GET') {
56
57
  const queryParam = this.apiCall.isListReq
57
- ? encodeListParams(serialize(params))
58
- : encodeParams(serialize(params));
58
+ ? encodeListParams(serialize(requestParams))
59
+ : encodeParams(serialize(requestParams));
59
60
  path += '?' + queryParam;
60
- params = {};
61
+ requestParams = {};
61
62
  }
62
63
  const jsonKeys = this.apiCall.jsonKeys;
63
64
  const data = this.apiCall.isJsonRequest
64
- ? JSON.stringify(params)
65
- : encodeParams(params, undefined, undefined, undefined, jsonKeys);
65
+ ? JSON.stringify(requestParams)
66
+ : encodeParams(requestParams, undefined, undefined, undefined, jsonKeys);
66
67
  const requestHeaders = Object.assign({}, this.httpHeaders);
67
68
  if (data.length) {
68
69
  extend(true, requestHeaders, {
@@ -3,3 +3,7 @@ import { FetchHttpClient } from './net/FetchClient.js';
3
3
  const httpClient = new FetchHttpClient();
4
4
  const Chargebee = CreateChargebee(httpClient);
5
5
  export default Chargebee;
6
+ // Export webhook modules
7
+ export { WebhookHandler } from './resources/webhook/handler.js';
8
+ export { default as webhook } from './resources/webhook/handler.js';
9
+ export { basicAuthValidator } from './resources/webhook/auth.js';
@@ -8,7 +8,7 @@ export const Environment = {
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
10
  timeout: DEFAULT_TIME_OUT,
11
- clientVersion: 'v3.15.1',
11
+ clientVersion: 'v3.16.0',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -1668,6 +1668,7 @@ export const Endpoints = {
1668
1668
  ],
1669
1669
  paymentReferenceNumber: [],
1670
1670
  paymentSchedule: [],
1671
+ einvoice: [],
1671
1672
  taxWithheld: [],
1672
1673
  creditNote: [
1673
1674
  [
@@ -2048,6 +2049,7 @@ export const Endpoints = {
2048
2049
  null,
2049
2050
  false,
2050
2051
  {
2052
+ meta_data: 0,
2051
2053
  additional_information: 1,
2052
2054
  },
2053
2055
  {
@@ -2948,6 +2950,7 @@ export const Endpoints = {
2948
2950
  quotedSubscription: [],
2949
2951
  quotedCharge: [],
2950
2952
  quotedRamp: [],
2953
+ quotedDeltaRamp: [],
2951
2954
  billingConfiguration: [],
2952
2955
  quoteLineGroup: [],
2953
2956
  plan: [
@@ -3957,6 +3960,19 @@ export const Endpoints = {
3957
3960
  {},
3958
3961
  {},
3959
3962
  ],
3963
+ [
3964
+ 'moveItemPrice',
3965
+ 'POST',
3966
+ '/item_prices',
3967
+ '/move',
3968
+ true,
3969
+ null,
3970
+ false,
3971
+ {},
3972
+ {
3973
+ isIdempotent: true,
3974
+ },
3975
+ ],
3960
3976
  ],
3961
3977
  attachedItem: [
3962
3978
  [
@@ -0,0 +1,23 @@
1
+ export const basicAuthValidator = (validateCredentials) => {
2
+ return (headers) => {
3
+ const authHeader = headers['authorization'] || headers['Authorization'];
4
+ if (!authHeader) {
5
+ throw new Error('Invalid authorization header');
6
+ }
7
+ const authStr = Array.isArray(authHeader) ? authHeader[0] : authHeader;
8
+ if (!authStr) {
9
+ throw new Error('Invalid authorization header');
10
+ }
11
+ const parts = authStr.split(' ');
12
+ if (parts.length !== 2 || parts[0] !== 'Basic') {
13
+ throw new Error('Invalid authorization header');
14
+ }
15
+ const credentials = Buffer.from(parts[1], 'base64').toString().split(':');
16
+ if (credentials.length !== 2) {
17
+ throw new Error('Invalid credentials');
18
+ }
19
+ if (!validateCredentials(credentials[0], credentials[1])) {
20
+ throw new Error('Invalid credentials');
21
+ }
22
+ };
23
+ };
@@ -0,0 +1,2 @@
1
+ ///<reference path='../../../types/index.d.ts'/>
2
+ export {};
@@ -0,0 +1,33 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import { basicAuthValidator } from './auth.js';
3
+ export class WebhookHandler extends EventEmitter {
4
+ constructor() {
5
+ super({ captureRejections: true });
6
+ }
7
+ handle(body, headers) {
8
+ try {
9
+ if (this.requestValidator && headers) {
10
+ this.requestValidator(headers);
11
+ }
12
+ const event = typeof body === 'string' ? JSON.parse(body) : body;
13
+ const eventType = event.event_type;
14
+ if (this.listenerCount(eventType) > 0) {
15
+ this.emit(eventType, event);
16
+ }
17
+ else {
18
+ this.emit('unhandled_event', event);
19
+ }
20
+ }
21
+ catch (err) {
22
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
23
+ }
24
+ }
25
+ }
26
+ const webhook = new WebhookHandler();
27
+ // Auto-configure basic auth if env vars are present
28
+ const username = process.env.CHARGEBEE_WEBHOOK_USERNAME;
29
+ const password = process.env.CHARGEBEE_WEBHOOK_PASSWORD;
30
+ if (username && password) {
31
+ webhook.requestValidator = basicAuthValidator((u, p) => u === username && p === password);
32
+ }
33
+ export default webhook;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.15.1",
3
+ "version": "3.17.0-beta.1",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
7
+ "test": "mocha -r ts-node/register 'test/**/*.test.ts'",
7
8
  "build": "npm run build-esm && npm run build-cjs",
8
9
  "build-esm": "rm -rf esm && mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
9
10
  "build-cjs": "rm -rf cjs && mkdir -p cjs && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
@@ -32,8 +33,6 @@
32
33
  "url": "http://github.com/chargebee/chargebee-node/blob/master/LICENSE"
33
34
  }
34
35
  ],
35
- "dependencies": {
36
- },
37
36
  "exports": {
38
37
  "types": "./types/index.d.ts",
39
38
  "browser": {
@@ -62,13 +61,19 @@
62
61
  }
63
62
  },
64
63
  "devDependencies": {
65
- "@types/node": "20.0.0",
64
+ "@types/chai": "^4.3.5",
65
+ "@types/mocha": "^10.0.10",
66
+ "@types/node": "20.12.0",
67
+ "chai": "^4.3.7",
68
+ "mocha": "^10.2.0",
66
69
  "prettier": "^3.3.3",
67
- "typescript": "^5.5.4"
70
+ "ts-node": "^10.9.1",
71
+ "typescript": "^5.5.4",
72
+ "undici-types": "^7.16.0"
68
73
  },
69
74
  "prettier": {
70
75
  "semi": true,
71
76
  "singleQuote": true,
72
77
  "parser": "typescript"
73
78
  }
74
- }
79
+ }
package/types/core.d.ts CHANGED
@@ -149,7 +149,9 @@ declare module 'chargebee' {
149
149
  | 'sales_order'
150
150
  | 'omnichannel_one_time_order'
151
151
  | 'omnichannel_one_time_order_item'
152
- | 'usage_file';
152
+ | 'usage_file'
153
+ | 'business_rule'
154
+ | 'ruleset';
153
155
  type EventNameEnum = 'cancellation_page_loaded';
154
156
  type EventTypeEnum =
155
157
  | 'coupon_created'
@@ -425,6 +427,7 @@ declare module 'chargebee' {
425
427
  | 'paystack'
426
428
  | 'jp_morgan'
427
429
  | 'deutsche_bank'
430
+ | 'ezidebit'
428
431
  | 'gocardless'
429
432
  | 'not_applicable';
430
433
  type HierarchyOperationTypeEnum =