@stripe/extensibility-sdk 0.22.4

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 (113) hide show
  1. package/LICENSE.md +19 -0
  2. package/dist/config-values/generate.cjs +262 -0
  3. package/dist/config-values/generate.d.ts +38 -0
  4. package/dist/config-values/generate.d.ts.map +1 -0
  5. package/dist/config-values/generate.js +232 -0
  6. package/dist/config-values/parse.d.ts +87 -0
  7. package/dist/config-values/parse.d.ts.map +1 -0
  8. package/dist/extensibility-sdk-alpha.d.ts +542 -0
  9. package/dist/extensibility-sdk-beta.d.ts +542 -0
  10. package/dist/extensibility-sdk-config-values-alpha.d.ts +27 -0
  11. package/dist/extensibility-sdk-config-values-beta.d.ts +27 -0
  12. package/dist/extensibility-sdk-config-values-internal.d.ts +118 -0
  13. package/dist/extensibility-sdk-config-values-public.d.ts +27 -0
  14. package/dist/extensibility-sdk-extensions-alpha.d.ts +1592 -0
  15. package/dist/extensibility-sdk-extensions-beta.d.ts +1592 -0
  16. package/dist/extensibility-sdk-extensions-internal.d.ts +1655 -0
  17. package/dist/extensibility-sdk-extensions-public.d.ts +1592 -0
  18. package/dist/extensibility-sdk-internal-alpha.d.ts +9 -0
  19. package/dist/extensibility-sdk-internal-beta.d.ts +9 -0
  20. package/dist/extensibility-sdk-internal-internal.d.ts +23 -0
  21. package/dist/extensibility-sdk-internal-public.d.ts +9 -0
  22. package/dist/extensibility-sdk-internal.d.ts +915 -0
  23. package/dist/extensibility-sdk-jsonschema-alpha.d.ts +3 -0
  24. package/dist/extensibility-sdk-jsonschema-beta.d.ts +3 -0
  25. package/dist/extensibility-sdk-jsonschema-internal.d.ts +15 -0
  26. package/dist/extensibility-sdk-jsonschema-public.d.ts +3 -0
  27. package/dist/extensibility-sdk-public.d.ts +542 -0
  28. package/dist/extensibility-sdk-stdlib-alpha.d.ts +531 -0
  29. package/dist/extensibility-sdk-stdlib-beta.d.ts +531 -0
  30. package/dist/extensibility-sdk-stdlib-internal.d.ts +904 -0
  31. package/dist/extensibility-sdk-stdlib-public.d.ts +531 -0
  32. package/dist/extensions/billing/bill/discount_calculation.d.ts +226 -0
  33. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
  34. package/dist/extensions/billing/bill/index.d.ts +2 -0
  35. package/dist/extensions/billing/bill/index.d.ts.map +1 -0
  36. package/dist/extensions/billing/customer_balance_application.d.ts +82 -0
  37. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -0
  38. package/dist/extensions/billing/index.d.ts +8 -0
  39. package/dist/extensions/billing/index.d.ts.map +1 -0
  40. package/dist/extensions/billing/invoice_collection_setting.d.ts +117 -0
  41. package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
  42. package/dist/extensions/billing/prorations.d.ts +222 -0
  43. package/dist/extensions/billing/prorations.d.ts.map +1 -0
  44. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
  45. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
  46. package/dist/extensions/billing/types.d.ts +33 -0
  47. package/dist/extensions/billing/types.d.ts.map +1 -0
  48. package/dist/extensions/context.d.ts +9 -0
  49. package/dist/extensions/context.d.ts.map +1 -0
  50. package/dist/extensions/core/index.d.ts +3 -0
  51. package/dist/extensions/core/index.d.ts.map +1 -0
  52. package/dist/extensions/core/workflows/custom_action.d.ts +142 -0
  53. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -0
  54. package/dist/extensions/core/workflows/index.d.ts +2 -0
  55. package/dist/extensions/core/workflows/index.d.ts.map +1 -0
  56. package/dist/extensions/extend/index.d.ts +3 -0
  57. package/dist/extensions/extend/index.d.ts.map +1 -0
  58. package/dist/extensions/extend/workflows/custom_action.d.ts +142 -0
  59. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -0
  60. package/dist/extensions/extend/workflows/index.d.ts +2 -0
  61. package/dist/extensions/extend/workflows/index.d.ts.map +1 -0
  62. package/dist/extensions/index.cjs +2356 -0
  63. package/dist/extensions/index.d.ts +9 -0
  64. package/dist/extensions/index.d.ts.map +1 -0
  65. package/dist/extensions/index.js +2435 -0
  66. package/dist/extensions/registry.d.ts +19 -0
  67. package/dist/extensions/registry.d.ts.map +1 -0
  68. package/dist/extensions/types.d.ts +10 -0
  69. package/dist/extensions/types.d.ts.map +1 -0
  70. package/dist/index.cjs +1519 -0
  71. package/dist/index.d.ts +12 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +1460 -0
  74. package/dist/internal.cjs +156 -0
  75. package/dist/internal.d.ts +3 -0
  76. package/dist/internal.d.ts.map +1 -0
  77. package/dist/internal.js +128 -0
  78. package/dist/jsonschema.cjs +18 -0
  79. package/dist/jsonschema.d.ts +2 -0
  80. package/dist/jsonschema.d.ts.map +1 -0
  81. package/dist/jsonschema.js +0 -0
  82. package/dist/stdlib/brand.d.ts +27 -0
  83. package/dist/stdlib/brand.d.ts.map +1 -0
  84. package/dist/stdlib/decimal.d.ts +324 -0
  85. package/dist/stdlib/decimal.d.ts.map +1 -0
  86. package/dist/stdlib/extension-method.d.ts +27 -0
  87. package/dist/stdlib/extension-method.d.ts.map +1 -0
  88. package/dist/stdlib/generated.d.ts +15 -0
  89. package/dist/stdlib/generated.d.ts.map +1 -0
  90. package/dist/stdlib/index.cjs +1519 -0
  91. package/dist/stdlib/index.d.ts +18 -0
  92. package/dist/stdlib/index.d.ts.map +1 -0
  93. package/dist/stdlib/index.js +1460 -0
  94. package/dist/stdlib/refs.d.ts +62 -0
  95. package/dist/stdlib/refs.d.ts.map +1 -0
  96. package/dist/stdlib/scalars.d.ts +141 -0
  97. package/dist/stdlib/scalars.d.ts.map +1 -0
  98. package/dist/stdlib/transform-strategies.d.ts +74 -0
  99. package/dist/stdlib/transform-strategies.d.ts.map +1 -0
  100. package/dist/stdlib/transforms.d.ts +97 -0
  101. package/dist/stdlib/transforms.d.ts.map +1 -0
  102. package/dist/stdlib/type-utils.d.ts +9 -0
  103. package/dist/stdlib/type-utils.d.ts.map +1 -0
  104. package/dist/stdlib/types.d.ts +281 -0
  105. package/dist/stdlib/types.d.ts.map +1 -0
  106. package/dist/stdlib/utils.d.ts +7 -0
  107. package/dist/stdlib/utils.d.ts.map +1 -0
  108. package/dist/tsconfig.build.tsbuildinfo +1 -0
  109. package/package.json +111 -0
  110. package/tslibs/5.9.3/lib.es2022.egress.d.ts +4328 -0
  111. package/tslibs/5.9.3/lib.es2022.restricted.d.ts +4067 -0
  112. package/tslibs/lib.egress.globals.d.ts +112 -0
  113. package/tslibs/lib.restricted.globals.d.ts +1 -0
@@ -0,0 +1,226 @@
1
+ import type { Context } from '../../context.js';
2
+ import type { AnyTimeRange, MonetaryAmount } from '../types.js';
3
+ import type { Decimal, _ConfigApplicationContext } from '../../../stdlib/index.js';
4
+ /** @public */
5
+ export declare namespace DiscountCalculation {
6
+ /** @public */
7
+ type BillingReason = 'automatic_pending_invoice_item_invoice' | 'manual' | 'subscription' | 'subscription_create' | 'subscription_cycle' | 'subscription_cancel' | 'subscription_threshold' | 'subscription_trial_ended' | 'subscription_update' | 'upcoming' | 'quote_accept';
8
+ /** @public */
9
+ type PricingTierMode = 'graduated' | 'volume';
10
+ /** @public */
11
+ type PriceType = 'one_time' | 'recurring';
12
+ /** @public */
13
+ type PricingScheme = 'per_unit' | 'tiered';
14
+ /** @public */
15
+ type UsageType = 'licensed' | 'metered';
16
+ /** @public */
17
+ type RecurringPriceInterval = 'day' | 'week' | 'month' | 'year';
18
+ /**
19
+ * The result of a discount calculation.
20
+ * @public
21
+ */
22
+ interface DiscountResult {
23
+ /** The computed discount to apply. */
24
+ discount: Discount;
25
+ }
26
+ /**
27
+ * A discount to apply to a discountable item.
28
+ * @public
29
+ */
30
+ interface Discount {
31
+ /** The discount amount to subtract from the discountable item. */
32
+ amount: MonetaryAmount;
33
+ }
34
+ /**
35
+ * An item eligible for discount calculation, containing its line items and billing context.
36
+ * @public
37
+ */
38
+ interface DiscountableItem {
39
+ /** The individual line items that make up the discountable item. */
40
+ lineItems: DiscountableLineItem[];
41
+ /** The total gross amount of the discountable item before any discounts. */
42
+ grossAmount: MonetaryAmount;
43
+ /** The customer associated with the discountable item. */
44
+ customer?: Customer;
45
+ /** The reason this item is being billed. */
46
+ billingReason?: BillingReason;
47
+ /** The subscription associated with the discountable item. */
48
+ subscription?: Subscription;
49
+ }
50
+ /**
51
+ * The subscription associated with the discountable item.
52
+ * @public
53
+ */
54
+ interface Subscription {
55
+ /** The unique identifier of the subscription. */
56
+ id: string;
57
+ /** The Unix timestamp of the billing cycle anchor. */
58
+ billingCycleAnchor?: number;
59
+ /** The structured billing cycle anchor configuration. */
60
+ billingCycleAnchorConfig?: BillingCycleAnchorConfig;
61
+ /** Custom key-value pairs attached to the subscription. */
62
+ metadata: Record<string, string>;
63
+ }
64
+ /**
65
+ * Configuration for the billing cycle anchor, specifying when recurring billing periods start.
66
+ * @public
67
+ */
68
+ interface BillingCycleAnchorConfig {
69
+ /** The month component of the billing cycle anchor. */
70
+ month: number;
71
+ /** The day of the month for the billing cycle anchor. */
72
+ dayOfMonth: number;
73
+ /** The hour component of the billing cycle anchor. */
74
+ hour: number;
75
+ /** The minute component of the billing cycle anchor. */
76
+ minute: number;
77
+ /** The second component of the billing cycle anchor. */
78
+ second: number;
79
+ }
80
+ /**
81
+ * The customer associated with the discountable item.
82
+ * @public
83
+ */
84
+ interface Customer {
85
+ /** The unique identifier of the customer. */
86
+ id: string;
87
+ /** Custom key-value pairs attached to the customer. */
88
+ metadata: Record<string, string>;
89
+ }
90
+ /**
91
+ * A single line item within a discountable item.
92
+ * @public
93
+ */
94
+ interface DiscountableLineItem {
95
+ /** The subtotal amount of this line item. */
96
+ subtotal: MonetaryAmount;
97
+ /** The quantity of this line item. */
98
+ quantity?: Decimal;
99
+ /** The billing period this line item covers. */
100
+ period: AnyTimeRange;
101
+ /** The price information for this line item. */
102
+ price?: Price;
103
+ }
104
+ /**
105
+ * The price associated with a line item.
106
+ * @public
107
+ */
108
+ interface Price {
109
+ /** The unique identifier for the price. */
110
+ id: string;
111
+ /** The product this price belongs to. */
112
+ product?: Product;
113
+ /** The recurring pricing configuration, if applicable. */
114
+ recurring?: RecurringPrice;
115
+ /** The billing scheme, either per-unit or tiered. */
116
+ billingScheme?: PricingScheme;
117
+ /** The pricing tiers, applicable for tiered billing schemes. */
118
+ tiers: PriceTier[];
119
+ /** The price type, either one-time or recurring. */
120
+ type?: PriceType;
121
+ /** The tiering mode, either graduated or volume. */
122
+ tiersMode?: PricingTierMode;
123
+ /** Key-value metadata attached to the price. */
124
+ metadata: Record<string, string>;
125
+ /** The unit amount of the price. */
126
+ unitAmount?: Decimal;
127
+ }
128
+ /**
129
+ * A tier within a tiered pricing structure.
130
+ * @public
131
+ */
132
+ interface PriceTier {
133
+ /** The flat fee charged for this tier. */
134
+ flatAmount?: Decimal;
135
+ /** The per-unit price for this tier. */
136
+ unitAmount?: Decimal;
137
+ /** The upper bound of the tier range. */
138
+ upTo?: Decimal;
139
+ }
140
+ /**
141
+ * The recurring pricing configuration for a price.
142
+ * @public
143
+ */
144
+ interface RecurringPrice {
145
+ /** The billing interval for the recurring price. */
146
+ interval: RecurringPriceInterval;
147
+ /** The number of intervals between each billing cycle. */
148
+ intervalCount: number;
149
+ /** The usage type, either licensed or metered. */
150
+ usageType?: UsageType;
151
+ /** The identifier of the meter tracking usage for this price. */
152
+ meter?: string;
153
+ }
154
+ /**
155
+ * The product associated with a price.
156
+ * @public
157
+ */
158
+ interface Product {
159
+ /** The unique identifier of the product. */
160
+ id: string;
161
+ /** The name of the product. */
162
+ name: string;
163
+ /** Custom key-value pairs attached to the product. */
164
+ metadata: Record<string, string>;
165
+ }
166
+ /**
167
+ * @public
168
+ * @deprecated Platform dispatch handles wire/SDK conversion.
169
+ */
170
+ function prepareArgsComputeDiscounts(proto: unknown): DiscountableItem;
171
+ /**
172
+ * @public
173
+ * @deprecated Platform dispatch handles wire/SDK conversion.
174
+ */
175
+ function prepareResultComputeDiscounts(result: DiscountResult): DiscountResult;
176
+ /** @internal */
177
+ function $platformWrapComputeDiscounts(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
178
+ computeDiscounts(...a: unknown[]): unknown;
179
+ }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
180
+ /**
181
+ * @public
182
+ * @deprecated Platform dispatch handles wire/SDK conversion.
183
+ */
184
+ const prepareArgs: typeof prepareArgsComputeDiscounts;
185
+ /**
186
+ * @public
187
+ * @deprecated Platform dispatch handles wire/SDK conversion.
188
+ */
189
+ const prepareResult: typeof prepareResultComputeDiscounts;
190
+ /**
191
+ * Computes discount amounts for a discountable item and returns a discount result.
192
+ * @public
193
+ */
194
+ type ComputeDiscountsFunction<Config extends Record<string, unknown>> = (request: DiscountableItem, config: Config, context: Context) => DiscountResult;
195
+ }
196
+ /**
197
+ * @example
198
+ * ```ts
199
+ * import type { Billing } from '@stripe/extensibility-sdk/extensions';
200
+ * import type { Context } from '@stripe/extensibility-sdk/extensions';
201
+ *
202
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
203
+ * interface MyDiscountCalculationConfig extends Record<string, unknown> {}
204
+ *
205
+ * export default class MyDiscountCalculation implements Billing.Bill
206
+ * .DiscountCalculation<MyDiscountCalculationConfig> {
207
+ * computeDiscounts(
208
+ * request: Billing.Bill.DiscountCalculation.DiscountableItem,
209
+ * _config: MyDiscountCalculationConfig,
210
+ * _context: Context
211
+ * ) {
212
+ * // TODO: implement your discount logic here
213
+ *
214
+ * return {
215
+ * discount: { amount: request.grossAmount },
216
+ * };
217
+ * }
218
+ * }
219
+ *
220
+ * ```
221
+ * @public
222
+ */
223
+ export interface DiscountCalculation<Config extends Record<string, unknown>> {
224
+ computeDiscounts: DiscountCalculation.ComputeDiscountsFunction<Config>;
225
+ }
226
+ //# sourceMappingURL=discount_calculation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discount_calculation.d.ts","sourceRoot":"","sources":["../../../../src/extensions/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AAE,EAC7D,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,GAAG,EAAE,OAAO,KACT,OAAO,CA0BX;IAID;;;OAGG;IACI,MAAM,WAAW,oCAAoB,CAAC;IAG7C;;;OAGG;IACI,MAAM,aAAa,sCAAsB,CAAC;IAEjD;;;OAGG;IACH,KAAY,wBAAwB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAC7E,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,KACb,cAAc,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzE,gBAAgB,EAAE,mBAAmB,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;CACxE"}
@@ -0,0 +1,2 @@
1
+ export * from './discount_calculation.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/billing/bill/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,82 @@
1
+ import type { Context } from '../context.js';
2
+ import type { MonetaryAmount } from './types.js';
3
+ import type { _ConfigApplicationContext } from '../../stdlib/index.js';
4
+ /** @public */
5
+ export declare namespace CustomerBalanceApplication {
6
+ /**
7
+ * The result of computing how much customer balance to apply to a bill.
8
+ * @public
9
+ */
10
+ interface CustomerBalanceApplicationResult {
11
+ /** The amount of customer balance to apply to this invoice. Positive values increase the invoice amount (applying a debit), negative values decrease it (applying a credit). Set to zero to apply no balance. */
12
+ appliedCustomerBalance: MonetaryAmount;
13
+ }
14
+ /**
15
+ * The bill details provided as input to the customer balance application extension.
16
+ * @public
17
+ */
18
+ interface CustomerBalanceApplicationInput {
19
+ /** The total amount of the invoice before applying any customer balance. */
20
+ totalAmount: MonetaryAmount;
21
+ /** The current customer balance available to apply. Positive values indicate debits (the customer owes money), negative values indicate credits. */
22
+ customerBalance: MonetaryAmount;
23
+ }
24
+ /**
25
+ * @public
26
+ * @deprecated Platform dispatch handles wire/SDK conversion.
27
+ */
28
+ function prepareArgsComputeAppliedCustomerBalance(proto: unknown): CustomerBalanceApplicationInput;
29
+ /**
30
+ * @public
31
+ * @deprecated Platform dispatch handles wire/SDK conversion.
32
+ */
33
+ function prepareResultComputeAppliedCustomerBalance(result: CustomerBalanceApplicationResult): CustomerBalanceApplicationResult;
34
+ /** @internal */
35
+ function $platformWrapComputeAppliedCustomerBalance(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
36
+ computeAppliedCustomerBalance(...a: unknown[]): unknown;
37
+ }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
38
+ /**
39
+ * @public
40
+ * @deprecated Platform dispatch handles wire/SDK conversion.
41
+ */
42
+ const prepareArgs: typeof prepareArgsComputeAppliedCustomerBalance;
43
+ /**
44
+ * @public
45
+ * @deprecated Platform dispatch handles wire/SDK conversion.
46
+ */
47
+ const prepareResult: typeof prepareResultComputeAppliedCustomerBalance;
48
+ /**
49
+ * 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.
50
+ * @public
51
+ */
52
+ type ComputeAppliedCustomerBalanceFunction<Config extends Record<string, unknown>> = (request: CustomerBalanceApplicationInput, config: Config, context: Context) => CustomerBalanceApplicationResult;
53
+ }
54
+ /**
55
+ * @example
56
+ * ```ts
57
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
58
+ *
59
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
60
+ * interface MyCustomerBalanceApplicationConfig extends Record<string, unknown> {}
61
+ *
62
+ * export default class MyCustomerBalanceApplication implements Billing.CustomerBalanceApplication<MyCustomerBalanceApplicationConfig> {
63
+ * computeAppliedCustomerBalance(
64
+ * request: Billing.CustomerBalanceApplication.CustomerBalanceApplicationInput,
65
+ * _config: MyCustomerBalanceApplicationConfig,
66
+ * _context: Context
67
+ * ) {
68
+ * // TODO: implement your customer balance logic here
69
+ *
70
+ * return {
71
+ * appliedCustomerBalance: request.customerBalance,
72
+ * };
73
+ * }
74
+ * }
75
+ *
76
+ * ```
77
+ * @public
78
+ */
79
+ export interface CustomerBalanceApplication<Config extends Record<string, unknown>> {
80
+ computeAppliedCustomerBalance: CustomerBalanceApplication.ComputeAppliedCustomerBalanceFunction<Config>;
81
+ }
82
+ //# sourceMappingURL=customer_balance_application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customer_balance_application.d.ts","sourceRoot":"","sources":["../../../src/extensions/billing/customer_balance_application.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAEV,yBAAyB,EAI1B,MAAM,uBAAuB,CAAC;AAwB/B,cAAc;AACd,yBAAiB,0BAA0B,CAAC;IAC1C;;;OAGG;IACH,UAAiB,gCAAgC;QAC/C,iNAAiN;QACjN,sBAAsB,EAAE,cAAc,CAAC;KACxC;IAED;;;OAGG;IACH,UAAiB,+BAA+B;QAC9C,4EAA4E;QAC5E,WAAW,EAAE,cAAc,CAAC;QAC5B,oJAAoJ;QACpJ,eAAe,EAAE,cAAc,CAAC;KACjC;IA2PD;;;OAGG;IACH,SAAgB,wCAAwC,CACtD,KAAK,EAAE,OAAO,GACb,+BAA+B,CAWjC;IAED;;;OAGG;IACH,SAAgB,0CAA0C,CACxD,MAAM,EAAE,gCAAgC,GACvC,gCAAgC,CAQlC;IAED,gBAAgB;IAChB,SAAgB,0CAA0C,CACxD,iBAAiB,CAAC,EAAE,CAClB,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,yBAAyB,KAC9B,OAAO,GACX,CACD,GAAG,EAAE,UAAU;QAAE,6BAA6B,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;KAAE,EAC1E,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,GAAG,EAAE,OAAO,KACT,OAAO,CAkCX;IAID;;;OAGG;IACI,MAAM,WAAW,iDAAoB,CAAC;IAG7C;;;OAGG;IACI,MAAM,aAAa,mDAAsB,CAAC;IAEjD;;;OAGG;IACH,KAAY,qCAAqC,CAC/C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACpC,CACF,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,KACb,gCAAgC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,0BAA0B,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChF,6BAA6B,EAAE,0BAA0B,CAAC,qCAAqC,CAAC,MAAM,CAAC,CAAC;CACzG"}
@@ -0,0 +1,8 @@
1
+ export * from './types.js';
2
+ import * as Bill from './bill/index.js';
3
+ export { CustomerBalanceApplication } from './customer_balance_application.js';
4
+ export { InvoiceCollectionSetting } from './invoice_collection_setting.js';
5
+ export { Prorations } from './prorations.js';
6
+ export { RecurringBillingItemHandling } from './recurring_billing_item_handling.js';
7
+ export { Bill };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/billing/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,117 @@
1
+ import type { Context } from '../context.js';
2
+ import type { _ConfigApplicationContext } from '../../stdlib/index.js';
3
+ /** @public */
4
+ export declare namespace InvoiceCollectionSetting {
5
+ /** @public */
6
+ type ParentType = 'subscription' | 'contract' | 'quote' | 'billing_cadence' | 'subscription_schedule' | 'standalone';
7
+ /** @public */
8
+ type PaymentMethodType = 'card' | 'ach_debit' | 'ach_credit_transfer' | 'sepa_debit' | 'sepa_credit_transfer' | 'bacs_debit' | 'au_becs_debit' | 'us_bank_account' | 'link' | 'boleto' | 'oxxo' | 'ideal' | 'bancontact' | 'giropay' | 'eps' | 'p24' | 'sofort' | 'alipay' | 'wechat_pay' | 'klarna' | 'affirm' | 'afterpay_clearpay' | 'cashapp' | 'paypal' | 'multibanco' | 'konbini' | 'promptpay' | 'paynow' | 'grabpay' | 'fpx';
9
+ /** @public */
10
+ type CollectionMethod = 'send_invoice' | 'charge_automatically';
11
+ /**
12
+ * The result of the invoice collection settings override extension.
13
+ * @public
14
+ */
15
+ interface InvoiceCollectionResponse {
16
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. Return null to use the default. */
17
+ autoAdvance?: boolean;
18
+ }
19
+ /** @public */
20
+ type InvoiceCollectionRequest = {
21
+ /** The current collection settings that would be applied to the invoice. */
22
+ collectionSettings: CollectionSettings;
23
+ /** The billing resource that triggered invoice creation. */
24
+ parent: Parent;
25
+ } & ({
26
+ payer: 'customer';
27
+ customer: Customer;
28
+ } | {
29
+ payer: 'other';
30
+ otherPayer: string;
31
+ });
32
+ /** @public */
33
+ interface Customer {
34
+ id: string;
35
+ metadata: Record<string, string>;
36
+ }
37
+ /**
38
+ * The parent resource that triggered the invoice creation.
39
+ * @public
40
+ */
41
+ interface Parent {
42
+ /** The type of parent resource (for example, subscription or contract). */
43
+ type: ParentType;
44
+ /** Custom key-value pairs attached to the parent resource. */
45
+ metadata: Record<string, string>;
46
+ }
47
+ /**
48
+ * The collection settings for an invoice.
49
+ * @public
50
+ */
51
+ interface CollectionSettings {
52
+ /** Whether the invoice automatically advances through its lifecycle. */
53
+ autoAdvance: boolean;
54
+ /** The payment collection method: charge_automatically or send_invoice. */
55
+ collectionMethod: CollectionMethod;
56
+ /** The delay before the invoice is finalized, in hours. */
57
+ finalizationGracePeriod: number;
58
+ /** The payment methods configured for this invoice. */
59
+ paymentMethods: PaymentMethodType[];
60
+ }
61
+ /**
62
+ * @public
63
+ * @deprecated Platform dispatch handles wire/SDK conversion.
64
+ */
65
+ function prepareArgsCollectionOverride(proto: unknown): InvoiceCollectionRequest;
66
+ /**
67
+ * @public
68
+ * @deprecated Platform dispatch handles wire/SDK conversion.
69
+ */
70
+ function prepareResultCollectionOverride(result: InvoiceCollectionResponse): InvoiceCollectionResponse;
71
+ /** @internal */
72
+ function $platformWrapCollectionOverride(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
73
+ collectionOverride(...a: unknown[]): unknown;
74
+ }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
75
+ /**
76
+ * @public
77
+ * @deprecated Platform dispatch handles wire/SDK conversion.
78
+ */
79
+ const prepareArgs: typeof prepareArgsCollectionOverride;
80
+ /**
81
+ * @public
82
+ * @deprecated Platform dispatch handles wire/SDK conversion.
83
+ */
84
+ const prepareResult: typeof prepareResultCollectionOverride;
85
+ /**
86
+ * Overrides invoice collection settings before a draft invoice is created.
87
+ * @public
88
+ */
89
+ type CollectionOverrideFunction<Config extends Record<string, unknown>> = (request: InvoiceCollectionRequest, config: Config, context: Context) => InvoiceCollectionResponse;
90
+ }
91
+ /**
92
+ * @example
93
+ * ```ts
94
+ * import type { Billing, Context } from '@stripe/extensibility-sdk/extensions';
95
+ *
96
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
97
+ * interface MyInvoiceCollectionSettingConfig extends Record<string, unknown> {}
98
+ *
99
+ * export default class MyInvoiceCollectionSetting implements Billing.InvoiceCollectionSetting<MyInvoiceCollectionSettingConfig> {
100
+ * collectionOverride(
101
+ * _request: Billing.InvoiceCollectionSetting.InvoiceCollectionRequest,
102
+ * _config: MyInvoiceCollectionSettingConfig,
103
+ * _context: Context
104
+ * ) {
105
+ * // TODO: implement your collection setting logic here
106
+ *
107
+ * return {};
108
+ * }
109
+ * }
110
+ *
111
+ * ```
112
+ * @public
113
+ */
114
+ export interface InvoiceCollectionSetting<Config extends Record<string, unknown>> {
115
+ collectionOverride: InvoiceCollectionSetting.CollectionOverrideFunction<Config>;
116
+ }
117
+ //# sourceMappingURL=invoice_collection_setting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice_collection_setting.d.ts","sourceRoot":"","sources":["../../../src/extensions/billing/invoice_collection_setting.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAEV,yBAAyB,EAI1B,MAAM,uBAAuB,CAAC;AAwB/B,cAAc;AACd,yBAAiB,wBAAwB,CAAC;IACxC,cAAc;IACd,KAAY,UAAU,GAClB,cAAc,GACd,UAAU,GACV,OAAO,GACP,iBAAiB,GACjB,uBAAuB,GACvB,YAAY,CAAC;IAEjB,cAAc;IACd,KAAY,iBAAiB,GACzB,MAAM,GACN,WAAW,GACX,qBAAqB,GACrB,YAAY,GACZ,sBAAsB,GACtB,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,YAAY,GACZ,SAAS,GACT,KAAK,GACL,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,mBAAmB,GACnB,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,GACT,KAAK,CAAC;IAEV,cAAc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