chargebee 3.8.0-beta.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,68 @@
1
+ ### v3.8.0 (2025-06-19)
2
+ * * *
3
+
4
+ ### New Resources
5
+ * QuotedRamp has been added.
6
+
7
+ ### New Attributes
8
+ * chargebee_response_schema_type has been added to Configuration.
9
+ * linked_item has been added to OmnichannelSubscriptionItem.
10
+ * resumes_at has been added to OmnichannelSubscriptionItem.
11
+
12
+ ### Changed Attributes
13
+ * percentage changed to is_percentage_pricing in CreditNote.
14
+ * percentage changed to is_percentage_pricing in QuoteLineGroup.
15
+ * percentage changed to is_percentage_pricing in CreditNoteEstimate.
16
+ * percentage changed to is_percentage_pricing in Invoice.
17
+ * percentage changed to is_percentage_pricing in InvoiceEstimate.
18
+ * percentage changed to is_percentage_pricing in Quote.
19
+
20
+
21
+ ### New Input Parameters
22
+ * is_percentage_pricing has been added to Item#UpdateRequest.
23
+ * line_item[subscription_id] has been added to CreditNote#RetrieveRequest.
24
+ * line_item[customer_id] has been added to CreditNote#RetrieveRequest.
25
+ * line_item[subscription_id] has been added to Invoice#RetrieveRequest.
26
+ * line_item[customer_id] has been added to Invoice#RetrieveRequest.
27
+ * billing_override[max_excess_payment_usage] has been added to Estimate#CreateSubItemForCustomerEstimateRequest.
28
+ * billing_override[max_refundable_credits_usage] has been added to Estimate#CreateSubItemForCustomerEstimateRequest.
29
+ * billing_override[max_excess_payment_usage] has been added to Estimate#UpdateSubscriptionForItemsRequest.
30
+ * billing_override[max_refundable_credits_usage] has been added to Estimate#UpdateSubscriptionForItemsRequest.
31
+ * billing_start_option has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
32
+ * net_term_days has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
33
+ * billing_address has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
34
+ * subscription_items has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
35
+ * discounts has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
36
+ * billing_start_option has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
37
+ * net_term_days has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
38
+ * billing_address has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
39
+ * subscription_items has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
40
+ * discounts has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
41
+ * net_term_days has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
42
+ * subscription_items has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
43
+ * discount has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
44
+ * coupons has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
45
+ * net_term_days has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
46
+ * subscription_items has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
47
+ * discounts has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
48
+ * coupons has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
49
+ * billing_address has been added to Quote#CreateForChargeItemsAndChargesRequest.
50
+ * billing_address has been added to Quote#EditForChargeItemsAndChargesRequest.
51
+ * sort_by[order] has been added to Subscription#SubscriptionContractTermsForSubscriptionRequest.
52
+ * item_tiers has been added to Quote#UpdateSubscriptionQuoteForItemsRequest.
53
+ * item_tiers has been added to Quote#EditUpdateSubscriptionQuoteForItemsRequest.
54
+ * item_tiers has been added to Quote#CreateSubItemsForCustomerQuoteRequest.
55
+ * item_tiers has been added to Quote#EditCreateSubCustomerQuoteForItemsRequest.
56
+
57
+ ### New Endpoints:
58
+ * PauseDunningRequest has been added to Invoice.
59
+ * ResumeDunningRequest has been added to Invoice.
60
+
61
+ ### Enum Attributes:
62
+ * BillingPeriodUnitEnum has been added.
63
+ * BillingStartOptionEnum has been added.
64
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_RESUMED has been added to EventTypeEnum.
65
+
1
66
  ### v3.7.0 (2025-05-15)
2
67
  * * *
3
68
 
package/README.md CHANGED
@@ -143,72 +143,6 @@ const chargebeeSiteEU = new Chargebee({
143
143
 
144
144
  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.
145
145
 
146
- ### Retry Handling
147
-
148
- Chargebee's SDK includes built-in retry logic to handle temporary network issues and server-side errors. This feature is **disabled by default** but can be **enabled when needed**.
149
-
150
- #### Key features include:
151
-
152
- - **Automatic retries for specific HTTP status codes**: Retries are automatically triggered for status codes `500`, `502`, `503`, and `504`.
153
- - **Exponential backoff**: Retry delays increase exponentially to prevent overwhelming the server.
154
- - **Rate limit management**: If a `429 Too Many Requests` response is received with a `Retry-After` header, the SDK waits for the specified duration before retrying.
155
- > *Note: Exponential backoff and max retries do not apply in this case.*
156
- - **Customizable retry behavior**: Retry logic can be configured using the `retryConfig` parameter in the environment configuration.
157
-
158
- #### Example: Customizing Retry Logic
159
-
160
- You can enable and configure the retry logic by passing a `retryConfig` object when initializing the Chargebee environment:
161
-
162
- ```typescript
163
- import Chargebee from 'chargebee';
164
-
165
- const chargebee = new Chargebee({
166
- site: "{{site}}",
167
- apiKey: "{{api-key}}",
168
- retryConfig: {
169
- enabled: true, // Enable retry logic
170
- maxRetries: 5, // Maximum number of retries
171
- delayMs: 300, // Initial delay between retries in milliseconds
172
- retryOn: [500, 502, 503, 504], // HTTP status codes to retry on
173
- },
174
- });
175
-
176
- try {
177
- const { customer } = await chargebee.customer.create({
178
- email: "john@test.com",
179
- });
180
- console.log("Customer created:", customer);
181
- } catch (err) {
182
- console.error("Request failed after retries:", err);
183
- }
184
- ```
185
-
186
- #### Example: Rate Limit retry logic
187
-
188
- You can enable and configure the retry logic for rate-limit by passing a `retryConfig` object when initializing the Chargebee environment:
189
-
190
- ```typescript
191
- import Chargebee from 'chargebee';
192
-
193
- const chargebee = new Chargebee({
194
- site: "{{site}}",
195
- apiKey: "{{api-key}}",
196
- retryConfig: {
197
- enabled: true,
198
- retryOn: [429],
199
- },
200
- });
201
-
202
- try {
203
- const { customer } = await chargebee.customer.create({
204
- email: "john@test.com",
205
- });
206
- console.log("Customer created:", customer);
207
- } catch (err) {
208
- console.error("Request failed after retries:", err);
209
- }
210
- ```
211
-
212
146
  ## Feedback
213
147
 
214
148
  If you find any bugs or have any questions / feedback, open an issue in this repository or reach out to us on dx@chargebee.com
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RequestWrapper = void 0;
4
- const util_1 = require("./util");
5
- const coreCommon_1 = require("./coreCommon");
4
+ const util_js_1 = require("./util.js");
5
+ const coreCommon_js_1 = require("./coreCommon.js");
6
6
  const node_buffer_1 = require("node:buffer");
7
7
  class RequestWrapper {
8
8
  constructor(args, apiCall, envArg) {
@@ -23,134 +23,73 @@ class RequestWrapper {
23
23
  }
24
24
  return idParam;
25
25
  }
26
- static parseRetryAfter(retryAfter) {
27
- if (!retryAfter)
28
- return null;
29
- const seconds = parseInt(retryAfter, 10);
30
- if (!isNaN(seconds)) {
31
- return seconds * 1000;
32
- }
33
- return null;
34
- }
35
- async request() {
26
+ request() {
36
27
  let env = {};
37
- (0, util_1.extend)(true, env, this.envArg);
38
- const retryConfig = Object.assign({ enabled: false, maxRetries: 3, delayMs: 200, retryOn: [500, 502, 503, 504] }, env.retryConfig);
28
+ (0, util_js_1.extend)(true, env, this.envArg);
39
29
  const urlIdParam = this.apiCall.hasIdInUrl ? this.args[0] : null;
40
30
  let params = this.apiCall.hasIdInUrl
41
31
  ? this.args[1]
42
32
  : this.args[0];
43
33
  let headers = this.apiCall.hasIdInUrl ? this.args[2] : this.args[1];
44
34
  Object.assign(this.httpHeaders, headers);
45
- if (this.apiCall.httpMethod === 'POST' &&
46
- !this.httpHeaders['chargebee-idempotency-key'] &&
47
- this.apiCall.options &&
48
- this.apiCall.options.isIdempotent) {
49
- this.httpHeaders['chargebee-idempotency-key'] = (0, util_1.generateUUIDv4)();
50
- }
51
- const makeRequest = async (attempt = 0) => {
52
- let path = (0, util_1.getApiURL)(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam);
53
- if (typeof params === 'undefined' || params === null) {
54
- params = {};
55
- }
56
- if (this.apiCall.httpMethod === 'GET') {
57
- const queryParam = this.apiCall.isListReq
58
- ? (0, util_1.encodeListParams)((0, util_1.serialize)(params))
59
- : (0, util_1.encodeParams)((0, util_1.serialize)(params));
60
- path += '?' + queryParam;
61
- params = {};
62
- }
63
- const jsonKeys = this.apiCall.jsonKeys;
64
- const data = this.apiCall.isJsonRequest
65
- ? JSON.stringify(params)
66
- : (0, util_1.encodeParams)(params, undefined, undefined, undefined, jsonKeys);
67
- const requestHeaders = Object.assign({}, this.httpHeaders);
68
- if (data.length) {
69
- (0, util_1.extend)(true, requestHeaders, {
70
- 'Content-Length': data.length,
71
- });
72
- }
73
- const contentType = this.apiCall.isJsonRequest
74
- ? 'application/json;charset=UTF-8'
75
- : 'application/x-www-form-urlencoded; charset=utf-8';
76
- (0, util_1.extend)(true, requestHeaders, {
77
- Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'),
78
- Accept: 'application/json',
79
- 'Content-Type': contentType,
80
- 'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion,
81
- 'Lang-Version': typeof process === 'undefined' ? '' : process.version,
82
- });
83
- if (attempt > 0) {
84
- requestHeaders['X-CB-Retry-Attempt'] = attempt.toString();
35
+ const promise = new Promise(async (resolve, reject) => {
36
+ function callBackWrapper(err, response) {
37
+ if (err) {
38
+ reject(err);
39
+ }
40
+ else {
41
+ resolve(response);
42
+ }
85
43
  }
86
- const resp = await this.envArg.httpClient.makeApiRequest({
87
- host: (0, util_1.getHost)(env, this.apiCall.subDomain),
88
- port: env.port,
89
- path,
90
- method: this.apiCall.httpMethod,
91
- protocol: env.protocol,
92
- headers: requestHeaders,
93
- data,
94
- timeout: env.timeout,
95
- });
96
- return new Promise((resolve, reject) => {
97
- (0, coreCommon_1.handleResponse)((err, response) => {
98
- if (err)
99
- return reject(err);
100
- return resolve(response);
101
- }, resp);
102
- });
103
- };
104
- const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
105
- const withRetry = async (retryCount, startTime) => {
106
- var _a, _b, _c, _d, _e, _f;
107
44
  try {
108
- return await makeRequest(retryCount);
109
- }
110
- catch (err) {
111
- const statusCode = (_d = (_c = (_a = err.statusCode) !== null && _a !== void 0 ? _a : (_b = err.response) === null || _b === void 0 ? void 0 : _b.statusCode) !== null && _c !== void 0 ? _c : err.http_code) !== null && _d !== void 0 ? _d : err.http_status_code;
112
- const isRateLimitError = statusCode === 429 && retryConfig.enabled;
113
- if (isRateLimitError) {
114
- const headers = ((_e = err.response) === null || _e === void 0 ? void 0 : _e.headers) || err.headers || {};
115
- const retryAfterHeader = (_f = headers['retry-after']) === null || _f === void 0 ? void 0 : _f.toLowerCase();
116
- const parsedDelay = RequestWrapper.parseRetryAfter(retryAfterHeader);
117
- if (!parsedDelay) {
118
- (0, util_1.log)(env, {
119
- level: 'ERROR',
120
- message: `Rate limit error occurred, but no retry-after header found. Retrying in ${retryConfig.delayMs}ms.`,
121
- });
122
- throw err;
123
- }
124
- (0, util_1.log)(env, {
125
- level: 'INFO',
126
- message: `Rate limit error occurred. Retrying in ${parsedDelay}ms.`,
127
- });
128
- await delay(parsedDelay);
45
+ let path = (0, util_js_1.getApiURL)(env, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam);
46
+ if (typeof params === 'undefined' || params === null) {
47
+ params = {};
129
48
  }
130
- else {
131
- const canRetry = retryConfig.enabled &&
132
- retryConfig.retryOn.includes(statusCode) &&
133
- retryCount < retryConfig.maxRetries;
134
- if (!canRetry) {
135
- (0, util_1.log)(env, {
136
- level: 'ERROR',
137
- message: `Request failed after ${retryCount} retries: ${err.message}`,
138
- });
139
- throw err;
140
- }
141
- let retryDelayMs = retryConfig.delayMs * Math.pow(2, retryCount) +
142
- Math.random() * 100;
143
- (0, util_1.log)(env, {
144
- level: 'INFO',
145
- message: `Retrying request [${retryCount + 1}/${retryConfig.maxRetries}] in ${retryDelayMs}ms due to status code ${statusCode}.`,
49
+ if (this.apiCall.httpMethod === 'GET') {
50
+ params = (0, util_js_1.serialize)(params);
51
+ let queryParam = this.apiCall.isListReq
52
+ ? (0, util_js_1.encodeListParams)(params)
53
+ : (0, util_js_1.encodeParams)(params);
54
+ path += '?' + queryParam;
55
+ params = {};
56
+ }
57
+ const jsonKeys = this.apiCall.jsonKeys;
58
+ let data = this.apiCall.isJsonRequest
59
+ ? JSON.stringify(params)
60
+ : (0, util_js_1.encodeParams)(params, undefined, undefined, undefined, jsonKeys);
61
+ if (data.length) {
62
+ (0, util_js_1.extend)(true, this.httpHeaders, {
63
+ 'Content-Length': data.length,
146
64
  });
147
- await delay(retryDelayMs);
148
65
  }
149
- return await withRetry(retryCount + 1, startTime);
66
+ const contentType = this.apiCall.isJsonRequest
67
+ ? 'application/json;charset=UTF-8'
68
+ : 'application/x-www-form-urlencoded; charset=utf-8';
69
+ (0, util_js_1.extend)(true, this.httpHeaders, {
70
+ Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'),
71
+ Accept: 'application/json',
72
+ 'Content-Type': contentType,
73
+ 'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion,
74
+ 'Lang-Version': typeof process === 'undefined' ? '' : process.version,
75
+ });
76
+ const resp = await this.envArg.httpClient.makeApiRequest({
77
+ host: (0, util_js_1.getHost)(env, this.apiCall.subDomain),
78
+ port: env.port,
79
+ path,
80
+ method: this.apiCall.httpMethod,
81
+ protocol: env.protocol,
82
+ headers: this.httpHeaders,
83
+ data: data,
84
+ timeout: env.timeout,
85
+ });
86
+ (0, coreCommon_js_1.handleResponse)(callBackWrapper, resp);
150
87
  }
151
- };
152
- const promise = withRetry(0, Date.now());
153
- return (0, util_1.callbackifyPromise)(promise);
88
+ catch (err) {
89
+ callBackWrapper(err, null);
90
+ }
91
+ });
92
+ return (0, util_js_1.callbackifyPromise)(promise);
154
93
  }
155
94
  }
156
95
  exports.RequestWrapper = RequestWrapper;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.waitForProcessToComplete = void 0;
4
- const util_1 = require("./util");
4
+ const util_js_1 = require("./util.js");
5
5
  const waitForProcessToComplete = (retrieveHandling, env) => {
6
- if (typeof retrieveHandling == 'undefined' || !(0, util_1.isFunction)(retrieveHandling)) {
6
+ if (typeof retrieveHandling == 'undefined' || !(0, util_js_1.isFunction)(retrieveHandling)) {
7
7
  throw new Error('The handling parameter should be a method.');
8
8
  }
9
9
  const DummyRequestWrapper = function () {
@@ -12,15 +12,15 @@ const waitForProcessToComplete = (retrieveHandling, env) => {
12
12
  const _request = function (callBack, envOptions) {
13
13
  const jsonConstructor = {}.constructor;
14
14
  if (typeof envOptions !== 'undefined') {
15
- (0, util_1.extend)(true, env, envOptions);
15
+ (0, util_js_1.extend)(true, env, envOptions);
16
16
  }
17
17
  else if (typeof callBack !== 'undefined' &&
18
18
  callBack.constructor === jsonConstructor &&
19
- !(0, util_1.isFunction)(callBack)) {
20
- (0, util_1.extend)(true, env, callBack);
19
+ !(0, util_js_1.isFunction)(callBack)) {
20
+ (0, util_js_1.extend)(true, env, callBack);
21
21
  callBack = undefined;
22
22
  }
23
- if (typeof callBack !== 'undefined' && !(0, util_1.isFunction)(callBack)) {
23
+ if (typeof callBack !== 'undefined' && !(0, util_js_1.isFunction)(callBack)) {
24
24
  throw new Error('The callback parameter passed is incorrect.');
25
25
  }
26
26
  const promise = new Promise((resolve, reject) => {
@@ -32,7 +32,7 @@ const waitForProcessToComplete = (retrieveHandling, env) => {
32
32
  reject(err);
33
33
  }
34
34
  });
35
- return (0, util_1.callbackifyPromise)(promise, callBack);
35
+ return (0, util_js_1.callbackifyPromise)(promise, callBack);
36
36
  };
37
37
  return new DummyRequestWrapper();
38
38
  };
package/cjs/coreCommon.js CHANGED
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleResponse = void 0;
4
4
  exports.throwError = throwError;
5
- const chargebeeError_1 = require("./chargebeeError");
6
- const util_1 = require("./util");
5
+ const chargebeeError_js_1 = require("./chargebeeError.js");
6
+ const util_js_1 = require("./util.js");
7
7
  const IDEMPOTENCY_REPLAYED_HEADER = 'chargebee-idempotency-replayed';
8
8
  function throwError(callBack, rawError, headers) {
9
- const error = new chargebeeError_1.ChargebeeError({
9
+ const error = new chargebeeError_js_1.ChargebeeError({
10
10
  message: rawError.message,
11
11
  type: rawError.type,
12
12
  api_error_code: rawError.errorCode,
@@ -31,7 +31,7 @@ const handleResponse = async (callback, response) => {
31
31
  }
32
32
  else {
33
33
  res.isIdempotencyReplayed = false;
34
- if ((0, util_1.isNotUndefinedNEmpty)(headers[IDEMPOTENCY_REPLAYED_HEADER])) {
34
+ if ((0, util_js_1.isNotUndefinedNEmpty)(headers[IDEMPOTENCY_REPLAYED_HEADER])) {
35
35
  res.isIdempotencyReplayed = headers[IDEMPOTENCY_REPLAYED_HEADER];
36
36
  }
37
37
  res.headers = headers;
@@ -1,24 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateChargebee = void 0;
4
- const RequestWrapper_1 = require("./RequestWrapper");
5
- const environment_1 = require("./environment");
6
- const api_endpoints_1 = require("./resources/api_endpoints");
7
- const util_1 = require("./util");
8
- const asyncApiSupport_1 = require("./asyncApiSupport");
4
+ const RequestWrapper_js_1 = require("./RequestWrapper.js");
5
+ const environment_js_1 = require("./environment.js");
6
+ const api_endpoints_js_1 = require("./resources/api_endpoints.js");
7
+ const util_js_1 = require("./util.js");
8
+ const asyncApiSupport_js_1 = require("./asyncApiSupport.js");
9
9
  const CreateChargebee = (httpClient) => {
10
10
  const Chargebee = function (conf) {
11
- this._env = Object.assign({}, environment_1.Environment);
12
- (0, util_1.extend)(true, this._env, conf);
11
+ this._env = Object.assign({}, environment_js_1.Environment);
12
+ (0, util_js_1.extend)(true, this._env, conf);
13
13
  // @ts-ignore
14
14
  this._env.httpClient = httpClient;
15
15
  this._buildResources();
16
- this._endpoints = api_endpoints_1.Endpoints;
16
+ this._endpoints = api_endpoints_js_1.Endpoints;
17
17
  };
18
18
  Chargebee.prototype = {
19
19
  _createApiFunc(apiCall, env) {
20
20
  return async function () {
21
- const rw = new RequestWrapper_1.RequestWrapper(arguments, apiCall, env);
21
+ const rw = new RequestWrapper_js_1.RequestWrapper(arguments, apiCall, env);
22
22
  return rw.getRequest();
23
23
  };
24
24
  },
@@ -32,7 +32,7 @@ const CreateChargebee = (httpClient) => {
32
32
  return result;
33
33
  }
34
34
  else if (exportObj.status === 'in_process') {
35
- await (0, util_1.sleep)(this._env.exportWaitInMillis);
35
+ await (0, util_js_1.sleep)(this._env.exportWaitInMillis);
36
36
  continue;
37
37
  }
38
38
  else {
@@ -41,7 +41,7 @@ const CreateChargebee = (httpClient) => {
41
41
  }
42
42
  throw new Error('Export is taking too long');
43
43
  };
44
- return (0, asyncApiSupport_1.waitForProcessToComplete)(retrieve);
44
+ return (0, asyncApiSupport_js_1.waitForProcessToComplete)(retrieve);
45
45
  },
46
46
  _timeMachineWait() {
47
47
  let count = 0;
@@ -53,7 +53,7 @@ const CreateChargebee = (httpClient) => {
53
53
  return result;
54
54
  }
55
55
  else if (time_machine.time_travel_status === 'in_progress') {
56
- await (0, util_1.sleep)(this._env.timemachineWaitInMillis);
56
+ await (0, util_js_1.sleep)(this._env.timemachineWaitInMillis);
57
57
  continue;
58
58
  }
59
59
  else {
@@ -62,13 +62,13 @@ const CreateChargebee = (httpClient) => {
62
62
  }
63
63
  throw new Error('The time travel is taking too much time');
64
64
  };
65
- return (0, asyncApiSupport_1.waitForProcessToComplete)(retrieve);
65
+ return (0, asyncApiSupport_js_1.waitForProcessToComplete)(retrieve);
66
66
  },
67
67
  _buildResources() {
68
- for (const res in api_endpoints_1.Endpoints) {
68
+ for (const res in api_endpoints_js_1.Endpoints) {
69
69
  this[res] = {};
70
70
  // @ts-ignore
71
- const apiCalls = api_endpoints_1.Endpoints[res];
71
+ const apiCalls = api_endpoints_js_1.Endpoints[res];
72
72
  for (let apiIdx = 0; apiIdx < apiCalls.length; apiIdx++) {
73
73
  const metaArr = apiCalls[apiIdx];
74
74
  const apiCall = {
@@ -81,7 +81,6 @@ const CreateChargebee = (httpClient) => {
81
81
  subDomain: metaArr[5],
82
82
  isJsonRequest: metaArr[6],
83
83
  jsonKeys: metaArr[7],
84
- options: metaArr[8],
85
84
  };
86
85
  this[res][apiCall.methodName] = this._createApiFunc(apiCall, this._env);
87
86
  }
@@ -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.8.0-beta.1',
14
+ clientVersion: 'v3.8.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpClientResponse = exports.HttpClient = void 0;
4
- const chargebeeError_1 = require("../chargebeeError");
4
+ const chargebeeError_js_1 = require("../chargebeeError.js");
5
5
  class HttpClient {
6
6
  async makeApiRequest(props) {
7
7
  throw new Error('makeApiRequest is not implemented');
8
8
  }
9
9
  static timeOutError() {
10
- const error = new chargebeeError_1.ChargebeeError({
10
+ const error = new chargebeeError_js_1.ChargebeeError({
11
11
  message: 'io_error',
12
12
  type: 'timeout',
13
13
  api_error_code: 'request aborted due to timeout.',
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FetchHttpClientResponse = exports.FetchHttpClient = void 0;
4
- const ClientInterface_1 = require("./ClientInterface");
5
- class FetchHttpClient extends ClientInterface_1.HttpClient {
4
+ const ClientInterface_js_1 = require("./ClientInterface.js");
5
+ class FetchHttpClient extends ClientInterface_js_1.HttpClient {
6
6
  async makeApiRequest(props) {
7
7
  const headers = this._createHeaders(props.headers);
8
8
  let url = `${props.protocol}://${props.host}:${props.port}${props.path}`;
@@ -33,7 +33,7 @@ class FetchHttpClient extends ClientInterface_1.HttpClient {
33
33
  const timeoutPromise = new Promise((_, reject) => {
34
34
  pendingTimeoutId = setTimeout(() => {
35
35
  pendingTimeoutId = null;
36
- reject(ClientInterface_1.HttpClient.timeOutError());
36
+ reject(ClientInterface_js_1.HttpClient.timeOutError());
37
37
  }, timeout);
38
38
  });
39
39
  const fetchPromise = fetch(url, fetchOptions);
@@ -47,14 +47,14 @@ class FetchHttpClient extends ClientInterface_1.HttpClient {
47
47
  const abort = new AbortController();
48
48
  let timeoutId = setTimeout(() => {
49
49
  timeoutId = null;
50
- abort.abort(ClientInterface_1.HttpClient.timeOutError());
50
+ abort.abort(ClientInterface_js_1.HttpClient.timeOutError());
51
51
  }, timeout);
52
52
  try {
53
53
  return await fetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: abort.signal }));
54
54
  }
55
55
  catch (err) {
56
56
  if (err.name === 'AbortError') {
57
- return Promise.reject(ClientInterface_1.HttpClient.timeOutError());
57
+ return Promise.reject(ClientInterface_js_1.HttpClient.timeOutError());
58
58
  }
59
59
  else {
60
60
  return Promise.reject(err);
@@ -68,7 +68,7 @@ class FetchHttpClient extends ClientInterface_1.HttpClient {
68
68
  }
69
69
  }
70
70
  exports.FetchHttpClient = FetchHttpClient;
71
- class FetchHttpClientResponse extends ClientInterface_1.HttpClientResponse {
71
+ class FetchHttpClientResponse extends ClientInterface_js_1.HttpClientResponse {
72
72
  constructor(response) {
73
73
  super(response.status, FetchHttpClientResponse._transformHeadersToObject(response.headers));
74
74
  this._res = response;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeHttpClientResponse = exports.NodeHttpClient = void 0;
4
- const ClientInterface_1 = require("./ClientInterface");
4
+ const ClientInterface_js_1 = require("./ClientInterface.js");
5
5
  const http = require("http");
6
6
  const https = require("https");
7
- class NodeHttpClient extends ClientInterface_1.HttpClient {
7
+ class NodeHttpClient extends ClientInterface_js_1.HttpClient {
8
8
  async makeApiRequest(props) {
9
9
  const protocol = props.protocol === 'http' ? http : https;
10
10
  const requestPromise = new Promise((resolve, reject) => {
@@ -16,7 +16,7 @@ class NodeHttpClient extends ClientInterface_1.HttpClient {
16
16
  headers: props.headers,
17
17
  });
18
18
  req.setTimeout(props.timeout, () => {
19
- throw ClientInterface_1.HttpClient.timeOutError();
19
+ throw ClientInterface_js_1.HttpClient.timeOutError();
20
20
  });
21
21
  req.on('response', (res) => {
22
22
  resolve(new NodeHttpClientResponse(res));
@@ -31,7 +31,7 @@ class NodeHttpClient extends ClientInterface_1.HttpClient {
31
31
  }
32
32
  }
33
33
  exports.NodeHttpClient = NodeHttpClient;
34
- class NodeHttpClientResponse extends ClientInterface_1.HttpClientResponse {
34
+ class NodeHttpClientResponse extends ClientInterface_js_1.HttpClientResponse {
35
35
  constructor(res) {
36
36
  //@ts-ignore
37
37
  super(res.statusCode, res.headers);
@@ -1249,6 +1249,32 @@ exports.Endpoints = {
1249
1249
  isIdempotent: true,
1250
1250
  },
1251
1251
  ],
1252
+ [
1253
+ 'pauseDunning',
1254
+ 'POST',
1255
+ '/invoices',
1256
+ '/pause_dunning',
1257
+ true,
1258
+ null,
1259
+ false,
1260
+ {},
1261
+ {
1262
+ isIdempotent: true,
1263
+ },
1264
+ ],
1265
+ [
1266
+ 'resumeDunning',
1267
+ 'POST',
1268
+ '/invoices',
1269
+ '/resume_dunning',
1270
+ true,
1271
+ null,
1272
+ false,
1273
+ {},
1274
+ {
1275
+ isIdempotent: true,
1276
+ },
1277
+ ],
1252
1278
  [
1253
1279
  'importInvoice',
1254
1280
  'POST',
@@ -2913,6 +2939,7 @@ exports.Endpoints = {
2913
2939
  ],
2914
2940
  quotedSubscription: [],
2915
2941
  quotedCharge: [],
2942
+ quotedRamp: [],
2916
2943
  quoteLineGroup: [],
2917
2944
  plan: [
2918
2945
  [
@@ -4270,6 +4297,21 @@ exports.Endpoints = {
4270
4297
  },
4271
4298
  ],
4272
4299
  ],
4300
+ nonSubscription: [
4301
+ [
4302
+ 'processReceipt',
4303
+ 'POST',
4304
+ '/non_subscriptions',
4305
+ '/one_time_purchase',
4306
+ true,
4307
+ null,
4308
+ false,
4309
+ {},
4310
+ {
4311
+ isIdempotent: true,
4312
+ },
4313
+ ],
4314
+ ],
4273
4315
  entitlementOverride: [
4274
4316
  [
4275
4317
  'addEntitlementOverrideForSubscription',