@stripe/extensibility-sdk 0.22.4 → 0.24.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/dist/api-surface.d.ts.map +1 -0
- package/dist/config-values/generate.cjs +1 -1
- package/dist/config-values/generate.d.ts +2 -2
- package/dist/config-values/generate.d.ts.map +1 -1
- package/dist/config-values/generate.js +1 -1
- package/dist/extensibility-sdk-alpha.d.ts +1290 -1
- package/dist/extensibility-sdk-beta.d.ts +1290 -1
- package/dist/extensibility-sdk-config-values-internal.d.ts +2 -2
- package/dist/extensibility-sdk-extensions-alpha.d.ts +95 -114
- package/dist/extensibility-sdk-extensions-beta.d.ts +95 -114
- package/dist/extensibility-sdk-extensions-internal.d.ts +106 -147
- package/dist/extensibility-sdk-extensions-public.d.ts +95 -114
- package/dist/extensibility-sdk-internal.d.ts +1301 -1
- package/dist/extensibility-sdk-public.d.ts +1290 -1
- package/dist/extensions/billing/bill/discount_calculation.d.ts +7 -10
- package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
- package/dist/extensions/billing/customer_balance_application.d.ts +7 -9
- package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
- package/dist/extensions/billing/invoice_collection_setting.d.ts +15 -19
- package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -1
- package/dist/extensions/billing/prorations.d.ts +25 -34
- package/dist/extensions/billing/prorations.d.ts.map +1 -1
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +29 -47
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
- package/dist/extensions/billing/types.d.ts +4 -4
- package/dist/extensions/core/workflows/custom_action.d.ts +7 -12
- package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
- package/dist/extensions/extend/workflows/custom_action.d.ts +7 -12
- package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
- package/dist/extensions/index.cjs +0 -2
- package/dist/extensions/index.d.ts +6 -2
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +1 -2
- package/dist/index.cjs +2317 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2320 -0
- package/dist/stdlib/decimal.d.ts +4 -40
- package/dist/stdlib/refs.d.ts +7 -21
- package/dist/stdlib/scalars.d.ts +16 -71
- package/dist/stdlib/type-utils.d.ts +1 -3
- package/dist/stdlib/types.d.ts +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -11
- package/dist/extensibility-sdk-jsonschema-alpha.d.ts +0 -3
- package/dist/extensibility-sdk-jsonschema-beta.d.ts +0 -3
- package/dist/extensibility-sdk-jsonschema-internal.d.ts +0 -15
- package/dist/extensibility-sdk-jsonschema-public.d.ts +0 -3
- package/dist/jsonschema.cjs +0 -18
- package/dist/jsonschema.d.ts +0 -2
- package/dist/jsonschema.d.ts.map +0 -1
- package/dist/jsonschema.js +0 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Import from `@stripe/extensibility-sdk` instead.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Opaque brand symbol used as a property key in SDK branded types.
|
|
3
8
|
*
|
|
@@ -26,15 +31,15 @@ declare const __stripeType: unique symbol;
|
|
|
26
31
|
|
|
27
32
|
/** @public */
|
|
28
33
|
declare type AnyTimeRange = {
|
|
29
|
-
value: 'oneTime';
|
|
30
34
|
at: Date;
|
|
35
|
+
value: 'oneTime';
|
|
31
36
|
} | {
|
|
32
|
-
value: 'timeRange';
|
|
33
|
-
startDate: Date;
|
|
34
37
|
endDate: Date;
|
|
38
|
+
startDate: Date;
|
|
39
|
+
value: 'timeRange';
|
|
35
40
|
} | {
|
|
36
|
-
value: 'other';
|
|
37
41
|
otherValue: string;
|
|
42
|
+
value: 'other';
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
declare namespace Bill {
|
|
@@ -164,22 +169,21 @@ declare namespace CustomAction {
|
|
|
164
169
|
* Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
|
|
165
170
|
* @public
|
|
166
171
|
*/
|
|
167
|
-
type ExecuteFunction<Config
|
|
172
|
+
type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
|
|
168
173
|
/**
|
|
169
174
|
* Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
|
|
170
175
|
* @public
|
|
171
176
|
*/
|
|
172
|
-
type GetFormStateFunction<Config
|
|
177
|
+
type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
173
178
|
}
|
|
174
179
|
|
|
175
180
|
/**
|
|
176
181
|
* @example
|
|
177
182
|
* ```ts
|
|
178
|
-
* import type { Core } from '@stripe/extensibility-sdk
|
|
179
|
-
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
183
|
+
* import type { Core, Context } from '@stripe/extensibility-sdk';
|
|
180
184
|
*
|
|
181
185
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
182
|
-
* interface MyCustomActionConfig
|
|
186
|
+
* interface MyCustomActionConfig {}
|
|
183
187
|
*
|
|
184
188
|
* export default class MyCustomAction implements Core.Workflows
|
|
185
189
|
* .CustomAction<MyCustomActionConfig> {
|
|
@@ -210,7 +214,7 @@ declare namespace CustomAction {
|
|
|
210
214
|
* ```
|
|
211
215
|
* @public
|
|
212
216
|
*/
|
|
213
|
-
declare interface CustomAction<Config
|
|
217
|
+
declare interface CustomAction<Config> {
|
|
214
218
|
execute: CustomAction.ExecuteFunction<Config>;
|
|
215
219
|
getFormState?: CustomAction.GetFormStateFunction<Config>;
|
|
216
220
|
}
|
|
@@ -299,22 +303,21 @@ declare namespace CustomAction_2 {
|
|
|
299
303
|
* Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
|
|
300
304
|
* @public
|
|
301
305
|
*/
|
|
302
|
-
type ExecuteFunction<Config
|
|
306
|
+
type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
|
|
303
307
|
/**
|
|
304
308
|
* Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
|
|
305
309
|
* @public
|
|
306
310
|
*/
|
|
307
|
-
type GetFormStateFunction<Config
|
|
311
|
+
type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
308
312
|
}
|
|
309
313
|
|
|
310
314
|
/**
|
|
311
315
|
* @example
|
|
312
316
|
* ```ts
|
|
313
|
-
* import type { Extend } from '@stripe/extensibility-sdk
|
|
314
|
-
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
317
|
+
* import type { Extend, Context } from '@stripe/extensibility-sdk';
|
|
315
318
|
*
|
|
316
319
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
317
|
-
* interface MyCustomActionConfig
|
|
320
|
+
* interface MyCustomActionConfig {}
|
|
318
321
|
*
|
|
319
322
|
* export default class MyCustomAction implements Extend.Workflows
|
|
320
323
|
* .CustomAction<MyCustomActionConfig> {
|
|
@@ -345,7 +348,7 @@ declare namespace CustomAction_2 {
|
|
|
345
348
|
* ```
|
|
346
349
|
* @public
|
|
347
350
|
*/
|
|
348
|
-
declare interface CustomAction_2<Config
|
|
351
|
+
declare interface CustomAction_2<Config> {
|
|
349
352
|
execute: CustomAction_2.ExecuteFunction<Config>;
|
|
350
353
|
getFormState?: CustomAction_2.GetFormStateFunction<Config>;
|
|
351
354
|
}
|
|
@@ -395,21 +398,21 @@ declare namespace CustomerBalanceApplication {
|
|
|
395
398
|
* Determines how much of the customer's balance to apply toward a bill total. The script receives the invoice total and current customer balance, then returns how much of that balance to apply.
|
|
396
399
|
* @public
|
|
397
400
|
*/
|
|
398
|
-
type ComputeAppliedCustomerBalanceFunction<Config
|
|
401
|
+
type ComputeAppliedCustomerBalanceFunction<Config> = (request: CustomerBalanceApplicationInput, config: Config, context: Context) => CustomerBalanceApplicationResult;
|
|
399
402
|
}
|
|
400
403
|
|
|
401
404
|
/**
|
|
402
405
|
* @example
|
|
403
406
|
* ```ts
|
|
404
|
-
* import type { Billing, Context } from '@stripe/extensibility-sdk
|
|
407
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
405
408
|
*
|
|
406
409
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
407
|
-
* interface
|
|
410
|
+
* interface MyBalanceAppConfig {}
|
|
408
411
|
*
|
|
409
|
-
* export default class
|
|
412
|
+
* export default class MyBalanceApp implements Billing.CustomerBalanceApplication<MyBalanceAppConfig> {
|
|
410
413
|
* computeAppliedCustomerBalance(
|
|
411
414
|
* request: Billing.CustomerBalanceApplication.CustomerBalanceApplicationInput,
|
|
412
|
-
* _config:
|
|
415
|
+
* _config: MyBalanceAppConfig,
|
|
413
416
|
* _context: Context
|
|
414
417
|
* ) {
|
|
415
418
|
* // TODO: implement your customer balance logic here
|
|
@@ -423,7 +426,7 @@ declare namespace CustomerBalanceApplication {
|
|
|
423
426
|
* ```
|
|
424
427
|
* @public
|
|
425
428
|
*/
|
|
426
|
-
declare interface CustomerBalanceApplication<Config
|
|
429
|
+
declare interface CustomerBalanceApplication<Config> {
|
|
427
430
|
computeAppliedCustomerBalance: CustomerBalanceApplication.ComputeAppliedCustomerBalanceFunction<Config>;
|
|
428
431
|
}
|
|
429
432
|
|
|
@@ -643,7 +646,7 @@ export declare const DecimalRoundingPresets: Readonly<{
|
|
|
643
646
|
/** @public */
|
|
644
647
|
declare namespace DiscountCalculation {
|
|
645
648
|
/** @public */
|
|
646
|
-
type BillingReason = 'automatic_pending_invoice_item_invoice' | 'manual' | '
|
|
649
|
+
type BillingReason = 'automatic_pending_invoice_item_invoice' | 'manual' | 'quote_accept' | 'subscription_cancel' | 'subscription_create' | 'subscription_cycle' | 'subscription_threshold' | 'subscription_trial_ended' | 'subscription_update' | 'subscription' | 'upcoming';
|
|
647
650
|
/** @public */
|
|
648
651
|
type PricingTierMode = 'graduated' | 'volume';
|
|
649
652
|
/** @public */
|
|
@@ -653,7 +656,7 @@ declare namespace DiscountCalculation {
|
|
|
653
656
|
/** @public */
|
|
654
657
|
type UsageType = 'licensed' | 'metered';
|
|
655
658
|
/** @public */
|
|
656
|
-
type RecurringPriceInterval = 'day' | '
|
|
659
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
657
660
|
/**
|
|
658
661
|
* The result of a discount calculation.
|
|
659
662
|
* @public
|
|
@@ -827,17 +830,16 @@ declare namespace DiscountCalculation {
|
|
|
827
830
|
* Computes discount amounts for a discountable item and returns a discount result.
|
|
828
831
|
* @public
|
|
829
832
|
*/
|
|
830
|
-
type ComputeDiscountsFunction<Config
|
|
833
|
+
type ComputeDiscountsFunction<Config> = (request: DiscountableItem, config: Config, context: Context) => DiscountResult;
|
|
831
834
|
}
|
|
832
835
|
|
|
833
836
|
/**
|
|
834
837
|
* @example
|
|
835
838
|
* ```ts
|
|
836
|
-
* import type { Billing } from '@stripe/extensibility-sdk
|
|
837
|
-
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
839
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
838
840
|
*
|
|
839
841
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
840
|
-
* interface MyDiscountCalculationConfig
|
|
842
|
+
* interface MyDiscountCalculationConfig {}
|
|
841
843
|
*
|
|
842
844
|
* export default class MyDiscountCalculation implements Billing.Bill
|
|
843
845
|
* .DiscountCalculation<MyDiscountCalculationConfig> {
|
|
@@ -857,7 +859,7 @@ declare namespace DiscountCalculation {
|
|
|
857
859
|
* ```
|
|
858
860
|
* @public
|
|
859
861
|
*/
|
|
860
|
-
declare interface DiscountCalculation<Config
|
|
862
|
+
declare interface DiscountCalculation<Config> {
|
|
861
863
|
computeDiscounts: DiscountCalculation.ComputeDiscountsFunction<Config>;
|
|
862
864
|
}
|
|
863
865
|
|
|
@@ -871,11 +873,11 @@ export { Extend }
|
|
|
871
873
|
/** @public */
|
|
872
874
|
declare namespace InvoiceCollectionSetting {
|
|
873
875
|
/** @public */
|
|
874
|
-
type ParentType = '
|
|
876
|
+
type ParentType = 'billing_cadence' | 'contract' | 'quote' | 'standalone' | 'subscription_schedule' | 'subscription';
|
|
875
877
|
/** @public */
|
|
876
|
-
type PaymentMethodType = '
|
|
878
|
+
type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'boleto' | 'card' | 'cashapp' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'klarna' | 'konbini' | 'link' | 'multibanco' | 'oxxo' | 'p24' | 'paynow' | 'paypal' | 'promptpay' | 'sepa_credit_transfer' | 'sepa_debit' | 'sofort' | 'us_bank_account' | 'wechat_pay';
|
|
877
879
|
/** @public */
|
|
878
|
-
type CollectionMethod = '
|
|
880
|
+
type CollectionMethod = 'charge_automatically' | 'send_invoice';
|
|
879
881
|
/**
|
|
880
882
|
* The result of the invoice collection settings override extension.
|
|
881
883
|
* @public
|
|
@@ -885,18 +887,16 @@ declare namespace InvoiceCollectionSetting {
|
|
|
885
887
|
autoAdvance?: boolean;
|
|
886
888
|
}
|
|
887
889
|
/** @public */
|
|
888
|
-
type InvoiceCollectionRequest = {
|
|
889
|
-
/** The current collection settings that would be applied to the invoice. */
|
|
890
|
-
collectionSettings: CollectionSettings;
|
|
891
|
-
/** The billing resource that triggered invoice creation. */
|
|
892
|
-
parent: Parent;
|
|
893
|
-
} & ({
|
|
894
|
-
payer: 'customer';
|
|
890
|
+
type InvoiceCollectionRequest = ({
|
|
895
891
|
customer: Customer;
|
|
892
|
+
payer: 'customer';
|
|
896
893
|
} | {
|
|
897
|
-
payer: 'other';
|
|
898
894
|
otherPayer: string;
|
|
899
|
-
|
|
895
|
+
payer: 'other';
|
|
896
|
+
}) & {
|
|
897
|
+
collectionSettings: CollectionSettings;
|
|
898
|
+
parent: Parent;
|
|
899
|
+
};
|
|
900
900
|
/** @public */
|
|
901
901
|
interface Customer {
|
|
902
902
|
id: string;
|
|
@@ -951,16 +951,16 @@ declare namespace InvoiceCollectionSetting {
|
|
|
951
951
|
* Overrides invoice collection settings before a draft invoice is created.
|
|
952
952
|
* @public
|
|
953
953
|
*/
|
|
954
|
-
type CollectionOverrideFunction<Config
|
|
954
|
+
type CollectionOverrideFunction<Config> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
|
|
955
955
|
}
|
|
956
956
|
|
|
957
957
|
/**
|
|
958
958
|
* @example
|
|
959
959
|
* ```ts
|
|
960
|
-
* import type { Billing, Context } from '@stripe/extensibility-sdk
|
|
960
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
961
961
|
*
|
|
962
962
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
963
|
-
* interface MyInvoiceCollectionSettingConfig
|
|
963
|
+
* interface MyInvoiceCollectionSettingConfig {}
|
|
964
964
|
*
|
|
965
965
|
* export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
|
|
966
966
|
* collectionOverride(
|
|
@@ -977,7 +977,7 @@ declare namespace InvoiceCollectionSetting {
|
|
|
977
977
|
* ```
|
|
978
978
|
* @public
|
|
979
979
|
*/
|
|
980
|
-
declare interface InvoiceCollectionSetting<Config
|
|
980
|
+
declare interface InvoiceCollectionSetting<Config> {
|
|
981
981
|
collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
|
|
982
982
|
}
|
|
983
983
|
|
|
@@ -1017,7 +1017,7 @@ declare namespace Prorations {
|
|
|
1017
1017
|
/** @public */
|
|
1018
1018
|
type PricingTierMode = 'graduated' | 'volume';
|
|
1019
1019
|
/** @public */
|
|
1020
|
-
type RecurringPriceInterval = 'day' | '
|
|
1020
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
1021
1021
|
/** @public */
|
|
1022
1022
|
type PriceType = 'one_time' | 'recurring';
|
|
1023
1023
|
/** @public */
|
|
@@ -1055,37 +1055,30 @@ declare namespace Prorations {
|
|
|
1055
1055
|
items: ProratableItem[];
|
|
1056
1056
|
}
|
|
1057
1057
|
/** @public */
|
|
1058
|
-
type ProratableItem = {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
/** Either CREDIT or DEBIT based on whether the item is a credit or debit. */
|
|
1062
|
-
type: ItemType;
|
|
1063
|
-
/** Whether the item was generated from a proration event. */
|
|
1064
|
-
isProration: boolean;
|
|
1065
|
-
/** The time period this item covers. */
|
|
1066
|
-
servicePeriod: TimeRange;
|
|
1067
|
-
/** The default proration factor calculated by Stripe. */
|
|
1068
|
-
currentProrationFactor: Decimal;
|
|
1069
|
-
/** The duration of the price interval in seconds. */
|
|
1070
|
-
priceIntervalDuration: number;
|
|
1071
|
-
/** Information about the corresponding debit that a CREDIT item credits against. */
|
|
1072
|
-
correspondingDebit?: PreviousDebit;
|
|
1073
|
-
} & ({
|
|
1074
|
-
priceKind: 'price';
|
|
1075
|
-
price: Price;
|
|
1058
|
+
type ProratableItem = ({
|
|
1059
|
+
customPricingUnitOverageRate: CustomPricingUnitOverageRate;
|
|
1060
|
+
priceKind: 'customPricingUnitOverageRate';
|
|
1076
1061
|
} | {
|
|
1077
|
-
priceKind: 'licenseFee';
|
|
1078
1062
|
licenseFee: LicenseFee;
|
|
1063
|
+
priceKind: 'licenseFee';
|
|
1079
1064
|
} | {
|
|
1080
|
-
|
|
1081
|
-
|
|
1065
|
+
otherPriceKind: string;
|
|
1066
|
+
priceKind: 'other';
|
|
1082
1067
|
} | {
|
|
1083
|
-
|
|
1084
|
-
|
|
1068
|
+
price: Price;
|
|
1069
|
+
priceKind: 'price';
|
|
1085
1070
|
} | {
|
|
1086
|
-
priceKind: '
|
|
1087
|
-
|
|
1088
|
-
})
|
|
1071
|
+
priceKind: 'rateCardRate';
|
|
1072
|
+
rateCardRate: RateCardRate;
|
|
1073
|
+
}) & {
|
|
1074
|
+
correspondingDebit?: PreviousDebit;
|
|
1075
|
+
currentProrationFactor: Decimal;
|
|
1076
|
+
isProration: boolean;
|
|
1077
|
+
key: string;
|
|
1078
|
+
priceIntervalDuration: number;
|
|
1079
|
+
servicePeriod: TimeRange;
|
|
1080
|
+
type: ItemType;
|
|
1081
|
+
};
|
|
1089
1082
|
/**
|
|
1090
1083
|
* Information about a previous debit that a credit item offsets.
|
|
1091
1084
|
* @public
|
|
@@ -1197,16 +1190,16 @@ declare namespace Prorations {
|
|
|
1197
1190
|
* Calculates prorated amounts for subscription items when changes occur mid-billing period. The script receives the invoice items, then returns computed proration factors for each item.
|
|
1198
1191
|
* @public
|
|
1199
1192
|
*/
|
|
1200
|
-
type ProrateItemsFunction<Config
|
|
1193
|
+
type ProrateItemsFunction<Config> = (request: ProrateItemsInput, config: Config, context: Context) => ProrateItemsResult;
|
|
1201
1194
|
}
|
|
1202
1195
|
|
|
1203
1196
|
/**
|
|
1204
1197
|
* @example
|
|
1205
1198
|
* ```ts
|
|
1206
|
-
* import type { Billing, Context } from '@stripe/extensibility-sdk
|
|
1199
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
1207
1200
|
*
|
|
1208
1201
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1209
|
-
* interface MyProrationsConfig
|
|
1202
|
+
* interface MyProrationsConfig {}
|
|
1210
1203
|
*
|
|
1211
1204
|
* export default class MyProrations implements Billing.Prorations<MyProrationsConfig> {
|
|
1212
1205
|
* prorateItems(
|
|
@@ -1225,7 +1218,7 @@ declare namespace Prorations {
|
|
|
1225
1218
|
* ```
|
|
1226
1219
|
* @public
|
|
1227
1220
|
*/
|
|
1228
|
-
declare interface Prorations<Config
|
|
1221
|
+
declare interface Prorations<Config> {
|
|
1229
1222
|
prorateItems: Prorations.ProrateItemsFunction<Config>;
|
|
1230
1223
|
}
|
|
1231
1224
|
|
|
@@ -1234,7 +1227,7 @@ declare namespace RecurringBillingItemHandling {
|
|
|
1234
1227
|
/** @public */
|
|
1235
1228
|
type PricingTierMode = 'graduated' | 'volume';
|
|
1236
1229
|
/** @public */
|
|
1237
|
-
type RecurringPriceInterval = 'day' | '
|
|
1230
|
+
type RecurringPriceInterval = 'day' | 'month' | 'week' | 'year';
|
|
1238
1231
|
/** @public */
|
|
1239
1232
|
type PriceType = 'one_time' | 'recurring';
|
|
1240
1233
|
/** @public */
|
|
@@ -1278,33 +1271,28 @@ declare namespace RecurringBillingItemHandling {
|
|
|
1278
1271
|
items: Item[];
|
|
1279
1272
|
}
|
|
1280
1273
|
/** @public */
|
|
1281
|
-
type Item = {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
/** Either CREDIT or DEBIT based on whether the item is a credit or debit. */
|
|
1285
|
-
type: ItemType;
|
|
1286
|
-
/** Whether the item was generated from a proration event. */
|
|
1287
|
-
isProration: boolean;
|
|
1288
|
-
/** The time period this item covers. */
|
|
1289
|
-
servicePeriod: AnyTimeRange;
|
|
1290
|
-
/** The proration factor for this item. */
|
|
1291
|
-
prorationFactor: Decimal;
|
|
1292
|
-
} & ({
|
|
1293
|
-
priceKind: 'price';
|
|
1294
|
-
price: Price;
|
|
1274
|
+
type Item = ({
|
|
1275
|
+
customPricingUnitOverageRate: CustomPricingUnitOverageRate;
|
|
1276
|
+
priceKind: 'customPricingUnitOverageRate';
|
|
1295
1277
|
} | {
|
|
1296
|
-
priceKind: 'licenseFee';
|
|
1297
1278
|
licenseFee: LicenseFee;
|
|
1279
|
+
priceKind: 'licenseFee';
|
|
1298
1280
|
} | {
|
|
1299
|
-
|
|
1300
|
-
|
|
1281
|
+
otherPriceKind: string;
|
|
1282
|
+
priceKind: 'other';
|
|
1301
1283
|
} | {
|
|
1302
|
-
|
|
1303
|
-
|
|
1284
|
+
price: Price;
|
|
1285
|
+
priceKind: 'price';
|
|
1304
1286
|
} | {
|
|
1305
|
-
priceKind: '
|
|
1306
|
-
|
|
1307
|
-
})
|
|
1287
|
+
priceKind: 'rateCardRate';
|
|
1288
|
+
rateCardRate: RateCardRate;
|
|
1289
|
+
}) & {
|
|
1290
|
+
isProration: boolean;
|
|
1291
|
+
key: string;
|
|
1292
|
+
prorationFactor: Decimal;
|
|
1293
|
+
servicePeriod: AnyTimeRange;
|
|
1294
|
+
type: ItemType;
|
|
1295
|
+
};
|
|
1308
1296
|
/** @public */
|
|
1309
1297
|
interface CustomPricingUnitOverageRate {
|
|
1310
1298
|
id: string;
|
|
@@ -1416,17 +1404,10 @@ declare namespace RecurringBillingItemHandling {
|
|
|
1416
1404
|
items: ItemWithCreationStrategy[];
|
|
1417
1405
|
}
|
|
1418
1406
|
/** @public */
|
|
1419
|
-
type ItemWithCreationStrategy = {
|
|
1420
|
-
/** The unique identifier of the item, matching a key from the input. */
|
|
1421
|
-
key: string;
|
|
1422
|
-
} & ({
|
|
1423
|
-
creationStrategy: 'doNotCreate';
|
|
1424
|
-
} | {
|
|
1425
|
-
creationStrategy: 'invoice';
|
|
1426
|
-
} | {
|
|
1407
|
+
type ItemWithCreationStrategy = ({
|
|
1427
1408
|
creationStrategy: 'other';
|
|
1428
1409
|
otherCreationStrategy: string;
|
|
1429
|
-
});
|
|
1410
|
+
} | { creationStrategy: 'doNotCreate' } | { creationStrategy: 'invoice' }) & { key: string };
|
|
1430
1411
|
/** @public */
|
|
1431
1412
|
type Invoice = Record<string, never>;
|
|
1432
1413
|
/** @public */
|
|
@@ -1476,26 +1457,26 @@ declare namespace RecurringBillingItemHandling {
|
|
|
1476
1457
|
* Runs before invoice items are created. Decides whether each item should be created or skipped.
|
|
1477
1458
|
* @public
|
|
1478
1459
|
*/
|
|
1479
|
-
type BeforeItemCreationFunction<Config
|
|
1460
|
+
type BeforeItemCreationFunction<Config> = (request: BeforeItemCreationInput, config: Config, context: Context) => BeforeItemCreationResult;
|
|
1480
1461
|
/**
|
|
1481
1462
|
* Runs before invoices are created. Decides which items to include on the invoice. Items not included are deferred as pending invoice items.
|
|
1482
1463
|
* @public
|
|
1483
1464
|
*/
|
|
1484
|
-
type FilterItemsFunction<Config
|
|
1465
|
+
type FilterItemsFunction<Config> = (request: FilterItemsInput, config: Config, context: Context) => FilterItemsResult;
|
|
1485
1466
|
/**
|
|
1486
1467
|
* Runs before invoices are created. Decides how items are grouped across one or more invoices.
|
|
1487
1468
|
* @public
|
|
1488
1469
|
*/
|
|
1489
|
-
type GroupItemsFunction<Config
|
|
1470
|
+
type GroupItemsFunction<Config> = (request: GroupItemsInput, config: Config, context: Context) => GroupItemsResult;
|
|
1490
1471
|
}
|
|
1491
1472
|
|
|
1492
1473
|
/**
|
|
1493
1474
|
* @example
|
|
1494
1475
|
* ```ts
|
|
1495
|
-
* import type { Billing, Context } from '@stripe/extensibility-sdk
|
|
1476
|
+
* import type { Billing, Context } from '@stripe/extensibility-sdk';
|
|
1496
1477
|
*
|
|
1497
1478
|
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
1498
|
-
* interface MyRecurringBillingItemHandlingConfig
|
|
1479
|
+
* interface MyRecurringBillingItemHandlingConfig {}
|
|
1499
1480
|
*
|
|
1500
1481
|
* export default class MyRecurringBillingItemHandling implements Billing.RecurringBillingItemHandling<MyRecurringBillingItemHandlingConfig> {
|
|
1501
1482
|
* beforeItemCreation(
|
|
@@ -1538,7 +1519,7 @@ declare namespace RecurringBillingItemHandling {
|
|
|
1538
1519
|
* ```
|
|
1539
1520
|
* @public
|
|
1540
1521
|
*/
|
|
1541
|
-
declare interface RecurringBillingItemHandling<Config
|
|
1522
|
+
declare interface RecurringBillingItemHandling<Config> {
|
|
1542
1523
|
beforeItemCreation: RecurringBillingItemHandling.BeforeItemCreationFunction<Config>;
|
|
1543
1524
|
filterItems: RecurringBillingItemHandling.FilterItemsFunction<Config>;
|
|
1544
1525
|
groupItems: RecurringBillingItemHandling.GroupItemsFunction<Config>;
|