@fantastic.dev/better-stripe 0.40.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
  4. package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
  5. package/dist/client/balanceFundingWorkflow/client.js +289 -0
  6. package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
  7. package/dist/client/billing/balanceFunding.d.ts +5 -0
  8. package/dist/client/billing/balanceFunding.d.ts.map +1 -1
  9. package/dist/client/billing/balanceFunding.js +30 -0
  10. package/dist/client/billing/balanceFunding.js.map +1 -1
  11. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +808 -2
  12. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  13. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +404 -1
  14. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  15. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +808 -2
  16. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  17. package/dist/client/connect/payoutSyncTestHelpers.d.ts +404 -1
  18. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  19. package/dist/client/costRecovery-invoices.d.ts +2 -2
  20. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  21. package/dist/client/costRecovery-invoices.js +4 -1
  22. package/dist/client/costRecovery-invoices.js.map +1 -1
  23. package/dist/client/costRecovery.d.ts +5 -2
  24. package/dist/client/costRecovery.d.ts.map +1 -1
  25. package/dist/client/costRecovery.js +3 -1
  26. package/dist/client/costRecovery.js.map +1 -1
  27. package/dist/client/index.d.ts +3 -0
  28. package/dist/client/index.d.ts.map +1 -1
  29. package/dist/client/index.js +4 -0
  30. package/dist/client/index.js.map +1 -1
  31. package/dist/client/recoveryWorkflow/client.d.ts +14 -0
  32. package/dist/client/recoveryWorkflow/client.d.ts.map +1 -0
  33. package/dist/client/recoveryWorkflow/client.js +34 -0
  34. package/dist/client/recoveryWorkflow/client.js.map +1 -0
  35. package/dist/client/recoveryWorkflow/contracts.d.ts +63 -0
  36. package/dist/client/recoveryWorkflow/contracts.d.ts.map +1 -0
  37. package/dist/client/recoveryWorkflow/contracts.js +11 -0
  38. package/dist/client/recoveryWorkflow/contracts.js.map +1 -0
  39. package/dist/client/recoveryWorkflow/provider.d.ts +10 -0
  40. package/dist/client/recoveryWorkflow/provider.d.ts.map +1 -0
  41. package/dist/client/recoveryWorkflow/provider.js +80 -0
  42. package/dist/client/recoveryWorkflow/provider.js.map +1 -0
  43. package/dist/client/recoveryWorkflow/settlement.d.ts +6 -0
  44. package/dist/client/recoveryWorkflow/settlement.d.ts.map +1 -0
  45. package/dist/client/recoveryWorkflow/settlement.js +43 -0
  46. package/dist/client/recoveryWorkflow/settlement.js.map +1 -0
  47. package/dist/component/_generated/api.d.ts +30 -0
  48. package/dist/component/_generated/api.d.ts.map +1 -1
  49. package/dist/component/_generated/api.js.map +1 -1
  50. package/dist/component/_generated/component.d.ts +637 -0
  51. package/dist/component/_generated/component.d.ts.map +1 -1
  52. package/dist/component/balanceFunding/helpers.d.ts +42 -0
  53. package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
  54. package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
  55. package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
  56. package/dist/component/balanceFunding/internal/actions.js +80 -0
  57. package/dist/component/balanceFunding/internal/actions.js.map +1 -0
  58. package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
  59. package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
  60. package/dist/component/balanceFunding/internal/mutations.js +54 -0
  61. package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
  62. package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
  63. package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
  64. package/dist/component/balanceFunding/internal/queries.js +35 -0
  65. package/dist/component/balanceFunding/internal/queries.js.map +1 -0
  66. package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
  67. package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
  68. package/dist/component/balanceFunding/internal/workflow.js +31 -0
  69. package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
  70. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
  71. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
  72. package/dist/component/balanceFunding/mutations.d.ts +419 -16
  73. package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
  74. package/dist/component/balanceFunding/mutations.js +24 -0
  75. package/dist/component/balanceFunding/mutations.js.map +1 -1
  76. package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
  77. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
  78. package/dist/component/balanceFunding/queries.d.ts +78 -0
  79. package/dist/component/balanceFunding/queries.d.ts.map +1 -1
  80. package/dist/component/balanceFunding/queries.js +35 -0
  81. package/dist/component/balanceFunding/queries.js.map +1 -1
  82. package/dist/component/balanceFunding/receipt.d.ts +5 -0
  83. package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
  84. package/dist/component/balanceFunding/receipt.js +37 -0
  85. package/dist/component/balanceFunding/receipt.js.map +1 -0
  86. package/dist/component/balanceFunding/schema.d.ts +506 -2
  87. package/dist/component/balanceFunding/schema.d.ts.map +1 -1
  88. package/dist/component/balanceFunding/schema.js +2 -0
  89. package/dist/component/balanceFunding/schema.js.map +1 -1
  90. package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
  91. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
  92. package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
  93. package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
  94. package/dist/component/balanceFunding/workflowControl.js +149 -0
  95. package/dist/component/balanceFunding/workflowControl.js.map +1 -0
  96. package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
  97. package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
  98. package/dist/component/balanceFunding/workflowSchema.js +48 -0
  99. package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
  100. package/dist/component/balanceFunding/workflowState.d.ts +157 -0
  101. package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
  102. package/dist/component/balanceFunding/workflowState.js +194 -0
  103. package/dist/component/balanceFunding/workflowState.js.map +1 -0
  104. package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
  105. package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
  106. package/dist/component/balanceFunding/workflowValidators.js +27 -0
  107. package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
  108. package/dist/component/earnings/triggers.d.ts +280 -2
  109. package/dist/component/earnings/triggers.d.ts.map +1 -1
  110. package/dist/component/payoutRelease/queries.d.ts +2 -2
  111. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  112. package/dist/component/recoveryWorkflow/bridge.d.ts +21 -0
  113. package/dist/component/recoveryWorkflow/bridge.d.ts.map +1 -0
  114. package/dist/component/recoveryWorkflow/bridge.js +52 -0
  115. package/dist/component/recoveryWorkflow/bridge.js.map +1 -0
  116. package/dist/component/recoveryWorkflow/helpers.d.ts +83 -0
  117. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -0
  118. package/dist/component/recoveryWorkflow/helpers.js +48 -0
  119. package/dist/component/recoveryWorkflow/helpers.js.map +1 -0
  120. package/dist/component/recoveryWorkflow/mutations.d.ts +91 -0
  121. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -0
  122. package/dist/component/recoveryWorkflow/mutations.js +177 -0
  123. package/dist/component/recoveryWorkflow/mutations.js.map +1 -0
  124. package/dist/component/recoveryWorkflow/queries.d.ts +118 -0
  125. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -0
  126. package/dist/component/recoveryWorkflow/queries.js +20 -0
  127. package/dist/component/recoveryWorkflow/queries.js.map +1 -0
  128. package/dist/component/recoveryWorkflow/schema.d.ts +653 -0
  129. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -0
  130. package/dist/component/recoveryWorkflow/schema.js +81 -0
  131. package/dist/component/recoveryWorkflow/schema.js.map +1 -0
  132. package/dist/component/recoveryWorkflow/steps.d.ts +70 -0
  133. package/dist/component/recoveryWorkflow/steps.d.ts.map +1 -0
  134. package/dist/component/recoveryWorkflow/steps.js +94 -0
  135. package/dist/component/recoveryWorkflow/steps.js.map +1 -0
  136. package/dist/component/recoveryWorkflow/workflow.d.ts +22 -0
  137. package/dist/component/recoveryWorkflow/workflow.d.ts.map +1 -0
  138. package/dist/component/recoveryWorkflow/workflow.js +56 -0
  139. package/dist/component/recoveryWorkflow/workflow.js.map +1 -0
  140. package/dist/component/schema.d.ts +404 -1
  141. package/dist/component/schema.js +3 -0
  142. package/dist/component/schema.js.map +1 -1
  143. package/package.json +1 -1
  144. package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
  145. package/src/client/balanceFundingWorkflow/client.ts +419 -0
  146. package/src/client/billing/balanceFunding.ts +50 -0
  147. package/src/client/costRecovery-invoices.ts +6 -0
  148. package/src/client/costRecovery.ts +8 -3
  149. package/src/client/index.ts +15 -0
  150. package/src/client/recoveryWorkflow/client.test.ts +37 -0
  151. package/src/client/recoveryWorkflow/client.ts +76 -0
  152. package/src/client/recoveryWorkflow/contracts.ts +72 -0
  153. package/src/client/recoveryWorkflow/provider.test.ts +424 -0
  154. package/src/client/recoveryWorkflow/provider.ts +119 -0
  155. package/src/client/recoveryWorkflow/settlement.ts +67 -0
  156. package/src/component/_generated/api.ts +30 -0
  157. package/src/component/_generated/component.ts +746 -0
  158. package/src/component/balanceFunding/internal/actions.ts +107 -0
  159. package/src/component/balanceFunding/internal/mutations.ts +66 -0
  160. package/src/component/balanceFunding/internal/queries.ts +34 -0
  161. package/src/component/balanceFunding/internal/workflow.ts +49 -0
  162. package/src/component/balanceFunding/mutations.ts +34 -0
  163. package/src/component/balanceFunding/queries.ts +38 -0
  164. package/src/component/balanceFunding/receipt.ts +48 -0
  165. package/src/component/balanceFunding/schema.ts +2 -0
  166. package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
  167. package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
  168. package/src/component/balanceFunding/workflow.test.ts +552 -0
  169. package/src/component/balanceFunding/workflowControl.ts +198 -0
  170. package/src/component/balanceFunding/workflowSchema.ts +78 -0
  171. package/src/component/balanceFunding/workflowState.ts +285 -0
  172. package/src/component/balanceFunding/workflowValidators.ts +40 -0
  173. package/src/component/recoveryWorkflow/bridge.test.ts +481 -0
  174. package/src/component/recoveryWorkflow/bridge.ts +66 -0
  175. package/src/component/recoveryWorkflow/helpers.ts +58 -0
  176. package/src/component/recoveryWorkflow/journal.test.ts +104 -0
  177. package/src/component/recoveryWorkflow/mutations.ts +224 -0
  178. package/src/component/recoveryWorkflow/queries.ts +19 -0
  179. package/src/component/recoveryWorkflow/schema.ts +92 -0
  180. package/src/component/recoveryWorkflow/state.test.ts +191 -0
  181. package/src/component/recoveryWorkflow/steps.ts +97 -0
  182. package/src/component/recoveryWorkflow/workflow.ts +73 -0
  183. package/src/component/schema.ts +6 -0
@@ -1,4 +1,225 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ accountId: string;
4
+ activePhase?: "execute" | "reconcile" | undefined;
5
+ allocation?: {
6
+ adjustmentAmount?: number | undefined;
7
+ currency: string;
8
+ gross: number;
9
+ paymentId?: string | undefined;
10
+ paymentIntentId?: string | undefined;
11
+ platformNet: number;
12
+ processingFee: number;
13
+ sourceChargeId: string;
14
+ sourceInvoiceId?: string | undefined;
15
+ transfers: {
16
+ amount: number;
17
+ destinationAccountId: string;
18
+ role: "affiliate" | "other" | "store";
19
+ }[];
20
+ } | undefined;
21
+ cancelRequested: boolean;
22
+ completion?: string | undefined;
23
+ currency: string;
24
+ definitionVersion: number;
25
+ groupKey: string;
26
+ maxAttempts: number;
27
+ outcome?: "collect" | "release" | undefined;
28
+ provider: string;
29
+ providerApiVersion: string;
30
+ providerStarted: boolean;
31
+ releaseUncollectible: boolean;
32
+ resumeQueued: boolean;
33
+ retryDelayMs: number;
34
+ scopeKey: string;
35
+ sourceId: string;
36
+ sourceKind: "invoice" | "settlement";
37
+ status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
38
+ version: number;
39
+ workflowId?: string | undefined;
40
+ }, {
41
+ accountId: import("convex/values").VString<string, "required">;
42
+ scopeKey: import("convex/values").VString<string, "required">;
43
+ currency: import("convex/values").VString<string, "required">;
44
+ groupKey: import("convex/values").VString<string, "required">;
45
+ provider: import("convex/values").VString<string, "required">;
46
+ completion: import("convex/values").VString<string | undefined, "optional">;
47
+ providerApiVersion: import("convex/values").VString<string, "required">;
48
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
49
+ releaseUncollectible: import("convex/values").VBoolean<boolean, "required">;
50
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
51
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
52
+ allocation: import("convex/values").VObject<{
53
+ adjustmentAmount?: number | undefined;
54
+ currency: string;
55
+ gross: number;
56
+ paymentId?: string | undefined;
57
+ paymentIntentId?: string | undefined;
58
+ platformNet: number;
59
+ processingFee: number;
60
+ sourceChargeId: string;
61
+ sourceInvoiceId?: string | undefined;
62
+ transfers: {
63
+ amount: number;
64
+ destinationAccountId: string;
65
+ role: "affiliate" | "other" | "store";
66
+ }[];
67
+ } | undefined, {
68
+ sourceChargeId: import("convex/values").VString<string, "required">;
69
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
70
+ sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
71
+ gross: import("convex/values").VFloat64<number, "required">;
72
+ currency: import("convex/values").VString<string, "required">;
73
+ processingFee: import("convex/values").VFloat64<number, "required">;
74
+ platformNet: import("convex/values").VFloat64<number, "required">;
75
+ adjustmentAmount: import("convex/values").VFloat64<number | undefined, "optional">;
76
+ paymentId: import("convex/values").VString<string | undefined, "optional">;
77
+ transfers: import("convex/values").VArray<{
78
+ amount: number;
79
+ destinationAccountId: string;
80
+ role: "affiliate" | "other" | "store";
81
+ }[], import("convex/values").VObject<{
82
+ amount: number;
83
+ destinationAccountId: string;
84
+ role: "affiliate" | "other" | "store";
85
+ }, {
86
+ destinationAccountId: import("convex/values").VString<string, "required">;
87
+ role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
88
+ amount: import("convex/values").VFloat64<number, "required">;
89
+ }, "required", "amount" | "destinationAccountId" | "role">, "required">;
90
+ }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
91
+ version: import("convex/values").VFloat64<number, "required">;
92
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
93
+ sourceId: import("convex/values").VString<string, "required">;
94
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
95
+ status: import("convex/values").VUnion<"canceled" | "completed" | "queued" | "running" | "unknown" | "waiting", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"waiting", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
96
+ cancelRequested: import("convex/values").VBoolean<boolean, "required">;
97
+ providerStarted: import("convex/values").VBoolean<boolean, "required">;
98
+ activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
99
+ resumeQueued: import("convex/values").VBoolean<boolean, "required">;
100
+ outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
101
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
102
+ by_group: ["groupKey", "_creationTime"];
103
+ by_source: ["sourceKind", "sourceId", "_creationTime"];
104
+ }, {}, {}>;
105
+ recoveryWorkflowRequests: import("convex/server").TableDefinition<import("convex/values").VObject<{
106
+ binding: {
107
+ accountId: string;
108
+ allocation?: {
109
+ adjustmentAmount?: number | undefined;
110
+ currency: string;
111
+ gross: number;
112
+ paymentId?: string | undefined;
113
+ paymentIntentId?: string | undefined;
114
+ platformNet: number;
115
+ processingFee: number;
116
+ sourceChargeId: string;
117
+ sourceInvoiceId?: string | undefined;
118
+ transfers: {
119
+ amount: number;
120
+ destinationAccountId: string;
121
+ role: "affiliate" | "other" | "store";
122
+ }[];
123
+ } | undefined;
124
+ completion?: string | undefined;
125
+ currency: string;
126
+ definitionVersion: number;
127
+ groupKey: string;
128
+ maxAttempts: number;
129
+ provider: string;
130
+ providerApiVersion: string;
131
+ releaseUncollectible: boolean;
132
+ retryDelayMs: number;
133
+ scopeKey: string;
134
+ };
135
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
136
+ requestKey: string;
137
+ }, {
138
+ requestKey: import("convex/values").VString<string, "required">;
139
+ binding: import("convex/values").VObject<{
140
+ accountId: string;
141
+ allocation?: {
142
+ adjustmentAmount?: number | undefined;
143
+ currency: string;
144
+ gross: number;
145
+ paymentId?: string | undefined;
146
+ paymentIntentId?: string | undefined;
147
+ platformNet: number;
148
+ processingFee: number;
149
+ sourceChargeId: string;
150
+ sourceInvoiceId?: string | undefined;
151
+ transfers: {
152
+ amount: number;
153
+ destinationAccountId: string;
154
+ role: "affiliate" | "other" | "store";
155
+ }[];
156
+ } | undefined;
157
+ completion?: string | undefined;
158
+ currency: string;
159
+ definitionVersion: number;
160
+ groupKey: string;
161
+ maxAttempts: number;
162
+ provider: string;
163
+ providerApiVersion: string;
164
+ releaseUncollectible: boolean;
165
+ retryDelayMs: number;
166
+ scopeKey: string;
167
+ }, {
168
+ accountId: import("convex/values").VString<string, "required">;
169
+ scopeKey: import("convex/values").VString<string, "required">;
170
+ currency: import("convex/values").VString<string, "required">;
171
+ groupKey: import("convex/values").VString<string, "required">;
172
+ provider: import("convex/values").VString<string, "required">;
173
+ completion: import("convex/values").VString<string | undefined, "optional">;
174
+ providerApiVersion: import("convex/values").VString<string, "required">;
175
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
176
+ releaseUncollectible: import("convex/values").VBoolean<boolean, "required">;
177
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
178
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
179
+ allocation: import("convex/values").VObject<{
180
+ adjustmentAmount?: number | undefined;
181
+ currency: string;
182
+ gross: number;
183
+ paymentId?: string | undefined;
184
+ paymentIntentId?: string | undefined;
185
+ platformNet: number;
186
+ processingFee: number;
187
+ sourceChargeId: string;
188
+ sourceInvoiceId?: string | undefined;
189
+ transfers: {
190
+ amount: number;
191
+ destinationAccountId: string;
192
+ role: "affiliate" | "other" | "store";
193
+ }[];
194
+ } | undefined, {
195
+ sourceChargeId: import("convex/values").VString<string, "required">;
196
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
197
+ sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
198
+ gross: import("convex/values").VFloat64<number, "required">;
199
+ currency: import("convex/values").VString<string, "required">;
200
+ processingFee: import("convex/values").VFloat64<number, "required">;
201
+ platformNet: import("convex/values").VFloat64<number, "required">;
202
+ adjustmentAmount: import("convex/values").VFloat64<number | undefined, "optional">;
203
+ paymentId: import("convex/values").VString<string | undefined, "optional">;
204
+ transfers: import("convex/values").VArray<{
205
+ amount: number;
206
+ destinationAccountId: string;
207
+ role: "affiliate" | "other" | "store";
208
+ }[], import("convex/values").VObject<{
209
+ amount: number;
210
+ destinationAccountId: string;
211
+ role: "affiliate" | "other" | "store";
212
+ }, {
213
+ destinationAccountId: import("convex/values").VString<string, "required">;
214
+ role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
215
+ amount: import("convex/values").VFloat64<number, "required">;
216
+ }, "required", "amount" | "destinationAccountId" | "role">, "required">;
217
+ }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
218
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
219
+ operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
220
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
221
+ by_key: ["requestKey", "_creationTime"];
222
+ }, {}, {}>;
2
223
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
224
  accountId: string;
4
225
  activeOperationId?: import("convex/values").GenericId<"balanceFundingOperations"> | undefined;
@@ -50,6 +271,48 @@ declare const _default: import("convex/server").SchemaDefinition<{
50
271
  accountId: string;
51
272
  cancelRequested: boolean;
52
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;
53
316
  failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
54
317
  kind: "apply" | "prepare";
55
318
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
@@ -105,7 +368,147 @@ declare const _default: import("convex/server").SchemaDefinition<{
105
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>;
106
369
  providerApiVersion: import("convex/values").VString<string, "required">;
107
370
  }, "optional", "customerAccount" | "paymentMethodId" | "paymentMethodTypes" | "providerApiVersion" | "stripeSubscriptionId">;
108
- }, "required", "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">, {
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">, {
109
512
  by_preparation_version: ["preparationId", "version", "_creationTime"];
110
513
  }, {}, {}>;
111
514
  balanceFundingRequests: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -1,3 +1,4 @@
1
+ import { operationsTable as recoveryWorkflowOperations, requestsTable as recoveryWorkflowRequests, } from "./recoveryWorkflow/schema.js";
1
2
  import { preparationsTable as balanceFundingPreparations, operationsTable as balanceFundingOperations, requestsTable as balanceFundingRequests, } from "./balanceFunding/schema.js";
2
3
  import { payloadsTable as operationEvidencePayloads, headersTable as operationEvidenceHeaders, } from "./operationEvidence/schema.js";
3
4
  import { transferBatchReferencesTable } from "./financialObservations/transferReferenceSchema.js";
@@ -22,6 +23,8 @@ import { accountsTable } from "./core/schema";
22
23
  import { pricesTable, productsTable } from "./products/schema";
23
24
  import { webhookEventsTable } from "./webhooks/schema";
24
25
  export default defineSchema({
26
+ recoveryWorkflowOperations,
27
+ recoveryWorkflowRequests,
25
28
  balanceFundingPreparations,
26
29
  balanceFundingOperations,
27
30
  balanceFundingRequests,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,IAAI,0BAA0B,EAC/C,eAAe,IAAI,wBAAwB,EAC3C,aAAa,IAAI,sBAAsB,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,IAAI,yBAAyB,EAC1C,YAAY,IAAI,wBAAwB,GACzC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,eAAe,IAAI,mBAAmB,EACtC,aAAa,IAAI,iBAAiB,EAClC,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,iBAAiB,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,IAAI,wBAAwB,EACvC,YAAY,IAA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B,EAAE,yBAAyB;IAC/C,2BAA2B,EAAE,mBAAmB;IAChD,uBAAuB;IACvB,iBAAiB;IACjB,gBAAgB;IAChB,yBAAyB,EAAE,iBAAiB;IAC5C,yBAAyB,EAAE,8BAA8B;IACzD,gBAAgB,EAAE,qBAAqB;IACvC,iBAAiB,EAAE,sBAAsB;IACzC,mBAAmB,EAAE,wBAAwB;IAC7C,uBAAuB,EAAE,4BAA4B;IACrD,cAAc,EAAE,aAAa;IAC7B,sBAAsB,EAAE,eAAe;IACvC,cAAc,EAAE,mBAAmB;IACnC,cAAc,EAAE,WAAW;IAC3B,gBAAgB,EAAE,aAAa;IAC/B,cAAc,EAAE,WAAW;IAC3B,oBAAoB,EAAE,iBAAiB;IACvC,qBAAqB,EAAE,gBAAgB;IACvC,eAAe,EAAE,oBAAoB;IACrC,mBAAmB,EAAE,wBAAwB;IAC7C,OAAO;IACP,QAAQ,EAAE,aAAa;IACvB,eAAe,EAAE,oBAAoB;IAErC,WAAW;IACX,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,WAAW;IAEnB,UAAU;IACV,aAAa,EAAE,kBAAkB;IACjC,gBAAgB,EAAE,qBAAqB;IACvC,QAAQ,EAAE,aAAa;IAEvB,UAAU;IACV,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,YAAY;IACrB,iBAAiB,EAAE,sBAAsB;IACzC,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;IACzB,mBAAmB,EAAE,wBAAwB;IAE7C,WAAW;IACX,aAAa,EAAE,kBAAkB;CAClC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.40.0",
3
+ "version": "0.42.0",
4
4
  "description": "A Convex component for Stripe V2 Accounts API integration.",
5
5
  "keywords": [
6
6
  "stripe",
@@ -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
+ });