chargebee 3.12.0 → 3.14.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 (45) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +30 -1
  3. package/cjs/coreCommon.js +1 -1
  4. package/cjs/environment.js +1 -1
  5. package/cjs/resources/api_endpoints.js +66 -0
  6. package/esm/coreCommon.js +1 -1
  7. package/esm/environment.js +1 -1
  8. package/esm/resources/api_endpoints.js +66 -0
  9. package/package.json +2 -2
  10. package/types/core.d.ts +8 -1
  11. package/types/index.d.ts +16 -0
  12. package/types/resources/BusinessEntityChange.d.ts +16 -0
  13. package/types/resources/Comment.d.ts +0 -9
  14. package/types/resources/Content.d.ts +110 -0
  15. package/types/resources/CreditNote.d.ts +3 -1
  16. package/types/resources/CreditNoteEstimate.d.ts +31 -31
  17. package/types/resources/Currency.d.ts +11 -5
  18. package/types/resources/Customer.d.ts +1 -0
  19. package/types/resources/Estimate.d.ts +2 -0
  20. package/types/resources/Event.d.ts +208 -1
  21. package/types/resources/GatewayErrorDetail.d.ts +1 -0
  22. package/types/resources/HostedPage.d.ts +3 -1
  23. package/types/resources/Invoice.d.ts +5 -1
  24. package/types/resources/InvoiceEstimate.d.ts +42 -42
  25. package/types/resources/OfferEvent.d.ts +25 -0
  26. package/types/resources/OfferFulfillment.d.ts +77 -0
  27. package/types/resources/OmnichannelOneTimeOrder.d.ts +1 -13
  28. package/types/resources/OmnichannelSubscription.d.ts +13 -12
  29. package/types/resources/OmnichannelSubscriptionItem.d.ts +1 -0
  30. package/types/resources/OmnichannelSubscriptionItemOffer.d.ts +22 -0
  31. package/types/resources/OmnichannelTransaction.d.ts +13 -0
  32. package/types/resources/Order.d.ts +0 -1
  33. package/types/resources/PersonalizedOffer.d.ts +64 -0
  34. package/types/resources/Product.d.ts +135 -0
  35. package/types/resources/Quote.d.ts +35 -34
  36. package/types/resources/QuoteLineGroup.d.ts +21 -21
  37. package/types/resources/Ramp.d.ts +46 -0
  38. package/types/resources/SalesOrder.d.ts +143 -0
  39. package/types/resources/Subscription.d.ts +1 -1
  40. package/types/resources/SubscriptionEstimate.d.ts +0 -1
  41. package/types/resources/Transaction.d.ts +1 -0
  42. package/types/resources/UsageFile.d.ts +2 -0
  43. package/types/resources/UsageReminderInfo.d.ts +9 -0
  44. package/types/resources/Variant.d.ts +116 -0
  45. package/types/resources/WebhookEvent.d.ts +1619 -0
@@ -0,0 +1,77 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface OfferFulfillment {
6
+ id: string;
7
+ personalized_offer_id: string;
8
+ option_id: string;
9
+ processing_type:
10
+ | 'billing_update'
11
+ | 'checkout'
12
+ | 'url_redirect'
13
+ | 'webhook'
14
+ | 'email';
15
+ status: 'in_progress' | 'completed' | 'failed';
16
+ redirect_url?: string;
17
+ failed_at?: number;
18
+ created_at: number;
19
+ completed_at?: number;
20
+ error?: OfferFulfillment.Error;
21
+ }
22
+
23
+ export namespace OfferFulfillment {
24
+ export class OfferFulfillmentResource {
25
+ offerFulfillments(
26
+ input: OfferFulfillmentsInputParam,
27
+ headers?: ChargebeeRequestHeader,
28
+ ): Promise<ChargebeeResponse<OfferFulfillmentsResponse>>;
29
+
30
+ offerFulfillmentsGet(
31
+ offer_fulfillment_id: string,
32
+ headers?: ChargebeeRequestHeader,
33
+ ): Promise<ChargebeeResponse<OfferFulfillmentsGetResponse>>;
34
+
35
+ offerFulfillmentsUpdate(
36
+ offer_fulfillment_id: string,
37
+ input: OfferFulfillmentsUpdateInputParam,
38
+ headers?: ChargebeeRequestHeader,
39
+ ): Promise<ChargebeeResponse<OfferFulfillmentsUpdateResponse>>;
40
+ }
41
+
42
+ export interface OfferFulfillmentsResponse {
43
+ offer_fulfillment: OfferFulfillment;
44
+ hosted_page?: HostedPage;
45
+ }
46
+
47
+ export interface OfferFulfillmentsGetResponse {
48
+ offer_fulfillment: OfferFulfillment;
49
+ }
50
+
51
+ export interface OfferFulfillmentsUpdateResponse {
52
+ offer_fulfillment: OfferFulfillment;
53
+ }
54
+
55
+ export interface Error {
56
+ code:
57
+ | 'billing_update_failed'
58
+ | 'checkout_abandoned'
59
+ | 'external_fulfillment_failed'
60
+ | 'internal_error'
61
+ | 'fulfillment_expired';
62
+ message: string;
63
+ }
64
+ // REQUEST PARAMS
65
+ //---------------
66
+
67
+ export interface OfferFulfillmentsInputParam {
68
+ personalized_offer_id: string;
69
+ option_id: string;
70
+ }
71
+ export interface OfferFulfillmentsUpdateInputParam {
72
+ id: string;
73
+ status: 'completed' | 'failed';
74
+ failure_reason?: string;
75
+ }
76
+ }
77
+ }
@@ -12,7 +12,7 @@ declare module 'chargebee' {
12
12
  created_at: number;
13
13
  resource_version?: number;
14
14
  omnichannel_one_time_order_items: OmnichannelOneTimeOrderItem[];
15
- purchase_transaction?: OmnichannelOneTimeOrder.OmnichannelTransaction;
15
+ purchase_transaction?: OmnichannelTransaction;
16
16
  }
17
17
 
18
18
  export namespace OmnichannelOneTimeOrder {
@@ -37,18 +37,6 @@ declare module 'chargebee' {
37
37
  next_offset?: string;
38
38
  }
39
39
 
40
- export interface OmnichannelTransaction {
41
- id: string;
42
- id_at_source: string;
43
- app_id: string;
44
- price_currency?: string;
45
- price_units?: number;
46
- price_nanos?: number;
47
- type: 'purchase' | 'renewal';
48
- transacted_at?: number;
49
- created_at: number;
50
- resource_version?: number;
51
- }
52
40
  // REQUEST PARAMS
53
41
  //---------------
54
42
 
@@ -11,7 +11,7 @@ declare module 'chargebee' {
11
11
  created_at: number;
12
12
  resource_version?: number;
13
13
  omnichannel_subscription_items: OmnichannelSubscriptionItem[];
14
- initial_purchase_transaction?: OmnichannelSubscription.OmnichannelTransaction;
14
+ initial_purchase_transaction?: OmnichannelTransaction;
15
15
  }
16
16
 
17
17
  export namespace OmnichannelSubscription {
@@ -33,6 +33,12 @@ declare module 'chargebee' {
33
33
  ): Promise<
34
34
  ChargebeeResponse<OmnichannelTransactionsForOmnichannelSubscriptionResponse>
35
35
  >;
36
+
37
+ move(
38
+ omnichannel_subscription_id: string,
39
+ input: MoveInputParam,
40
+ headers?: ChargebeeRequestHeader,
41
+ ): Promise<ChargebeeResponse<MoveResponse>>;
36
42
  }
37
43
 
38
44
  export interface RetrieveResponse {
@@ -49,18 +55,10 @@ declare module 'chargebee' {
49
55
  next_offset?: string;
50
56
  }
51
57
 
52
- export interface OmnichannelTransaction {
53
- id: string;
54
- id_at_source: string;
55
- app_id: string;
56
- price_currency?: string;
57
- price_units?: number;
58
- price_nanos?: number;
59
- type: 'purchase' | 'renewal';
60
- transacted_at?: number;
61
- created_at: number;
62
- resource_version?: number;
58
+ export interface MoveResponse {
59
+ omnichannel_subscription: OmnichannelSubscription;
63
60
  }
61
+
64
62
  // REQUEST PARAMS
65
63
  //---------------
66
64
 
@@ -74,5 +72,8 @@ declare module 'chargebee' {
74
72
  limit?: number;
75
73
  offset?: string;
76
74
  }
75
+ export interface MoveInputParam {
76
+ to_customer_id: string;
77
+ }
77
78
  }
78
79
  }
@@ -29,6 +29,7 @@ declare module 'chargebee' {
29
29
  resumes_at?: number;
30
30
  has_scheduled_changes: boolean;
31
31
  resource_version?: number;
32
+ omnichannel_subscription_item_offers: OmnichannelSubscriptionItemOffer[];
32
33
  upcoming_renewal?: OmnichannelSubscriptionItem.UpcomingRenewal;
33
34
  linked_item?: OmnichannelSubscriptionItem.LinkedItem;
34
35
  }
@@ -0,0 +1,22 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface OmnichannelSubscriptionItemOffer {
6
+ id: string;
7
+ offer_id_at_source?: string;
8
+ category: CategoryEnum;
9
+ category_at_source?: string;
10
+ type: TypeEnum;
11
+ type_at_source?: string;
12
+ discount_type?: DiscountTypeEnum;
13
+ duration: string;
14
+ percentage?: number;
15
+ price_currency?: string;
16
+ price_units?: number;
17
+ price_nanos?: number;
18
+ offer_term_start?: number;
19
+ offer_term_end?: number;
20
+ resource_version?: number;
21
+ }
22
+ }
@@ -13,5 +13,18 @@ declare module 'chargebee' {
13
13
  transacted_at?: number;
14
14
  created_at: number;
15
15
  resource_version?: number;
16
+ linked_omnichannel_subscriptions?: OmnichannelTransaction.LinkedOmnichannelSubscription[];
17
+ linked_omnichannel_one_time_orders?: OmnichannelTransaction.LinkedOmnichannelOneTimeOrder[];
18
+ }
19
+
20
+ export namespace OmnichannelTransaction {
21
+ export interface LinkedOmnichannelSubscription {
22
+ omnichannel_subscription_id?: string;
23
+ }
24
+ export interface LinkedOmnichannelOneTimeOrder {
25
+ omnichannel_one_time_order_id?: string;
26
+ }
27
+ // REQUEST PARAMS
28
+ //---------------
16
29
  }
17
30
  }
@@ -258,7 +258,6 @@ declare module 'chargebee' {
258
258
  country?: string;
259
259
  zip?: string;
260
260
  validation_status?: ValidationStatusEnum;
261
- index: number;
262
261
  }
263
262
  export interface BillingAddress {
264
263
  first_name?: string;
@@ -0,0 +1,64 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface PersonalizedOffer {
6
+ id: string;
7
+ offer_id: string;
8
+ content: PersonalizedOffer.Content;
9
+ options: PersonalizedOffer.Option[];
10
+ }
11
+
12
+ export namespace PersonalizedOffer {
13
+ export class PersonalizedOfferResource {
14
+ personalizedOffers(
15
+ input: PersonalizedOffersInputParam,
16
+ headers?: ChargebeeRequestHeader,
17
+ ): Promise<ChargebeeResponse<PersonalizedOffersResponse>>;
18
+ }
19
+
20
+ export interface PersonalizedOffersResponse {
21
+ personalized_offers: PersonalizedOffer[];
22
+ brand?: Brand;
23
+ expires_at: number;
24
+ }
25
+
26
+ export interface Content {
27
+ title: string;
28
+ description: string;
29
+ }
30
+ export interface Option {
31
+ id: string;
32
+ label: string;
33
+ processing_type:
34
+ | 'billing_update'
35
+ | 'checkout'
36
+ | 'url_redirect'
37
+ | 'webhook'
38
+ | 'email';
39
+ processing_layout: 'in_app' | 'full_page';
40
+ redirect_url: string;
41
+ }
42
+ // REQUEST PARAMS
43
+ //---------------
44
+
45
+ export interface PersonalizedOffersInputParam {
46
+ first_name?: string;
47
+ last_name?: string;
48
+ email?: string;
49
+ roles?: string[];
50
+ external_user_id?: string;
51
+ subscription_id?: string;
52
+ customer_id: string;
53
+ custom?: any;
54
+ request_context?: RequestContextPersonalizedOffersInputParam;
55
+ }
56
+ export interface RequestContextPersonalizedOffersInputParam {
57
+ user_agent?: string;
58
+ locale?: string;
59
+ timezone?: string;
60
+ url?: string;
61
+ referrer_url?: string;
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,135 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+ ///<reference path='./filter.d.ts'/>
4
+ declare module 'chargebee' {
5
+ export interface Product {
6
+ id: string;
7
+ name: string;
8
+ external_name: string;
9
+ description?: string;
10
+ has_variant: boolean;
11
+ status: 'active' | 'inactive';
12
+ shippable: boolean;
13
+ sku?: string;
14
+ created_at: number;
15
+ resource_version?: number;
16
+ updated_at?: number;
17
+ deleted: boolean;
18
+ options?: Product.Option[];
19
+ metadata?: any;
20
+ }
21
+
22
+ export namespace Product {
23
+ export class ProductResource {
24
+ create(
25
+ input: CreateInputParam,
26
+ headers?: ChargebeeRequestHeader,
27
+ ): Promise<ChargebeeResponse<CreateResponse>>;
28
+
29
+ retrieve(
30
+ product_id: string,
31
+ headers?: ChargebeeRequestHeader,
32
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
33
+
34
+ update(
35
+ product_id: string,
36
+ input?: UpdateInputParam,
37
+ headers?: ChargebeeRequestHeader,
38
+ ): Promise<ChargebeeResponse<UpdateResponse>>;
39
+
40
+ delete(
41
+ product_id: string,
42
+ headers?: ChargebeeRequestHeader,
43
+ ): Promise<ChargebeeResponse<DeleteResponse>>;
44
+
45
+ updateOptions(
46
+ product_id: string,
47
+ input: UpdateOptionsInputParam,
48
+ headers?: ChargebeeRequestHeader,
49
+ ): Promise<ChargebeeResponse<UpdateOptionsResponse>>;
50
+
51
+ list(
52
+ input?: ListInputParam,
53
+ headers?: ChargebeeRequestHeader,
54
+ ): Promise<ChargebeeResponse<ListResponse>>;
55
+ }
56
+
57
+ export interface CreateResponse {
58
+ product: Product;
59
+ }
60
+
61
+ export interface RetrieveResponse {
62
+ product: Product;
63
+ }
64
+
65
+ export interface UpdateResponse {
66
+ product: Product;
67
+ }
68
+
69
+ export interface DeleteResponse {
70
+ product: Product;
71
+ }
72
+
73
+ export interface UpdateOptionsResponse {
74
+ product: Product;
75
+ }
76
+
77
+ export interface ListResponse {
78
+ list: { product: Product }[];
79
+ next_offset?: string;
80
+ }
81
+
82
+ export interface Option {
83
+ id?: string;
84
+ name?: string;
85
+ values?: any[];
86
+ default_value?: string;
87
+ type?: 'select';
88
+ }
89
+ // REQUEST PARAMS
90
+ //---------------
91
+
92
+ export interface CreateInputParam {
93
+ name: string;
94
+ external_name: string;
95
+ status: 'active' | 'inactive';
96
+ id?: string;
97
+ description?: string;
98
+ sku?: string;
99
+ metadata?: any;
100
+ shippable?: boolean;
101
+ }
102
+ export interface UpdateInputParam {
103
+ name?: string;
104
+ external_name?: string;
105
+ description?: string;
106
+ status?: 'active' | 'inactive';
107
+ sku?: string;
108
+ shippable?: boolean;
109
+ metadata?: any;
110
+ }
111
+ export interface UpdateOptionsInputParam {
112
+ remove_options?: string[];
113
+ options?: OptionsUpdateOptionsInputParam[];
114
+ }
115
+ export interface ListInputParam {
116
+ limit?: number;
117
+ offset?: string;
118
+ include_deleted?: boolean;
119
+ id?: filter.String;
120
+ name?: filter.String;
121
+ status?: filter.Enum;
122
+ shippable?: filter.Boolean;
123
+ has_variant?: filter.Boolean;
124
+ created_at?: filter.Timestamp;
125
+ updated_at?: filter.Timestamp;
126
+ 'sort_by[asc]'?: string;
127
+ 'sort_by[desc]'?: string;
128
+ }
129
+ export interface OptionsUpdateOptionsInputParam {
130
+ name: string;
131
+ values?: any;
132
+ default_value?: string;
133
+ }
134
+ }
135
+ }
@@ -42,11 +42,11 @@ declare module 'chargebee' {
42
42
  updated_at?: number;
43
43
  vat_number_prefix?: string;
44
44
  line_items?: Quote.LineItem[];
45
- discounts?: Quote.Discount[];
45
+ line_item_tiers?: Quote.LineItemTier[];
46
46
  line_item_discounts?: Quote.LineItemDiscount[];
47
- taxes?: Quote.Tax[];
48
47
  line_item_taxes?: Quote.LineItemTax[];
49
- line_item_tiers?: Quote.LineItemTier[];
48
+ discounts?: Quote.Discount[];
49
+ taxes?: Quote.Tax[];
50
50
  tax_category?: string;
51
51
  currency_code: string;
52
52
  notes?: any;
@@ -351,19 +351,18 @@ declare module 'chargebee' {
351
351
  entity_id?: string;
352
352
  customer_id?: string;
353
353
  }
354
- export interface Discount {
355
- amount: number;
356
- description?: string;
357
- entity_type:
358
- | 'item_level_coupon'
359
- | 'document_level_coupon'
360
- | 'promotional_credits'
361
- | 'prorated_credits'
362
- | 'item_level_discount'
363
- | 'document_level_discount';
364
- discount_type?: 'fixed_amount' | 'percentage';
365
- entity_id?: string;
366
- coupon_set_code?: string;
354
+ export interface LineItemTier {
355
+ line_item_id?: string;
356
+ starting_unit: number;
357
+ ending_unit?: number;
358
+ quantity_used: number;
359
+ unit_amount: number;
360
+ starting_unit_in_decimal?: string;
361
+ ending_unit_in_decimal?: string;
362
+ quantity_used_in_decimal?: string;
363
+ unit_amount_in_decimal?: string;
364
+ pricing_type?: 'per_unit' | 'flat_fee' | 'package';
365
+ package_size?: number;
367
366
  }
368
367
  export interface LineItemDiscount {
369
368
  line_item_id: string;
@@ -378,11 +377,6 @@ declare module 'chargebee' {
378
377
  entity_id?: string;
379
378
  discount_amount: number;
380
379
  }
381
- export interface Tax {
382
- name: string;
383
- amount: number;
384
- description?: string;
385
- }
386
380
  export interface LineItemTax {
387
381
  line_item_id?: string;
388
382
  tax_name: string;
@@ -408,18 +402,24 @@ declare module 'chargebee' {
408
402
  tax_amount_in_local_currency?: number;
409
403
  local_currency_code?: string;
410
404
  }
411
- export interface LineItemTier {
412
- line_item_id?: string;
413
- starting_unit: number;
414
- ending_unit?: number;
415
- quantity_used: number;
416
- unit_amount: number;
417
- starting_unit_in_decimal?: string;
418
- ending_unit_in_decimal?: string;
419
- quantity_used_in_decimal?: string;
420
- unit_amount_in_decimal?: string;
421
- pricing_type?: 'per_unit' | 'flat_fee' | 'package';
422
- package_size?: number;
405
+ export interface Discount {
406
+ amount: number;
407
+ description?: string;
408
+ entity_type:
409
+ | 'item_level_coupon'
410
+ | 'document_level_coupon'
411
+ | 'promotional_credits'
412
+ | 'prorated_credits'
413
+ | 'item_level_discount'
414
+ | 'document_level_discount';
415
+ discount_type?: 'fixed_amount' | 'percentage';
416
+ entity_id?: string;
417
+ coupon_set_code?: string;
418
+ }
419
+ export interface Tax {
420
+ name: string;
421
+ amount: number;
422
+ description?: string;
423
423
  }
424
424
  export interface ShippingAddress {
425
425
  first_name?: string;
@@ -436,7 +436,6 @@ declare module 'chargebee' {
436
436
  country?: string;
437
437
  zip?: string;
438
438
  validation_status?: ValidationStatusEnum;
439
- index: number;
440
439
  }
441
440
  export interface BillingAddress {
442
441
  first_name?: string;
@@ -1118,6 +1117,7 @@ declare module 'chargebee' {
1118
1117
  */
1119
1118
  setup_fee?: number;
1120
1119
  start_date?: number;
1120
+ offline_payment_method?: OfflinePaymentMethodEnum;
1121
1121
  contract_term_billing_cycle_on_renewal?: number;
1122
1122
  }
1123
1123
 
@@ -1216,6 +1216,7 @@ declare module 'chargebee' {
1216
1216
  */
1217
1217
  setup_fee?: number;
1218
1218
  start_date?: number;
1219
+ offline_payment_method?: OfflinePaymentMethodEnum;
1219
1220
  contract_term_billing_cycle_on_renewal?: number;
1220
1221
  }
1221
1222
 
@@ -19,10 +19,10 @@ declare module 'chargebee' {
19
19
  | 'subscription_cancel';
20
20
  billing_cycle_number?: number;
21
21
  line_items?: QuoteLineGroup.LineItem[];
22
- discounts?: QuoteLineGroup.Discount[];
23
22
  line_item_discounts?: QuoteLineGroup.LineItemDiscount[];
24
- taxes?: QuoteLineGroup.Tax[];
25
23
  line_item_taxes?: QuoteLineGroup.LineItemTax[];
24
+ discounts?: QuoteLineGroup.Discount[];
25
+ taxes?: QuoteLineGroup.Tax[];
26
26
  }
27
27
 
28
28
  export namespace QuoteLineGroup {
@@ -75,20 +75,6 @@ declare module 'chargebee' {
75
75
  entity_id?: string;
76
76
  customer_id?: string;
77
77
  }
78
- export interface Discount {
79
- amount: number;
80
- description?: string;
81
- entity_type:
82
- | 'item_level_coupon'
83
- | 'document_level_coupon'
84
- | 'promotional_credits'
85
- | 'prorated_credits'
86
- | 'item_level_discount'
87
- | 'document_level_discount';
88
- discount_type?: 'fixed_amount' | 'percentage';
89
- entity_id?: string;
90
- coupon_set_code?: string;
91
- }
92
78
  export interface LineItemDiscount {
93
79
  line_item_id: string;
94
80
  discount_type:
@@ -102,11 +88,6 @@ declare module 'chargebee' {
102
88
  entity_id?: string;
103
89
  discount_amount: number;
104
90
  }
105
- export interface Tax {
106
- name: string;
107
- amount: number;
108
- description?: string;
109
- }
110
91
  export interface LineItemTax {
111
92
  line_item_id?: string;
112
93
  tax_name: string;
@@ -132,6 +113,25 @@ declare module 'chargebee' {
132
113
  tax_amount_in_local_currency?: number;
133
114
  local_currency_code?: string;
134
115
  }
116
+ export interface Discount {
117
+ amount: number;
118
+ description?: string;
119
+ entity_type:
120
+ | 'item_level_coupon'
121
+ | 'document_level_coupon'
122
+ | 'promotional_credits'
123
+ | 'prorated_credits'
124
+ | 'item_level_discount'
125
+ | 'document_level_discount';
126
+ discount_type?: 'fixed_amount' | 'percentage';
127
+ entity_id?: string;
128
+ coupon_set_code?: string;
129
+ }
130
+ export interface Tax {
131
+ name: string;
132
+ amount: number;
133
+ description?: string;
134
+ }
135
135
  // REQUEST PARAMS
136
136
  //---------------
137
137
  }