chargebee 3.2.1 → 3.4.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/cjs/RequestWrapper.js +9 -3
  3. package/cjs/coreCommon.js +1 -0
  4. package/cjs/createChargebee.js +3 -0
  5. package/cjs/environment.js +1 -1
  6. package/cjs/resources/api_endpoints.js +2099 -365
  7. package/cjs/util.js +22 -17
  8. package/esm/RequestWrapper.js +9 -3
  9. package/esm/coreCommon.js +1 -0
  10. package/esm/createChargebee.js +3 -0
  11. package/esm/environment.js +1 -1
  12. package/esm/resources/api_endpoints.js +2099 -365
  13. package/esm/util.js +22 -17
  14. package/package.json +1 -1
  15. package/types/core.d.ts +13 -1
  16. package/types/index.d.ts +6 -0
  17. package/types/resources/AttachedItem.d.ts +1 -0
  18. package/types/resources/Comment.d.ts +1 -0
  19. package/types/resources/Configuration.d.ts +24 -0
  20. package/types/resources/Coupon.d.ts +5 -16
  21. package/types/resources/CreditNote.d.ts +5 -3
  22. package/types/resources/CreditNoteEstimate.d.ts +2 -1
  23. package/types/resources/Customer.d.ts +0 -12
  24. package/types/resources/DifferentialPrice.d.ts +1 -0
  25. package/types/resources/Event.d.ts +4 -2
  26. package/types/resources/Feature.d.ts +1 -0
  27. package/types/resources/GatewayErrorDetail.d.ts +1 -0
  28. package/types/resources/Invoice.d.ts +8 -0
  29. package/types/resources/InvoiceEstimate.d.ts +7 -0
  30. package/types/resources/Item.d.ts +1 -0
  31. package/types/resources/ItemFamily.d.ts +1 -0
  32. package/types/resources/ItemPrice.d.ts +1 -0
  33. package/types/resources/OmnichannelSubscription.d.ts +13 -0
  34. package/types/resources/OmnichannelSubscriptionItem.d.ts +7 -1
  35. package/types/resources/Order.d.ts +1 -1
  36. package/types/resources/PriceVariant.d.ts +1 -0
  37. package/types/resources/Quote.d.ts +2 -0
  38. package/types/resources/QuoteLineGroup.d.ts +1 -0
  39. package/types/resources/QuotedSubscription.d.ts +3 -0
  40. package/types/resources/RecordedPurchase.d.ts +1 -1
  41. package/types/resources/Rule.d.ts +33 -0
  42. package/types/resources/Subscription.d.ts +19 -0
  43. package/types/resources/Transaction.d.ts +1 -0
  44. package/types/resources/UsageEvent.d.ts +53 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,84 @@
1
+ ### v3.4.0 (2025-02-10)
2
+ * * *
3
+
4
+ #### New Resources:
5
+ * Rule has been added.
6
+ * UsageEvent has been added.
7
+
8
+ #### New Attribute:
9
+ * deleted has been added to AttachedItem.
10
+ * deleted has been added to Coupon.
11
+ * deleted has been added to DifferentialPrice.
12
+ * deleted has been added to ItemFamily.
13
+ * deleted has been added to ItemPrice.
14
+ * deleted has been added to Item.
15
+ * deleted has been added to PriceVariant.
16
+ * tax_application has abeend added to CreditNote#Allocation.
17
+ * tax_application has been added to Invoice#AppliedCredit.
18
+ * line_item_credit has been added to Invoice.
19
+
20
+ #### New Input Params:
21
+ * exhausted_coupon_ids has been added to Subscription#ImportForItems.
22
+
23
+ #### New Enums
24
+ * STORE has been added in CreditNote#TypeEnum.
25
+ * STORE has been added in CreditNoteEstimate#TypeEnum.
26
+ * STORE has been added in Order#TypeEnum.
27
+ * TaxApplicationEnum has been added in CreditNote#Application.
28
+ * TaxApplicationEnum has been added in Invoice#AppliedCredit.
29
+ * RECORDED_PURCHASE has been added in EntityTypeEnum.
30
+ * RECORD_PURCHASE_FAILED, has been added in EventTypeEnum.
31
+
32
+ #### Deleted Input Params
33
+ * tax_providers_fields has been removed from Customer#MoveParams.
34
+ * tax_providers_fields has been removed from Customer#MergeParams
35
+
36
+ #### Deprecated input params.
37
+ * deprecated label in discount_quantity has been removed from Coupon#CreateParams.
38
+ * deprecated label in discount_quantity has been removed from Coupon#UpdateParams.
39
+ * deprecated label in discount_quantity has been removed from Coupon#CreateForItemsParams.
40
+ * deprecated label in discount_quantity has been removed from Coupon#UpdateForItemsParams.
41
+
42
+ ### v3.3.0 (2024-12-19)
43
+ * * *
44
+
45
+ #### New Resource:
46
+ * Configuration has been added.
47
+
48
+ #### New Attribute:
49
+ * discount_type has been added to CreditNote#Discount.
50
+ * discount_type has been added to CreditNoteEstimate#Discount.
51
+ * discount_type has been added to Invoice#Discount.
52
+ * discount_type has been added to InvoiceEstimate#Discount.
53
+ * discount_type has been added to QuoteLineGroup#Discount.
54
+ * initial_purchase_transaction has been added to OmnichannelSubscription.
55
+ * error_cause_id has been added to GatewayErrorDetail.
56
+ * error_cause_id has been added to Transaction#GatewayErrorDetail.
57
+ * error_cause_id has been added to APIError.
58
+ * deleted has been added to Quote.
59
+ * current_term_start has been added to QuotedSubscripiton#SubscriptionItem.
60
+ * current_term_end has been added to QuotedSubscripiton#SubscriptionItem.
61
+ * next_billing_at has been added to QuotedSubscripiton#SubscriptionItem.
62
+ * current_term_start has been added to Subscription#SubscriptionItem.
63
+ * current_term_end has been added to Subscription#SubscriptionItem.
64
+ * next_billing_at has been added to Subscription#SubscriptionItem.
65
+ * billing_override has been added to Subscription.
66
+ * grace_period_expires_at has been added to OmnichannelSubscriptionItem.
67
+
68
+ #### New Input Params:
69
+ * billing_override has been added to Subscription#CreateWithItemsInputParam.
70
+ * billing_override has been added to Subscription#UpdateForItemsInputParam.
71
+
72
+ #### New Enum Values:
73
+ * OMNICHANNEL_SUBSCRIPTION_IMPORTED has been added to EventTypeEnum.
74
+ * DISABLED has been added to Event#WebhookStatus.
75
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_GRACE_PERIOD_STARTED has been added to EventTypeEnum.
76
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_GRACE_PERIOD_EXPIRED has been added to EventTypeEnum.
77
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_DUNNING_STARTED has been added to EventTypeEnum.
78
+ * OMNICHANNEL_SUBSCRIPTION_ITEM_DUNNING_EXPIRED has been added to EventTypeEnum.
79
+ * IGNORED has been added to RecordedPurchase#StatusEnum.
80
+ * IN_DUNNING & IN_GRACE_PERIOD have been added to OmnichannelSubscriptionItem#StatusEnum.
81
+
1
82
  ### v3.2.1 (2024-12-04)
2
83
  * * *
3
84
 
@@ -54,21 +54,27 @@ class RequestWrapper {
54
54
  path += '?' + queryParam;
55
55
  params = {};
56
56
  }
57
- let data = (0, util_js_1.encodeParams)(params);
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);
58
61
  if (data.length) {
59
62
  (0, util_js_1.extend)(true, this.httpHeaders, {
60
63
  'Content-Length': data.length,
61
64
  });
62
65
  }
66
+ const contentType = this.apiCall.isJsonRequest
67
+ ? 'application/json;charset=UTF-8'
68
+ : 'application/x-www-form-urlencoded; charset=utf-8';
63
69
  (0, util_js_1.extend)(true, this.httpHeaders, {
64
70
  Authorization: 'Basic ' + node_buffer_1.Buffer.from(env.apiKey + ':').toString('base64'),
65
71
  Accept: 'application/json',
66
- 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
72
+ 'Content-Type': contentType,
67
73
  'User-Agent': 'Chargebee-NodeJs-Client ' + env.clientVersion,
68
74
  'Lang-Version': typeof process === 'undefined' ? '' : process.version,
69
75
  });
70
76
  const resp = await this.envArg.httpClient.makeApiRequest({
71
- host: (0, util_js_1.getHost)(env),
77
+ host: (0, util_js_1.getHost)(env, this.apiCall.subDomain),
72
78
  port: env.port,
73
79
  path,
74
80
  method: this.apiCall.httpMethod,
package/cjs/coreCommon.js CHANGED
@@ -35,6 +35,7 @@ const handleResponse = async (callback, response) => {
35
35
  res.isIdempotencyReplayed = headers[IDEMPOTENCY_REPLAYED_HEADER];
36
36
  }
37
37
  res.headers = headers;
38
+ res.httpStatusCode = status;
38
39
  return callback(null, res);
39
40
  }
40
41
  }
@@ -78,6 +78,9 @@ const CreateChargebee = (httpClient) => {
78
78
  urlSuffix: metaArr[3],
79
79
  hasIdInUrl: metaArr[4],
80
80
  isListReq: metaArr[0] === 'list',
81
+ subDomain: metaArr[5],
82
+ isJsonRequest: metaArr[6],
83
+ jsonKeys: metaArr[7],
81
84
  };
82
85
  this[res][apiCall.methodName] = this._createApiFunc(apiCall, this._env);
83
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.2.1',
14
+ clientVersion: 'v3.4.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,