@fantastic.dev/better-stripe 0.41.0 → 0.42.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/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
- package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
- package/dist/client/balanceFundingWorkflow/client.js +289 -0
- package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
- package/dist/client/billing/balanceFunding.d.ts +5 -0
- package/dist/client/billing/balanceFunding.d.ts.map +1 -1
- package/dist/client/billing/balanceFunding.js +30 -0
- package/dist/client/billing/balanceFunding.js.map +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +366 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +199 -17
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +366 -2
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +199 -17
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +18 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +473 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/helpers.d.ts +42 -0
- package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
- package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/actions.js +80 -0
- package/dist/component/balanceFunding/internal/actions.js.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.js +54 -0
- package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
- package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
- package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/queries.js +35 -0
- package/dist/component/balanceFunding/internal/queries.js.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.js +31 -0
- package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.d.ts +403 -0
- package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.js +24 -0
- package/dist/component/balanceFunding/mutations.js.map +1 -1
- package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
- package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.d.ts +78 -0
- package/dist/component/balanceFunding/queries.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.js +35 -0
- package/dist/component/balanceFunding/queries.js.map +1 -1
- package/dist/component/balanceFunding/receipt.d.ts +5 -0
- package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
- package/dist/component/balanceFunding/receipt.js +37 -0
- package/dist/component/balanceFunding/receipt.js.map +1 -0
- package/dist/component/balanceFunding/schema.d.ts +506 -2
- package/dist/component/balanceFunding/schema.d.ts.map +1 -1
- package/dist/component/balanceFunding/schema.js +2 -0
- package/dist/component/balanceFunding/schema.js.map +1 -1
- package/dist/component/balanceFunding/stateHandlers.d.ts +50 -8
- package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
- package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowControl.js +149 -0
- package/dist/component/balanceFunding/workflowControl.js.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.js +48 -0
- package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
- package/dist/component/balanceFunding/workflowState.d.ts +157 -0
- package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowState.js +194 -0
- package/dist/component/balanceFunding/workflowState.js.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.js +27 -0
- package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +102 -18
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/schema.d.ts +183 -1
- package/package.json +1 -1
- package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
- package/src/client/balanceFundingWorkflow/client.ts +419 -0
- package/src/client/billing/balanceFunding.ts +50 -0
- package/src/client/index.ts +15 -0
- package/src/component/_generated/api.ts +18 -0
- package/src/component/_generated/component.ts +524 -0
- package/src/component/balanceFunding/internal/actions.ts +107 -0
- package/src/component/balanceFunding/internal/mutations.ts +66 -0
- package/src/component/balanceFunding/internal/queries.ts +34 -0
- package/src/component/balanceFunding/internal/workflow.ts +49 -0
- package/src/component/balanceFunding/mutations.ts +34 -0
- package/src/component/balanceFunding/queries.ts +38 -0
- package/src/component/balanceFunding/receipt.ts +48 -0
- package/src/component/balanceFunding/schema.ts +2 -0
- package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
- package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
- package/src/component/balanceFunding/workflow.test.ts +552 -0
- package/src/component/balanceFunding/workflowControl.ts +198 -0
- package/src/component/balanceFunding/workflowSchema.ts +78 -0
- package/src/component/balanceFunding/workflowState.ts +285 -0
- package/src/component/balanceFunding/workflowValidators.ts +40 -0
|
@@ -251,6 +251,48 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
251
251
|
accountId: string;
|
|
252
252
|
cancelRequested: boolean;
|
|
253
253
|
enabled: boolean;
|
|
254
|
+
execution?: {
|
|
255
|
+
apply?: {
|
|
256
|
+
receipt?: {
|
|
257
|
+
customerAccount: string;
|
|
258
|
+
enabled?: boolean | undefined;
|
|
259
|
+
paymentMethodId: string | null;
|
|
260
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
261
|
+
phase: "apply" | "attach" | "create";
|
|
262
|
+
providerApiVersion: string;
|
|
263
|
+
stripeSubscriptionId: string;
|
|
264
|
+
} | undefined;
|
|
265
|
+
state: "running" | "succeeded" | "unknown";
|
|
266
|
+
} | undefined;
|
|
267
|
+
attach?: {
|
|
268
|
+
receipt?: {
|
|
269
|
+
customerAccount: string;
|
|
270
|
+
enabled?: boolean | undefined;
|
|
271
|
+
paymentMethodId: string | null;
|
|
272
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
273
|
+
phase: "apply" | "attach" | "create";
|
|
274
|
+
providerApiVersion: string;
|
|
275
|
+
stripeSubscriptionId: string;
|
|
276
|
+
} | undefined;
|
|
277
|
+
state: "running" | "succeeded" | "unknown";
|
|
278
|
+
} | undefined;
|
|
279
|
+
create?: {
|
|
280
|
+
receipt?: {
|
|
281
|
+
customerAccount: string;
|
|
282
|
+
enabled?: boolean | undefined;
|
|
283
|
+
paymentMethodId: string | null;
|
|
284
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
285
|
+
phase: "apply" | "attach" | "create";
|
|
286
|
+
providerApiVersion: string;
|
|
287
|
+
stripeSubscriptionId: string;
|
|
288
|
+
} | undefined;
|
|
289
|
+
state: "running" | "succeeded" | "unknown";
|
|
290
|
+
} | undefined;
|
|
291
|
+
definitionVersion: string;
|
|
292
|
+
providerAction: string;
|
|
293
|
+
providerApiVersion: string;
|
|
294
|
+
workflowId?: string | undefined;
|
|
295
|
+
} | undefined;
|
|
254
296
|
failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
|
|
255
297
|
kind: "apply" | "prepare";
|
|
256
298
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
@@ -272,7 +314,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
272
314
|
state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
|
|
273
315
|
version: number;
|
|
274
316
|
};
|
|
275
|
-
fieldPaths: "_id" | ("_creationTime" | "accountId" | "cancelRequested" | "enabled" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version");
|
|
317
|
+
fieldPaths: "_id" | ("_creationTime" | "accountId" | "cancelRequested" | "enabled" | "execution" | "execution.apply" | "execution.apply.receipt" | "execution.apply.receipt.customerAccount" | "execution.apply.receipt.enabled" | "execution.apply.receipt.paymentMethodId" | "execution.apply.receipt.paymentMethodTypes" | "execution.apply.receipt.phase" | "execution.apply.receipt.providerApiVersion" | "execution.apply.receipt.stripeSubscriptionId" | "execution.apply.state" | "execution.attach" | "execution.attach.receipt" | "execution.attach.receipt.customerAccount" | "execution.attach.receipt.enabled" | "execution.attach.receipt.paymentMethodId" | "execution.attach.receipt.paymentMethodTypes" | "execution.attach.receipt.phase" | "execution.attach.receipt.providerApiVersion" | "execution.attach.receipt.stripeSubscriptionId" | "execution.attach.state" | "execution.create" | "execution.create.receipt" | "execution.create.receipt.customerAccount" | "execution.create.receipt.enabled" | "execution.create.receipt.paymentMethodId" | "execution.create.receipt.paymentMethodTypes" | "execution.create.receipt.phase" | "execution.create.receipt.providerApiVersion" | "execution.create.receipt.stripeSubscriptionId" | "execution.create.state" | "execution.definitionVersion" | "execution.providerAction" | "execution.providerApiVersion" | "execution.workflowId" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version");
|
|
276
318
|
indexes: {
|
|
277
319
|
by_id: ["_id"];
|
|
278
320
|
by_creation_time: ["_creationTime"];
|
|
@@ -330,6 +372,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
330
372
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
331
373
|
requestKey: string;
|
|
332
374
|
result?: {
|
|
375
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
376
|
+
retryable: false;
|
|
377
|
+
status: "conflict";
|
|
378
|
+
} | {
|
|
379
|
+
reason: "policy_invalid";
|
|
380
|
+
retryable: false;
|
|
381
|
+
status: "rejected";
|
|
382
|
+
} | {
|
|
333
383
|
operation: {
|
|
334
384
|
accountId: string;
|
|
335
385
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -340,14 +390,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
340
390
|
} | {
|
|
341
391
|
enabled: boolean;
|
|
342
392
|
status: "unchanged";
|
|
343
|
-
} | {
|
|
344
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
345
|
-
retryable: false;
|
|
346
|
-
status: "conflict";
|
|
347
|
-
} | {
|
|
348
|
-
reason: "policy_invalid";
|
|
349
|
-
retryable: false;
|
|
350
|
-
status: "rejected";
|
|
351
393
|
} | {
|
|
352
394
|
reason: "provider_pending";
|
|
353
395
|
retryable: true;
|
|
@@ -2046,6 +2088,48 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
2046
2088
|
accountId: string;
|
|
2047
2089
|
cancelRequested: boolean;
|
|
2048
2090
|
enabled: boolean;
|
|
2091
|
+
execution?: {
|
|
2092
|
+
apply?: {
|
|
2093
|
+
receipt?: {
|
|
2094
|
+
customerAccount: string;
|
|
2095
|
+
enabled?: boolean | undefined;
|
|
2096
|
+
paymentMethodId: string | null;
|
|
2097
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
2098
|
+
phase: "apply" | "attach" | "create";
|
|
2099
|
+
providerApiVersion: string;
|
|
2100
|
+
stripeSubscriptionId: string;
|
|
2101
|
+
} | undefined;
|
|
2102
|
+
state: "running" | "succeeded" | "unknown";
|
|
2103
|
+
} | undefined;
|
|
2104
|
+
attach?: {
|
|
2105
|
+
receipt?: {
|
|
2106
|
+
customerAccount: string;
|
|
2107
|
+
enabled?: boolean | undefined;
|
|
2108
|
+
paymentMethodId: string | null;
|
|
2109
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
2110
|
+
phase: "apply" | "attach" | "create";
|
|
2111
|
+
providerApiVersion: string;
|
|
2112
|
+
stripeSubscriptionId: string;
|
|
2113
|
+
} | undefined;
|
|
2114
|
+
state: "running" | "succeeded" | "unknown";
|
|
2115
|
+
} | undefined;
|
|
2116
|
+
create?: {
|
|
2117
|
+
receipt?: {
|
|
2118
|
+
customerAccount: string;
|
|
2119
|
+
enabled?: boolean | undefined;
|
|
2120
|
+
paymentMethodId: string | null;
|
|
2121
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
2122
|
+
phase: "apply" | "attach" | "create";
|
|
2123
|
+
providerApiVersion: string;
|
|
2124
|
+
stripeSubscriptionId: string;
|
|
2125
|
+
} | undefined;
|
|
2126
|
+
state: "running" | "succeeded" | "unknown";
|
|
2127
|
+
} | undefined;
|
|
2128
|
+
definitionVersion: string;
|
|
2129
|
+
providerAction: string;
|
|
2130
|
+
providerApiVersion: string;
|
|
2131
|
+
workflowId?: string | undefined;
|
|
2132
|
+
} | undefined;
|
|
2049
2133
|
failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
|
|
2050
2134
|
kind: "apply" | "prepare";
|
|
2051
2135
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
@@ -2067,7 +2151,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
2067
2151
|
state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
|
|
2068
2152
|
version: number;
|
|
2069
2153
|
};
|
|
2070
|
-
fieldPaths: "_id" | ("_creationTime" | "accountId" | "cancelRequested" | "enabled" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version");
|
|
2154
|
+
fieldPaths: "_id" | ("_creationTime" | "accountId" | "cancelRequested" | "enabled" | "execution" | "execution.apply" | "execution.apply.receipt" | "execution.apply.receipt.customerAccount" | "execution.apply.receipt.enabled" | "execution.apply.receipt.paymentMethodId" | "execution.apply.receipt.paymentMethodTypes" | "execution.apply.receipt.phase" | "execution.apply.receipt.providerApiVersion" | "execution.apply.receipt.stripeSubscriptionId" | "execution.apply.state" | "execution.attach" | "execution.attach.receipt" | "execution.attach.receipt.customerAccount" | "execution.attach.receipt.enabled" | "execution.attach.receipt.paymentMethodId" | "execution.attach.receipt.paymentMethodTypes" | "execution.attach.receipt.phase" | "execution.attach.receipt.providerApiVersion" | "execution.attach.receipt.stripeSubscriptionId" | "execution.attach.state" | "execution.create" | "execution.create.receipt" | "execution.create.receipt.customerAccount" | "execution.create.receipt.enabled" | "execution.create.receipt.paymentMethodId" | "execution.create.receipt.paymentMethodTypes" | "execution.create.receipt.phase" | "execution.create.receipt.providerApiVersion" | "execution.create.receipt.stripeSubscriptionId" | "execution.create.state" | "execution.definitionVersion" | "execution.providerAction" | "execution.providerApiVersion" | "execution.workflowId" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version");
|
|
2071
2155
|
indexes: {
|
|
2072
2156
|
by_id: ["_id"];
|
|
2073
2157
|
by_creation_time: ["_creationTime"];
|
|
@@ -2125,6 +2209,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
2125
2209
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2126
2210
|
requestKey: string;
|
|
2127
2211
|
result?: {
|
|
2212
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2213
|
+
retryable: false;
|
|
2214
|
+
status: "conflict";
|
|
2215
|
+
} | {
|
|
2216
|
+
reason: "policy_invalid";
|
|
2217
|
+
retryable: false;
|
|
2218
|
+
status: "rejected";
|
|
2219
|
+
} | {
|
|
2128
2220
|
operation: {
|
|
2129
2221
|
accountId: string;
|
|
2130
2222
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2135,14 +2227,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
2135
2227
|
} | {
|
|
2136
2228
|
enabled: boolean;
|
|
2137
2229
|
status: "unchanged";
|
|
2138
|
-
} | {
|
|
2139
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2140
|
-
retryable: false;
|
|
2141
|
-
status: "conflict";
|
|
2142
|
-
} | {
|
|
2143
|
-
reason: "policy_invalid";
|
|
2144
|
-
retryable: false;
|
|
2145
|
-
status: "rejected";
|
|
2146
2230
|
} | {
|
|
2147
2231
|
reason: "provider_pending";
|
|
2148
2232
|
retryable: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/component/earnings/triggers.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/component/earnings/triggers.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAA0D,CAAC"}
|
|
@@ -271,6 +271,48 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
271
271
|
accountId: string;
|
|
272
272
|
cancelRequested: boolean;
|
|
273
273
|
enabled: boolean;
|
|
274
|
+
execution?: {
|
|
275
|
+
apply?: {
|
|
276
|
+
receipt?: {
|
|
277
|
+
customerAccount: string;
|
|
278
|
+
enabled?: boolean | undefined;
|
|
279
|
+
paymentMethodId: string | null;
|
|
280
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
281
|
+
phase: "apply" | "attach" | "create";
|
|
282
|
+
providerApiVersion: string;
|
|
283
|
+
stripeSubscriptionId: string;
|
|
284
|
+
} | undefined;
|
|
285
|
+
state: "running" | "succeeded" | "unknown";
|
|
286
|
+
} | undefined;
|
|
287
|
+
attach?: {
|
|
288
|
+
receipt?: {
|
|
289
|
+
customerAccount: string;
|
|
290
|
+
enabled?: boolean | undefined;
|
|
291
|
+
paymentMethodId: string | null;
|
|
292
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
293
|
+
phase: "apply" | "attach" | "create";
|
|
294
|
+
providerApiVersion: string;
|
|
295
|
+
stripeSubscriptionId: string;
|
|
296
|
+
} | undefined;
|
|
297
|
+
state: "running" | "succeeded" | "unknown";
|
|
298
|
+
} | undefined;
|
|
299
|
+
create?: {
|
|
300
|
+
receipt?: {
|
|
301
|
+
customerAccount: string;
|
|
302
|
+
enabled?: boolean | undefined;
|
|
303
|
+
paymentMethodId: string | null;
|
|
304
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
305
|
+
phase: "apply" | "attach" | "create";
|
|
306
|
+
providerApiVersion: string;
|
|
307
|
+
stripeSubscriptionId: string;
|
|
308
|
+
} | undefined;
|
|
309
|
+
state: "running" | "succeeded" | "unknown";
|
|
310
|
+
} | undefined;
|
|
311
|
+
definitionVersion: string;
|
|
312
|
+
providerAction: string;
|
|
313
|
+
providerApiVersion: string;
|
|
314
|
+
workflowId?: string | undefined;
|
|
315
|
+
} | undefined;
|
|
274
316
|
failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
|
|
275
317
|
kind: "apply" | "prepare";
|
|
276
318
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
@@ -326,7 +368,147 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
326
368
|
paymentMethodTypes: import("convex/values").VUnion<string[] | null, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
327
369
|
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
328
370
|
}, "optional", "customerAccount" | "paymentMethodId" | "paymentMethodTypes" | "providerApiVersion" | "stripeSubscriptionId">;
|
|
329
|
-
|
|
371
|
+
execution: import("convex/values").VObject<{
|
|
372
|
+
apply?: {
|
|
373
|
+
receipt?: {
|
|
374
|
+
customerAccount: string;
|
|
375
|
+
enabled?: boolean | undefined;
|
|
376
|
+
paymentMethodId: string | null;
|
|
377
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
378
|
+
phase: "apply" | "attach" | "create";
|
|
379
|
+
providerApiVersion: string;
|
|
380
|
+
stripeSubscriptionId: string;
|
|
381
|
+
} | undefined;
|
|
382
|
+
state: "running" | "succeeded" | "unknown";
|
|
383
|
+
} | undefined;
|
|
384
|
+
attach?: {
|
|
385
|
+
receipt?: {
|
|
386
|
+
customerAccount: string;
|
|
387
|
+
enabled?: boolean | undefined;
|
|
388
|
+
paymentMethodId: string | null;
|
|
389
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
390
|
+
phase: "apply" | "attach" | "create";
|
|
391
|
+
providerApiVersion: string;
|
|
392
|
+
stripeSubscriptionId: string;
|
|
393
|
+
} | undefined;
|
|
394
|
+
state: "running" | "succeeded" | "unknown";
|
|
395
|
+
} | undefined;
|
|
396
|
+
create?: {
|
|
397
|
+
receipt?: {
|
|
398
|
+
customerAccount: string;
|
|
399
|
+
enabled?: boolean | undefined;
|
|
400
|
+
paymentMethodId: string | null;
|
|
401
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
402
|
+
phase: "apply" | "attach" | "create";
|
|
403
|
+
providerApiVersion: string;
|
|
404
|
+
stripeSubscriptionId: string;
|
|
405
|
+
} | undefined;
|
|
406
|
+
state: "running" | "succeeded" | "unknown";
|
|
407
|
+
} | undefined;
|
|
408
|
+
definitionVersion: string;
|
|
409
|
+
providerAction: string;
|
|
410
|
+
providerApiVersion: string;
|
|
411
|
+
workflowId?: string | undefined;
|
|
412
|
+
} | undefined, {
|
|
413
|
+
workflowId: import("convex/values").VString<string | undefined, "optional">;
|
|
414
|
+
definitionVersion: import("convex/values").VString<string, "required">;
|
|
415
|
+
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
416
|
+
providerAction: import("convex/values").VString<string, "required">;
|
|
417
|
+
create: import("convex/values").VObject<{
|
|
418
|
+
receipt?: {
|
|
419
|
+
customerAccount: string;
|
|
420
|
+
enabled?: boolean | undefined;
|
|
421
|
+
paymentMethodId: string | null;
|
|
422
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
423
|
+
phase: "apply" | "attach" | "create";
|
|
424
|
+
providerApiVersion: string;
|
|
425
|
+
stripeSubscriptionId: string;
|
|
426
|
+
} | undefined;
|
|
427
|
+
state: "running" | "succeeded" | "unknown";
|
|
428
|
+
} | undefined, {
|
|
429
|
+
state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
|
|
430
|
+
receipt: import("convex/values").VObject<{
|
|
431
|
+
customerAccount: string;
|
|
432
|
+
enabled?: boolean | undefined;
|
|
433
|
+
paymentMethodId: string | null;
|
|
434
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
435
|
+
phase: "apply" | "attach" | "create";
|
|
436
|
+
providerApiVersion: string;
|
|
437
|
+
stripeSubscriptionId: string;
|
|
438
|
+
} | undefined, {
|
|
439
|
+
phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
|
|
440
|
+
customerAccount: import("convex/values").VString<string, "required">;
|
|
441
|
+
stripeSubscriptionId: import("convex/values").VString<string, "required">;
|
|
442
|
+
paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
443
|
+
paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
444
|
+
enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
445
|
+
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
446
|
+
}, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
|
|
447
|
+
}, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
|
|
448
|
+
attach: import("convex/values").VObject<{
|
|
449
|
+
receipt?: {
|
|
450
|
+
customerAccount: string;
|
|
451
|
+
enabled?: boolean | undefined;
|
|
452
|
+
paymentMethodId: string | null;
|
|
453
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
454
|
+
phase: "apply" | "attach" | "create";
|
|
455
|
+
providerApiVersion: string;
|
|
456
|
+
stripeSubscriptionId: string;
|
|
457
|
+
} | undefined;
|
|
458
|
+
state: "running" | "succeeded" | "unknown";
|
|
459
|
+
} | undefined, {
|
|
460
|
+
state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
|
|
461
|
+
receipt: import("convex/values").VObject<{
|
|
462
|
+
customerAccount: string;
|
|
463
|
+
enabled?: boolean | undefined;
|
|
464
|
+
paymentMethodId: string | null;
|
|
465
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
466
|
+
phase: "apply" | "attach" | "create";
|
|
467
|
+
providerApiVersion: string;
|
|
468
|
+
stripeSubscriptionId: string;
|
|
469
|
+
} | undefined, {
|
|
470
|
+
phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
|
|
471
|
+
customerAccount: import("convex/values").VString<string, "required">;
|
|
472
|
+
stripeSubscriptionId: import("convex/values").VString<string, "required">;
|
|
473
|
+
paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
474
|
+
paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
475
|
+
enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
476
|
+
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
477
|
+
}, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
|
|
478
|
+
}, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
|
|
479
|
+
apply: import("convex/values").VObject<{
|
|
480
|
+
receipt?: {
|
|
481
|
+
customerAccount: string;
|
|
482
|
+
enabled?: boolean | undefined;
|
|
483
|
+
paymentMethodId: string | null;
|
|
484
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
485
|
+
phase: "apply" | "attach" | "create";
|
|
486
|
+
providerApiVersion: string;
|
|
487
|
+
stripeSubscriptionId: string;
|
|
488
|
+
} | undefined;
|
|
489
|
+
state: "running" | "succeeded" | "unknown";
|
|
490
|
+
} | undefined, {
|
|
491
|
+
state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
|
|
492
|
+
receipt: import("convex/values").VObject<{
|
|
493
|
+
customerAccount: string;
|
|
494
|
+
enabled?: boolean | undefined;
|
|
495
|
+
paymentMethodId: string | null;
|
|
496
|
+
paymentMethodTypes?: string[] | null | undefined;
|
|
497
|
+
phase: "apply" | "attach" | "create";
|
|
498
|
+
providerApiVersion: string;
|
|
499
|
+
stripeSubscriptionId: string;
|
|
500
|
+
} | undefined, {
|
|
501
|
+
phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
|
|
502
|
+
customerAccount: import("convex/values").VString<string, "required">;
|
|
503
|
+
stripeSubscriptionId: import("convex/values").VString<string, "required">;
|
|
504
|
+
paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
505
|
+
paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
506
|
+
enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
507
|
+
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
508
|
+
}, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
|
|
509
|
+
}, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
|
|
510
|
+
}, "optional", "apply" | "apply.receipt" | "apply.receipt.customerAccount" | "apply.receipt.enabled" | "apply.receipt.paymentMethodId" | "apply.receipt.paymentMethodTypes" | "apply.receipt.phase" | "apply.receipt.providerApiVersion" | "apply.receipt.stripeSubscriptionId" | "apply.state" | "attach" | "attach.receipt" | "attach.receipt.customerAccount" | "attach.receipt.enabled" | "attach.receipt.paymentMethodId" | "attach.receipt.paymentMethodTypes" | "attach.receipt.phase" | "attach.receipt.providerApiVersion" | "attach.receipt.stripeSubscriptionId" | "attach.state" | "create" | "create.receipt" | "create.receipt.customerAccount" | "create.receipt.enabled" | "create.receipt.paymentMethodId" | "create.receipt.paymentMethodTypes" | "create.receipt.phase" | "create.receipt.providerApiVersion" | "create.receipt.stripeSubscriptionId" | "create.state" | "definitionVersion" | "providerAction" | "providerApiVersion" | "workflowId">;
|
|
511
|
+
}, "required", "accountId" | "cancelRequested" | "enabled" | "execution" | "execution.apply" | "execution.apply.receipt" | "execution.apply.receipt.customerAccount" | "execution.apply.receipt.enabled" | "execution.apply.receipt.paymentMethodId" | "execution.apply.receipt.paymentMethodTypes" | "execution.apply.receipt.phase" | "execution.apply.receipt.providerApiVersion" | "execution.apply.receipt.stripeSubscriptionId" | "execution.apply.state" | "execution.attach" | "execution.attach.receipt" | "execution.attach.receipt.customerAccount" | "execution.attach.receipt.enabled" | "execution.attach.receipt.paymentMethodId" | "execution.attach.receipt.paymentMethodTypes" | "execution.attach.receipt.phase" | "execution.attach.receipt.providerApiVersion" | "execution.attach.receipt.stripeSubscriptionId" | "execution.attach.state" | "execution.create" | "execution.create.receipt" | "execution.create.receipt.customerAccount" | "execution.create.receipt.enabled" | "execution.create.receipt.paymentMethodId" | "execution.create.receipt.paymentMethodTypes" | "execution.create.receipt.phase" | "execution.create.receipt.providerApiVersion" | "execution.create.receipt.stripeSubscriptionId" | "execution.create.state" | "execution.definitionVersion" | "execution.providerAction" | "execution.providerApiVersion" | "execution.workflowId" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version">, {
|
|
330
512
|
by_preparation_version: ["preparationId", "version", "_creationTime"];
|
|
331
513
|
}, {}, {}>;
|
|
332
514
|
balanceFundingRequests: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
package/package.json
CHANGED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import Stripe from "stripe";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import { STRIPE_CUSTOMER_PREVIEW_API_VERSION } from "../apiVersion.js";
|
|
4
|
+
import * as funding from "../billing/balanceFunding.js";
|
|
5
|
+
|
|
6
|
+
function fixture(sdkVersion: string = STRIPE_CUSTOMER_PREVIEW_API_VERSION) {
|
|
7
|
+
const requests: { method: string; path: string; version: string | null }[] =
|
|
8
|
+
[];
|
|
9
|
+
const subscription = {
|
|
10
|
+
id: "sub_plan",
|
|
11
|
+
object: "subscription",
|
|
12
|
+
customer_account: "acct_owner",
|
|
13
|
+
status: "active",
|
|
14
|
+
default_payment_method: "pm_card",
|
|
15
|
+
payment_settings: { payment_method_types: ["card"] },
|
|
16
|
+
};
|
|
17
|
+
const method = {
|
|
18
|
+
id: "pm_card",
|
|
19
|
+
object: "payment_method",
|
|
20
|
+
type: "card",
|
|
21
|
+
customer_account: "acct_owner",
|
|
22
|
+
};
|
|
23
|
+
const stripe = new Stripe("sk_test_capture_fixture", {
|
|
24
|
+
apiVersion: sdkVersion as Stripe.LatestApiVersion,
|
|
25
|
+
maxNetworkRetries: 0,
|
|
26
|
+
httpClient: Stripe.createFetchHttpClient(async (url, init) => {
|
|
27
|
+
const path = new URL(String(url)).pathname;
|
|
28
|
+
requests.push({
|
|
29
|
+
method: init?.method ?? "GET",
|
|
30
|
+
path,
|
|
31
|
+
version: new Headers(init?.headers).get("Stripe-Version"),
|
|
32
|
+
});
|
|
33
|
+
return new Response(
|
|
34
|
+
JSON.stringify(path.includes("subscriptions") ? subscription : method),
|
|
35
|
+
{ status: 200 },
|
|
36
|
+
);
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
const capture = (
|
|
40
|
+
version = STRIPE_CUSTOMER_PREVIEW_API_VERSION,
|
|
41
|
+
consent = true,
|
|
42
|
+
) => {
|
|
43
|
+
return funding.captureBalanceFundingOriginal(stripe, version, {
|
|
44
|
+
customerAccount: "acct_owner",
|
|
45
|
+
stripeSubscriptionId: "sub_plan",
|
|
46
|
+
consent: consent as true,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return { capture, subscription, method, requests };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
it("captures immutable original settings through read-only preview SDK calls before provisioning", async () => {
|
|
53
|
+
const s = fixture();
|
|
54
|
+
expect(await s.capture()).toEqual({
|
|
55
|
+
customerAccount: "acct_owner",
|
|
56
|
+
stripeSubscriptionId: "sub_plan",
|
|
57
|
+
previousPaymentMethodId: "pm_card",
|
|
58
|
+
previousPaymentMethodTypes: ["card"],
|
|
59
|
+
});
|
|
60
|
+
expect(s.requests).toEqual([
|
|
61
|
+
{
|
|
62
|
+
method: "GET",
|
|
63
|
+
path: "/v1/subscriptions/sub_plan",
|
|
64
|
+
version: STRIPE_CUSTOMER_PREVIEW_API_VERSION,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
method: "GET",
|
|
68
|
+
path: "/v1/payment_methods/pm_card",
|
|
69
|
+
version: STRIPE_CUSTOMER_PREVIEW_API_VERSION,
|
|
70
|
+
},
|
|
71
|
+
]);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("preserves null versus empty restoration settings", async () => {
|
|
75
|
+
for (const types of [null, []]) {
|
|
76
|
+
const s = fixture();
|
|
77
|
+
Object.assign(s.subscription, {
|
|
78
|
+
default_payment_method: null,
|
|
79
|
+
payment_settings: { payment_method_types: types },
|
|
80
|
+
});
|
|
81
|
+
expect(await s.capture()).toMatchObject({
|
|
82
|
+
previousPaymentMethodId: null,
|
|
83
|
+
previousPaymentMethodTypes: types,
|
|
84
|
+
});
|
|
85
|
+
expect(s.requests).toHaveLength(1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("requires explicit preview configuration and consent before provider reads", async () => {
|
|
90
|
+
const s = fixture();
|
|
91
|
+
await expect(
|
|
92
|
+
s.capture(
|
|
93
|
+
"2026-02-25.clover" as typeof STRIPE_CUSTOMER_PREVIEW_API_VERSION,
|
|
94
|
+
),
|
|
95
|
+
).rejects.toThrow(/preview/i);
|
|
96
|
+
await expect(s.capture(undefined, false)).rejects.toThrow(/consent/i);
|
|
97
|
+
expect(s.requests).toHaveLength(0);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("refuses recapture when balance funding is already configured", async () => {
|
|
101
|
+
const settings = fixture();
|
|
102
|
+
settings.subscription.payment_settings.payment_method_types = [
|
|
103
|
+
"stripe_balance",
|
|
104
|
+
];
|
|
105
|
+
await expect(settings.capture()).rejects.toThrow(/persisted restoration/i);
|
|
106
|
+
const method = fixture();
|
|
107
|
+
method.method.type = "stripe_balance";
|
|
108
|
+
await expect(method.capture()).rejects.toThrow(/persisted restoration/i);
|
|
109
|
+
expect(
|
|
110
|
+
[...settings.requests, ...method.requests].every((r) => r.method === "GET"),
|
|
111
|
+
).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("rejects foreign or inactive subscriptions before any provider write", async () => {
|
|
115
|
+
const foreign = fixture();
|
|
116
|
+
foreign.subscription.customer_account = "acct_foreign";
|
|
117
|
+
await expect(foreign.capture()).rejects.toThrow(/belong/i);
|
|
118
|
+
const inactive = fixture();
|
|
119
|
+
inactive.subscription.status = "canceled";
|
|
120
|
+
await expect(inactive.capture()).rejects.toThrow(/cannot change/i);
|
|
121
|
+
expect(
|
|
122
|
+
[...foreign.requests, ...inactive.requests].every(
|
|
123
|
+
(r) => r.method === "GET",
|
|
124
|
+
),
|
|
125
|
+
).toBe(true);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it("rejects a version argument that disagrees with the actual configured SDK", async () => {
|
|
129
|
+
const s = fixture("2026-02-25.clover");
|
|
130
|
+
await expect(s.capture()).rejects.toThrow(/preview|version/i);
|
|
131
|
+
expect(s.requests).toHaveLength(0);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("verifies the captured subscription and original payment method identities", async () => {
|
|
135
|
+
const subscription = fixture();
|
|
136
|
+
subscription.subscription.id = "sub_foreign";
|
|
137
|
+
await expect(subscription.capture()).rejects.toThrow(/identity|match/i);
|
|
138
|
+
const method = fixture();
|
|
139
|
+
method.method.id = "pm_foreign";
|
|
140
|
+
await expect(method.capture()).rejects.toThrow(/identity|match/i);
|
|
141
|
+
const owner = fixture();
|
|
142
|
+
owner.method.customer_account = "acct_foreign";
|
|
143
|
+
await expect(owner.capture()).rejects.toThrow(/belong|identity/i);
|
|
144
|
+
});
|