@fantastic.dev/better-stripe 0.41.0 → 0.43.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 (209) hide show
  1. package/CHANGELOG.md +25 -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 +1388 -2
  12. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  13. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +710 -17
  14. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  15. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1420 -34
  16. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  17. package/dist/client/connect/payoutSyncTestHelpers.d.ts +694 -1
  18. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  19. package/dist/client/costRecovery-invoices.d.ts +3 -2
  20. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  21. package/dist/client/costRecovery-invoices.js +10 -5
  22. package/dist/client/costRecovery-invoices.js.map +1 -1
  23. package/dist/client/costRecovery.d.ts +4 -2
  24. package/dist/client/costRecovery.d.ts.map +1 -1
  25. package/dist/client/costRecovery.js +2 -2
  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/processingCostReconciliation/client.d.ts +14 -0
  32. package/dist/client/processingCostReconciliation/client.d.ts.map +1 -0
  33. package/dist/client/processingCostReconciliation/client.js +35 -0
  34. package/dist/client/processingCostReconciliation/client.js.map +1 -0
  35. package/dist/client/processingCostReconciliation/contracts.d.ts +172 -0
  36. package/dist/client/processingCostReconciliation/contracts.d.ts.map +1 -0
  37. package/dist/client/processingCostReconciliation/contracts.js +55 -0
  38. package/dist/client/processingCostReconciliation/contracts.js.map +1 -0
  39. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts +15 -0
  40. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts.map +1 -0
  41. package/dist/client/processingCostReconciliation/invoiceFunding.js +195 -0
  42. package/dist/client/processingCostReconciliation/invoiceFunding.js.map +1 -0
  43. package/dist/client/processingCostReconciliation/provider.d.ts +9 -0
  44. package/dist/client/processingCostReconciliation/provider.d.ts.map +1 -0
  45. package/dist/client/processingCostReconciliation/provider.js +148 -0
  46. package/dist/client/processingCostReconciliation/provider.js.map +1 -0
  47. package/dist/client/settlement/processingCostHistory.d.ts +12 -0
  48. package/dist/client/settlement/processingCostHistory.d.ts.map +1 -0
  49. package/dist/client/settlement/processingCostHistory.js +20 -0
  50. package/dist/client/settlement/processingCostHistory.js.map +1 -0
  51. package/dist/client/settlement/processingCosts.d.ts +3 -0
  52. package/dist/client/settlement/processingCosts.d.ts.map +1 -1
  53. package/dist/client/settlement/processingCosts.js +27 -7
  54. package/dist/client/settlement/processingCosts.js.map +1 -1
  55. package/dist/component/_generated/api.d.ts +36 -0
  56. package/dist/component/_generated/api.d.ts.map +1 -1
  57. package/dist/component/_generated/api.js.map +1 -1
  58. package/dist/component/_generated/component.d.ts +988 -0
  59. package/dist/component/_generated/component.d.ts.map +1 -1
  60. package/dist/component/balanceFunding/helpers.d.ts +42 -0
  61. package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
  62. package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
  63. package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
  64. package/dist/component/balanceFunding/internal/actions.js +80 -0
  65. package/dist/component/balanceFunding/internal/actions.js.map +1 -0
  66. package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
  67. package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
  68. package/dist/component/balanceFunding/internal/mutations.js +54 -0
  69. package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
  70. package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
  71. package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
  72. package/dist/component/balanceFunding/internal/queries.js +35 -0
  73. package/dist/component/balanceFunding/internal/queries.js.map +1 -0
  74. package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
  75. package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
  76. package/dist/component/balanceFunding/internal/workflow.js +31 -0
  77. package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
  78. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
  79. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
  80. package/dist/component/balanceFunding/mutations.d.ts +419 -16
  81. package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
  82. package/dist/component/balanceFunding/mutations.js +24 -0
  83. package/dist/component/balanceFunding/mutations.js.map +1 -1
  84. package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
  85. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
  86. package/dist/component/balanceFunding/queries.d.ts +78 -0
  87. package/dist/component/balanceFunding/queries.d.ts.map +1 -1
  88. package/dist/component/balanceFunding/queries.js +35 -0
  89. package/dist/component/balanceFunding/queries.js.map +1 -1
  90. package/dist/component/balanceFunding/receipt.d.ts +5 -0
  91. package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
  92. package/dist/component/balanceFunding/receipt.js +37 -0
  93. package/dist/component/balanceFunding/receipt.js.map +1 -0
  94. package/dist/component/balanceFunding/schema.d.ts +506 -2
  95. package/dist/component/balanceFunding/schema.d.ts.map +1 -1
  96. package/dist/component/balanceFunding/schema.js +2 -0
  97. package/dist/component/balanceFunding/schema.js.map +1 -1
  98. package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
  99. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
  100. package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
  101. package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
  102. package/dist/component/balanceFunding/workflowControl.js +149 -0
  103. package/dist/component/balanceFunding/workflowControl.js.map +1 -0
  104. package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
  105. package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
  106. package/dist/component/balanceFunding/workflowSchema.js +48 -0
  107. package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
  108. package/dist/component/balanceFunding/workflowState.d.ts +157 -0
  109. package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
  110. package/dist/component/balanceFunding/workflowState.js +194 -0
  111. package/dist/component/balanceFunding/workflowState.js.map +1 -0
  112. package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
  113. package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
  114. package/dist/component/balanceFunding/workflowValidators.js +27 -0
  115. package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
  116. package/dist/component/earnings/triggers.d.ts +388 -2
  117. package/dist/component/earnings/triggers.d.ts.map +1 -1
  118. package/dist/component/payoutRelease/queries.d.ts +2 -2
  119. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  120. package/dist/component/processingCostReconciliation/adoption.d.ts +29 -0
  121. package/dist/component/processingCostReconciliation/adoption.d.ts.map +1 -0
  122. package/dist/component/processingCostReconciliation/adoption.js +58 -0
  123. package/dist/component/processingCostReconciliation/adoption.js.map +1 -0
  124. package/dist/component/processingCostReconciliation/bridge.d.ts +45 -0
  125. package/dist/component/processingCostReconciliation/bridge.d.ts.map +1 -0
  126. package/dist/component/processingCostReconciliation/bridge.js +41 -0
  127. package/dist/component/processingCostReconciliation/bridge.js.map +1 -0
  128. package/dist/component/processingCostReconciliation/helpers.d.ts +327 -0
  129. package/dist/component/processingCostReconciliation/helpers.d.ts.map +1 -0
  130. package/dist/component/processingCostReconciliation/helpers.js +39 -0
  131. package/dist/component/processingCostReconciliation/helpers.js.map +1 -0
  132. package/dist/component/processingCostReconciliation/mutations.d.ts +303 -0
  133. package/dist/component/processingCostReconciliation/mutations.d.ts.map +1 -0
  134. package/dist/component/processingCostReconciliation/mutations.js +121 -0
  135. package/dist/component/processingCostReconciliation/mutations.js.map +1 -0
  136. package/dist/component/processingCostReconciliation/queries.d.ts +422 -0
  137. package/dist/component/processingCostReconciliation/queries.d.ts.map +1 -0
  138. package/dist/component/processingCostReconciliation/queries.js +19 -0
  139. package/dist/component/processingCostReconciliation/queries.js.map +1 -0
  140. package/dist/component/processingCostReconciliation/rollback.d.ts +21 -0
  141. package/dist/component/processingCostReconciliation/rollback.d.ts.map +1 -0
  142. package/dist/component/processingCostReconciliation/rollback.js +54 -0
  143. package/dist/component/processingCostReconciliation/rollback.js.map +1 -0
  144. package/dist/component/processingCostReconciliation/schema.d.ts +2460 -0
  145. package/dist/component/processingCostReconciliation/schema.d.ts.map +1 -0
  146. package/dist/component/processingCostReconciliation/schema.js +137 -0
  147. package/dist/component/processingCostReconciliation/schema.js.map +1 -0
  148. package/dist/component/processingCostReconciliation/steps.d.ts +306 -0
  149. package/dist/component/processingCostReconciliation/steps.d.ts.map +1 -0
  150. package/dist/component/processingCostReconciliation/steps.js +149 -0
  151. package/dist/component/processingCostReconciliation/steps.js.map +1 -0
  152. package/dist/component/processingCostReconciliation/validation.d.ts +13 -0
  153. package/dist/component/processingCostReconciliation/validation.d.ts.map +1 -0
  154. package/dist/component/processingCostReconciliation/validation.js +61 -0
  155. package/dist/component/processingCostReconciliation/validation.js.map +1 -0
  156. package/dist/component/processingCostReconciliation/workflow.d.ts +105 -0
  157. package/dist/component/processingCostReconciliation/workflow.d.ts.map +1 -0
  158. package/dist/component/processingCostReconciliation/workflow.js +33 -0
  159. package/dist/component/processingCostReconciliation/workflow.js.map +1 -0
  160. package/dist/component/schema.d.ts +694 -1
  161. package/dist/component/schema.js +2 -0
  162. package/dist/component/schema.js.map +1 -1
  163. package/package.json +1 -1
  164. package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
  165. package/src/client/balanceFundingWorkflow/client.ts +419 -0
  166. package/src/client/billing/balanceFunding.ts +50 -0
  167. package/src/client/costRecovery-invoices.ts +19 -4
  168. package/src/client/costRecovery.ts +4 -2
  169. package/src/client/index.ts +15 -0
  170. package/src/client/processingCostReconciliation/client.ts +75 -0
  171. package/src/client/processingCostReconciliation/contracts.ts +176 -0
  172. package/src/client/processingCostReconciliation/invoiceFunding.ts +270 -0
  173. package/src/client/processingCostReconciliation/invoiceProvider.test.ts +353 -0
  174. package/src/client/processingCostReconciliation/provider.test.ts +324 -0
  175. package/src/client/processingCostReconciliation/provider.ts +178 -0
  176. package/src/client/settlement/processingCostHistory.ts +31 -0
  177. package/src/client/settlement/processingCosts.ts +50 -15
  178. package/src/component/_generated/api.ts +36 -0
  179. package/src/component/_generated/component.ts +1094 -0
  180. package/src/component/balanceFunding/internal/actions.ts +107 -0
  181. package/src/component/balanceFunding/internal/mutations.ts +66 -0
  182. package/src/component/balanceFunding/internal/queries.ts +34 -0
  183. package/src/component/balanceFunding/internal/workflow.ts +49 -0
  184. package/src/component/balanceFunding/mutations.ts +34 -0
  185. package/src/component/balanceFunding/queries.ts +38 -0
  186. package/src/component/balanceFunding/receipt.ts +48 -0
  187. package/src/component/balanceFunding/schema.ts +2 -0
  188. package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
  189. package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
  190. package/src/component/balanceFunding/workflow.test.ts +552 -0
  191. package/src/component/balanceFunding/workflowControl.ts +198 -0
  192. package/src/component/balanceFunding/workflowSchema.ts +78 -0
  193. package/src/component/balanceFunding/workflowState.ts +285 -0
  194. package/src/component/balanceFunding/workflowValidators.ts +40 -0
  195. package/src/component/processingCostReconciliation/adoption.test.ts +206 -0
  196. package/src/component/processingCostReconciliation/adoption.ts +77 -0
  197. package/src/component/processingCostReconciliation/bridge.ts +50 -0
  198. package/src/component/processingCostReconciliation/helpers.ts +55 -0
  199. package/src/component/processingCostReconciliation/invoice.test.ts +152 -0
  200. package/src/component/processingCostReconciliation/mutations.ts +148 -0
  201. package/src/component/processingCostReconciliation/queries.ts +18 -0
  202. package/src/component/processingCostReconciliation/rollback.ts +72 -0
  203. package/src/component/processingCostReconciliation/schema.ts +191 -0
  204. package/src/component/processingCostReconciliation/state.test.ts +407 -0
  205. package/src/component/processingCostReconciliation/steps.ts +168 -0
  206. package/src/component/processingCostReconciliation/validation.ts +79 -0
  207. package/src/component/processingCostReconciliation/workflow.test.ts +329 -0
  208. package/src/component/processingCostReconciliation/workflow.ts +50 -0
  209. package/src/component/schema.ts +2 -0
@@ -506,6 +506,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
506
506
  retryable: true;
507
507
  status: "not_ready";
508
508
  }, Name>;
509
+ cancelWorkflow: FunctionReference<"mutation", "internal", {
510
+ accountId: string;
511
+ definitionVersion: string;
512
+ operationId: string;
513
+ providerApiVersion: string;
514
+ scopeKey: string;
515
+ stripeSubscriptionId: string;
516
+ version: number;
517
+ }, {
518
+ accountId: string;
519
+ cancelRequested: boolean;
520
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
521
+ operationId: string;
522
+ scopeKey: string;
523
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
524
+ version: number;
525
+ }, Name>;
526
+ claimProviderPhase: FunctionReference<"mutation", "internal", {
527
+ accountId: string;
528
+ definitionVersion: string;
529
+ operationId: string;
530
+ phase: "create" | "attach" | "apply";
531
+ providerApiVersion: string;
532
+ providerKey: string;
533
+ scopeKey: string;
534
+ stripeSubscriptionId: string;
535
+ version: number;
536
+ }, {
537
+ mode: "execute" | "reconcile";
538
+ paymentMethodId?: string;
539
+ status: "claimed";
540
+ } | {
541
+ status: "ready";
542
+ value: {
543
+ customerAccount: string;
544
+ enabled?: boolean;
545
+ paymentMethodId: string | null;
546
+ paymentMethodTypes?: Array<string> | null;
547
+ phase: "create" | "attach" | "apply";
548
+ providerApiVersion: string;
549
+ stripeSubscriptionId: string;
550
+ };
551
+ } | {
552
+ reason: "provider_outcome_unknown" | "history_incomplete";
553
+ retryable: false;
554
+ status: "unknown";
555
+ } | {
556
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
557
+ retryable: false;
558
+ status: "conflict";
559
+ } | {
560
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
561
+ retryable: false;
562
+ status: "rejected";
563
+ } | {
564
+ reason: "provider_pending";
565
+ retryable: true;
566
+ status: "not_ready";
567
+ }, Name>;
509
568
  failBeforeStart: FunctionReference<"mutation", "internal", {
510
569
  accountId: string;
511
570
  failureCode: "invalid_scope" | "unsupported_source" | "policy_invalid";
@@ -518,6 +577,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
518
577
  accountId: string;
519
578
  cancelRequested: boolean;
520
579
  enabled: boolean;
580
+ execution?: {
581
+ apply?: {
582
+ receipt?: {
583
+ customerAccount: string;
584
+ enabled?: boolean;
585
+ paymentMethodId: string | null;
586
+ paymentMethodTypes?: Array<string> | null;
587
+ phase: "create" | "attach" | "apply";
588
+ providerApiVersion: string;
589
+ stripeSubscriptionId: string;
590
+ };
591
+ state: "running" | "unknown" | "succeeded";
592
+ };
593
+ attach?: {
594
+ receipt?: {
595
+ customerAccount: string;
596
+ enabled?: boolean;
597
+ paymentMethodId: string | null;
598
+ paymentMethodTypes?: Array<string> | null;
599
+ phase: "create" | "attach" | "apply";
600
+ providerApiVersion: string;
601
+ stripeSubscriptionId: string;
602
+ };
603
+ state: "running" | "unknown" | "succeeded";
604
+ };
605
+ create?: {
606
+ receipt?: {
607
+ customerAccount: string;
608
+ enabled?: boolean;
609
+ paymentMethodId: string | null;
610
+ paymentMethodTypes?: Array<string> | null;
611
+ phase: "create" | "attach" | "apply";
612
+ providerApiVersion: string;
613
+ stripeSubscriptionId: string;
614
+ };
615
+ state: "running" | "unknown" | "succeeded";
616
+ };
617
+ definitionVersion: string;
618
+ providerAction: string;
619
+ providerApiVersion: string;
620
+ workflowId?: string;
621
+ };
521
622
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
522
623
  kind: "prepare" | "apply";
523
624
  preparationId: string;
@@ -558,6 +659,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
558
659
  accountId: string;
559
660
  cancelRequested: boolean;
560
661
  enabled: boolean;
662
+ execution?: {
663
+ apply?: {
664
+ receipt?: {
665
+ customerAccount: string;
666
+ enabled?: boolean;
667
+ paymentMethodId: string | null;
668
+ paymentMethodTypes?: Array<string> | null;
669
+ phase: "create" | "attach" | "apply";
670
+ providerApiVersion: string;
671
+ stripeSubscriptionId: string;
672
+ };
673
+ state: "running" | "unknown" | "succeeded";
674
+ };
675
+ attach?: {
676
+ receipt?: {
677
+ customerAccount: string;
678
+ enabled?: boolean;
679
+ paymentMethodId: string | null;
680
+ paymentMethodTypes?: Array<string> | null;
681
+ phase: "create" | "attach" | "apply";
682
+ providerApiVersion: string;
683
+ stripeSubscriptionId: string;
684
+ };
685
+ state: "running" | "unknown" | "succeeded";
686
+ };
687
+ create?: {
688
+ receipt?: {
689
+ customerAccount: string;
690
+ enabled?: boolean;
691
+ paymentMethodId: string | null;
692
+ paymentMethodTypes?: Array<string> | null;
693
+ phase: "create" | "attach" | "apply";
694
+ providerApiVersion: string;
695
+ stripeSubscriptionId: string;
696
+ };
697
+ state: "running" | "unknown" | "succeeded";
698
+ };
699
+ definitionVersion: string;
700
+ providerAction: string;
701
+ providerApiVersion: string;
702
+ workflowId?: string;
703
+ };
561
704
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
562
705
  kind: "prepare" | "apply";
563
706
  preparationId: string;
@@ -598,6 +741,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
598
741
  accountId: string;
599
742
  cancelRequested: boolean;
600
743
  enabled: boolean;
744
+ execution?: {
745
+ apply?: {
746
+ receipt?: {
747
+ customerAccount: string;
748
+ enabled?: boolean;
749
+ paymentMethodId: string | null;
750
+ paymentMethodTypes?: Array<string> | null;
751
+ phase: "create" | "attach" | "apply";
752
+ providerApiVersion: string;
753
+ stripeSubscriptionId: string;
754
+ };
755
+ state: "running" | "unknown" | "succeeded";
756
+ };
757
+ attach?: {
758
+ receipt?: {
759
+ customerAccount: string;
760
+ enabled?: boolean;
761
+ paymentMethodId: string | null;
762
+ paymentMethodTypes?: Array<string> | null;
763
+ phase: "create" | "attach" | "apply";
764
+ providerApiVersion: string;
765
+ stripeSubscriptionId: string;
766
+ };
767
+ state: "running" | "unknown" | "succeeded";
768
+ };
769
+ create?: {
770
+ receipt?: {
771
+ customerAccount: string;
772
+ enabled?: boolean;
773
+ paymentMethodId: string | null;
774
+ paymentMethodTypes?: Array<string> | null;
775
+ phase: "create" | "attach" | "apply";
776
+ providerApiVersion: string;
777
+ stripeSubscriptionId: string;
778
+ };
779
+ state: "running" | "unknown" | "succeeded";
780
+ };
781
+ definitionVersion: string;
782
+ providerAction: string;
783
+ providerApiVersion: string;
784
+ workflowId?: string;
785
+ };
601
786
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
602
787
  kind: "prepare" | "apply";
603
788
  preparationId: string;
@@ -661,6 +846,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
661
846
  accountId: string;
662
847
  cancelRequested: boolean;
663
848
  enabled: boolean;
849
+ execution?: {
850
+ apply?: {
851
+ receipt?: {
852
+ customerAccount: string;
853
+ enabled?: boolean;
854
+ paymentMethodId: string | null;
855
+ paymentMethodTypes?: Array<string> | null;
856
+ phase: "create" | "attach" | "apply";
857
+ providerApiVersion: string;
858
+ stripeSubscriptionId: string;
859
+ };
860
+ state: "running" | "unknown" | "succeeded";
861
+ };
862
+ attach?: {
863
+ receipt?: {
864
+ customerAccount: string;
865
+ enabled?: boolean;
866
+ paymentMethodId: string | null;
867
+ paymentMethodTypes?: Array<string> | null;
868
+ phase: "create" | "attach" | "apply";
869
+ providerApiVersion: string;
870
+ stripeSubscriptionId: string;
871
+ };
872
+ state: "running" | "unknown" | "succeeded";
873
+ };
874
+ create?: {
875
+ receipt?: {
876
+ customerAccount: string;
877
+ enabled?: boolean;
878
+ paymentMethodId: string | null;
879
+ paymentMethodTypes?: Array<string> | null;
880
+ phase: "create" | "attach" | "apply";
881
+ providerApiVersion: string;
882
+ stripeSubscriptionId: string;
883
+ };
884
+ state: "running" | "unknown" | "succeeded";
885
+ };
886
+ definitionVersion: string;
887
+ providerAction: string;
888
+ providerApiVersion: string;
889
+ workflowId?: string;
890
+ };
664
891
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
665
892
  kind: "prepare" | "apply";
666
893
  preparationId: string;
@@ -731,6 +958,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
731
958
  accountId: string;
732
959
  cancelRequested: boolean;
733
960
  enabled: boolean;
961
+ execution?: {
962
+ apply?: {
963
+ receipt?: {
964
+ customerAccount: string;
965
+ enabled?: boolean;
966
+ paymentMethodId: string | null;
967
+ paymentMethodTypes?: Array<string> | null;
968
+ phase: "create" | "attach" | "apply";
969
+ providerApiVersion: string;
970
+ stripeSubscriptionId: string;
971
+ };
972
+ state: "running" | "unknown" | "succeeded";
973
+ };
974
+ attach?: {
975
+ receipt?: {
976
+ customerAccount: string;
977
+ enabled?: boolean;
978
+ paymentMethodId: string | null;
979
+ paymentMethodTypes?: Array<string> | null;
980
+ phase: "create" | "attach" | "apply";
981
+ providerApiVersion: string;
982
+ stripeSubscriptionId: string;
983
+ };
984
+ state: "running" | "unknown" | "succeeded";
985
+ };
986
+ create?: {
987
+ receipt?: {
988
+ customerAccount: string;
989
+ enabled?: boolean;
990
+ paymentMethodId: string | null;
991
+ paymentMethodTypes?: Array<string> | null;
992
+ phase: "create" | "attach" | "apply";
993
+ providerApiVersion: string;
994
+ stripeSubscriptionId: string;
995
+ };
996
+ state: "running" | "unknown" | "succeeded";
997
+ };
998
+ definitionVersion: string;
999
+ providerAction: string;
1000
+ providerApiVersion: string;
1001
+ workflowId?: string;
1002
+ };
734
1003
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
735
1004
  kind: "prepare" | "apply";
736
1005
  preparationId: string;
@@ -752,6 +1021,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
752
1021
  state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
753
1022
  version: number;
754
1023
  }, Name>;
1024
+ resumeWorkflow: FunctionReference<"mutation", "internal", {
1025
+ accountId: string;
1026
+ definitionVersion: string;
1027
+ operationId: string;
1028
+ providerApiVersion: string;
1029
+ scopeKey: string;
1030
+ stripeSubscriptionId: string;
1031
+ version: number;
1032
+ }, {
1033
+ operation: {
1034
+ accountId: string;
1035
+ operationId: string;
1036
+ scopeKey: string;
1037
+ version: number;
1038
+ };
1039
+ status: "accepted";
1040
+ workflowId?: string;
1041
+ } | {
1042
+ operation: {
1043
+ accountId: string;
1044
+ operationId: string;
1045
+ scopeKey: string;
1046
+ version: number;
1047
+ };
1048
+ status: "canceled";
1049
+ } | {
1050
+ reason: "provider_outcome_unknown" | "history_incomplete";
1051
+ retryable: false;
1052
+ status: "unknown";
1053
+ } | {
1054
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1055
+ retryable: false;
1056
+ status: "conflict";
1057
+ } | {
1058
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
1059
+ retryable: false;
1060
+ status: "rejected";
1061
+ } | {
1062
+ reason: "provider_pending";
1063
+ retryable: true;
1064
+ status: "not_ready";
1065
+ }, Name>;
755
1066
  savePreparation: FunctionReference<"mutation", "internal", {
756
1067
  accountId: string;
757
1068
  consentAt: number;
@@ -786,6 +1097,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
786
1097
  accountId: string;
787
1098
  cancelRequested: boolean;
788
1099
  enabled: boolean;
1100
+ execution?: {
1101
+ apply?: {
1102
+ receipt?: {
1103
+ customerAccount: string;
1104
+ enabled?: boolean;
1105
+ paymentMethodId: string | null;
1106
+ paymentMethodTypes?: Array<string> | null;
1107
+ phase: "create" | "attach" | "apply";
1108
+ providerApiVersion: string;
1109
+ stripeSubscriptionId: string;
1110
+ };
1111
+ state: "running" | "unknown" | "succeeded";
1112
+ };
1113
+ attach?: {
1114
+ receipt?: {
1115
+ customerAccount: string;
1116
+ enabled?: boolean;
1117
+ paymentMethodId: string | null;
1118
+ paymentMethodTypes?: Array<string> | null;
1119
+ phase: "create" | "attach" | "apply";
1120
+ providerApiVersion: string;
1121
+ stripeSubscriptionId: string;
1122
+ };
1123
+ state: "running" | "unknown" | "succeeded";
1124
+ };
1125
+ create?: {
1126
+ receipt?: {
1127
+ customerAccount: string;
1128
+ enabled?: boolean;
1129
+ paymentMethodId: string | null;
1130
+ paymentMethodTypes?: Array<string> | null;
1131
+ phase: "create" | "attach" | "apply";
1132
+ providerApiVersion: string;
1133
+ stripeSubscriptionId: string;
1134
+ };
1135
+ state: "running" | "unknown" | "succeeded";
1136
+ };
1137
+ definitionVersion: string;
1138
+ providerAction: string;
1139
+ providerApiVersion: string;
1140
+ workflowId?: string;
1141
+ };
789
1142
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
790
1143
  kind: "prepare" | "apply";
791
1144
  preparationId: string;
@@ -807,6 +1160,49 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
807
1160
  state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
808
1161
  version: number;
809
1162
  }, Name>;
1163
+ startWorkflow: FunctionReference<"mutation", "internal", {
1164
+ accountId: string;
1165
+ definitionVersion: string;
1166
+ operationId: string;
1167
+ providerAction: string;
1168
+ providerApiVersion: string;
1169
+ scopeKey: string;
1170
+ stripeSubscriptionId: string;
1171
+ version: number;
1172
+ }, {
1173
+ operation: {
1174
+ accountId: string;
1175
+ operationId: string;
1176
+ scopeKey: string;
1177
+ version: number;
1178
+ };
1179
+ status: "accepted";
1180
+ workflowId?: string;
1181
+ } | {
1182
+ operation: {
1183
+ accountId: string;
1184
+ operationId: string;
1185
+ scopeKey: string;
1186
+ version: number;
1187
+ };
1188
+ status: "canceled";
1189
+ } | {
1190
+ reason: "provider_outcome_unknown" | "history_incomplete";
1191
+ retryable: false;
1192
+ status: "unknown";
1193
+ } | {
1194
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1195
+ retryable: false;
1196
+ status: "conflict";
1197
+ } | {
1198
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
1199
+ retryable: false;
1200
+ status: "rejected";
1201
+ } | {
1202
+ reason: "provider_pending";
1203
+ retryable: true;
1204
+ status: "not_ready";
1205
+ }, Name>;
810
1206
  };
811
1207
  queries: {
812
1208
  findPreparationOperation: FunctionReference<"query", "internal", {
@@ -894,6 +1290,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
894
1290
  accountId: string;
895
1291
  cancelRequested: boolean;
896
1292
  enabled: boolean;
1293
+ execution?: {
1294
+ apply?: {
1295
+ receipt?: {
1296
+ customerAccount: string;
1297
+ enabled?: boolean;
1298
+ paymentMethodId: string | null;
1299
+ paymentMethodTypes?: Array<string> | null;
1300
+ phase: "create" | "attach" | "apply";
1301
+ providerApiVersion: string;
1302
+ stripeSubscriptionId: string;
1303
+ };
1304
+ state: "running" | "unknown" | "succeeded";
1305
+ };
1306
+ attach?: {
1307
+ receipt?: {
1308
+ customerAccount: string;
1309
+ enabled?: boolean;
1310
+ paymentMethodId: string | null;
1311
+ paymentMethodTypes?: Array<string> | null;
1312
+ phase: "create" | "attach" | "apply";
1313
+ providerApiVersion: string;
1314
+ stripeSubscriptionId: string;
1315
+ };
1316
+ state: "running" | "unknown" | "succeeded";
1317
+ };
1318
+ create?: {
1319
+ receipt?: {
1320
+ customerAccount: string;
1321
+ enabled?: boolean;
1322
+ paymentMethodId: string | null;
1323
+ paymentMethodTypes?: Array<string> | null;
1324
+ phase: "create" | "attach" | "apply";
1325
+ providerApiVersion: string;
1326
+ stripeSubscriptionId: string;
1327
+ };
1328
+ state: "running" | "unknown" | "succeeded";
1329
+ };
1330
+ definitionVersion: string;
1331
+ providerAction: string;
1332
+ providerApiVersion: string;
1333
+ workflowId?: string;
1334
+ };
897
1335
  failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
898
1336
  kind: "prepare" | "apply";
899
1337
  preparationId: string;
@@ -942,6 +1380,41 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
942
1380
  startsPaused: boolean;
943
1381
  verified: boolean;
944
1382
  } | null, Name>;
1383
+ readScopePreparation: FunctionReference<"query", "internal", {
1384
+ accountId: string;
1385
+ providerApiVersion: string;
1386
+ scopeKey: string;
1387
+ stripeSubscriptionId: string;
1388
+ }, {
1389
+ _creationTime: number;
1390
+ _id: string;
1391
+ accountId: string;
1392
+ activeOperationId?: string;
1393
+ consentAt: number;
1394
+ consentReference: string;
1395
+ enabled: boolean;
1396
+ operationVersion: number;
1397
+ preparation: {
1398
+ customerAccount: string;
1399
+ paymentMethodId?: string;
1400
+ previousPaymentMethodId: string | null;
1401
+ previousPaymentMethodTypes: Array<string> | null;
1402
+ stripeSubscriptionId: string;
1403
+ };
1404
+ preparationOperationId?: string;
1405
+ providerApiVersion: string;
1406
+ scopeKey: string;
1407
+ startsPaused: boolean;
1408
+ verified: boolean;
1409
+ } | {
1410
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1411
+ retryable: false;
1412
+ status: "conflict";
1413
+ } | {
1414
+ reason: "invalid_scope";
1415
+ retryable: false;
1416
+ status: "rejected";
1417
+ } | null, Name>;
945
1418
  };
946
1419
  };
947
1420
  billing: {
@@ -4986,6 +5459,521 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
4986
5459
  }, Name>;
4987
5460
  };
4988
5461
  };
5462
+ processingCostReconciliation: {
5463
+ mutations: {
5464
+ resume: FunctionReference<"mutation", "internal", {
5465
+ accountId: string;
5466
+ currency: string;
5467
+ operationId: string;
5468
+ scopeKey: string;
5469
+ version: number;
5470
+ }, {
5471
+ accountId: string;
5472
+ currency: string;
5473
+ operationId: string;
5474
+ scopeKey: string;
5475
+ status: "queued" | "running";
5476
+ version: number;
5477
+ } | {
5478
+ accountId: string;
5479
+ currency: string;
5480
+ operationId: string;
5481
+ result: {
5482
+ claim: {
5483
+ _creationTime: number;
5484
+ _id: string;
5485
+ accountId: string;
5486
+ amountDue: number;
5487
+ claimKey: string;
5488
+ collectedAmount: number;
5489
+ currency: string;
5490
+ openingCollection?: {
5491
+ amountDue: number;
5492
+ collectedAmount: number;
5493
+ operationKey: string;
5494
+ revision: number;
5495
+ };
5496
+ outstanding: number;
5497
+ reservedAmount: number;
5498
+ revision: number;
5499
+ scopeKey: string;
5500
+ sign: "positive" | "negative" | "zero";
5501
+ sourceChargeId: string;
5502
+ sourceGross: number;
5503
+ sourceProcessingFee: number;
5504
+ };
5505
+ deficit: {
5506
+ amountDue: number;
5507
+ currency: string;
5508
+ disputeLiability: number;
5509
+ processingLiability: number;
5510
+ retainedFee: number;
5511
+ };
5512
+ observation: {
5513
+ currency: string;
5514
+ disputeFees: number;
5515
+ gross: number;
5516
+ originalProcessingFee: number;
5517
+ paymentIntentId: string;
5518
+ principalReturned: number;
5519
+ processingFee: number;
5520
+ provenance: {
5521
+ customerAccountId: string;
5522
+ invoiceId: string;
5523
+ invoicePaymentId: string;
5524
+ recoveryInvoiceItemId?: string;
5525
+ stripePriceId?: string;
5526
+ stripeProductId?: string;
5527
+ subscriptionId?: string;
5528
+ };
5529
+ sourceChargeId: string;
5530
+ };
5531
+ rollbackClaim?: {
5532
+ _creationTime: number;
5533
+ _id: string;
5534
+ accountId: string;
5535
+ amountDue: number;
5536
+ claimKey: string;
5537
+ collectedAmount: number;
5538
+ currency: string;
5539
+ openingCollection?: {
5540
+ amountDue: number;
5541
+ collectedAmount: number;
5542
+ operationKey: string;
5543
+ revision: number;
5544
+ };
5545
+ outstanding: number;
5546
+ reservedAmount: number;
5547
+ revision: number;
5548
+ scopeKey: string;
5549
+ sign: "positive" | "negative" | "zero";
5550
+ sourceChargeId: string;
5551
+ sourceGross: number;
5552
+ sourceProcessingFee: number;
5553
+ };
5554
+ };
5555
+ scopeKey: string;
5556
+ status: "completed";
5557
+ version: number;
5558
+ } | {
5559
+ accountId: string;
5560
+ currency: string;
5561
+ operationId: string;
5562
+ reason: string;
5563
+ retryable: boolean;
5564
+ scopeKey: string;
5565
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
5566
+ version: number;
5567
+ }, Name>;
5568
+ start: FunctionReference<"mutation", "internal", {
5569
+ accountId: string;
5570
+ claimKey: string;
5571
+ currency: string;
5572
+ definitionVersion: number;
5573
+ expectedRevision: number;
5574
+ importHook?: string;
5575
+ maxAttempts: number;
5576
+ policy: {
5577
+ liability: {
5578
+ disputeCosts: "all" | "none";
5579
+ processingCosts: "uncovered" | "all" | "none";
5580
+ };
5581
+ rounding: "nearest" | "floor" | "ceil";
5582
+ sellingFee: number;
5583
+ };
5584
+ projection?: string;
5585
+ provider: string;
5586
+ providerApiVersion: string;
5587
+ requestKey: string;
5588
+ retryDelayMs: number;
5589
+ rollback?: {
5590
+ expectedRevision: number;
5591
+ groupKey: string;
5592
+ };
5593
+ scopeKey: string;
5594
+ source: {
5595
+ customerAccountId: string;
5596
+ gross: number;
5597
+ invoiceId?: string;
5598
+ kind: "sale";
5599
+ paymentIntentId: string;
5600
+ stripeAccountId?: string;
5601
+ stripePriceId?: string;
5602
+ stripeProductId?: string;
5603
+ subscriptionId?: string;
5604
+ } | {
5605
+ gross: number;
5606
+ groupKey: string;
5607
+ kind: "invoice_recovery";
5608
+ paymentIntentId: string;
5609
+ };
5610
+ }, {
5611
+ accountId: string;
5612
+ currency: string;
5613
+ operationId: string;
5614
+ scopeKey: string;
5615
+ status: "queued" | "running";
5616
+ version: number;
5617
+ } | {
5618
+ accountId: string;
5619
+ currency: string;
5620
+ operationId: string;
5621
+ result: {
5622
+ claim: {
5623
+ _creationTime: number;
5624
+ _id: string;
5625
+ accountId: string;
5626
+ amountDue: number;
5627
+ claimKey: string;
5628
+ collectedAmount: number;
5629
+ currency: string;
5630
+ openingCollection?: {
5631
+ amountDue: number;
5632
+ collectedAmount: number;
5633
+ operationKey: string;
5634
+ revision: number;
5635
+ };
5636
+ outstanding: number;
5637
+ reservedAmount: number;
5638
+ revision: number;
5639
+ scopeKey: string;
5640
+ sign: "positive" | "negative" | "zero";
5641
+ sourceChargeId: string;
5642
+ sourceGross: number;
5643
+ sourceProcessingFee: number;
5644
+ };
5645
+ deficit: {
5646
+ amountDue: number;
5647
+ currency: string;
5648
+ disputeLiability: number;
5649
+ processingLiability: number;
5650
+ retainedFee: number;
5651
+ };
5652
+ observation: {
5653
+ currency: string;
5654
+ disputeFees: number;
5655
+ gross: number;
5656
+ originalProcessingFee: number;
5657
+ paymentIntentId: string;
5658
+ principalReturned: number;
5659
+ processingFee: number;
5660
+ provenance: {
5661
+ customerAccountId: string;
5662
+ invoiceId: string;
5663
+ invoicePaymentId: string;
5664
+ recoveryInvoiceItemId?: string;
5665
+ stripePriceId?: string;
5666
+ stripeProductId?: string;
5667
+ subscriptionId?: string;
5668
+ };
5669
+ sourceChargeId: string;
5670
+ };
5671
+ rollbackClaim?: {
5672
+ _creationTime: number;
5673
+ _id: string;
5674
+ accountId: string;
5675
+ amountDue: number;
5676
+ claimKey: string;
5677
+ collectedAmount: number;
5678
+ currency: string;
5679
+ openingCollection?: {
5680
+ amountDue: number;
5681
+ collectedAmount: number;
5682
+ operationKey: string;
5683
+ revision: number;
5684
+ };
5685
+ outstanding: number;
5686
+ reservedAmount: number;
5687
+ revision: number;
5688
+ scopeKey: string;
5689
+ sign: "positive" | "negative" | "zero";
5690
+ sourceChargeId: string;
5691
+ sourceGross: number;
5692
+ sourceProcessingFee: number;
5693
+ };
5694
+ };
5695
+ scopeKey: string;
5696
+ status: "completed";
5697
+ version: number;
5698
+ } | {
5699
+ accountId: string;
5700
+ currency: string;
5701
+ operationId: string;
5702
+ reason: string;
5703
+ retryable: boolean;
5704
+ scopeKey: string;
5705
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
5706
+ version: number;
5707
+ } | {
5708
+ reason: "provider_pending" | "fee_pending" | "history_incomplete";
5709
+ retryable: true;
5710
+ status: "not_ready";
5711
+ } | {
5712
+ reason: "scope_busy" | "revision_changed" | "identity_changed";
5713
+ retryable: false;
5714
+ status: "conflict";
5715
+ } | {
5716
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid" | "payment_not_payable" | "currency_mismatch";
5717
+ retryable: false;
5718
+ status: "rejected";
5719
+ } | {
5720
+ reason: "provider_outcome_unknown" | "history_incomplete";
5721
+ retryable: false;
5722
+ status: "unknown";
5723
+ }, Name>;
5724
+ };
5725
+ queries: {
5726
+ get: FunctionReference<"query", "internal", {
5727
+ accountId: string;
5728
+ currency: string;
5729
+ operationId: string;
5730
+ scopeKey: string;
5731
+ version: number;
5732
+ }, {
5733
+ accountId: string;
5734
+ currency: string;
5735
+ operationId: string;
5736
+ scopeKey: string;
5737
+ status: "queued" | "running";
5738
+ version: number;
5739
+ } | {
5740
+ accountId: string;
5741
+ currency: string;
5742
+ operationId: string;
5743
+ result: {
5744
+ claim: {
5745
+ _creationTime: number;
5746
+ _id: string;
5747
+ accountId: string;
5748
+ amountDue: number;
5749
+ claimKey: string;
5750
+ collectedAmount: number;
5751
+ currency: string;
5752
+ openingCollection?: {
5753
+ amountDue: number;
5754
+ collectedAmount: number;
5755
+ operationKey: string;
5756
+ revision: number;
5757
+ };
5758
+ outstanding: number;
5759
+ reservedAmount: number;
5760
+ revision: number;
5761
+ scopeKey: string;
5762
+ sign: "positive" | "negative" | "zero";
5763
+ sourceChargeId: string;
5764
+ sourceGross: number;
5765
+ sourceProcessingFee: number;
5766
+ };
5767
+ deficit: {
5768
+ amountDue: number;
5769
+ currency: string;
5770
+ disputeLiability: number;
5771
+ processingLiability: number;
5772
+ retainedFee: number;
5773
+ };
5774
+ observation: {
5775
+ currency: string;
5776
+ disputeFees: number;
5777
+ gross: number;
5778
+ originalProcessingFee: number;
5779
+ paymentIntentId: string;
5780
+ principalReturned: number;
5781
+ processingFee: number;
5782
+ provenance: {
5783
+ customerAccountId: string;
5784
+ invoiceId: string;
5785
+ invoicePaymentId: string;
5786
+ recoveryInvoiceItemId?: string;
5787
+ stripePriceId?: string;
5788
+ stripeProductId?: string;
5789
+ subscriptionId?: string;
5790
+ };
5791
+ sourceChargeId: string;
5792
+ };
5793
+ rollbackClaim?: {
5794
+ _creationTime: number;
5795
+ _id: string;
5796
+ accountId: string;
5797
+ amountDue: number;
5798
+ claimKey: string;
5799
+ collectedAmount: number;
5800
+ currency: string;
5801
+ openingCollection?: {
5802
+ amountDue: number;
5803
+ collectedAmount: number;
5804
+ operationKey: string;
5805
+ revision: number;
5806
+ };
5807
+ outstanding: number;
5808
+ reservedAmount: number;
5809
+ revision: number;
5810
+ scopeKey: string;
5811
+ sign: "positive" | "negative" | "zero";
5812
+ sourceChargeId: string;
5813
+ sourceGross: number;
5814
+ sourceProcessingFee: number;
5815
+ };
5816
+ };
5817
+ scopeKey: string;
5818
+ status: "completed";
5819
+ version: number;
5820
+ } | {
5821
+ accountId: string;
5822
+ currency: string;
5823
+ operationId: string;
5824
+ reason: string;
5825
+ retryable: boolean;
5826
+ scopeKey: string;
5827
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
5828
+ version: number;
5829
+ }, Name>;
5830
+ snapshot: FunctionReference<"query", "internal", {
5831
+ accountId: string;
5832
+ currency: string;
5833
+ operationId: string;
5834
+ scopeKey: string;
5835
+ version: number;
5836
+ }, {
5837
+ _creationTime: number;
5838
+ _id: string;
5839
+ accountId: string;
5840
+ claimKey: string;
5841
+ currency: string;
5842
+ definitionVersion: number;
5843
+ expectedRevision: number;
5844
+ failure?: {
5845
+ reason: "provider_pending" | "fee_pending" | "history_incomplete";
5846
+ retryable: true;
5847
+ status: "not_ready";
5848
+ } | {
5849
+ reason: "scope_busy" | "revision_changed" | "identity_changed";
5850
+ retryable: false;
5851
+ status: "conflict";
5852
+ } | {
5853
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid" | "payment_not_payable" | "currency_mismatch";
5854
+ retryable: false;
5855
+ status: "rejected";
5856
+ } | {
5857
+ reason: "provider_outcome_unknown" | "history_incomplete";
5858
+ retryable: false;
5859
+ status: "unknown";
5860
+ };
5861
+ importHook?: string;
5862
+ maxAttempts: number;
5863
+ policy: {
5864
+ liability: {
5865
+ disputeCosts: "all" | "none";
5866
+ processingCosts: "uncovered" | "all" | "none";
5867
+ };
5868
+ rounding: "nearest" | "floor" | "ceil";
5869
+ sellingFee: number;
5870
+ };
5871
+ projection?: string;
5872
+ provider: string;
5873
+ providerApiVersion: string;
5874
+ requestKey: string;
5875
+ result?: {
5876
+ claim: {
5877
+ _creationTime: number;
5878
+ _id: string;
5879
+ accountId: string;
5880
+ amountDue: number;
5881
+ claimKey: string;
5882
+ collectedAmount: number;
5883
+ currency: string;
5884
+ openingCollection?: {
5885
+ amountDue: number;
5886
+ collectedAmount: number;
5887
+ operationKey: string;
5888
+ revision: number;
5889
+ };
5890
+ outstanding: number;
5891
+ reservedAmount: number;
5892
+ revision: number;
5893
+ scopeKey: string;
5894
+ sign: "positive" | "negative" | "zero";
5895
+ sourceChargeId: string;
5896
+ sourceGross: number;
5897
+ sourceProcessingFee: number;
5898
+ };
5899
+ deficit: {
5900
+ amountDue: number;
5901
+ currency: string;
5902
+ disputeLiability: number;
5903
+ processingLiability: number;
5904
+ retainedFee: number;
5905
+ };
5906
+ observation: {
5907
+ currency: string;
5908
+ disputeFees: number;
5909
+ gross: number;
5910
+ originalProcessingFee: number;
5911
+ paymentIntentId: string;
5912
+ principalReturned: number;
5913
+ processingFee: number;
5914
+ provenance: {
5915
+ customerAccountId: string;
5916
+ invoiceId: string;
5917
+ invoicePaymentId: string;
5918
+ recoveryInvoiceItemId?: string;
5919
+ stripePriceId?: string;
5920
+ stripeProductId?: string;
5921
+ subscriptionId?: string;
5922
+ };
5923
+ sourceChargeId: string;
5924
+ };
5925
+ rollbackClaim?: {
5926
+ _creationTime: number;
5927
+ _id: string;
5928
+ accountId: string;
5929
+ amountDue: number;
5930
+ claimKey: string;
5931
+ collectedAmount: number;
5932
+ currency: string;
5933
+ openingCollection?: {
5934
+ amountDue: number;
5935
+ collectedAmount: number;
5936
+ operationKey: string;
5937
+ revision: number;
5938
+ };
5939
+ outstanding: number;
5940
+ reservedAmount: number;
5941
+ revision: number;
5942
+ scopeKey: string;
5943
+ sign: "positive" | "negative" | "zero";
5944
+ sourceChargeId: string;
5945
+ sourceGross: number;
5946
+ sourceProcessingFee: number;
5947
+ };
5948
+ };
5949
+ retryDelayMs: number;
5950
+ rollback?: {
5951
+ expectedRevision: number;
5952
+ groupKey: string;
5953
+ };
5954
+ scopeKey: string;
5955
+ source: {
5956
+ customerAccountId: string;
5957
+ gross: number;
5958
+ invoiceId?: string;
5959
+ kind: "sale";
5960
+ paymentIntentId: string;
5961
+ stripeAccountId?: string;
5962
+ stripePriceId?: string;
5963
+ stripeProductId?: string;
5964
+ subscriptionId?: string;
5965
+ } | {
5966
+ gross: number;
5967
+ groupKey: string;
5968
+ kind: "invoice_recovery";
5969
+ paymentIntentId: string;
5970
+ };
5971
+ status: "queued" | "running" | "waiting" | "completed" | "conflict" | "rejected" | "unknown";
5972
+ version: number;
5973
+ workflowId?: string;
5974
+ }, Name>;
5975
+ };
5976
+ };
4989
5977
  products: {
4990
5978
  mutations: {
4991
5979
  adoptProduct: FunctionReference<"mutation", "internal", {