chargebee 3.17.0-beta.2 → 3.18.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 +43 -8
- package/README.md +25 -173
- package/cjs/chargebee.cjs.js +4 -9
- package/cjs/environment.js +1 -1
- package/cjs/resources/api_endpoints.js +6 -2
- package/esm/chargebee.esm.js +2 -4
- package/esm/environment.js +1 -1
- package/esm/resources/api_endpoints.js +6 -2
- package/package.json +6 -11
- package/types/core.d.ts +19 -2
- package/types/index.d.ts +0 -65
- package/types/resources/CouponCode.d.ts +4 -0
- package/types/resources/CreditNote.d.ts +4 -0
- package/types/resources/Customer.d.ts +24 -2
- package/types/resources/Estimate.d.ts +13 -2
- package/types/resources/Gift.d.ts +12 -2
- package/types/resources/HostedPage.d.ts +5 -0
- package/types/resources/Invoice.d.ts +25 -2
- package/types/resources/ItemPrice.d.ts +5 -0
- package/types/resources/Order.d.ts +4 -0
- package/types/resources/PaymentIntent.d.ts +30 -5
- package/types/resources/PaymentSource.d.ts +6 -1
- package/types/resources/PricingPageSession.d.ts +2 -0
- package/types/resources/Purchase.d.ts +6 -1
- package/types/resources/SalesOrder.d.ts +1 -0
- package/types/resources/Subscription.d.ts +46 -7
- package/types/resources/Transaction.d.ts +8 -0
- package/types/resources/WebhookEvent.d.ts +28 -27
- package/cjs/resources/webhook/auth.js +0 -27
- package/cjs/resources/webhook/content.js +0 -3
- package/cjs/resources/webhook/handler.js +0 -40
- package/esm/resources/webhook/auth.js +0 -23
- package/esm/resources/webhook/content.js +0 -2
- package/esm/resources/webhook/handler.js +0 -35
|
@@ -203,7 +203,12 @@ declare module 'chargebee' {
|
|
|
203
203
|
| 'sepa_instant_transfer'
|
|
204
204
|
| 'klarna_pay_now'
|
|
205
205
|
| 'online_banking_poland'
|
|
206
|
-
| 'payconiq_by_bancontact'
|
|
206
|
+
| 'payconiq_by_bancontact'
|
|
207
|
+
| 'electronic_payment_standard'
|
|
208
|
+
| 'kbc_payment_button'
|
|
209
|
+
| 'pay_by_bank'
|
|
210
|
+
| 'trustly'
|
|
211
|
+
| 'stablecoin';
|
|
207
212
|
reference_id?: string;
|
|
208
213
|
/**
|
|
209
214
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -275,7 +280,12 @@ declare module 'chargebee' {
|
|
|
275
280
|
| 'sepa_instant_transfer'
|
|
276
281
|
| 'klarna_pay_now'
|
|
277
282
|
| 'online_banking_poland'
|
|
278
|
-
| 'payconiq_by_bancontact'
|
|
283
|
+
| 'payconiq_by_bancontact'
|
|
284
|
+
| 'electronic_payment_standard'
|
|
285
|
+
| 'kbc_payment_button'
|
|
286
|
+
| 'pay_by_bank'
|
|
287
|
+
| 'trustly'
|
|
288
|
+
| 'stablecoin';
|
|
279
289
|
reference_id?: string;
|
|
280
290
|
/**
|
|
281
291
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -68,6 +68,10 @@ declare module 'chargebee' {
|
|
|
68
68
|
headers?: ChargebeeRequestHeader,
|
|
69
69
|
): Promise<ChargebeeResponse<CheckoutExistingForItemsResponse>>;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
73
|
+
*/
|
|
74
|
+
|
|
71
75
|
updateCard(
|
|
72
76
|
input: UpdateCardInputParam,
|
|
73
77
|
headers?: ChargebeeRequestHeader,
|
|
@@ -370,6 +374,7 @@ declare module 'chargebee' {
|
|
|
370
374
|
force_term_reset?: boolean;
|
|
371
375
|
change_option?: ChangeOptionEnum;
|
|
372
376
|
changes_scheduled_at?: number;
|
|
377
|
+
invoice_usages?: boolean;
|
|
373
378
|
redirect_url?: string;
|
|
374
379
|
cancel_url?: string;
|
|
375
380
|
pass_thru_content?: string;
|
|
@@ -104,6 +104,10 @@ declare module 'chargebee' {
|
|
|
104
104
|
headers?: ChargebeeRequestHeader,
|
|
105
105
|
): Promise<ChargebeeResponse<ChargeAddonResponse>>;
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
109
|
+
*/
|
|
110
|
+
|
|
107
111
|
createForChargeItem(
|
|
108
112
|
input: CreateForChargeItemInputParam,
|
|
109
113
|
headers?: ChargebeeRequestHeader,
|
|
@@ -160,12 +164,20 @@ declare module 'chargebee' {
|
|
|
160
164
|
headers?: ChargebeeRequestHeader,
|
|
161
165
|
): Promise<ChargebeeResponse<ListResponse>>;
|
|
162
166
|
|
|
167
|
+
/**
|
|
168
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
169
|
+
*/
|
|
170
|
+
|
|
163
171
|
invoicesForCustomer(
|
|
164
172
|
customer_id: string,
|
|
165
173
|
input?: InvoicesForCustomerInputParam,
|
|
166
174
|
headers?: ChargebeeRequestHeader,
|
|
167
175
|
): Promise<ChargebeeResponse<InvoicesForCustomerResponse>>;
|
|
168
176
|
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
179
|
+
*/
|
|
180
|
+
|
|
169
181
|
invoicesForSubscription(
|
|
170
182
|
subscription_id: string,
|
|
171
183
|
input?: InvoicesForSubscriptionInputParam,
|
|
@@ -687,6 +699,7 @@ declare module 'chargebee' {
|
|
|
687
699
|
| 'needs_attention'
|
|
688
700
|
| 'late_failure';
|
|
689
701
|
txn_amount?: number;
|
|
702
|
+
retry_engine?: 'chargebee' | 'flexpay' | 'successplus';
|
|
690
703
|
}
|
|
691
704
|
export interface AppliedCredit {
|
|
692
705
|
cn_id: string;
|
|
@@ -1247,7 +1260,12 @@ declare module 'chargebee' {
|
|
|
1247
1260
|
| 'sepa_instant_transfer'
|
|
1248
1261
|
| 'klarna_pay_now'
|
|
1249
1262
|
| 'online_banking_poland'
|
|
1250
|
-
| 'payconiq_by_bancontact'
|
|
1263
|
+
| 'payconiq_by_bancontact'
|
|
1264
|
+
| 'electronic_payment_standard'
|
|
1265
|
+
| 'kbc_payment_button'
|
|
1266
|
+
| 'pay_by_bank'
|
|
1267
|
+
| 'trustly'
|
|
1268
|
+
| 'stablecoin';
|
|
1251
1269
|
reference_id?: string;
|
|
1252
1270
|
/**
|
|
1253
1271
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1394,7 +1412,12 @@ declare module 'chargebee' {
|
|
|
1394
1412
|
| 'sepa_instant_transfer'
|
|
1395
1413
|
| 'klarna_pay_now'
|
|
1396
1414
|
| 'online_banking_poland'
|
|
1397
|
-
| 'payconiq_by_bancontact'
|
|
1415
|
+
| 'payconiq_by_bancontact'
|
|
1416
|
+
| 'electronic_payment_standard'
|
|
1417
|
+
| 'kbc_payment_button'
|
|
1418
|
+
| 'pay_by_bank'
|
|
1419
|
+
| 'trustly'
|
|
1420
|
+
| 'stablecoin';
|
|
1398
1421
|
reference_id?: string;
|
|
1399
1422
|
/**
|
|
1400
1423
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -92,6 +92,10 @@ declare module 'chargebee' {
|
|
|
92
92
|
headers?: ChargebeeRequestHeader,
|
|
93
93
|
): Promise<ChargebeeResponse<FindApplicableItemPricesResponse>>;
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
97
|
+
*/
|
|
98
|
+
|
|
95
99
|
moveItemPrice(
|
|
96
100
|
item_price_id: string,
|
|
97
101
|
input: MoveItemPriceInputParam,
|
|
@@ -281,6 +285,7 @@ declare module 'chargebee' {
|
|
|
281
285
|
}
|
|
282
286
|
export interface MoveItemPriceInputParam {
|
|
283
287
|
destination_item_id: string;
|
|
288
|
+
variant_id?: string;
|
|
284
289
|
}
|
|
285
290
|
export interface TaxDetailCreateInputParam {
|
|
286
291
|
tax_profile_id?: string;
|
|
@@ -143,6 +143,10 @@ declare module 'chargebee' {
|
|
|
143
143
|
headers?: ChargebeeRequestHeader,
|
|
144
144
|
): Promise<ChargebeeResponse<ListResponse>>;
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
148
|
+
*/
|
|
149
|
+
|
|
146
150
|
ordersForInvoice(
|
|
147
151
|
invoice_id: string,
|
|
148
152
|
input?: OrdersForInvoiceInputParam,
|
|
@@ -31,7 +31,12 @@ declare module 'chargebee' {
|
|
|
31
31
|
| 'sepa_instant_transfer'
|
|
32
32
|
| 'klarna_pay_now'
|
|
33
33
|
| 'online_banking_poland'
|
|
34
|
-
| 'payconiq_by_bancontact'
|
|
34
|
+
| 'payconiq_by_bancontact'
|
|
35
|
+
| 'electronic_payment_standard'
|
|
36
|
+
| 'kbc_payment_button'
|
|
37
|
+
| 'pay_by_bank'
|
|
38
|
+
| 'trustly'
|
|
39
|
+
| 'stablecoin';
|
|
35
40
|
success_url?: string;
|
|
36
41
|
failure_url?: string;
|
|
37
42
|
created_at: number;
|
|
@@ -107,7 +112,12 @@ declare module 'chargebee' {
|
|
|
107
112
|
| 'sepa_instant_transfer'
|
|
108
113
|
| 'klarna_pay_now'
|
|
109
114
|
| 'online_banking_poland'
|
|
110
|
-
| 'payconiq_by_bancontact'
|
|
115
|
+
| 'payconiq_by_bancontact'
|
|
116
|
+
| 'electronic_payment_standard'
|
|
117
|
+
| 'kbc_payment_button'
|
|
118
|
+
| 'pay_by_bank'
|
|
119
|
+
| 'trustly'
|
|
120
|
+
| 'stablecoin';
|
|
111
121
|
id_at_gateway?: string;
|
|
112
122
|
error_code?: string;
|
|
113
123
|
error_text?: string;
|
|
@@ -147,7 +157,12 @@ declare module 'chargebee' {
|
|
|
147
157
|
| 'sepa_instant_transfer'
|
|
148
158
|
| 'klarna_pay_now'
|
|
149
159
|
| 'online_banking_poland'
|
|
150
|
-
| 'payconiq_by_bancontact'
|
|
160
|
+
| 'payconiq_by_bancontact'
|
|
161
|
+
| 'electronic_payment_standard'
|
|
162
|
+
| 'kbc_payment_button'
|
|
163
|
+
| 'pay_by_bank'
|
|
164
|
+
| 'trustly'
|
|
165
|
+
| 'stablecoin';
|
|
151
166
|
id_at_gateway?: string;
|
|
152
167
|
error_code?: string;
|
|
153
168
|
error_text?: string;
|
|
@@ -187,7 +202,12 @@ declare module 'chargebee' {
|
|
|
187
202
|
| 'sepa_instant_transfer'
|
|
188
203
|
| 'klarna_pay_now'
|
|
189
204
|
| 'online_banking_poland'
|
|
190
|
-
| 'payconiq_by_bancontact'
|
|
205
|
+
| 'payconiq_by_bancontact'
|
|
206
|
+
| 'electronic_payment_standard'
|
|
207
|
+
| 'kbc_payment_button'
|
|
208
|
+
| 'pay_by_bank'
|
|
209
|
+
| 'trustly'
|
|
210
|
+
| 'stablecoin';
|
|
191
211
|
success_url?: string;
|
|
192
212
|
failure_url?: string;
|
|
193
213
|
}
|
|
@@ -216,7 +236,12 @@ declare module 'chargebee' {
|
|
|
216
236
|
| 'sepa_instant_transfer'
|
|
217
237
|
| 'klarna_pay_now'
|
|
218
238
|
| 'online_banking_poland'
|
|
219
|
-
| 'payconiq_by_bancontact'
|
|
239
|
+
| 'payconiq_by_bancontact'
|
|
240
|
+
| 'electronic_payment_standard'
|
|
241
|
+
| 'kbc_payment_button'
|
|
242
|
+
| 'pay_by_bank'
|
|
243
|
+
| 'trustly'
|
|
244
|
+
| 'stablecoin';
|
|
220
245
|
success_url?: string;
|
|
221
246
|
failure_url?: string;
|
|
222
247
|
}
|
|
@@ -453,7 +453,12 @@ declare module 'chargebee' {
|
|
|
453
453
|
| 'sepa_instant_transfer'
|
|
454
454
|
| 'klarna_pay_now'
|
|
455
455
|
| 'online_banking_poland'
|
|
456
|
-
| 'payconiq_by_bancontact'
|
|
456
|
+
| 'payconiq_by_bancontact'
|
|
457
|
+
| 'electronic_payment_standard'
|
|
458
|
+
| 'kbc_payment_button'
|
|
459
|
+
| 'pay_by_bank'
|
|
460
|
+
| 'trustly'
|
|
461
|
+
| 'stablecoin';
|
|
457
462
|
reference_id?: string;
|
|
458
463
|
/**
|
|
459
464
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -37,6 +37,7 @@ declare module 'chargebee' {
|
|
|
37
37
|
redirect_url?: string;
|
|
38
38
|
business_entity_id?: string;
|
|
39
39
|
auto_select_local_currency?: boolean;
|
|
40
|
+
custom?: any;
|
|
40
41
|
pricing_page?: PricingPageCreateForNewSubscriptionInputParam;
|
|
41
42
|
subscription?: SubscriptionCreateForNewSubscriptionInputParam;
|
|
42
43
|
customer?: CustomerCreateForNewSubscriptionInputParam;
|
|
@@ -46,6 +47,7 @@ declare module 'chargebee' {
|
|
|
46
47
|
}
|
|
47
48
|
export interface CreateForExistingSubscriptionInputParam {
|
|
48
49
|
redirect_url?: string;
|
|
50
|
+
custom?: any;
|
|
49
51
|
pricing_page?: PricingPageCreateForExistingSubscriptionInputParam;
|
|
50
52
|
subscription?: SubscriptionCreateForExistingSubscriptionInputParam;
|
|
51
53
|
discounts?: DiscountsCreateForExistingSubscriptionInputParam[];
|
|
@@ -98,7 +98,12 @@ declare module 'chargebee' {
|
|
|
98
98
|
| 'sepa_instant_transfer'
|
|
99
99
|
| 'klarna_pay_now'
|
|
100
100
|
| 'online_banking_poland'
|
|
101
|
-
| 'payconiq_by_bancontact'
|
|
101
|
+
| 'payconiq_by_bancontact'
|
|
102
|
+
| 'electronic_payment_standard'
|
|
103
|
+
| 'kbc_payment_button'
|
|
104
|
+
| 'pay_by_bank'
|
|
105
|
+
| 'trustly'
|
|
106
|
+
| 'stablecoin';
|
|
102
107
|
reference_id?: string;
|
|
103
108
|
/**
|
|
104
109
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -122,6 +122,10 @@ declare module 'chargebee' {
|
|
|
122
122
|
headers?: ChargebeeRequestHeader,
|
|
123
123
|
): Promise<ChargebeeResponse<ListResponse>>;
|
|
124
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
127
|
+
*/
|
|
128
|
+
|
|
125
129
|
subscriptionsForCustomer(
|
|
126
130
|
customer_id: string,
|
|
127
131
|
input?: SubscriptionsForCustomerInputParam,
|
|
@@ -1401,7 +1405,12 @@ declare module 'chargebee' {
|
|
|
1401
1405
|
| 'sepa_instant_transfer'
|
|
1402
1406
|
| 'klarna_pay_now'
|
|
1403
1407
|
| 'online_banking_poland'
|
|
1404
|
-
| 'payconiq_by_bancontact'
|
|
1408
|
+
| 'payconiq_by_bancontact'
|
|
1409
|
+
| 'electronic_payment_standard'
|
|
1410
|
+
| 'kbc_payment_button'
|
|
1411
|
+
| 'pay_by_bank'
|
|
1412
|
+
| 'trustly'
|
|
1413
|
+
| 'stablecoin';
|
|
1405
1414
|
reference_id?: string;
|
|
1406
1415
|
/**
|
|
1407
1416
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1529,7 +1538,12 @@ declare module 'chargebee' {
|
|
|
1529
1538
|
| 'sepa_instant_transfer'
|
|
1530
1539
|
| 'klarna_pay_now'
|
|
1531
1540
|
| 'online_banking_poland'
|
|
1532
|
-
| 'payconiq_by_bancontact'
|
|
1541
|
+
| 'payconiq_by_bancontact'
|
|
1542
|
+
| 'electronic_payment_standard'
|
|
1543
|
+
| 'kbc_payment_button'
|
|
1544
|
+
| 'pay_by_bank'
|
|
1545
|
+
| 'trustly'
|
|
1546
|
+
| 'stablecoin';
|
|
1533
1547
|
reference_id?: string;
|
|
1534
1548
|
/**
|
|
1535
1549
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1624,7 +1638,12 @@ declare module 'chargebee' {
|
|
|
1624
1638
|
| 'sepa_instant_transfer'
|
|
1625
1639
|
| 'klarna_pay_now'
|
|
1626
1640
|
| 'online_banking_poland'
|
|
1627
|
-
| 'payconiq_by_bancontact'
|
|
1641
|
+
| 'payconiq_by_bancontact'
|
|
1642
|
+
| 'electronic_payment_standard'
|
|
1643
|
+
| 'kbc_payment_button'
|
|
1644
|
+
| 'pay_by_bank'
|
|
1645
|
+
| 'trustly'
|
|
1646
|
+
| 'stablecoin';
|
|
1628
1647
|
reference_id?: string;
|
|
1629
1648
|
/**
|
|
1630
1649
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1774,7 +1793,12 @@ declare module 'chargebee' {
|
|
|
1774
1793
|
| 'sepa_instant_transfer'
|
|
1775
1794
|
| 'klarna_pay_now'
|
|
1776
1795
|
| 'online_banking_poland'
|
|
1777
|
-
| 'payconiq_by_bancontact'
|
|
1796
|
+
| 'payconiq_by_bancontact'
|
|
1797
|
+
| 'electronic_payment_standard'
|
|
1798
|
+
| 'kbc_payment_button'
|
|
1799
|
+
| 'pay_by_bank'
|
|
1800
|
+
| 'trustly'
|
|
1801
|
+
| 'stablecoin';
|
|
1778
1802
|
reference_id?: string;
|
|
1779
1803
|
/**
|
|
1780
1804
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1938,7 +1962,12 @@ declare module 'chargebee' {
|
|
|
1938
1962
|
| 'sepa_instant_transfer'
|
|
1939
1963
|
| 'klarna_pay_now'
|
|
1940
1964
|
| 'online_banking_poland'
|
|
1941
|
-
| 'payconiq_by_bancontact'
|
|
1965
|
+
| 'payconiq_by_bancontact'
|
|
1966
|
+
| 'electronic_payment_standard'
|
|
1967
|
+
| 'kbc_payment_button'
|
|
1968
|
+
| 'pay_by_bank'
|
|
1969
|
+
| 'trustly'
|
|
1970
|
+
| 'stablecoin';
|
|
1942
1971
|
reference_id?: string;
|
|
1943
1972
|
/**
|
|
1944
1973
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -2058,7 +2087,12 @@ declare module 'chargebee' {
|
|
|
2058
2087
|
| 'sepa_instant_transfer'
|
|
2059
2088
|
| 'klarna_pay_now'
|
|
2060
2089
|
| 'online_banking_poland'
|
|
2061
|
-
| 'payconiq_by_bancontact'
|
|
2090
|
+
| 'payconiq_by_bancontact'
|
|
2091
|
+
| 'electronic_payment_standard'
|
|
2092
|
+
| 'kbc_payment_button'
|
|
2093
|
+
| 'pay_by_bank'
|
|
2094
|
+
| 'trustly'
|
|
2095
|
+
| 'stablecoin';
|
|
2062
2096
|
reference_id?: string;
|
|
2063
2097
|
/**
|
|
2064
2098
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -2484,7 +2518,12 @@ declare module 'chargebee' {
|
|
|
2484
2518
|
| 'sepa_instant_transfer'
|
|
2485
2519
|
| 'klarna_pay_now'
|
|
2486
2520
|
| 'online_banking_poland'
|
|
2487
|
-
| 'payconiq_by_bancontact'
|
|
2521
|
+
| 'payconiq_by_bancontact'
|
|
2522
|
+
| 'electronic_payment_standard'
|
|
2523
|
+
| 'kbc_payment_button'
|
|
2524
|
+
| 'pay_by_bank'
|
|
2525
|
+
| 'trustly'
|
|
2526
|
+
| 'stablecoin';
|
|
2488
2527
|
reference_id?: string;
|
|
2489
2528
|
/**
|
|
2490
2529
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -96,12 +96,20 @@ declare module 'chargebee' {
|
|
|
96
96
|
headers?: ChargebeeRequestHeader,
|
|
97
97
|
): Promise<ChargebeeResponse<ListResponse>>;
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
101
|
+
*/
|
|
102
|
+
|
|
99
103
|
transactionsForCustomer(
|
|
100
104
|
customer_id: string,
|
|
101
105
|
input?: TransactionsForCustomerInputParam,
|
|
102
106
|
headers?: ChargebeeRequestHeader,
|
|
103
107
|
): Promise<ChargebeeResponse<TransactionsForCustomerResponse>>;
|
|
104
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
111
|
+
*/
|
|
112
|
+
|
|
105
113
|
transactionsForSubscription(
|
|
106
114
|
subscription_id: string,
|
|
107
115
|
input?: TransactionsForSubscriptionInputParam,
|
|
@@ -220,6 +220,7 @@ declare module 'chargebee' {
|
|
|
220
220
|
PlanCreated = 'plan_created',
|
|
221
221
|
PlanUpdated = 'plan_updated',
|
|
222
222
|
}
|
|
223
|
+
|
|
223
224
|
/**
|
|
224
225
|
* @deprecated Use WebhookEventType instead.
|
|
225
226
|
*/
|
|
@@ -487,7 +488,7 @@ declare module 'chargebee' {
|
|
|
487
488
|
|
|
488
489
|
customer: Customer;
|
|
489
490
|
|
|
490
|
-
advance_invoice_schedule: AdvanceInvoiceSchedule;
|
|
491
|
+
advance_invoice_schedule: AdvanceInvoiceSchedule[];
|
|
491
492
|
};
|
|
492
493
|
export type GiftExpiredContent = {
|
|
493
494
|
gift: Gift;
|
|
@@ -500,7 +501,7 @@ declare module 'chargebee' {
|
|
|
500
501
|
credit_note: CreditNote;
|
|
501
502
|
};
|
|
502
503
|
export type UnbilledChargesDeletedContent = {
|
|
503
|
-
unbilled_charge: UnbilledCharge;
|
|
504
|
+
unbilled_charge: UnbilledCharge[];
|
|
504
505
|
};
|
|
505
506
|
export type CouponUpdatedContent = {
|
|
506
507
|
coupon: Coupon;
|
|
@@ -524,7 +525,7 @@ declare module 'chargebee' {
|
|
|
524
525
|
customer: Customer;
|
|
525
526
|
};
|
|
526
527
|
export type UnbilledChargesCreatedContent = {
|
|
527
|
-
unbilled_charge: UnbilledCharge;
|
|
528
|
+
unbilled_charge: UnbilledCharge[];
|
|
528
529
|
};
|
|
529
530
|
export type SubscriptionResumedContent = {
|
|
530
531
|
subscription: Subscription;
|
|
@@ -535,7 +536,7 @@ declare module 'chargebee' {
|
|
|
535
536
|
|
|
536
537
|
invoice: Invoice;
|
|
537
538
|
|
|
538
|
-
unbilled_charge: UnbilledCharge;
|
|
539
|
+
unbilled_charge: UnbilledCharge[];
|
|
539
540
|
};
|
|
540
541
|
export type OmnichannelOneTimeOrderItemCancelledContent = {
|
|
541
542
|
omnichannel_one_time_order: OmnichannelOneTimeOrder;
|
|
@@ -555,9 +556,9 @@ declare module 'chargebee' {
|
|
|
555
556
|
|
|
556
557
|
invoice: Invoice;
|
|
557
558
|
|
|
558
|
-
credit_note: CreditNote;
|
|
559
|
+
credit_note: CreditNote[];
|
|
559
560
|
|
|
560
|
-
unbilled_charge: UnbilledCharge;
|
|
561
|
+
unbilled_charge: UnbilledCharge[];
|
|
561
562
|
};
|
|
562
563
|
export type ItemEntitlementsRemovedContent = {
|
|
563
564
|
feature: Feature;
|
|
@@ -600,7 +601,7 @@ declare module 'chargebee' {
|
|
|
600
601
|
|
|
601
602
|
invoice: Invoice;
|
|
602
603
|
|
|
603
|
-
unbilled_charge: UnbilledCharge;
|
|
604
|
+
unbilled_charge: UnbilledCharge[];
|
|
604
605
|
};
|
|
605
606
|
export type SubscriptionTrialEndReminderContent = {
|
|
606
607
|
subscription: Subscription;
|
|
@@ -631,7 +632,7 @@ declare module 'chargebee' {
|
|
|
631
632
|
|
|
632
633
|
card: Card;
|
|
633
634
|
|
|
634
|
-
subscription: Subscription;
|
|
635
|
+
subscription: Subscription[];
|
|
635
636
|
};
|
|
636
637
|
export type RefundInitiatedContent = {
|
|
637
638
|
transaction: Transaction;
|
|
@@ -712,9 +713,9 @@ declare module 'chargebee' {
|
|
|
712
713
|
|
|
713
714
|
invoice: Invoice;
|
|
714
715
|
|
|
715
|
-
credit_note: CreditNote;
|
|
716
|
+
credit_note: CreditNote[];
|
|
716
717
|
|
|
717
|
-
unbilled_charge: UnbilledCharge;
|
|
718
|
+
unbilled_charge: UnbilledCharge[];
|
|
718
719
|
};
|
|
719
720
|
export type OmnichannelSubscriptionItemChangedContent = {
|
|
720
721
|
omnichannel_subscription_item: OmnichannelSubscriptionItem;
|
|
@@ -768,7 +769,7 @@ declare module 'chargebee' {
|
|
|
768
769
|
|
|
769
770
|
customer: Customer;
|
|
770
771
|
|
|
771
|
-
advance_invoice_schedule: AdvanceInvoiceSchedule;
|
|
772
|
+
advance_invoice_schedule: AdvanceInvoiceSchedule[];
|
|
772
773
|
};
|
|
773
774
|
export type ItemDeletedContent = {
|
|
774
775
|
item: Item;
|
|
@@ -812,7 +813,7 @@ declare module 'chargebee' {
|
|
|
812
813
|
|
|
813
814
|
invoice: Invoice;
|
|
814
815
|
|
|
815
|
-
unbilled_charge: UnbilledCharge;
|
|
816
|
+
unbilled_charge: UnbilledCharge[];
|
|
816
817
|
};
|
|
817
818
|
export type FeatureUpdatedContent = {
|
|
818
819
|
feature: Feature;
|
|
@@ -916,9 +917,9 @@ declare module 'chargebee' {
|
|
|
916
917
|
|
|
917
918
|
invoice: Invoice;
|
|
918
919
|
|
|
919
|
-
credit_note: CreditNote;
|
|
920
|
+
credit_note: CreditNote[];
|
|
920
921
|
|
|
921
|
-
unbilled_charge: UnbilledCharge;
|
|
922
|
+
unbilled_charge: UnbilledCharge[];
|
|
922
923
|
};
|
|
923
924
|
export type OrderReadyToProcessContent = {
|
|
924
925
|
order: Order;
|
|
@@ -964,7 +965,7 @@ declare module 'chargebee' {
|
|
|
964
965
|
subscription: Subscription;
|
|
965
966
|
};
|
|
966
967
|
export type UnbilledChargesInvoicedContent = {
|
|
967
|
-
unbilled_charge: UnbilledCharge;
|
|
968
|
+
unbilled_charge: UnbilledCharge[];
|
|
968
969
|
|
|
969
970
|
invoice: Invoice;
|
|
970
971
|
};
|
|
@@ -993,9 +994,9 @@ declare module 'chargebee' {
|
|
|
993
994
|
|
|
994
995
|
invoice: Invoice;
|
|
995
996
|
|
|
996
|
-
credit_note: CreditNote;
|
|
997
|
+
credit_note: CreditNote[];
|
|
997
998
|
|
|
998
|
-
unbilled_charge: UnbilledCharge;
|
|
999
|
+
unbilled_charge: UnbilledCharge[];
|
|
999
1000
|
};
|
|
1000
1001
|
export type PaymentFailedContent = {
|
|
1001
1002
|
transaction: Transaction;
|
|
@@ -1152,7 +1153,7 @@ declare module 'chargebee' {
|
|
|
1152
1153
|
|
|
1153
1154
|
customer: Customer;
|
|
1154
1155
|
|
|
1155
|
-
advance_invoice_schedule: AdvanceInvoiceSchedule;
|
|
1156
|
+
advance_invoice_schedule: AdvanceInvoiceSchedule[];
|
|
1156
1157
|
};
|
|
1157
1158
|
export type CardDeletedContent = {
|
|
1158
1159
|
customer: Customer;
|
|
@@ -1205,7 +1206,7 @@ declare module 'chargebee' {
|
|
|
1205
1206
|
|
|
1206
1207
|
invoice: Invoice;
|
|
1207
1208
|
|
|
1208
|
-
unbilled_charge: UnbilledCharge;
|
|
1209
|
+
unbilled_charge: UnbilledCharge[];
|
|
1209
1210
|
};
|
|
1210
1211
|
export type OmnichannelSubscriptionImportedContent = {
|
|
1211
1212
|
omnichannel_subscription_item: OmnichannelSubscriptionItem;
|
|
@@ -1261,7 +1262,7 @@ declare module 'chargebee' {
|
|
|
1261
1262
|
|
|
1262
1263
|
invoice: Invoice;
|
|
1263
1264
|
|
|
1264
|
-
unbilled_charge: UnbilledCharge;
|
|
1265
|
+
unbilled_charge: UnbilledCharge[];
|
|
1265
1266
|
};
|
|
1266
1267
|
export type SubscriptionEntitlementsCreatedContent = {
|
|
1267
1268
|
subscription_entitlements_created_detail: SubscriptionEntitlementsCreatedDetail;
|
|
@@ -1345,12 +1346,12 @@ declare module 'chargebee' {
|
|
|
1345
1346
|
|
|
1346
1347
|
invoice: Invoice;
|
|
1347
1348
|
|
|
1348
|
-
credit_note: CreditNote;
|
|
1349
|
+
credit_note: CreditNote[];
|
|
1349
1350
|
|
|
1350
|
-
unbilled_charge: UnbilledCharge;
|
|
1351
|
+
unbilled_charge: UnbilledCharge[];
|
|
1351
1352
|
};
|
|
1352
1353
|
export type UnbilledChargesVoidedContent = {
|
|
1353
|
-
unbilled_charge: UnbilledCharge;
|
|
1354
|
+
unbilled_charge: UnbilledCharge[];
|
|
1354
1355
|
};
|
|
1355
1356
|
export type QuoteCreatedContent = {
|
|
1356
1357
|
quote: Quote;
|
|
@@ -1403,7 +1404,7 @@ declare module 'chargebee' {
|
|
|
1403
1404
|
|
|
1404
1405
|
invoice: Invoice;
|
|
1405
1406
|
|
|
1406
|
-
unbilled_charge: UnbilledCharge;
|
|
1407
|
+
unbilled_charge: UnbilledCharge[];
|
|
1407
1408
|
};
|
|
1408
1409
|
export type OrderUpdatedContent = {
|
|
1409
1410
|
order: Order;
|
|
@@ -1435,7 +1436,7 @@ declare module 'chargebee' {
|
|
|
1435
1436
|
|
|
1436
1437
|
invoice: Invoice;
|
|
1437
1438
|
|
|
1438
|
-
unbilled_charge: UnbilledCharge;
|
|
1439
|
+
unbilled_charge: UnbilledCharge[];
|
|
1439
1440
|
};
|
|
1440
1441
|
export type SubscriptionRampCreatedContent = {
|
|
1441
1442
|
ramp: Ramp;
|
|
@@ -1570,9 +1571,9 @@ declare module 'chargebee' {
|
|
|
1570
1571
|
|
|
1571
1572
|
invoice: Invoice;
|
|
1572
1573
|
|
|
1573
|
-
credit_note: CreditNote;
|
|
1574
|
+
credit_note: CreditNote[];
|
|
1574
1575
|
|
|
1575
|
-
unbilled_charge: UnbilledCharge;
|
|
1576
|
+
unbilled_charge: UnbilledCharge[];
|
|
1576
1577
|
};
|
|
1577
1578
|
export type RuleCreatedContent = {
|
|
1578
1579
|
rule: Rule;
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookHandler = exports.WebhookContentType = exports.WebhookEventType = void 0;
|
|
4
|
-
const node_events_1 = require("node:events");
|
|
5
|
-
const auth_js_1 = require("./auth.js");
|
|
6
|
-
const eventType_js_1 = require("./eventType.js");
|
|
7
|
-
Object.defineProperty(exports, "WebhookEventType", { enumerable: true, get: function () { return eventType_js_1.WebhookEventType; } });
|
|
8
|
-
Object.defineProperty(exports, "WebhookContentType", { enumerable: true, get: function () { return eventType_js_1.WebhookContentType; } });
|
|
9
|
-
class WebhookHandler extends node_events_1.EventEmitter {
|
|
10
|
-
constructor() {
|
|
11
|
-
super({ captureRejections: true });
|
|
12
|
-
}
|
|
13
|
-
handle(body, headers) {
|
|
14
|
-
try {
|
|
15
|
-
if (this.requestValidator && headers) {
|
|
16
|
-
this.requestValidator(headers);
|
|
17
|
-
}
|
|
18
|
-
const event = typeof body === 'string' ? JSON.parse(body) : body;
|
|
19
|
-
const eventType = event.event_type;
|
|
20
|
-
if (this.listenerCount(eventType) > 0) {
|
|
21
|
-
this.emit(eventType, event);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
this.emit('unhandled_event', event);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
this.emit('error', err instanceof Error ? err : new Error(String(err)));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.WebhookHandler = WebhookHandler;
|
|
33
|
-
const webhook = new WebhookHandler();
|
|
34
|
-
// Auto-configure basic auth if env vars are present
|
|
35
|
-
const username = process.env.CHARGEBEE_WEBHOOK_USERNAME;
|
|
36
|
-
const password = process.env.CHARGEBEE_WEBHOOK_PASSWORD;
|
|
37
|
-
if (username && password) {
|
|
38
|
-
webhook.requestValidator = (0, auth_js_1.basicAuthValidator)((u, p) => u === username && p === password);
|
|
39
|
-
}
|
|
40
|
-
exports.default = webhook;
|