orb-billing 4.54.0 → 4.56.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 (38) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/core.d.ts.map +1 -1
  3. package/core.js +12 -6
  4. package/core.js.map +1 -1
  5. package/core.mjs +12 -6
  6. package/core.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/customers/balance-transactions.d.ts +2 -2
  9. package/resources/customers/balance-transactions.d.ts.map +1 -1
  10. package/resources/customers/balance-transactions.js.map +1 -1
  11. package/resources/customers/balance-transactions.mjs.map +1 -1
  12. package/resources/events/backfills.d.ts +30 -0
  13. package/resources/events/backfills.d.ts.map +1 -1
  14. package/resources/events/backfills.js.map +1 -1
  15. package/resources/events/backfills.mjs.map +1 -1
  16. package/resources/invoice-line-items.d.ts +49 -45
  17. package/resources/invoice-line-items.d.ts.map +1 -1
  18. package/resources/invoices.d.ts +100 -92
  19. package/resources/invoices.d.ts.map +1 -1
  20. package/resources/invoices.js.map +1 -1
  21. package/resources/invoices.mjs.map +1 -1
  22. package/resources/plans/plans.d.ts +24 -24
  23. package/resources/plans/plans.d.ts.map +1 -1
  24. package/resources/subscriptions.d.ts +374 -268
  25. package/resources/subscriptions.d.ts.map +1 -1
  26. package/resources/subscriptions.js.map +1 -1
  27. package/resources/subscriptions.mjs.map +1 -1
  28. package/src/core.ts +14 -6
  29. package/src/resources/customers/balance-transactions.ts +4 -2
  30. package/src/resources/events/backfills.ts +35 -0
  31. package/src/resources/invoice-line-items.ts +57 -53
  32. package/src/resources/invoices.ts +118 -108
  33. package/src/resources/plans/plans.ts +31 -31
  34. package/src/resources/subscriptions.ts +472 -346
  35. package/src/version.ts +1 -1
  36. package/version.d.ts +1 -1
  37. package/version.js +1 -1
  38. package/version.mjs +1 -1
@@ -524,7 +524,8 @@ export namespace Invoice {
524
524
  | 'return_from_voiding'
525
525
  | 'credit_note_applied'
526
526
  | 'credit_note_voided'
527
- | 'overpayment_refund';
527
+ | 'overpayment_refund'
528
+ | 'external_payment';
528
529
 
529
530
  /**
530
531
  * The value of the amount changed in the transaction.
@@ -847,29 +848,30 @@ export namespace Invoice {
847
848
  id: string;
848
849
 
849
850
  /**
850
- * The line amount after any adjustments, before overage conversion, credits and
851
+ * The line amount after any adjustments and before overage conversion, credits and
851
852
  * partial invoicing.
852
853
  */
853
854
  adjusted_subtotal: string;
854
855
 
855
856
  /**
856
- * All adjustments applied to the line item.
857
+ * All adjustments (ie. maximums, minimums, discounts) applied to the line item.
857
858
  */
858
859
  adjustments: Array<
859
- | LineItem.AmountDiscountAdjustment
860
- | LineItem.PercentageDiscountAdjustment
861
- | LineItem.UsageDiscountAdjustment
862
- | LineItem.MinimumAdjustment
863
- | LineItem.MaximumAdjustment
860
+ | LineItem.MonetaryUsageDiscountAdjustment
861
+ | LineItem.MonetaryAmountDiscountAdjustment
862
+ | LineItem.MonetaryPercentageDiscountAdjustment
863
+ | LineItem.MonetaryMinimumAdjustment
864
+ | LineItem.MonetaryMaximumAdjustment
864
865
  >;
865
866
 
866
867
  /**
867
- * The final amount after any discounts or minimums.
868
+ * The final amount for a line item after all adjustments and pre paid credits have
869
+ * been applied.
868
870
  */
869
871
  amount: string;
870
872
 
871
873
  /**
872
- * The number of credits used
874
+ * The number of prepaid credits applied.
873
875
  */
874
876
  credits_applied: string;
875
877
 
@@ -931,6 +933,9 @@ export namespace Invoice {
931
933
  */
932
934
  price: PricesAPI.Price | null;
933
935
 
936
+ /**
937
+ * Either the fixed fee quantity or the usage during the service period.
938
+ */
934
939
  quantity: number;
935
940
 
936
941
  /**
@@ -945,7 +950,7 @@ export namespace Invoice {
945
950
  sub_line_items: Array<LineItem.MatrixSubLineItem | LineItem.TierSubLineItem | LineItem.OtherSubLineItem>;
946
951
 
947
952
  /**
948
- * The line amount before any line item-specific discounts or minimums.
953
+ * The line amount before before any adjustments.
949
954
  */
950
955
  subtotal: string;
951
956
 
@@ -957,16 +962,15 @@ export namespace Invoice {
957
962
  }
958
963
 
959
964
  export namespace LineItem {
960
- export interface AmountDiscountAdjustment {
965
+ export interface MonetaryUsageDiscountAdjustment {
961
966
  id: string;
962
967
 
963
- adjustment_type: 'amount_discount';
968
+ adjustment_type: 'usage_discount';
964
969
 
965
970
  /**
966
- * The amount by which to discount the prices this adjustment applies to in a given
967
- * billing period.
971
+ * The value applied by an adjustment.
968
972
  */
969
- amount_discount: string;
973
+ amount: string;
970
974
 
971
975
  /**
972
976
  * The price IDs that this adjustment applies to.
@@ -980,42 +984,43 @@ export namespace Invoice {
980
984
  is_invoice_level: boolean;
981
985
 
982
986
  /**
983
- * The plan phase in which this adjustment is active.
987
+ * The reason for the adjustment.
984
988
  */
985
- plan_phase_order: number | null;
989
+ reason: string | null;
986
990
 
987
991
  /**
988
- * The reason for the adjustment.
992
+ * The number of usage units by which to discount the price this adjustment applies
993
+ * to in a given billing period.
989
994
  */
990
- reason: string | null;
995
+ usage_discount: number;
991
996
  }
992
997
 
993
- export interface PercentageDiscountAdjustment {
998
+ export interface MonetaryAmountDiscountAdjustment {
994
999
  id: string;
995
1000
 
996
- adjustment_type: 'percentage_discount';
1001
+ adjustment_type: 'amount_discount';
997
1002
 
998
1003
  /**
999
- * The price IDs that this adjustment applies to.
1004
+ * The value applied by an adjustment.
1000
1005
  */
1001
- applies_to_price_ids: Array<string>;
1006
+ amount: string;
1002
1007
 
1003
1008
  /**
1004
- * True for adjustments that apply to an entire invocice, false for adjustments
1005
- * that apply to only one price.
1009
+ * The amount by which to discount the prices this adjustment applies to in a given
1010
+ * billing period.
1006
1011
  */
1007
- is_invoice_level: boolean;
1012
+ amount_discount: string;
1008
1013
 
1009
1014
  /**
1010
- * The percentage (as a value between 0 and 1) by which to discount the price
1011
- * intervals this adjustment applies to in a given billing period.
1015
+ * The price IDs that this adjustment applies to.
1012
1016
  */
1013
- percentage_discount: number;
1017
+ applies_to_price_ids: Array<string>;
1014
1018
 
1015
1019
  /**
1016
- * The plan phase in which this adjustment is active.
1020
+ * True for adjustments that apply to an entire invocice, false for adjustments
1021
+ * that apply to only one price.
1017
1022
  */
1018
- plan_phase_order: number | null;
1023
+ is_invoice_level: boolean;
1019
1024
 
1020
1025
  /**
1021
1026
  * The reason for the adjustment.
@@ -1023,10 +1028,15 @@ export namespace Invoice {
1023
1028
  reason: string | null;
1024
1029
  }
1025
1030
 
1026
- export interface UsageDiscountAdjustment {
1031
+ export interface MonetaryPercentageDiscountAdjustment {
1027
1032
  id: string;
1028
1033
 
1029
- adjustment_type: 'usage_discount';
1034
+ adjustment_type: 'percentage_discount';
1035
+
1036
+ /**
1037
+ * The value applied by an adjustment.
1038
+ */
1039
+ amount: string;
1030
1040
 
1031
1041
  /**
1032
1042
  * The price IDs that this adjustment applies to.
@@ -1040,27 +1050,27 @@ export namespace Invoice {
1040
1050
  is_invoice_level: boolean;
1041
1051
 
1042
1052
  /**
1043
- * The plan phase in which this adjustment is active.
1053
+ * The percentage (as a value between 0 and 1) by which to discount the price
1054
+ * intervals this adjustment applies to in a given billing period.
1044
1055
  */
1045
- plan_phase_order: number | null;
1056
+ percentage_discount: number;
1046
1057
 
1047
1058
  /**
1048
1059
  * The reason for the adjustment.
1049
1060
  */
1050
1061
  reason: string | null;
1051
-
1052
- /**
1053
- * The number of usage units by which to discount the price this adjustment applies
1054
- * to in a given billing period.
1055
- */
1056
- usage_discount: number;
1057
1062
  }
1058
1063
 
1059
- export interface MinimumAdjustment {
1064
+ export interface MonetaryMinimumAdjustment {
1060
1065
  id: string;
1061
1066
 
1062
1067
  adjustment_type: 'minimum';
1063
1068
 
1069
+ /**
1070
+ * The value applied by an adjustment.
1071
+ */
1072
+ amount: string;
1073
+
1064
1074
  /**
1065
1075
  * The price IDs that this adjustment applies to.
1066
1076
  */
@@ -1083,22 +1093,22 @@ export namespace Invoice {
1083
1093
  */
1084
1094
  minimum_amount: string;
1085
1095
 
1086
- /**
1087
- * The plan phase in which this adjustment is active.
1088
- */
1089
- plan_phase_order: number | null;
1090
-
1091
1096
  /**
1092
1097
  * The reason for the adjustment.
1093
1098
  */
1094
1099
  reason: string | null;
1095
1100
  }
1096
1101
 
1097
- export interface MaximumAdjustment {
1102
+ export interface MonetaryMaximumAdjustment {
1098
1103
  id: string;
1099
1104
 
1100
1105
  adjustment_type: 'maximum';
1101
1106
 
1107
+ /**
1108
+ * The value applied by an adjustment.
1109
+ */
1110
+ amount: string;
1111
+
1102
1112
  /**
1103
1113
  * The price IDs that this adjustment applies to.
1104
1114
  */
@@ -1116,11 +1126,6 @@ export namespace Invoice {
1116
1126
  */
1117
1127
  maximum_amount: string;
1118
1128
 
1119
- /**
1120
- * The plan phase in which this adjustment is active.
1121
- */
1122
- plan_phase_order: number | null;
1123
-
1124
1129
  /**
1125
1130
  * The reason for the adjustment.
1126
1131
  */
@@ -1730,7 +1735,8 @@ export namespace InvoiceFetchUpcomingResponse {
1730
1735
  | 'return_from_voiding'
1731
1736
  | 'credit_note_applied'
1732
1737
  | 'credit_note_voided'
1733
- | 'overpayment_refund';
1738
+ | 'overpayment_refund'
1739
+ | 'external_payment';
1734
1740
 
1735
1741
  /**
1736
1742
  * The value of the amount changed in the transaction.
@@ -2053,29 +2059,30 @@ export namespace InvoiceFetchUpcomingResponse {
2053
2059
  id: string;
2054
2060
 
2055
2061
  /**
2056
- * The line amount after any adjustments, before overage conversion, credits and
2062
+ * The line amount after any adjustments and before overage conversion, credits and
2057
2063
  * partial invoicing.
2058
2064
  */
2059
2065
  adjusted_subtotal: string;
2060
2066
 
2061
2067
  /**
2062
- * All adjustments applied to the line item.
2068
+ * All adjustments (ie. maximums, minimums, discounts) applied to the line item.
2063
2069
  */
2064
2070
  adjustments: Array<
2065
- | LineItem.AmountDiscountAdjustment
2066
- | LineItem.PercentageDiscountAdjustment
2067
- | LineItem.UsageDiscountAdjustment
2068
- | LineItem.MinimumAdjustment
2069
- | LineItem.MaximumAdjustment
2071
+ | LineItem.MonetaryUsageDiscountAdjustment
2072
+ | LineItem.MonetaryAmountDiscountAdjustment
2073
+ | LineItem.MonetaryPercentageDiscountAdjustment
2074
+ | LineItem.MonetaryMinimumAdjustment
2075
+ | LineItem.MonetaryMaximumAdjustment
2070
2076
  >;
2071
2077
 
2072
2078
  /**
2073
- * The final amount after any discounts or minimums.
2079
+ * The final amount for a line item after all adjustments and pre paid credits have
2080
+ * been applied.
2074
2081
  */
2075
2082
  amount: string;
2076
2083
 
2077
2084
  /**
2078
- * The number of credits used
2085
+ * The number of prepaid credits applied.
2079
2086
  */
2080
2087
  credits_applied: string;
2081
2088
 
@@ -2137,6 +2144,9 @@ export namespace InvoiceFetchUpcomingResponse {
2137
2144
  */
2138
2145
  price: PricesAPI.Price | null;
2139
2146
 
2147
+ /**
2148
+ * Either the fixed fee quantity or the usage during the service period.
2149
+ */
2140
2150
  quantity: number;
2141
2151
 
2142
2152
  /**
@@ -2151,7 +2161,7 @@ export namespace InvoiceFetchUpcomingResponse {
2151
2161
  sub_line_items: Array<LineItem.MatrixSubLineItem | LineItem.TierSubLineItem | LineItem.OtherSubLineItem>;
2152
2162
 
2153
2163
  /**
2154
- * The line amount before any line item-specific discounts or minimums.
2164
+ * The line amount before before any adjustments.
2155
2165
  */
2156
2166
  subtotal: string;
2157
2167
 
@@ -2163,16 +2173,15 @@ export namespace InvoiceFetchUpcomingResponse {
2163
2173
  }
2164
2174
 
2165
2175
  export namespace LineItem {
2166
- export interface AmountDiscountAdjustment {
2176
+ export interface MonetaryUsageDiscountAdjustment {
2167
2177
  id: string;
2168
2178
 
2169
- adjustment_type: 'amount_discount';
2179
+ adjustment_type: 'usage_discount';
2170
2180
 
2171
2181
  /**
2172
- * The amount by which to discount the prices this adjustment applies to in a given
2173
- * billing period.
2182
+ * The value applied by an adjustment.
2174
2183
  */
2175
- amount_discount: string;
2184
+ amount: string;
2176
2185
 
2177
2186
  /**
2178
2187
  * The price IDs that this adjustment applies to.
@@ -2186,42 +2195,43 @@ export namespace InvoiceFetchUpcomingResponse {
2186
2195
  is_invoice_level: boolean;
2187
2196
 
2188
2197
  /**
2189
- * The plan phase in which this adjustment is active.
2198
+ * The reason for the adjustment.
2190
2199
  */
2191
- plan_phase_order: number | null;
2200
+ reason: string | null;
2192
2201
 
2193
2202
  /**
2194
- * The reason for the adjustment.
2203
+ * The number of usage units by which to discount the price this adjustment applies
2204
+ * to in a given billing period.
2195
2205
  */
2196
- reason: string | null;
2206
+ usage_discount: number;
2197
2207
  }
2198
2208
 
2199
- export interface PercentageDiscountAdjustment {
2209
+ export interface MonetaryAmountDiscountAdjustment {
2200
2210
  id: string;
2201
2211
 
2202
- adjustment_type: 'percentage_discount';
2212
+ adjustment_type: 'amount_discount';
2203
2213
 
2204
2214
  /**
2205
- * The price IDs that this adjustment applies to.
2215
+ * The value applied by an adjustment.
2206
2216
  */
2207
- applies_to_price_ids: Array<string>;
2217
+ amount: string;
2208
2218
 
2209
2219
  /**
2210
- * True for adjustments that apply to an entire invocice, false for adjustments
2211
- * that apply to only one price.
2220
+ * The amount by which to discount the prices this adjustment applies to in a given
2221
+ * billing period.
2212
2222
  */
2213
- is_invoice_level: boolean;
2223
+ amount_discount: string;
2214
2224
 
2215
2225
  /**
2216
- * The percentage (as a value between 0 and 1) by which to discount the price
2217
- * intervals this adjustment applies to in a given billing period.
2226
+ * The price IDs that this adjustment applies to.
2218
2227
  */
2219
- percentage_discount: number;
2228
+ applies_to_price_ids: Array<string>;
2220
2229
 
2221
2230
  /**
2222
- * The plan phase in which this adjustment is active.
2231
+ * True for adjustments that apply to an entire invocice, false for adjustments
2232
+ * that apply to only one price.
2223
2233
  */
2224
- plan_phase_order: number | null;
2234
+ is_invoice_level: boolean;
2225
2235
 
2226
2236
  /**
2227
2237
  * The reason for the adjustment.
@@ -2229,10 +2239,15 @@ export namespace InvoiceFetchUpcomingResponse {
2229
2239
  reason: string | null;
2230
2240
  }
2231
2241
 
2232
- export interface UsageDiscountAdjustment {
2242
+ export interface MonetaryPercentageDiscountAdjustment {
2233
2243
  id: string;
2234
2244
 
2235
- adjustment_type: 'usage_discount';
2245
+ adjustment_type: 'percentage_discount';
2246
+
2247
+ /**
2248
+ * The value applied by an adjustment.
2249
+ */
2250
+ amount: string;
2236
2251
 
2237
2252
  /**
2238
2253
  * The price IDs that this adjustment applies to.
@@ -2246,27 +2261,27 @@ export namespace InvoiceFetchUpcomingResponse {
2246
2261
  is_invoice_level: boolean;
2247
2262
 
2248
2263
  /**
2249
- * The plan phase in which this adjustment is active.
2264
+ * The percentage (as a value between 0 and 1) by which to discount the price
2265
+ * intervals this adjustment applies to in a given billing period.
2250
2266
  */
2251
- plan_phase_order: number | null;
2267
+ percentage_discount: number;
2252
2268
 
2253
2269
  /**
2254
2270
  * The reason for the adjustment.
2255
2271
  */
2256
2272
  reason: string | null;
2257
-
2258
- /**
2259
- * The number of usage units by which to discount the price this adjustment applies
2260
- * to in a given billing period.
2261
- */
2262
- usage_discount: number;
2263
2273
  }
2264
2274
 
2265
- export interface MinimumAdjustment {
2275
+ export interface MonetaryMinimumAdjustment {
2266
2276
  id: string;
2267
2277
 
2268
2278
  adjustment_type: 'minimum';
2269
2279
 
2280
+ /**
2281
+ * The value applied by an adjustment.
2282
+ */
2283
+ amount: string;
2284
+
2270
2285
  /**
2271
2286
  * The price IDs that this adjustment applies to.
2272
2287
  */
@@ -2289,22 +2304,22 @@ export namespace InvoiceFetchUpcomingResponse {
2289
2304
  */
2290
2305
  minimum_amount: string;
2291
2306
 
2292
- /**
2293
- * The plan phase in which this adjustment is active.
2294
- */
2295
- plan_phase_order: number | null;
2296
-
2297
2307
  /**
2298
2308
  * The reason for the adjustment.
2299
2309
  */
2300
2310
  reason: string | null;
2301
2311
  }
2302
2312
 
2303
- export interface MaximumAdjustment {
2313
+ export interface MonetaryMaximumAdjustment {
2304
2314
  id: string;
2305
2315
 
2306
2316
  adjustment_type: 'maximum';
2307
2317
 
2318
+ /**
2319
+ * The value applied by an adjustment.
2320
+ */
2321
+ amount: string;
2322
+
2308
2323
  /**
2309
2324
  * The price IDs that this adjustment applies to.
2310
2325
  */
@@ -2322,11 +2337,6 @@ export namespace InvoiceFetchUpcomingResponse {
2322
2337
  */
2323
2338
  maximum_amount: string;
2324
2339
 
2325
- /**
2326
- * The plan phase in which this adjustment is active.
2327
- */
2328
- plan_phase_order: number | null;
2329
-
2330
2340
  /**
2331
2341
  * The reason for the adjustment.
2332
2342
  */
@@ -88,11 +88,11 @@ export interface Plan {
88
88
  * across all phases of the plan.
89
89
  */
90
90
  adjustments: Array<
91
- | Plan.AmountDiscountAdjustment
92
- | Plan.PercentageDiscountAdjustment
93
- | Plan.UsageDiscountAdjustment
94
- | Plan.MinimumAdjustment
95
- | Plan.MaximumAdjustment
91
+ | Plan.PlanPhaseUsageDiscountAdjustment
92
+ | Plan.PlanPhaseAmountDiscountAdjustment
93
+ | Plan.PlanPhasePercentageDiscountAdjustment
94
+ | Plan.PlanPhaseMinimumAdjustment
95
+ | Plan.PlanPhaseMaximumAdjustment
96
96
  >;
97
97
 
98
98
  base_plan: Plan.BasePlan | null;
@@ -179,16 +179,10 @@ export interface Plan {
179
179
  }
180
180
 
181
181
  export namespace Plan {
182
- export interface AmountDiscountAdjustment {
182
+ export interface PlanPhaseUsageDiscountAdjustment {
183
183
  id: string;
184
184
 
185
- adjustment_type: 'amount_discount';
186
-
187
- /**
188
- * The amount by which to discount the prices this adjustment applies to in a given
189
- * billing period.
190
- */
191
- amount_discount: string;
185
+ adjustment_type: 'usage_discount';
192
186
 
193
187
  /**
194
188
  * The price IDs that this adjustment applies to.
@@ -210,12 +204,24 @@ export namespace Plan {
210
204
  * The reason for the adjustment.
211
205
  */
212
206
  reason: string | null;
207
+
208
+ /**
209
+ * The number of usage units by which to discount the price this adjustment applies
210
+ * to in a given billing period.
211
+ */
212
+ usage_discount: number;
213
213
  }
214
214
 
215
- export interface PercentageDiscountAdjustment {
215
+ export interface PlanPhaseAmountDiscountAdjustment {
216
216
  id: string;
217
217
 
218
- adjustment_type: 'percentage_discount';
218
+ adjustment_type: 'amount_discount';
219
+
220
+ /**
221
+ * The amount by which to discount the prices this adjustment applies to in a given
222
+ * billing period.
223
+ */
224
+ amount_discount: string;
219
225
 
220
226
  /**
221
227
  * The price IDs that this adjustment applies to.
@@ -228,12 +234,6 @@ export namespace Plan {
228
234
  */
229
235
  is_invoice_level: boolean;
230
236
 
231
- /**
232
- * The percentage (as a value between 0 and 1) by which to discount the price
233
- * intervals this adjustment applies to in a given billing period.
234
- */
235
- percentage_discount: number;
236
-
237
237
  /**
238
238
  * The plan phase in which this adjustment is active.
239
239
  */
@@ -245,10 +245,10 @@ export namespace Plan {
245
245
  reason: string | null;
246
246
  }
247
247
 
248
- export interface UsageDiscountAdjustment {
248
+ export interface PlanPhasePercentageDiscountAdjustment {
249
249
  id: string;
250
250
 
251
- adjustment_type: 'usage_discount';
251
+ adjustment_type: 'percentage_discount';
252
252
 
253
253
  /**
254
254
  * The price IDs that this adjustment applies to.
@@ -261,6 +261,12 @@ export namespace Plan {
261
261
  */
262
262
  is_invoice_level: boolean;
263
263
 
264
+ /**
265
+ * The percentage (as a value between 0 and 1) by which to discount the price
266
+ * intervals this adjustment applies to in a given billing period.
267
+ */
268
+ percentage_discount: number;
269
+
264
270
  /**
265
271
  * The plan phase in which this adjustment is active.
266
272
  */
@@ -270,15 +276,9 @@ export namespace Plan {
270
276
  * The reason for the adjustment.
271
277
  */
272
278
  reason: string | null;
273
-
274
- /**
275
- * The number of usage units by which to discount the price this adjustment applies
276
- * to in a given billing period.
277
- */
278
- usage_discount: number;
279
279
  }
280
280
 
281
- export interface MinimumAdjustment {
281
+ export interface PlanPhaseMinimumAdjustment {
282
282
  id: string;
283
283
 
284
284
  adjustment_type: 'minimum';
@@ -316,7 +316,7 @@ export namespace Plan {
316
316
  reason: string | null;
317
317
  }
318
318
 
319
- export interface MaximumAdjustment {
319
+ export interface PlanPhaseMaximumAdjustment {
320
320
  id: string;
321
321
 
322
322
  adjustment_type: 'maximum';