chargebee 2.6.6 → 2.9.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,98 @@
1
+ ### v2.9.0 (2022-01-21)
2
+ * * *
3
+
4
+ #### New endpoints:
5
+ * credit_notes#download_einvoice has been added to the credit_notes resource.
6
+ * invoice#download_einvoice has been added to the invoice resource.
7
+
8
+ #### New attributes:
9
+ * is_einvoice_enabled, entity_identifier_scheme, entity_identifier_standard and entity_identifiers[] have been added to the customer resource.
10
+ * einvoice has been added to the invoice resource.
11
+ * einvoice has been added to the credit_notes resource.
12
+ * mime_type has been added to the download resource.
13
+
14
+ #### New Input parameters:
15
+ * entity_identifier_scheme, entity_identifier_standard, is_einvoice_enabled, entity_identifiers[id][0..N], entity_identifiers[scheme][0..N], entity_identifiers[value][0..N], entity_identifiers[standard][0..N] have been added to customers#create_a_customer, customers#update_billing_info_for_a_customer apis.
16
+ * customer[entity_identifier_scheme], customer[entity_identifier_standard], customer[is_einvoice_enabled], entity_identifiers[id][0..N], entity_identifiers[scheme][0..N], entity_identifiers[value][0..N], entity_identifiers[standard][0..N] have been added to the subscriptions#create_a_subscription api.
17
+ * customer[entity_identifier_scheme], customer[entity_identifier_standard], customer[is_einvoice_enabled] have been added to subscriptions#update_a_subscription and subscriptions#update_subscription_for_items apis.
18
+
19
+ #### New Enum values:
20
+ * operation enum has been added.
21
+ * status enum has been added in credit_notes_einvoice subresource of credit_notes resource.
22
+
23
+ #### Deprecated attributes:
24
+ * user, type, payment_method and exchange_rate have been deprecated from TaxWithHeld resource.
25
+
26
+ #### Deprecated enums:
27
+ * type and payment_method have been deprecated in TaxWithHeld resource.
28
+
29
+ #### Updated parameters:
30
+ * hierarchy_operation_type has been made mandatory in customers#get_hierarchy api.
31
+
32
+ #### Removed Filter parameters:
33
+ * create_pending_invoices has been removed from subscriptions#list_subscriptions api.
34
+
35
+
36
+ ### v2.8.1 (2022-01-05)
37
+ * * *
38
+
39
+ ### Fixes:
40
+ * Improved error message for Invalid JSON response.
41
+
42
+ ### v2.8.0 (2021-12-08)
43
+ * * *
44
+
45
+ ### Fixes:
46
+ * Exposed function chargebee#updateRequestTimeoutInMillis to set custom time out.
47
+ * Updated default request timeout to 80000ms.
48
+
49
+ #### New endpoints:
50
+ * payment_sources#update_bank_account have been added in payment_sources resource.
51
+ * item_price#item_price_find_applicable_items and item_price#item_price_find_applicable_item_prices have been added in item_price resource.
52
+
53
+ #### New Attributes:
54
+ * hsn_code have been added to the resource addon, item_price and plan.
55
+ * first_name, last_name and email have been added to the resource payment_sources.
56
+
57
+ #### New Resource:
58
+ * TaxWithheld has been added.Applicable only for API V2.
59
+
60
+ #### New Input parameters:
61
+ * hsn_code have been added to addons#create_an_addon, addons#update_an_addon, plan#create_an_plan and plan#update_an_plan apis.
62
+ * bank_account[first_name],bank_account[last_name] and bank_account[email] have been added to payment_sources#update_bank_account api.
63
+ * charges[hsn_code] have been added in estimate#Create_Invoice, estimate#Create_Invoice_For_Items, hosted_pages#Checkout_One_Time, hosted_pages#Checkout_One_Time_For_Items, invoice#create_an_invoice, invoice#Create_For_Charge_Items_And_Charges and unbilledCharge#create_an_unbilledCharge apis.
64
+ * tax_detail[hsn_code] have been added in item_price#create_an_itemPrice and item_price#update_an_itemPrice apis.
65
+ * include_deleted have been added in plan#plan_list and addon#addon_list apis.Applicable only for Product Catalog V1.
66
+
67
+ #### New Enum values:
68
+ * subscription_activated_with_backdating, tax_withheld_recorded, tax_withheld_deleted and tax_withheld_refunded has been added to event_type enum.
69
+
70
+ ### v2.7.0 (2021-08-16)
71
+ * * *
72
+ #### New Attributes:
73
+ * generated_at has been added in credit_note and invoice resources.
74
+ * change_option have been added in quoted_subscription resource.
75
+ * changes_scheduled_at has been added in subscription and quoted_subscription resources.
76
+ * iin and last4 have been added in transaction resource.
77
+
78
+ #### New Resource:
79
+ * quoted_charge has been added.
80
+
81
+ #### New Input parameters:
82
+ * invoice_date has been added in estimates##create_subscription_estimate, estimates#estimate_for_creating_a_customer_and_subscription, estimates#estimate_for_creating_a_subscription, estimates#create_subscription_for_a_customer_estimate, estimates#update_subscription_estimate, estimates#estimate_for_updating_a_subscription, estimates#cancel_subscription_estimate, estimates#cancel_subscription_for_items_estimate, estimates#create_invoice_for_items_estimate, estimates#create_invoice_estimate, hosted_pages#checkout_existing_subscription, hosted_pages#create_checkout_to_update_a_subscription, invoices#create_an_invoice, invoices#create_invoice_for_items_and_one-time_charges, subscriptions#create_a_subscription, subscriptions#create_subscription_for_customer, subscriptions#update_a_subscription, subscriptions#create_subscription_for_items, subscriptions#update_subscription_for_items, subscriptions#reactivate_a_subscription, subscriptions#cancel_subscription_for_items and subscriptions#cancel_a_subscription endpoints.
83
+ * coupon_ids has been added to invoices#create_invoice_for_a_one-time_charge, invoice#create_invoice_for_a_non-recurring_addon, quotes#create_quote_for_one-time_charges, quotes#edit_quote_for_one-time_charges, quotes#create_a_quote_for_charge_and_charge_items, quotes#edit_quote_for_charge_items_and_charges endpoints.
84
+ * change_option and changes_scheduled_at have been added in quotes#create_quote_for_updating_a_subscription, quotes#edit_quote_for_updating_a_subscription, quotes#create_a_quote_for_update_subscription_items, quotes#edit_update_subscription_quote_for_items, subscriptions#update_a_subscription and subscriptions#create_subscription_for_items endpoints.
85
+ * invoice_date, create_pending_invoices and first_invoice_pending have been added in quotes#convert_a_quote endpoint.
86
+ * subscription[auto_close_invoices] has been added in quotes#convert_a_quote endpoint.
87
+
88
+ #### New Enum values:
89
+ * subscription_cancel has been added to charge_event enum in quote_line_groups resource.
90
+ * subscription_created_with_backdating, subscription_changed_with_backdating, subscription_canceled_with_backdating, subscription_reactivated_with_backdating, invoice_generated_with_backdating and credit_note_created_with_backdating have been added to event_type enum
91
+ * change_option enum has been added.
92
+
93
+ #### Deprecated parameters:
94
+ * coupon has been deprecated in invoices#create_invoice_for_a_one-time_charge and invoices#create_invoice_for_a_non-recurring_addon endpoints.
95
+
1
96
  ### v2.6.6 (2021-07-22)
2
97
  * * *
3
98
  #### Fixes:
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2011-2020 ChargeBee, Inc.
3
+ Copyright (c) 2011-2022 ChargeBee, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person
6
6
  obtaining a copy of this software and associated documentation
package/lib/chargebee.js CHANGED
@@ -7,8 +7,8 @@ ChargeBee._env = {
7
7
  protocol: 'https',
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
- timeout: 40000,
11
- clientVersion: 'v2.6.6',
10
+ timeout: 80000,
11
+ clientVersion: 'v2.9.0',
12
12
  port: 443,
13
13
  timemachineWaitInMillis: 3000,
14
14
  exportWaitInMillis: 3000
@@ -18,6 +18,10 @@ ChargeBee.configure = function(conf) {
18
18
  ChargeBee._util.extend(true, ChargeBee._env, conf);
19
19
  };
20
20
 
21
+ ChargeBee.updateRequestTimeoutInMillis = function(timeout) {
22
+ ChargeBee._env.timeout = timeout;
23
+ };
24
+
21
25
  ChargeBee._endpoints = require('./resources/api_endpoints.js');
22
26
 
23
27
 
@@ -187,7 +191,36 @@ ChargeBee._core = (function() {
187
191
  try {
188
192
  response = JSON.parse(response);
189
193
  } catch (e) {
190
- throwError(callBack,'client_error', 500, 'invalid_json', 'invalid json in response. Probably not a ChargeBee response', e);
194
+ if (response.includes('503')) {
195
+ return throwError(
196
+ callBack,
197
+ 'internal_temporary_error',
198
+ 503,
199
+ 'internal_temporary_error',
200
+ 'Sorry, the server is currently unable to handle the request due to a temporary overload or scheduled maintenance. Please retry after sometime.',
201
+ e
202
+ );
203
+ }
204
+ else if(response.includes('504')) {
205
+ return throwError(
206
+ callBack,
207
+ 'gateway_timeout',
208
+ 504,
209
+ 'gateway_timeout',
210
+ 'The server did not receive a timely response from an upstream server, request aborted. If this problem persists, contact us at support@chargebee.com.',
211
+ e
212
+ );
213
+ }
214
+ else {
215
+ return throwError(
216
+ callBack,
217
+ 'internal_error',
218
+ 500,
219
+ 'internal_error',
220
+ 'Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com.',
221
+ e
222
+ );
223
+ }
191
224
  }
192
225
  if (res.statusCode < 200 || res.statusCode > 299) {
193
226
  response.http_status_code = res.statusCode;
@@ -459,4 +492,5 @@ ChargeBee._util = (function() {
459
492
  }
460
493
  module.exports.time_machine.wait_for_time_travel_completion = ChargeBee._timeMachineWait;
461
494
  module.exports.export.wait_for_export_completion = ChargeBee._waitForExport;
495
+ module.exports.updateRequestTimeoutInMillis = ChargeBee.updateRequestTimeoutInMillis;
462
496
  })();
@@ -471,6 +471,13 @@ var _endpoints = {
471
471
  "/update_card",
472
472
  true
473
473
  ],
474
+ [
475
+ "update_bank_account",
476
+ "POST",
477
+ "/payment_sources",
478
+ "/update_bank_account",
479
+ true
480
+ ],
474
481
  [
475
482
  "verify_bank_account",
476
483
  "POST",
@@ -739,6 +746,13 @@ var _endpoints = {
739
746
  "/pdf",
740
747
  true
741
748
  ],
749
+ [
750
+ "download_einvoice",
751
+ "GET",
752
+ "/invoices",
753
+ "/download_einvoice",
754
+ true
755
+ ],
742
756
  [
743
757
  "add_charge",
744
758
  "POST",
@@ -838,6 +852,7 @@ var _endpoints = {
838
852
  true
839
853
  ]
840
854
  ],
855
+ "tax_withheld": [],
841
856
  "credit_note": [
842
857
  [
843
858
  "create",
@@ -860,6 +875,13 @@ var _endpoints = {
860
875
  "/pdf",
861
876
  true
862
877
  ],
878
+ [
879
+ "download_einvoice",
880
+ "GET",
881
+ "/credit_notes",
882
+ "/download_einvoice",
883
+ true
884
+ ],
863
885
  [
864
886
  "refund",
865
887
  "POST",
@@ -1562,6 +1584,7 @@ var _endpoints = {
1562
1584
  ]
1563
1585
  ],
1564
1586
  "quoted_subscription": [],
1587
+ "quoted_charge": [],
1565
1588
  "quote_line_group": [],
1566
1589
  "plan": [
1567
1590
  [
@@ -2231,6 +2254,20 @@ var _endpoints = {
2231
2254
  "/item_prices",
2232
2255
  "/delete",
2233
2256
  true
2257
+ ],
2258
+ [
2259
+ "find_applicable_items",
2260
+ "GET",
2261
+ "/item_prices",
2262
+ "/applicable_items",
2263
+ true
2264
+ ],
2265
+ [
2266
+ "find_applicable_item_prices",
2267
+ "GET",
2268
+ "/item_prices",
2269
+ "/applicable_item_prices",
2270
+ true
2234
2271
  ]
2235
2272
  ],
2236
2273
  "attached_item": [
@@ -2268,13 +2305,6 @@ var _endpoints = {
2268
2305
  "/items",
2269
2306
  "/attached_items",
2270
2307
  true
2271
- ],
2272
- [
2273
- "list_internal",
2274
- "GET",
2275
- "/attached_items",
2276
- "/list_internal",
2277
- false
2278
2308
  ]
2279
2309
  ],
2280
2310
  "differential_price": [
@@ -2313,6 +2343,6 @@ var _endpoints = {
2313
2343
  null,
2314
2344
  false
2315
2345
  ]
2316
- ],
2346
+ ]
2317
2347
  };
2318
2348
  module.exports = _endpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"chargebee",
3
- "version":"2.6.6",
3
+ "version":"2.9.0",
4
4
  "description":"A library for integrating with ChargeBee.",
5
5
  "keywords":[
6
6
  "payments",