chargebee 3.15.1 → 3.17.0-beta.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 +46 -0
- package/README.md +168 -0
- package/cjs/RequestWrapper.js +9 -8
- package/cjs/chargebee.cjs.js +7 -0
- package/cjs/environment.js +1 -1
- package/cjs/resources/api_endpoints.js +16 -0
- package/cjs/resources/webhook/auth.js +27 -0
- package/cjs/resources/webhook/content.js +3 -0
- package/cjs/resources/webhook/handler.js +37 -0
- package/esm/RequestWrapper.js +9 -8
- package/esm/chargebee.esm.js +4 -0
- package/esm/environment.js +1 -1
- package/esm/resources/api_endpoints.js +16 -0
- package/esm/resources/webhook/auth.js +23 -0
- package/esm/resources/webhook/content.js +2 -0
- package/esm/resources/webhook/handler.js +33 -0
- package/package.json +11 -6
- package/types/core.d.ts +4 -1
- package/types/index.d.ts +67 -0
- package/types/resources/Content.d.ts +2 -0
- package/types/resources/CreditNote.d.ts +3 -0
- package/types/resources/Einvoice.d.ts +17 -0
- package/types/resources/Estimate.d.ts +12 -0
- package/types/resources/Event.d.ts +7 -1
- package/types/resources/Gift.d.ts +13 -0
- package/types/resources/HostedPage.d.ts +12 -0
- package/types/resources/Invoice.d.ts +3 -0
- package/types/resources/ItemPrice.d.ts +13 -0
- package/types/resources/PricingPageSession.d.ts +1 -0
- package/types/resources/QuotedDeltaRamp.d.ts +16 -0
- package/types/resources/SalesOrder.d.ts +9 -0
- package/types/resources/WebhookEvent.d.ts +249 -217
package/types/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
///<reference path='./resources/DifferentialPrice.d.ts' />
|
|
25
25
|
///<reference path='./resources/Discount.d.ts' />
|
|
26
26
|
///<reference path='./resources/Download.d.ts' />
|
|
27
|
+
///<reference path='./resources/Einvoice.d.ts' />
|
|
27
28
|
///<reference path='./resources/Entitlement.d.ts' />
|
|
28
29
|
///<reference path='./resources/EntitlementOverride.d.ts' />
|
|
29
30
|
///<reference path='./resources/Estimate.d.ts' />
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
///<reference path='./resources/Quote.d.ts' />
|
|
76
77
|
///<reference path='./resources/QuoteLineGroup.d.ts' />
|
|
77
78
|
///<reference path='./resources/QuotedCharge.d.ts' />
|
|
79
|
+
///<reference path='./resources/QuotedDeltaRamp.d.ts' />
|
|
78
80
|
///<reference path='./resources/QuotedRamp.d.ts' />
|
|
79
81
|
///<reference path='./resources/QuotedSubscription.d.ts' />
|
|
80
82
|
///<reference path='./resources/Ramp.d.ts' />
|
|
@@ -248,4 +250,69 @@ declare module 'chargebee' {
|
|
|
248
250
|
virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
|
|
249
251
|
webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
|
|
250
252
|
}
|
|
253
|
+
|
|
254
|
+
// Webhook Handler
|
|
255
|
+
export type WebhookEventName = EventTypeEnum | 'unhandled_event';
|
|
256
|
+
export type WebhookEventTypeValue = `${WebhookEventType}`;
|
|
257
|
+
/** @deprecated Use WebhookEventTypeValue instead */
|
|
258
|
+
export type WebhookContentTypeValue = WebhookEventTypeValue;
|
|
259
|
+
|
|
260
|
+
export type WebhookEventListener<
|
|
261
|
+
T extends WebhookEventType = WebhookEventType,
|
|
262
|
+
> = (event: WebhookEvent<T>) => Promise<void> | void;
|
|
263
|
+
export type WebhookErrorListener = (error: Error) => Promise<void> | void;
|
|
264
|
+
|
|
265
|
+
// Helper type to map string literal to enum member
|
|
266
|
+
type StringToWebhookEventType<S extends WebhookEventTypeValue> = {
|
|
267
|
+
[K in WebhookEventType]: `${K}` extends S ? K : never;
|
|
268
|
+
}[WebhookEventType];
|
|
269
|
+
|
|
270
|
+
export class WebhookHandler {
|
|
271
|
+
on<T extends WebhookEventType>(
|
|
272
|
+
eventName: T,
|
|
273
|
+
listener: WebhookEventListener<T>,
|
|
274
|
+
): this;
|
|
275
|
+
on<S extends WebhookEventTypeValue>(
|
|
276
|
+
eventName: S,
|
|
277
|
+
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
278
|
+
): this;
|
|
279
|
+
on(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
280
|
+
on(eventName: 'error', listener: WebhookErrorListener): this;
|
|
281
|
+
once<T extends WebhookEventType>(
|
|
282
|
+
eventName: T,
|
|
283
|
+
listener: WebhookEventListener<T>,
|
|
284
|
+
): this;
|
|
285
|
+
once<S extends WebhookEventTypeValue>(
|
|
286
|
+
eventName: S,
|
|
287
|
+
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
288
|
+
): this;
|
|
289
|
+
once(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
290
|
+
once(eventName: 'error', listener: WebhookErrorListener): this;
|
|
291
|
+
off<T extends WebhookEventType>(
|
|
292
|
+
eventName: T,
|
|
293
|
+
listener: WebhookEventListener<T>,
|
|
294
|
+
): this;
|
|
295
|
+
off<S extends WebhookEventTypeValue>(
|
|
296
|
+
eventName: S,
|
|
297
|
+
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
298
|
+
): this;
|
|
299
|
+
off(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
300
|
+
off(eventName: 'error', listener: WebhookErrorListener): this;
|
|
301
|
+
handle(
|
|
302
|
+
body: string | object,
|
|
303
|
+
headers?: Record<string, string | string[] | undefined>,
|
|
304
|
+
): void;
|
|
305
|
+
onError?: (error: any) => void;
|
|
306
|
+
requestValidator?: (
|
|
307
|
+
headers: Record<string, string | string[] | undefined>,
|
|
308
|
+
) => void;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Webhook Auth
|
|
312
|
+
export function basicAuthValidator(
|
|
313
|
+
validateCredentials: (username: string, password: string) => boolean,
|
|
314
|
+
): (headers: Record<string, string | string[] | undefined>) => void;
|
|
315
|
+
|
|
316
|
+
// Default webhook handler instance
|
|
317
|
+
export const webhook: WebhookHandler;
|
|
251
318
|
}
|
|
@@ -29,6 +29,7 @@ declare module 'chargebee' {
|
|
|
29
29
|
differential_price: DifferentialPrice;
|
|
30
30
|
discount: Discount;
|
|
31
31
|
download: Download;
|
|
32
|
+
einvoice: Einvoice;
|
|
32
33
|
entitlement: Entitlement;
|
|
33
34
|
entitlement_override: EntitlementOverride;
|
|
34
35
|
estimate: Estimate;
|
|
@@ -80,6 +81,7 @@ declare module 'chargebee' {
|
|
|
80
81
|
quote: Quote;
|
|
81
82
|
quote_line_group: QuoteLineGroup;
|
|
82
83
|
quoted_charge: QuotedCharge;
|
|
84
|
+
quoted_delta_ramp: QuotedDeltaRamp;
|
|
83
85
|
quoted_ramp: QuotedRamp;
|
|
84
86
|
quoted_subscription: QuotedSubscription;
|
|
85
87
|
ramp: Ramp;
|
|
@@ -37,6 +37,7 @@ declare module 'chargebee' {
|
|
|
37
37
|
resource_version?: number;
|
|
38
38
|
updated_at?: number;
|
|
39
39
|
channel?: ChannelEnum;
|
|
40
|
+
line_items_next_offset?: string;
|
|
40
41
|
sub_total: number;
|
|
41
42
|
sub_total_in_local_currency?: number;
|
|
42
43
|
total_in_local_currency?: number;
|
|
@@ -454,6 +455,8 @@ declare module 'chargebee' {
|
|
|
454
455
|
[key: `cf_${string}`]: unknown;
|
|
455
456
|
}
|
|
456
457
|
export interface RetrieveInputParam {
|
|
458
|
+
line_items_limit?: number;
|
|
459
|
+
line_items_offset?: string;
|
|
457
460
|
line_item?: LineItemRetrieveInputParam;
|
|
458
461
|
}
|
|
459
462
|
export interface PdfInputParam {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
///<reference path='./../core.d.ts'/>
|
|
2
|
+
///<reference path='./../index.d.ts'/>
|
|
3
|
+
|
|
4
|
+
declare module 'chargebee' {
|
|
5
|
+
export interface Einvoice {
|
|
6
|
+
id: string;
|
|
7
|
+
reference_number?: string;
|
|
8
|
+
status:
|
|
9
|
+
| 'scheduled'
|
|
10
|
+
| 'skipped'
|
|
11
|
+
| 'in_progress'
|
|
12
|
+
| 'success'
|
|
13
|
+
| 'failed'
|
|
14
|
+
| 'registered';
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -413,6 +413,7 @@ declare module 'chargebee' {
|
|
|
413
413
|
payment_intent?: PaymentIntentGiftSubscriptionForItemsInputParam;
|
|
414
414
|
shipping_address?: ShippingAddressGiftSubscriptionForItemsInputParam;
|
|
415
415
|
subscription_items?: SubscriptionItemsGiftSubscriptionForItemsInputParam[];
|
|
416
|
+
item_tiers?: ItemTiersGiftSubscriptionForItemsInputParam[];
|
|
416
417
|
}
|
|
417
418
|
export interface CreateInvoiceInputParam {
|
|
418
419
|
currency_code?: string;
|
|
@@ -1131,6 +1132,17 @@ declare module 'chargebee' {
|
|
|
1131
1132
|
item_price_id?: string;
|
|
1132
1133
|
quantity?: number;
|
|
1133
1134
|
quantity_in_decimal?: string;
|
|
1135
|
+
unit_price?: number;
|
|
1136
|
+
unit_price_in_decimal?: string;
|
|
1137
|
+
}
|
|
1138
|
+
export interface ItemTiersGiftSubscriptionForItemsInputParam {
|
|
1139
|
+
item_price_id?: string;
|
|
1140
|
+
starting_unit?: number;
|
|
1141
|
+
ending_unit?: number;
|
|
1142
|
+
price?: number;
|
|
1143
|
+
starting_unit_in_decimal?: string;
|
|
1144
|
+
ending_unit_in_decimal?: string;
|
|
1145
|
+
price_in_decimal?: string;
|
|
1134
1146
|
}
|
|
1135
1147
|
export interface InvoiceCreateInvoiceInputParam {
|
|
1136
1148
|
customer_id?: string;
|
|
@@ -228,7 +228,13 @@ declare module 'chargebee' {
|
|
|
228
228
|
PaymentSourceUpdatedContent &
|
|
229
229
|
BusinessEntityDeletedContent &
|
|
230
230
|
AuthorizationVoidedContent &
|
|
231
|
-
SubscriptionRampDeletedContent
|
|
231
|
+
SubscriptionRampDeletedContent &
|
|
232
|
+
PlanDeletedContent &
|
|
233
|
+
AddonDeletedContent &
|
|
234
|
+
AddonUpdatedContent &
|
|
235
|
+
AddonCreatedContent &
|
|
236
|
+
PlanCreatedContent &
|
|
237
|
+
PlanUpdatedContent;
|
|
232
238
|
origin_user?: string;
|
|
233
239
|
}
|
|
234
240
|
|
|
@@ -131,11 +131,13 @@ declare module 'chargebee' {
|
|
|
131
131
|
no_expiry?: boolean;
|
|
132
132
|
claim_expiry_date?: number;
|
|
133
133
|
coupon_ids?: string[];
|
|
134
|
+
meta_data?: any;
|
|
134
135
|
gifter?: GifterCreateForItemsInputParam;
|
|
135
136
|
gift_receiver?: GiftReceiverCreateForItemsInputParam;
|
|
136
137
|
payment_intent?: PaymentIntentCreateForItemsInputParam;
|
|
137
138
|
shipping_address?: ShippingAddressCreateForItemsInputParam;
|
|
138
139
|
subscription_items?: SubscriptionItemsCreateForItemsInputParam[];
|
|
140
|
+
item_tiers?: ItemTiersCreateForItemsInputParam[];
|
|
139
141
|
}
|
|
140
142
|
export interface ListInputParam {
|
|
141
143
|
limit?: number;
|
|
@@ -286,6 +288,17 @@ declare module 'chargebee' {
|
|
|
286
288
|
item_price_id?: string;
|
|
287
289
|
quantity?: number;
|
|
288
290
|
quantity_in_decimal?: string;
|
|
291
|
+
unit_price?: number;
|
|
292
|
+
unit_price_in_decimal?: string;
|
|
293
|
+
}
|
|
294
|
+
export interface ItemTiersCreateForItemsInputParam {
|
|
295
|
+
item_price_id?: string;
|
|
296
|
+
starting_unit?: number;
|
|
297
|
+
ending_unit?: number;
|
|
298
|
+
price?: number;
|
|
299
|
+
starting_unit_in_decimal?: string;
|
|
300
|
+
ending_unit_in_decimal?: string;
|
|
301
|
+
price_in_decimal?: string;
|
|
289
302
|
}
|
|
290
303
|
export interface GifterGiftListInputParam {
|
|
291
304
|
customer_id?: filter.String;
|
|
@@ -435,6 +435,7 @@ declare module 'chargebee' {
|
|
|
435
435
|
coupon_ids?: string[];
|
|
436
436
|
gifter?: GifterCheckoutGiftForItemsInputParam;
|
|
437
437
|
subscription_items?: SubscriptionItemsCheckoutGiftForItemsInputParam[];
|
|
438
|
+
item_tiers?: ItemTiersCheckoutGiftForItemsInputParam[];
|
|
438
439
|
}
|
|
439
440
|
export interface ClaimGiftInputParam {
|
|
440
441
|
redirect_url?: string;
|
|
@@ -1105,6 +1106,17 @@ declare module 'chargebee' {
|
|
|
1105
1106
|
item_price_id?: string;
|
|
1106
1107
|
quantity?: number;
|
|
1107
1108
|
quantity_in_decimal?: string;
|
|
1109
|
+
unit_price?: number;
|
|
1110
|
+
unit_price_in_decimal?: string;
|
|
1111
|
+
}
|
|
1112
|
+
export interface ItemTiersCheckoutGiftForItemsInputParam {
|
|
1113
|
+
item_price_id?: string;
|
|
1114
|
+
starting_unit?: number;
|
|
1115
|
+
ending_unit?: number;
|
|
1116
|
+
price?: number;
|
|
1117
|
+
starting_unit_in_decimal?: string;
|
|
1118
|
+
ending_unit_in_decimal?: string;
|
|
1119
|
+
price_in_decimal?: string;
|
|
1108
1120
|
}
|
|
1109
1121
|
export interface GiftClaimGiftInputParam {
|
|
1110
1122
|
id: string;
|
|
@@ -42,6 +42,7 @@ declare module 'chargebee' {
|
|
|
42
42
|
voided_at?: number;
|
|
43
43
|
resource_version?: number;
|
|
44
44
|
updated_at?: number;
|
|
45
|
+
line_items_next_offset?: string;
|
|
45
46
|
first_invoice?: boolean;
|
|
46
47
|
new_sales_amount?: number;
|
|
47
48
|
has_advance_charges?: boolean;
|
|
@@ -1062,6 +1063,8 @@ declare module 'chargebee' {
|
|
|
1062
1063
|
offset?: string;
|
|
1063
1064
|
}
|
|
1064
1065
|
export interface RetrieveInputParam {
|
|
1066
|
+
line_items_limit?: number;
|
|
1067
|
+
line_items_offset?: string;
|
|
1065
1068
|
line_item?: LineItemRetrieveInputParam;
|
|
1066
1069
|
}
|
|
1067
1070
|
export interface PdfInputParam {
|
|
@@ -91,6 +91,12 @@ declare module 'chargebee' {
|
|
|
91
91
|
input?: FindApplicableItemPricesInputParam,
|
|
92
92
|
headers?: ChargebeeRequestHeader,
|
|
93
93
|
): Promise<ChargebeeResponse<FindApplicableItemPricesResponse>>;
|
|
94
|
+
|
|
95
|
+
moveItemPrice(
|
|
96
|
+
item_price_id: string,
|
|
97
|
+
input: MoveItemPriceInputParam,
|
|
98
|
+
headers?: ChargebeeRequestHeader,
|
|
99
|
+
): Promise<ChargebeeResponse<MoveItemPriceResponse>>;
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
export interface CreateResponse {
|
|
@@ -124,6 +130,10 @@ declare module 'chargebee' {
|
|
|
124
130
|
next_offset?: string;
|
|
125
131
|
}
|
|
126
132
|
|
|
133
|
+
export interface MoveItemPriceResponse {
|
|
134
|
+
item_price: ItemPrice;
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
export interface Tier {
|
|
128
138
|
starting_unit: number;
|
|
129
139
|
ending_unit?: number;
|
|
@@ -269,6 +279,9 @@ declare module 'chargebee' {
|
|
|
269
279
|
'sort_by[asc]'?: string;
|
|
270
280
|
'sort_by[desc]'?: string;
|
|
271
281
|
}
|
|
282
|
+
export interface MoveItemPriceInputParam {
|
|
283
|
+
destination_item_id: string;
|
|
284
|
+
}
|
|
272
285
|
export interface TaxDetailCreateInputParam {
|
|
273
286
|
tax_profile_id?: string;
|
|
274
287
|
avalara_tax_code?: string;
|
|
@@ -36,6 +36,7 @@ declare module 'chargebee' {
|
|
|
36
36
|
export interface CreateForNewSubscriptionInputParam {
|
|
37
37
|
redirect_url?: string;
|
|
38
38
|
business_entity_id?: string;
|
|
39
|
+
auto_select_local_currency?: boolean;
|
|
39
40
|
pricing_page?: PricingPageCreateForNewSubscriptionInputParam;
|
|
40
41
|
subscription?: SubscriptionCreateForNewSubscriptionInputParam;
|
|
41
42
|
customer?: CustomerCreateForNewSubscriptionInputParam;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
///<reference path='./../core.d.ts'/>
|
|
2
|
+
///<reference path='./../index.d.ts'/>
|
|
3
|
+
|
|
4
|
+
declare module 'chargebee' {
|
|
5
|
+
export interface QuotedDeltaRamp {
|
|
6
|
+
line_items?: QuotedDeltaRamp.LineItem[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export namespace QuotedDeltaRamp {
|
|
10
|
+
export interface LineItem {
|
|
11
|
+
item_level_discount_per_billing_cycle_in_decimal?: string;
|
|
12
|
+
}
|
|
13
|
+
// REQUEST PARAMS
|
|
14
|
+
//---------------
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -27,6 +27,7 @@ declare module 'chargebee' {
|
|
|
27
27
|
billing_configuration?: SalesOrder.BillingConfiguration;
|
|
28
28
|
renewal_term?: SalesOrder.RenewalTerm;
|
|
29
29
|
status: 'active' | 'completed';
|
|
30
|
+
credit_lines?: SalesOrder.CreditLine[];
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export namespace SalesOrder {
|
|
@@ -37,6 +38,9 @@ declare module 'chargebee' {
|
|
|
37
38
|
name?: string;
|
|
38
39
|
quantity: string;
|
|
39
40
|
unit_price: string;
|
|
41
|
+
billable_unit_price?: string;
|
|
42
|
+
billable_quantity?: string;
|
|
43
|
+
billable_amount?: string;
|
|
40
44
|
billing_period?: number;
|
|
41
45
|
billing_period_unit?: 'day' | 'week' | 'month' | 'year';
|
|
42
46
|
service_period_days?: number;
|
|
@@ -137,6 +141,11 @@ declare module 'chargebee' {
|
|
|
137
141
|
cancellation_cutoff_period?: number;
|
|
138
142
|
renewal_billing_cycles?: number;
|
|
139
143
|
}
|
|
144
|
+
export interface CreditLine {
|
|
145
|
+
amount: string;
|
|
146
|
+
unit_price: string;
|
|
147
|
+
line_item_association_id?: string;
|
|
148
|
+
}
|
|
140
149
|
// REQUEST PARAMS
|
|
141
150
|
//---------------
|
|
142
151
|
}
|