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/esm/util.js CHANGED
@@ -148,47 +148,52 @@ export function encodeListParams(paramObj) {
148
148
  }
149
149
  return encodeParams(paramObj);
150
150
  }
151
- export function getHost(env) {
151
+ export function getHost(env, subDomain) {
152
+ if (subDomain != null) {
153
+ return env.site + '.' + subDomain + env.hostSuffix;
154
+ }
152
155
  return env.site + env.hostSuffix;
153
156
  }
154
- export function encodeParams(paramObj, serialized, scope, index) {
157
+ export function encodeParams(paramObj, serialized, scope, index, jsonKeys, level = 0) {
155
158
  let key, value;
156
159
  if (typeof serialized === 'undefined' || serialized === null) {
157
160
  serialized = [];
158
161
  }
159
162
  for (key in paramObj) {
160
163
  value = paramObj[key];
164
+ const originalKey = key;
161
165
  if (scope) {
162
- key = '' + scope + '[' + key + ']';
166
+ key = `${scope}[${key}]`;
163
167
  }
164
168
  if (typeof index !== 'undefined' && index !== null) {
165
- key = key + '[' + index + ']';
169
+ key = `${key}[${index}]`;
170
+ }
171
+ if (jsonKeys && jsonKeys[originalKey] === level) {
172
+ let attrVal = '';
173
+ if (value !== null) {
174
+ attrVal = encodeURIComponent(Object.prototype.toString.call(value) === '[object String]'
175
+ ? trim(value)
176
+ : JSON.stringify(value));
177
+ }
178
+ serialized.push(encodeURIComponent(key) + '=' + attrVal);
166
179
  }
167
- if (isArray(value)) {
180
+ else if (isArray(value) &&
181
+ !(jsonKeys && jsonKeys[originalKey] === level)) {
168
182
  for (let arrIdx = 0; arrIdx < value.length; arrIdx++) {
169
183
  if (typeof value[arrIdx] === 'object' || isArray(value[arrIdx])) {
170
- encodeParams(value[arrIdx], serialized, key, arrIdx);
184
+ encodeParams(value[arrIdx], serialized, key, arrIdx, jsonKeys, level + 1);
171
185
  }
172
186
  else {
173
187
  if (typeof value[arrIdx] !== 'undefined') {
174
- serialized.push(encodeURIComponent(key + '[' + arrIdx + ']') +
188
+ serialized.push(encodeURIComponent(`${key}[${arrIdx}]`) +
175
189
  '=' +
176
190
  encodeURIComponent(trim(value[arrIdx]) !== '' ? value[arrIdx] : ''));
177
191
  }
178
192
  }
179
193
  }
180
194
  }
181
- else if (key === 'meta_data' || key === 'metadata') {
182
- let attrVal = '';
183
- if (value !== null) {
184
- attrVal = encodeURIComponent(Object.prototype.toString.call(value) === '[object String]'
185
- ? trim(value)
186
- : JSON.stringify(value));
187
- }
188
- serialized.push(encodeURIComponent(key) + '=' + attrVal);
189
- }
190
195
  else if (typeof value === 'object' && !isArray(value)) {
191
- encodeParams(value, serialized, key);
196
+ encodeParams(value, serialized, key, undefined, jsonKeys, level + 1);
192
197
  }
193
198
  else {
194
199
  if (typeof value !== 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.2.1",
3
+ "version": "3.4.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
package/types/core.d.ts CHANGED
@@ -9,6 +9,7 @@ declare module 'chargebee' {
9
9
  export type ChargebeeResponse<T> = T & {
10
10
  headers: { [key: string]: string };
11
11
  isIdempotencyReplayed?: boolean | string;
12
+ httpStatusCode: number | null;
12
13
  };
13
14
  export type ChargebeeRequestHeader = {
14
15
  [key: string]: string | undefined;
@@ -135,7 +136,8 @@ declare module 'chargebee' {
135
136
  | 'price_variant'
136
137
  | 'omnichannel_subscription'
137
138
  | 'omnichannel_subscription_item'
138
- | 'omnichannel_transaction';
139
+ | 'omnichannel_transaction'
140
+ | 'recorded_purchase';
139
141
  type EventNameEnum = 'cancellation_page_loaded';
140
142
  type EventTypeEnum =
141
143
  | 'coupon_created'
@@ -324,6 +326,15 @@ declare module 'chargebee' {
324
326
  | 'omnichannel_subscription_item_resubscribed'
325
327
  | 'omnichannel_subscription_item_upgraded'
326
328
  | 'omnichannel_subscription_item_cancelled'
329
+ | 'omnichannel_subscription_imported'
330
+ | 'omnichannel_subscription_item_grace_period_started'
331
+ | 'omnichannel_subscription_item_grace_period_expired'
332
+ | 'omnichannel_subscription_item_dunning_started'
333
+ | 'omnichannel_subscription_item_dunning_expired'
334
+ | 'rule_created'
335
+ | 'rule_updated'
336
+ | 'rule_deleted'
337
+ | 'record_purchase_failed'
327
338
  | 'plan_created'
328
339
  | 'plan_updated'
329
340
  | 'plan_deleted'
@@ -492,6 +503,7 @@ declare module 'chargebee' {
492
503
  | 'tiered'
493
504
  | 'volume'
494
505
  | 'stairstep';
506
+ type ProductCatalogVersionEnum = 'v1' | 'v2';
495
507
  type ProrationTypeEnum = 'full_term' | 'partial_term' | 'none';
496
508
  type ReferralSystemEnum =
497
509
  | 'referral_candy'
package/types/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  ///<reference path='./resources/BusinessEntityTransfer.d.ts' />
7
7
  ///<reference path='./resources/Card.d.ts' />
8
8
  ///<reference path='./resources/Comment.d.ts' />
9
+ ///<reference path='./resources/Configuration.d.ts' />
9
10
  ///<reference path='./resources/Contact.d.ts' />
10
11
  ///<reference path='./resources/ContractTerm.d.ts' />
11
12
  ///<reference path='./resources/Coupon.d.ts' />
@@ -64,6 +65,7 @@
64
65
  ///<reference path='./resources/Ramp.d.ts' />
65
66
  ///<reference path='./resources/RecordedPurchase.d.ts' />
66
67
  ///<reference path='./resources/ResourceMigration.d.ts' />
68
+ ///<reference path='./resources/Rule.d.ts' />
67
69
  ///<reference path='./resources/SiteMigrationDetail.d.ts' />
68
70
  ///<reference path='./resources/Subscription.d.ts' />
69
71
  ///<reference path='./resources/SubscriptionEntitlement.d.ts' />
@@ -75,6 +77,7 @@
75
77
  ///<reference path='./resources/Transaction.d.ts' />
76
78
  ///<reference path='./resources/UnbilledCharge.d.ts' />
77
79
  ///<reference path='./resources/Usage.d.ts' />
80
+ ///<reference path='./resources/UsageEvent.d.ts' />
78
81
  ///<reference path='./resources/VirtualBankAccount.d.ts' />
79
82
 
80
83
  export type Config = {
@@ -123,6 +126,7 @@ declare module 'chargebee' {
123
126
  businessEntity: BusinessEntity.BusinessEntityResource;
124
127
  card: Card.CardResource;
125
128
  comment: Comment.CommentResource;
129
+ configuration: Configuration.ConfigurationResource;
126
130
  coupon: Coupon.CouponResource;
127
131
  couponCode: CouponCode.CouponCodeResource;
128
132
  couponSet: CouponSet.CouponSetResource;
@@ -161,6 +165,7 @@ declare module 'chargebee' {
161
165
  ramp: Ramp.RampResource;
162
166
  recordedPurchase: RecordedPurchase.RecordedPurchaseResource;
163
167
  resourceMigration: ResourceMigration.ResourceMigrationResource;
168
+ rule: Rule.RuleResource;
164
169
  siteMigrationDetail: SiteMigrationDetail.SiteMigrationDetailResource;
165
170
  subscription: Subscription.SubscriptionResource;
166
171
  subscriptionEntitlement: SubscriptionEntitlement.SubscriptionEntitlementResource;
@@ -168,6 +173,7 @@ declare module 'chargebee' {
168
173
  transaction: Transaction.TransactionResource;
169
174
  unbilledCharge: UnbilledCharge.UnbilledChargeResource;
170
175
  usage: Usage.UsageResource;
176
+ usageEvent: UsageEvent.UsageEventResource;
171
177
  virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
172
178
  }
173
179
  }
@@ -18,6 +18,7 @@ declare module 'chargebee' {
18
18
  updated_at?: number;
19
19
  channel?: ChannelEnum;
20
20
  business_entity_id?: string;
21
+ deleted: boolean;
21
22
  }
22
23
 
23
24
  export namespace AttachedItem {
@@ -79,6 +79,7 @@ declare module 'chargebee' {
79
79
  | 'omnichannel_subscription'
80
80
  | 'omnichannel_subscription_item'
81
81
  | 'omnichannel_transaction'
82
+ | 'recorded_purchase'
82
83
  | 'item_family'
83
84
  | 'item'
84
85
  | 'item_price'
@@ -0,0 +1,24 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface Configuration {
6
+ domain?: string;
7
+ product_catalog_version?: ProductCatalogVersionEnum;
8
+ }
9
+
10
+ export namespace Configuration {
11
+ export class ConfigurationResource {
12
+ list(
13
+ headers?: ChargebeeRequestHeader,
14
+ ): Promise<ChargebeeResponse<ListResponse>>;
15
+ }
16
+
17
+ export interface ListResponse {
18
+ configurations: Configuration[];
19
+ }
20
+
21
+ // REQUEST PARAMS
22
+ //---------------
23
+ }
24
+ }
@@ -41,6 +41,7 @@ declare module 'chargebee' {
41
41
  invoice_notes?: string;
42
42
  meta_data?: any;
43
43
  coupon_constraints?: Coupon.CouponConstraint[];
44
+ deleted: boolean;
44
45
  }
45
46
 
46
47
  export namespace Coupon {
@@ -160,10 +161,7 @@ declare module 'chargebee' {
160
161
  discount_type?: 'fixed_amount' | 'percentage' | 'offer_quantity';
161
162
  discount_amount?: number;
162
163
  currency_code?: string;
163
- discount_percentage?: number /**
164
- * @deprecated Please refer API docs to use other attributes
165
- */;
166
-
164
+ discount_percentage?: number;
167
165
  discount_quantity?: number;
168
166
  apply_on: 'invoice_amount' | 'each_specified_item';
169
167
  duration_type?: 'one_time' | 'forever' | 'limited_period';
@@ -188,10 +186,7 @@ declare module 'chargebee' {
188
186
  discount_type?: 'fixed_amount' | 'percentage' | 'offer_quantity';
189
187
  discount_amount?: number;
190
188
  currency_code?: string;
191
- discount_percentage?: number /**
192
- * @deprecated Please refer API docs to use other attributes
193
- */;
194
-
189
+ discount_percentage?: number;
195
190
  discount_quantity?: number;
196
191
  apply_on: 'invoice_amount' | 'each_specified_item';
197
192
  duration_type?: 'one_time' | 'forever' | 'limited_period';
@@ -216,10 +211,7 @@ declare module 'chargebee' {
216
211
  discount_type?: 'fixed_amount' | 'percentage' | 'offer_quantity';
217
212
  discount_amount?: number;
218
213
  currency_code?: string;
219
- discount_percentage?: number /**
220
- * @deprecated Please refer API docs to use other attributes
221
- */;
222
-
214
+ discount_percentage?: number;
223
215
  discount_quantity?: number;
224
216
  apply_on?: 'invoice_amount' | 'each_specified_item';
225
217
  duration_type?: 'one_time' | 'forever' | 'limited_period';
@@ -259,10 +251,7 @@ declare module 'chargebee' {
259
251
  discount_type?: 'fixed_amount' | 'percentage' | 'offer_quantity';
260
252
  discount_amount?: number;
261
253
  currency_code?: string;
262
- discount_percentage?: number /**
263
- * @deprecated Please refer API docs to use other attributes
264
- */;
265
-
254
+ discount_percentage?: number;
266
255
  discount_quantity?: number;
267
256
  apply_on?: 'invoice_amount' | 'each_specified_item';
268
257
  duration_type?: 'one_time' | 'forever' | 'limited_period';
@@ -7,7 +7,7 @@ declare module 'chargebee' {
7
7
  customer_id: string;
8
8
  subscription_id?: string;
9
9
  reference_invoice_id?: string;
10
- type: 'adjustment' | 'refundable';
10
+ type: 'adjustment' | 'refundable' | 'store';
11
11
  reason_code?:
12
12
  | 'write_off'
13
13
  | 'subscription_change'
@@ -274,6 +274,7 @@ declare module 'chargebee' {
274
274
  | 'prorated_credits'
275
275
  | 'item_level_discount'
276
276
  | 'document_level_discount';
277
+ discount_type?: 'fixed_amount' | 'percentage';
277
278
  entity_id?: string;
278
279
  coupon_set_code?: string;
279
280
  }
@@ -359,6 +360,7 @@ declare module 'chargebee' {
359
360
  | 'not_paid'
360
361
  | 'voided'
361
362
  | 'pending';
363
+ tax_application?: 'pre_tax' | 'post_tax';
362
364
  }
363
365
  export interface ShippingAddress {
364
366
  first_name?: string;
@@ -408,7 +410,7 @@ declare module 'chargebee' {
408
410
  reference_invoice_id?: string;
409
411
  customer_id?: string;
410
412
  total?: number;
411
- type: 'adjustment' | 'refundable';
413
+ type: 'adjustment' | 'refundable' | 'store';
412
414
  reason_code?:
413
415
  | 'product_unsatisfactory'
414
416
  | 'service_unsatisfactory'
@@ -479,7 +481,7 @@ declare module 'chargebee' {
479
481
  customer_id?: string;
480
482
  subscription_id?: string;
481
483
  reference_invoice_id: string;
482
- type: 'adjustment' | 'refundable';
484
+ type: 'adjustment' | 'refundable' | 'store';
483
485
  currency_code?: string;
484
486
  create_reason_code: string;
485
487
  date: number;
@@ -4,7 +4,7 @@
4
4
  declare module 'chargebee' {
5
5
  export interface CreditNoteEstimate {
6
6
  reference_invoice_id: string;
7
- type: 'adjustment' | 'refundable';
7
+ type: 'adjustment' | 'refundable' | 'store';
8
8
  price_type: PriceTypeEnum;
9
9
  currency_code: string;
10
10
  sub_total: number;
@@ -80,6 +80,7 @@ declare module 'chargebee' {
80
80
  | 'prorated_credits'
81
81
  | 'item_level_discount'
82
82
  | 'document_level_discount';
83
+ discount_type?: 'fixed_amount' | 'percentage';
83
84
  entity_id?: string;
84
85
  coupon_set_code?: string;
85
86
  }
@@ -608,7 +608,6 @@ declare module 'chargebee' {
608
608
  export interface MoveInputParam {
609
609
  id_at_from_site: string;
610
610
  from_site: string;
611
- tax_providers_fields?: TaxProvidersFieldsMoveInputParam[];
612
611
  }
613
612
  export interface ChangeBillingDateInputParam {
614
613
  billing_date?: number;
@@ -627,7 +626,6 @@ declare module 'chargebee' {
627
626
  export interface MergeInputParam {
628
627
  from_customer_id: string;
629
628
  to_customer_id: string;
630
- tax_providers_fields?: TaxProvidersFieldsMergeInputParam[];
631
629
  }
632
630
  export interface RelationshipsInputParam {
633
631
  parent_id?: string;
@@ -921,16 +919,6 @@ declare module 'chargebee' {
921
919
  invoice_id: string;
922
920
  allocation_amount?: number;
923
921
  }
924
- export interface TaxProvidersFieldsMoveInputParam {
925
- provider_name?: string;
926
- field_id?: string;
927
- field_value?: string;
928
- }
929
- export interface TaxProvidersFieldsMergeInputParam {
930
- provider_name?: string;
931
- field_id?: string;
932
- field_value?: string;
933
- }
934
922
  export interface ParentAccountAccessRelationshipsInputParam {
935
923
  portal_edit_child_subscriptions?: 'yes' | 'view_only' | 'no';
936
924
  portal_download_child_invoices?: 'yes' | 'view_only' | 'no';
@@ -17,6 +17,7 @@ declare module 'chargebee' {
17
17
  currency_code: string;
18
18
  parent_periods?: DifferentialPrice.ParentPeriod[];
19
19
  business_entity_id?: string;
20
+ deleted: boolean;
20
21
  }
21
22
 
22
23
  export namespace DifferentialPrice {
@@ -14,7 +14,8 @@ declare module 'chargebee' {
14
14
  | 're_scheduled'
15
15
  | 'failed'
16
16
  | 'skipped'
17
- | 'not_applicable';
17
+ | 'not_applicable'
18
+ | 'disabled';
18
19
  webhook_failure_reason?: string;
19
20
  webhooks?: Event.Webhook[];
20
21
  event_type?: EventTypeEnum;
@@ -54,7 +55,8 @@ declare module 'chargebee' {
54
55
  | 're_scheduled'
55
56
  | 'failed'
56
57
  | 'skipped'
57
- | 'not_applicable';
58
+ | 'not_applicable'
59
+ | 'disabled';
58
60
  }
59
61
  // REQUEST PARAMS
60
62
  //---------------
@@ -3,6 +3,7 @@
3
3
  ///<reference path='./filter.d.ts'/>
4
4
  declare module 'chargebee' {
5
5
  export interface Feature {
6
+ [key: string]: unknown;
6
7
  id: string;
7
8
  name: string;
8
9
  description?: string;
@@ -16,5 +16,6 @@ declare module 'chargebee' {
16
16
  recommendation_message?: string;
17
17
  processor_error_code?: string;
18
18
  processor_error_message?: string;
19
+ error_cause_id?: string;
19
20
  }
20
21
  }
@@ -54,6 +54,7 @@ declare module 'chargebee' {
54
54
  line_item_discounts?: Invoice.LineItemDiscount[];
55
55
  taxes?: Invoice.Tax[];
56
56
  line_item_taxes?: Invoice.LineItemTax[];
57
+ line_item_credits?: Invoice.LineItemCredit[];
57
58
  line_item_tiers?: Invoice.LineItemTier[];
58
59
  linked_payments?: Invoice.LinkedPayment[];
59
60
  dunning_attempts?: Invoice.DunningAttempt[];
@@ -519,6 +520,7 @@ declare module 'chargebee' {
519
520
  | 'prorated_credits'
520
521
  | 'item_level_discount'
521
522
  | 'document_level_discount';
523
+ discount_type?: 'fixed_amount' | 'percentage';
522
524
  entity_id?: string;
523
525
  coupon_set_code?: string;
524
526
  }
@@ -565,6 +567,11 @@ declare module 'chargebee' {
565
567
  tax_amount_in_local_currency?: number;
566
568
  local_currency_code?: string;
567
569
  }
570
+ export interface LineItemCredit {
571
+ cn_id: string;
572
+ applied_amount: number;
573
+ line_item_id?: string;
574
+ }
568
575
  export interface LineItemTier {
569
576
  line_item_id?: string;
570
577
  starting_unit: number;
@@ -626,6 +633,7 @@ declare module 'chargebee' {
626
633
  cn_create_reason_code?: string;
627
634
  cn_date?: number;
628
635
  cn_status: 'adjusted' | 'refunded' | 'refund_due' | 'voided';
636
+ tax_application?: 'pre_tax' | 'post_tax';
629
637
  }
630
638
  export interface AdjustmentCreditNote {
631
639
  cn_id: string;
@@ -16,6 +16,7 @@ declare module 'chargebee' {
16
16
  taxes?: InvoiceEstimate.Tax[];
17
17
  line_item_taxes?: InvoiceEstimate.LineItemTax[];
18
18
  line_item_tiers?: InvoiceEstimate.LineItemTier[];
19
+ line_item_credits?: InvoiceEstimate.LineItemCredit[];
19
20
  line_item_discounts?: InvoiceEstimate.LineItemDiscount[];
20
21
  round_off_amount?: number;
21
22
  customer_id?: string;
@@ -80,6 +81,7 @@ declare module 'chargebee' {
80
81
  | 'prorated_credits'
81
82
  | 'item_level_discount'
82
83
  | 'document_level_discount';
84
+ discount_type?: 'fixed_amount' | 'percentage';
83
85
  entity_id?: string;
84
86
  coupon_set_code?: string;
85
87
  }
@@ -124,6 +126,11 @@ declare module 'chargebee' {
124
126
  quantity_used_in_decimal?: string;
125
127
  unit_amount_in_decimal?: string;
126
128
  }
129
+ export interface LineItemCredit {
130
+ cn_id: string;
131
+ applied_amount: number;
132
+ line_item_id?: string;
133
+ }
127
134
  export interface LineItemDiscount {
128
135
  line_item_id: string;
129
136
  discount_type:
@@ -30,6 +30,7 @@ declare module 'chargebee' {
30
30
  bundle_items?: Item.BundleItem[];
31
31
  bundle_configuration?: Item.BundleConfiguration;
32
32
  metadata?: any;
33
+ deleted: boolean;
33
34
  business_entity_id?: string;
34
35
  }
35
36
 
@@ -12,6 +12,7 @@ declare module 'chargebee' {
12
12
  updated_at?: number;
13
13
  channel?: ChannelEnum;
14
14
  business_entity_id?: string;
15
+ deleted: boolean;
15
16
  }
16
17
 
17
18
  export namespace ItemFamily {
@@ -48,6 +48,7 @@ declare module 'chargebee' {
48
48
  parent_item_id?: string;
49
49
  show_description_in_invoices?: boolean;
50
50
  show_description_in_quotes?: boolean;
51
+ deleted: boolean;
51
52
  business_entity_id?: string;
52
53
  }
53
54
 
@@ -11,6 +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
15
  }
15
16
 
16
17
  export namespace OmnichannelSubscription {
@@ -48,6 +49,18 @@ declare module 'chargebee' {
48
49
  next_offset?: string;
49
50
  }
50
51
 
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;
63
+ }
51
64
  // REQUEST PARAMS
52
65
  //---------------
53
66
 
@@ -5,7 +5,12 @@ declare module 'chargebee' {
5
5
  export interface OmnichannelSubscriptionItem {
6
6
  id: string;
7
7
  item_id_at_source: string;
8
- status: 'active' | 'expired' | 'cancelled';
8
+ status:
9
+ | 'active'
10
+ | 'expired'
11
+ | 'cancelled'
12
+ | 'in_dunning'
13
+ | 'in_grace_period';
9
14
  current_term_start?: number;
10
15
  current_term_end?: number;
11
16
  expired_at?: number;
@@ -14,6 +19,7 @@ declare module 'chargebee' {
14
19
  cancellation_reason?:
15
20
  | 'customer_cancelled'
16
21
  | 'customer_did_not_consent_to_price_increase';
22
+ grace_period_expires_at?: number;
17
23
  resource_version?: number;
18
24
  }
19
25
  }
@@ -317,7 +317,7 @@ declare module 'chargebee' {
317
317
  }
318
318
  export interface LinkedCreditNote {
319
319
  amount?: number;
320
- type: 'adjustment' | 'refundable';
320
+ type: 'adjustment' | 'refundable' | 'store';
321
321
  id: string;
322
322
  status: 'adjusted' | 'refunded' | 'refund_due' | 'voided';
323
323
  amount_adjusted?: number;
@@ -15,6 +15,7 @@ declare module 'chargebee' {
15
15
  archived_at?: number;
16
16
  attributes?: PriceVariant.Attribute[];
17
17
  business_entity_id?: string;
18
+ deleted: boolean;
18
19
  }
19
20
 
20
21
  export namespace PriceVariant {
@@ -44,6 +44,7 @@ declare module 'chargebee' {
44
44
  contract_term_end?: number;
45
45
  contract_term_termination_fee?: number;
46
46
  business_entity_id?: string;
47
+ deleted: boolean;
47
48
  }
48
49
 
49
50
  export namespace Quote {
@@ -332,6 +333,7 @@ declare module 'chargebee' {
332
333
  | 'prorated_credits'
333
334
  | 'item_level_discount'
334
335
  | 'document_level_discount';
336
+ discount_type?: 'fixed_amount' | 'percentage';
335
337
  entity_id?: string;
336
338
  coupon_set_code?: string;
337
339
  }
@@ -84,6 +84,7 @@ declare module 'chargebee' {
84
84
  | 'prorated_credits'
85
85
  | 'item_level_discount'
86
86
  | 'document_level_discount';
87
+ discount_type?: 'fixed_amount' | 'percentage';
87
88
  entity_id?: string;
88
89
  coupon_set_code?: string;
89
90
  }
@@ -69,6 +69,9 @@ declare module 'chargebee' {
69
69
  unit_price?: number;
70
70
  unit_price_in_decimal?: string;
71
71
  amount?: number;
72
+ current_term_start?: number;
73
+ current_term_end?: number;
74
+ next_billing_at?: number;
72
75
  amount_in_decimal?: string;
73
76
  billing_period?: number;
74
77
  billing_period_unit?: 'day' | 'week' | 'month' | 'year';
@@ -7,7 +7,7 @@ declare module 'chargebee' {
7
7
  customer_id: string;
8
8
  app_id: string;
9
9
  source: 'apple_app_store';
10
- status: 'in_process' | 'completed' | 'failed';
10
+ status: 'in_process' | 'completed' | 'failed' | 'ignored';
11
11
  omnichannel_transaction_id?: string;
12
12
  created_at: number;
13
13
  resource_version?: number;
@@ -0,0 +1,33 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface Rule {
6
+ id: string;
7
+ namespace: string;
8
+ rule_name: string;
9
+ rule_order?: number;
10
+ status: 'active' | 'disabled';
11
+ conditions?: string;
12
+ outcome?: string;
13
+ deleted: boolean;
14
+ created_at: number;
15
+ modified_at: number;
16
+ }
17
+
18
+ export namespace Rule {
19
+ export class RuleResource {
20
+ retrieve(
21
+ rule_id: string,
22
+ headers?: ChargebeeRequestHeader,
23
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
24
+ }
25
+
26
+ export interface RetrieveResponse {
27
+ rule: Rule;
28
+ }
29
+
30
+ // REQUEST PARAMS
31
+ //---------------
32
+ }
33
+ }