chargebee 2.23.0 → 2.23.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,10 @@
1
+ ### v2.23.1 (2023-06-08)
2
+ * * *
3
+
4
+ #### New Feature:
5
+ * Added utiltity to retrieve the response headers and isIdempotencyReplayed key through response object.
6
+
7
+
1
8
  ### v2.23.0 (2023-05-31)
2
9
  * * *
3
10
 
package/README.md CHANGED
@@ -188,6 +188,24 @@ const result = await chargebee.customer
188
188
  .setIdempotencyKey("safeKey")
189
189
  .request();
190
190
  const customer = result.customer;
191
+ const headers = result.headers;
192
+ const isIdempotencyReplayed = result.isIdempotencyReplayed;
193
+ ```
194
+
195
+ OR
196
+
197
+ ```js
198
+ chargebee.customer.create({ email: 'john@test.com', cf_host_url: 'http://xyz.com' })
199
+ .setIdempotencyKey("safeKey")
200
+ .request(function(error,result) {
201
+ if(error){
202
+ //handle error
203
+ }else{
204
+ const customer = result.customer;
205
+ const headers = result.headers;
206
+ const isIdempotencyReplayed = result.isIdempotencyReplayed;
207
+ }
208
+ });
191
209
  ```
192
210
 
193
211
  ### Processing Webhooks - API Version Check
package/lib/chargebee.js CHANGED
@@ -4,13 +4,14 @@ var Q = require("q");
4
4
  var os = require("os");
5
5
  var Buffer = require("safer-buffer").Buffer;
6
6
  const IDEMPOTENCY_HEADER = "chargebee-idempotency-key";
7
+ const IDEMPOTENCY_REPLAYED_HEADER = 'chargebee-idempotency-replayed';
7
8
 
8
9
  ChargeBee._env = {
9
10
  protocol: 'https',
10
11
  hostSuffix: '.chargebee.com',
11
12
  apiPath: '/api/v2',
12
13
  timeout: 80000,
13
- clientVersion: 'v2.23.0',
14
+ clientVersion: 'v2.23.1',
14
15
  port: 443,
15
16
  timemachineWaitInMillis: 3000,
16
17
  exportWaitInMillis: 3000
@@ -235,6 +236,12 @@ ChargeBee._core = (function() {
235
236
  response.http_status_code = res.statusCode;
236
237
  callBack(response, null);
237
238
  } else {
239
+ response.isIdempotencyReplayed = false;
240
+ if (ChargeBee._util.isNotUndefinedNEmpty(res.headers[IDEMPOTENCY_REPLAYED_HEADER])) {
241
+ response.isIdempotencyReplayed = res.headers[IDEMPOTENCY_REPLAYED_HEADER];
242
+ }
243
+ response.headers = res.headers;
244
+
238
245
  callBack(null, response);
239
246
  }
240
247
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"chargebee",
3
- "version":"2.23.0",
3
+ "version":"2.23.1",
4
4
  "description":"A library for integrating with ChargeBee.",
5
5
  "keywords":[
6
6
  "payments",