@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
@@ -644,6 +644,89 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
644
644
  },
645
645
  Name
646
646
  >;
647
+ cancelWorkflow: FunctionReference<
648
+ "mutation",
649
+ "internal",
650
+ {
651
+ accountId: string;
652
+ definitionVersion: string;
653
+ operationId: string;
654
+ providerApiVersion: string;
655
+ scopeKey: string;
656
+ stripeSubscriptionId: string;
657
+ version: number;
658
+ },
659
+ {
660
+ accountId: string;
661
+ cancelRequested: boolean;
662
+ failureCode?:
663
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
664
+ operationId: string;
665
+ scopeKey: string;
666
+ state:
667
+ | "pending"
668
+ | "running"
669
+ | "unknown"
670
+ | "succeeded"
671
+ | "canceled"
672
+ | "failed";
673
+ version: number;
674
+ },
675
+ Name
676
+ >;
677
+ claimProviderPhase: FunctionReference<
678
+ "mutation",
679
+ "internal",
680
+ {
681
+ accountId: string;
682
+ definitionVersion: string;
683
+ operationId: string;
684
+ phase: "create" | "attach" | "apply";
685
+ providerApiVersion: string;
686
+ providerKey: string;
687
+ scopeKey: string;
688
+ stripeSubscriptionId: string;
689
+ version: number;
690
+ },
691
+ | {
692
+ mode: "execute" | "reconcile";
693
+ paymentMethodId?: string;
694
+ status: "claimed";
695
+ }
696
+ | {
697
+ status: "ready";
698
+ value: {
699
+ customerAccount: string;
700
+ enabled?: boolean;
701
+ paymentMethodId: string | null;
702
+ paymentMethodTypes?: Array<string> | null;
703
+ phase: "create" | "attach" | "apply";
704
+ providerApiVersion: string;
705
+ stripeSubscriptionId: string;
706
+ };
707
+ }
708
+ | {
709
+ reason: "provider_outcome_unknown" | "history_incomplete";
710
+ retryable: false;
711
+ status: "unknown";
712
+ }
713
+ | {
714
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
715
+ retryable: false;
716
+ status: "conflict";
717
+ }
718
+ | {
719
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
720
+ retryable: false;
721
+ status: "rejected";
722
+ }
723
+ | {
724
+ reason: "provider_pending";
725
+ retryable: true;
726
+ status: "not_ready";
727
+ },
728
+ Name
729
+ >;
647
730
  failBeforeStart: FunctionReference<
648
731
  "mutation",
649
732
  "internal",
@@ -661,6 +744,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
661
744
  accountId: string;
662
745
  cancelRequested: boolean;
663
746
  enabled: boolean;
747
+ execution?: {
748
+ apply?: {
749
+ receipt?: {
750
+ customerAccount: string;
751
+ enabled?: boolean;
752
+ paymentMethodId: string | null;
753
+ paymentMethodTypes?: Array<string> | null;
754
+ phase: "create" | "attach" | "apply";
755
+ providerApiVersion: string;
756
+ stripeSubscriptionId: string;
757
+ };
758
+ state: "running" | "unknown" | "succeeded";
759
+ };
760
+ attach?: {
761
+ receipt?: {
762
+ customerAccount: string;
763
+ enabled?: boolean;
764
+ paymentMethodId: string | null;
765
+ paymentMethodTypes?: Array<string> | null;
766
+ phase: "create" | "attach" | "apply";
767
+ providerApiVersion: string;
768
+ stripeSubscriptionId: string;
769
+ };
770
+ state: "running" | "unknown" | "succeeded";
771
+ };
772
+ create?: {
773
+ receipt?: {
774
+ customerAccount: string;
775
+ enabled?: boolean;
776
+ paymentMethodId: string | null;
777
+ paymentMethodTypes?: Array<string> | null;
778
+ phase: "create" | "attach" | "apply";
779
+ providerApiVersion: string;
780
+ stripeSubscriptionId: string;
781
+ };
782
+ state: "running" | "unknown" | "succeeded";
783
+ };
784
+ definitionVersion: string;
785
+ providerAction: string;
786
+ providerApiVersion: string;
787
+ workflowId?: string;
788
+ };
664
789
  failureCode?:
665
790
  "invalid_scope" | "unsupported_source" | "policy_invalid";
666
791
  kind: "prepare" | "apply";
@@ -714,6 +839,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
714
839
  accountId: string;
715
840
  cancelRequested: boolean;
716
841
  enabled: boolean;
842
+ execution?: {
843
+ apply?: {
844
+ receipt?: {
845
+ customerAccount: string;
846
+ enabled?: boolean;
847
+ paymentMethodId: string | null;
848
+ paymentMethodTypes?: Array<string> | null;
849
+ phase: "create" | "attach" | "apply";
850
+ providerApiVersion: string;
851
+ stripeSubscriptionId: string;
852
+ };
853
+ state: "running" | "unknown" | "succeeded";
854
+ };
855
+ attach?: {
856
+ receipt?: {
857
+ customerAccount: string;
858
+ enabled?: boolean;
859
+ paymentMethodId: string | null;
860
+ paymentMethodTypes?: Array<string> | null;
861
+ phase: "create" | "attach" | "apply";
862
+ providerApiVersion: string;
863
+ stripeSubscriptionId: string;
864
+ };
865
+ state: "running" | "unknown" | "succeeded";
866
+ };
867
+ create?: {
868
+ receipt?: {
869
+ customerAccount: string;
870
+ enabled?: boolean;
871
+ paymentMethodId: string | null;
872
+ paymentMethodTypes?: Array<string> | null;
873
+ phase: "create" | "attach" | "apply";
874
+ providerApiVersion: string;
875
+ stripeSubscriptionId: string;
876
+ };
877
+ state: "running" | "unknown" | "succeeded";
878
+ };
879
+ definitionVersion: string;
880
+ providerAction: string;
881
+ providerApiVersion: string;
882
+ workflowId?: string;
883
+ };
717
884
  failureCode?:
718
885
  "invalid_scope" | "unsupported_source" | "policy_invalid";
719
886
  kind: "prepare" | "apply";
@@ -767,6 +934,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
767
934
  accountId: string;
768
935
  cancelRequested: boolean;
769
936
  enabled: boolean;
937
+ execution?: {
938
+ apply?: {
939
+ receipt?: {
940
+ customerAccount: string;
941
+ enabled?: boolean;
942
+ paymentMethodId: string | null;
943
+ paymentMethodTypes?: Array<string> | null;
944
+ phase: "create" | "attach" | "apply";
945
+ providerApiVersion: string;
946
+ stripeSubscriptionId: string;
947
+ };
948
+ state: "running" | "unknown" | "succeeded";
949
+ };
950
+ attach?: {
951
+ receipt?: {
952
+ customerAccount: string;
953
+ enabled?: boolean;
954
+ paymentMethodId: string | null;
955
+ paymentMethodTypes?: Array<string> | null;
956
+ phase: "create" | "attach" | "apply";
957
+ providerApiVersion: string;
958
+ stripeSubscriptionId: string;
959
+ };
960
+ state: "running" | "unknown" | "succeeded";
961
+ };
962
+ create?: {
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
+ definitionVersion: string;
975
+ providerAction: string;
976
+ providerApiVersion: string;
977
+ workflowId?: string;
978
+ };
770
979
  failureCode?:
771
980
  "invalid_scope" | "unsupported_source" | "policy_invalid";
772
981
  kind: "prepare" | "apply";
@@ -849,6 +1058,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
849
1058
  accountId: string;
850
1059
  cancelRequested: boolean;
851
1060
  enabled: boolean;
1061
+ execution?: {
1062
+ apply?: {
1063
+ receipt?: {
1064
+ customerAccount: string;
1065
+ enabled?: boolean;
1066
+ paymentMethodId: string | null;
1067
+ paymentMethodTypes?: Array<string> | null;
1068
+ phase: "create" | "attach" | "apply";
1069
+ providerApiVersion: string;
1070
+ stripeSubscriptionId: string;
1071
+ };
1072
+ state: "running" | "unknown" | "succeeded";
1073
+ };
1074
+ attach?: {
1075
+ receipt?: {
1076
+ customerAccount: string;
1077
+ enabled?: boolean;
1078
+ paymentMethodId: string | null;
1079
+ paymentMethodTypes?: Array<string> | null;
1080
+ phase: "create" | "attach" | "apply";
1081
+ providerApiVersion: string;
1082
+ stripeSubscriptionId: string;
1083
+ };
1084
+ state: "running" | "unknown" | "succeeded";
1085
+ };
1086
+ create?: {
1087
+ receipt?: {
1088
+ customerAccount: string;
1089
+ enabled?: boolean;
1090
+ paymentMethodId: string | null;
1091
+ paymentMethodTypes?: Array<string> | null;
1092
+ phase: "create" | "attach" | "apply";
1093
+ providerApiVersion: string;
1094
+ stripeSubscriptionId: string;
1095
+ };
1096
+ state: "running" | "unknown" | "succeeded";
1097
+ };
1098
+ definitionVersion: string;
1099
+ providerAction: string;
1100
+ providerApiVersion: string;
1101
+ workflowId?: string;
1102
+ };
852
1103
  failureCode?:
853
1104
  "invalid_scope" | "unsupported_source" | "policy_invalid";
854
1105
  kind: "prepare" | "apply";
@@ -935,6 +1186,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
935
1186
  accountId: string;
936
1187
  cancelRequested: boolean;
937
1188
  enabled: boolean;
1189
+ execution?: {
1190
+ apply?: {
1191
+ receipt?: {
1192
+ customerAccount: string;
1193
+ enabled?: boolean;
1194
+ paymentMethodId: string | null;
1195
+ paymentMethodTypes?: Array<string> | null;
1196
+ phase: "create" | "attach" | "apply";
1197
+ providerApiVersion: string;
1198
+ stripeSubscriptionId: string;
1199
+ };
1200
+ state: "running" | "unknown" | "succeeded";
1201
+ };
1202
+ attach?: {
1203
+ receipt?: {
1204
+ customerAccount: string;
1205
+ enabled?: boolean;
1206
+ paymentMethodId: string | null;
1207
+ paymentMethodTypes?: Array<string> | null;
1208
+ phase: "create" | "attach" | "apply";
1209
+ providerApiVersion: string;
1210
+ stripeSubscriptionId: string;
1211
+ };
1212
+ state: "running" | "unknown" | "succeeded";
1213
+ };
1214
+ create?: {
1215
+ receipt?: {
1216
+ customerAccount: string;
1217
+ enabled?: boolean;
1218
+ paymentMethodId: string | null;
1219
+ paymentMethodTypes?: Array<string> | null;
1220
+ phase: "create" | "attach" | "apply";
1221
+ providerApiVersion: string;
1222
+ stripeSubscriptionId: string;
1223
+ };
1224
+ state: "running" | "unknown" | "succeeded";
1225
+ };
1226
+ definitionVersion: string;
1227
+ providerAction: string;
1228
+ providerApiVersion: string;
1229
+ workflowId?: string;
1230
+ };
938
1231
  failureCode?:
939
1232
  "invalid_scope" | "unsupported_source" | "policy_invalid";
940
1233
  kind: "prepare" | "apply";
@@ -965,6 +1258,59 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
965
1258
  },
966
1259
  Name
967
1260
  >;
1261
+ resumeWorkflow: FunctionReference<
1262
+ "mutation",
1263
+ "internal",
1264
+ {
1265
+ accountId: string;
1266
+ definitionVersion: string;
1267
+ operationId: string;
1268
+ providerApiVersion: string;
1269
+ scopeKey: string;
1270
+ stripeSubscriptionId: string;
1271
+ version: number;
1272
+ },
1273
+ | {
1274
+ operation: {
1275
+ accountId: string;
1276
+ operationId: string;
1277
+ scopeKey: string;
1278
+ version: number;
1279
+ };
1280
+ status: "accepted";
1281
+ workflowId?: string;
1282
+ }
1283
+ | {
1284
+ operation: {
1285
+ accountId: string;
1286
+ operationId: string;
1287
+ scopeKey: string;
1288
+ version: number;
1289
+ };
1290
+ status: "canceled";
1291
+ }
1292
+ | {
1293
+ reason: "provider_outcome_unknown" | "history_incomplete";
1294
+ retryable: false;
1295
+ status: "unknown";
1296
+ }
1297
+ | {
1298
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1299
+ retryable: false;
1300
+ status: "conflict";
1301
+ }
1302
+ | {
1303
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
1304
+ retryable: false;
1305
+ status: "rejected";
1306
+ }
1307
+ | {
1308
+ reason: "provider_pending";
1309
+ retryable: true;
1310
+ status: "not_ready";
1311
+ },
1312
+ Name
1313
+ >;
968
1314
  savePreparation: FunctionReference<
969
1315
  "mutation",
970
1316
  "internal",
@@ -1013,6 +1359,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1013
1359
  accountId: string;
1014
1360
  cancelRequested: boolean;
1015
1361
  enabled: boolean;
1362
+ execution?: {
1363
+ apply?: {
1364
+ receipt?: {
1365
+ customerAccount: string;
1366
+ enabled?: boolean;
1367
+ paymentMethodId: string | null;
1368
+ paymentMethodTypes?: Array<string> | null;
1369
+ phase: "create" | "attach" | "apply";
1370
+ providerApiVersion: string;
1371
+ stripeSubscriptionId: string;
1372
+ };
1373
+ state: "running" | "unknown" | "succeeded";
1374
+ };
1375
+ attach?: {
1376
+ receipt?: {
1377
+ customerAccount: string;
1378
+ enabled?: boolean;
1379
+ paymentMethodId: string | null;
1380
+ paymentMethodTypes?: Array<string> | null;
1381
+ phase: "create" | "attach" | "apply";
1382
+ providerApiVersion: string;
1383
+ stripeSubscriptionId: string;
1384
+ };
1385
+ state: "running" | "unknown" | "succeeded";
1386
+ };
1387
+ create?: {
1388
+ receipt?: {
1389
+ customerAccount: string;
1390
+ enabled?: boolean;
1391
+ paymentMethodId: string | null;
1392
+ paymentMethodTypes?: Array<string> | null;
1393
+ phase: "create" | "attach" | "apply";
1394
+ providerApiVersion: string;
1395
+ stripeSubscriptionId: string;
1396
+ };
1397
+ state: "running" | "unknown" | "succeeded";
1398
+ };
1399
+ definitionVersion: string;
1400
+ providerAction: string;
1401
+ providerApiVersion: string;
1402
+ workflowId?: string;
1403
+ };
1016
1404
  failureCode?:
1017
1405
  "invalid_scope" | "unsupported_source" | "policy_invalid";
1018
1406
  kind: "prepare" | "apply";
@@ -1043,6 +1431,60 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1043
1431
  },
1044
1432
  Name
1045
1433
  >;
1434
+ startWorkflow: FunctionReference<
1435
+ "mutation",
1436
+ "internal",
1437
+ {
1438
+ accountId: string;
1439
+ definitionVersion: string;
1440
+ operationId: string;
1441
+ providerAction: string;
1442
+ providerApiVersion: string;
1443
+ scopeKey: string;
1444
+ stripeSubscriptionId: string;
1445
+ version: number;
1446
+ },
1447
+ | {
1448
+ operation: {
1449
+ accountId: string;
1450
+ operationId: string;
1451
+ scopeKey: string;
1452
+ version: number;
1453
+ };
1454
+ status: "accepted";
1455
+ workflowId?: string;
1456
+ }
1457
+ | {
1458
+ operation: {
1459
+ accountId: string;
1460
+ operationId: string;
1461
+ scopeKey: string;
1462
+ version: number;
1463
+ };
1464
+ status: "canceled";
1465
+ }
1466
+ | {
1467
+ reason: "provider_outcome_unknown" | "history_incomplete";
1468
+ retryable: false;
1469
+ status: "unknown";
1470
+ }
1471
+ | {
1472
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1473
+ retryable: false;
1474
+ status: "conflict";
1475
+ }
1476
+ | {
1477
+ reason: "invalid_scope" | "unsupported_source" | "policy_invalid";
1478
+ retryable: false;
1479
+ status: "rejected";
1480
+ }
1481
+ | {
1482
+ reason: "provider_pending";
1483
+ retryable: true;
1484
+ status: "not_ready";
1485
+ },
1486
+ Name
1487
+ >;
1046
1488
  };
1047
1489
  queries: {
1048
1490
  findPreparationOperation: FunctionReference<
@@ -1166,6 +1608,48 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1166
1608
  accountId: string;
1167
1609
  cancelRequested: boolean;
1168
1610
  enabled: boolean;
1611
+ execution?: {
1612
+ apply?: {
1613
+ receipt?: {
1614
+ customerAccount: string;
1615
+ enabled?: boolean;
1616
+ paymentMethodId: string | null;
1617
+ paymentMethodTypes?: Array<string> | null;
1618
+ phase: "create" | "attach" | "apply";
1619
+ providerApiVersion: string;
1620
+ stripeSubscriptionId: string;
1621
+ };
1622
+ state: "running" | "unknown" | "succeeded";
1623
+ };
1624
+ attach?: {
1625
+ receipt?: {
1626
+ customerAccount: string;
1627
+ enabled?: boolean;
1628
+ paymentMethodId: string | null;
1629
+ paymentMethodTypes?: Array<string> | null;
1630
+ phase: "create" | "attach" | "apply";
1631
+ providerApiVersion: string;
1632
+ stripeSubscriptionId: string;
1633
+ };
1634
+ state: "running" | "unknown" | "succeeded";
1635
+ };
1636
+ create?: {
1637
+ receipt?: {
1638
+ customerAccount: string;
1639
+ enabled?: boolean;
1640
+ paymentMethodId: string | null;
1641
+ paymentMethodTypes?: Array<string> | null;
1642
+ phase: "create" | "attach" | "apply";
1643
+ providerApiVersion: string;
1644
+ stripeSubscriptionId: string;
1645
+ };
1646
+ state: "running" | "unknown" | "succeeded";
1647
+ };
1648
+ definitionVersion: string;
1649
+ providerAction: string;
1650
+ providerApiVersion: string;
1651
+ workflowId?: string;
1652
+ };
1169
1653
  failureCode?:
1170
1654
  "invalid_scope" | "unsupported_source" | "policy_invalid";
1171
1655
  kind: "prepare" | "apply";
@@ -1229,6 +1713,46 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1229
1713
  } | null,
1230
1714
  Name
1231
1715
  >;
1716
+ readScopePreparation: FunctionReference<
1717
+ "query",
1718
+ "internal",
1719
+ {
1720
+ accountId: string;
1721
+ providerApiVersion: string;
1722
+ scopeKey: string;
1723
+ stripeSubscriptionId: string;
1724
+ },
1725
+ | {
1726
+ _creationTime: number;
1727
+ _id: string;
1728
+ accountId: string;
1729
+ activeOperationId?: string;
1730
+ consentAt: number;
1731
+ consentReference: string;
1732
+ enabled: boolean;
1733
+ operationVersion: number;
1734
+ preparation: {
1735
+ customerAccount: string;
1736
+ paymentMethodId?: string;
1737
+ previousPaymentMethodId: string | null;
1738
+ previousPaymentMethodTypes: Array<string> | null;
1739
+ stripeSubscriptionId: string;
1740
+ };
1741
+ preparationOperationId?: string;
1742
+ providerApiVersion: string;
1743
+ scopeKey: string;
1744
+ startsPaused: boolean;
1745
+ verified: boolean;
1746
+ }
1747
+ | {
1748
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1749
+ retryable: false;
1750
+ status: "conflict";
1751
+ }
1752
+ | { reason: "invalid_scope"; retryable: false; status: "rejected" }
1753
+ | null,
1754
+ Name
1755
+ >;
1232
1756
  };
1233
1757
  };
1234
1758
  billing: {
@@ -6164,6 +6688,576 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
6164
6688
  >;
6165
6689
  };
6166
6690
  };
6691
+ processingCostReconciliation: {
6692
+ mutations: {
6693
+ resume: FunctionReference<
6694
+ "mutation",
6695
+ "internal",
6696
+ {
6697
+ accountId: string;
6698
+ currency: string;
6699
+ operationId: string;
6700
+ scopeKey: string;
6701
+ version: number;
6702
+ },
6703
+ | {
6704
+ accountId: string;
6705
+ currency: string;
6706
+ operationId: string;
6707
+ scopeKey: string;
6708
+ status: "queued" | "running";
6709
+ version: number;
6710
+ }
6711
+ | {
6712
+ accountId: string;
6713
+ currency: string;
6714
+ operationId: string;
6715
+ result: {
6716
+ claim: {
6717
+ _creationTime: number;
6718
+ _id: string;
6719
+ accountId: string;
6720
+ amountDue: number;
6721
+ claimKey: string;
6722
+ collectedAmount: number;
6723
+ currency: string;
6724
+ openingCollection?: {
6725
+ amountDue: number;
6726
+ collectedAmount: number;
6727
+ operationKey: string;
6728
+ revision: number;
6729
+ };
6730
+ outstanding: number;
6731
+ reservedAmount: number;
6732
+ revision: number;
6733
+ scopeKey: string;
6734
+ sign: "positive" | "negative" | "zero";
6735
+ sourceChargeId: string;
6736
+ sourceGross: number;
6737
+ sourceProcessingFee: number;
6738
+ };
6739
+ deficit: {
6740
+ amountDue: number;
6741
+ currency: string;
6742
+ disputeLiability: number;
6743
+ processingLiability: number;
6744
+ retainedFee: number;
6745
+ };
6746
+ observation: {
6747
+ currency: string;
6748
+ disputeFees: number;
6749
+ gross: number;
6750
+ originalProcessingFee: number;
6751
+ paymentIntentId: string;
6752
+ principalReturned: number;
6753
+ processingFee: number;
6754
+ provenance: {
6755
+ customerAccountId: string;
6756
+ invoiceId: string;
6757
+ invoicePaymentId: string;
6758
+ recoveryInvoiceItemId?: string;
6759
+ stripePriceId?: string;
6760
+ stripeProductId?: string;
6761
+ subscriptionId?: string;
6762
+ };
6763
+ sourceChargeId: string;
6764
+ };
6765
+ rollbackClaim?: {
6766
+ _creationTime: number;
6767
+ _id: string;
6768
+ accountId: string;
6769
+ amountDue: number;
6770
+ claimKey: string;
6771
+ collectedAmount: number;
6772
+ currency: string;
6773
+ openingCollection?: {
6774
+ amountDue: number;
6775
+ collectedAmount: number;
6776
+ operationKey: string;
6777
+ revision: number;
6778
+ };
6779
+ outstanding: number;
6780
+ reservedAmount: number;
6781
+ revision: number;
6782
+ scopeKey: string;
6783
+ sign: "positive" | "negative" | "zero";
6784
+ sourceChargeId: string;
6785
+ sourceGross: number;
6786
+ sourceProcessingFee: number;
6787
+ };
6788
+ };
6789
+ scopeKey: string;
6790
+ status: "completed";
6791
+ version: number;
6792
+ }
6793
+ | {
6794
+ accountId: string;
6795
+ currency: string;
6796
+ operationId: string;
6797
+ reason: string;
6798
+ retryable: boolean;
6799
+ scopeKey: string;
6800
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
6801
+ version: number;
6802
+ },
6803
+ Name
6804
+ >;
6805
+ start: FunctionReference<
6806
+ "mutation",
6807
+ "internal",
6808
+ {
6809
+ accountId: string;
6810
+ claimKey: string;
6811
+ currency: string;
6812
+ definitionVersion: number;
6813
+ expectedRevision: number;
6814
+ importHook?: string;
6815
+ maxAttempts: number;
6816
+ policy: {
6817
+ liability: {
6818
+ disputeCosts: "all" | "none";
6819
+ processingCosts: "uncovered" | "all" | "none";
6820
+ };
6821
+ rounding: "nearest" | "floor" | "ceil";
6822
+ sellingFee: number;
6823
+ };
6824
+ projection?: string;
6825
+ provider: string;
6826
+ providerApiVersion: string;
6827
+ requestKey: string;
6828
+ retryDelayMs: number;
6829
+ rollback?: { expectedRevision: number; groupKey: string };
6830
+ scopeKey: string;
6831
+ source:
6832
+ | {
6833
+ customerAccountId: string;
6834
+ gross: number;
6835
+ invoiceId?: string;
6836
+ kind: "sale";
6837
+ paymentIntentId: string;
6838
+ stripeAccountId?: string;
6839
+ stripePriceId?: string;
6840
+ stripeProductId?: string;
6841
+ subscriptionId?: string;
6842
+ }
6843
+ | {
6844
+ gross: number;
6845
+ groupKey: string;
6846
+ kind: "invoice_recovery";
6847
+ paymentIntentId: string;
6848
+ };
6849
+ },
6850
+ | {
6851
+ accountId: string;
6852
+ currency: string;
6853
+ operationId: string;
6854
+ scopeKey: string;
6855
+ status: "queued" | "running";
6856
+ version: number;
6857
+ }
6858
+ | {
6859
+ accountId: string;
6860
+ currency: string;
6861
+ operationId: string;
6862
+ result: {
6863
+ claim: {
6864
+ _creationTime: number;
6865
+ _id: string;
6866
+ accountId: string;
6867
+ amountDue: number;
6868
+ claimKey: string;
6869
+ collectedAmount: number;
6870
+ currency: string;
6871
+ openingCollection?: {
6872
+ amountDue: number;
6873
+ collectedAmount: number;
6874
+ operationKey: string;
6875
+ revision: number;
6876
+ };
6877
+ outstanding: number;
6878
+ reservedAmount: number;
6879
+ revision: number;
6880
+ scopeKey: string;
6881
+ sign: "positive" | "negative" | "zero";
6882
+ sourceChargeId: string;
6883
+ sourceGross: number;
6884
+ sourceProcessingFee: number;
6885
+ };
6886
+ deficit: {
6887
+ amountDue: number;
6888
+ currency: string;
6889
+ disputeLiability: number;
6890
+ processingLiability: number;
6891
+ retainedFee: number;
6892
+ };
6893
+ observation: {
6894
+ currency: string;
6895
+ disputeFees: number;
6896
+ gross: number;
6897
+ originalProcessingFee: number;
6898
+ paymentIntentId: string;
6899
+ principalReturned: number;
6900
+ processingFee: number;
6901
+ provenance: {
6902
+ customerAccountId: string;
6903
+ invoiceId: string;
6904
+ invoicePaymentId: string;
6905
+ recoveryInvoiceItemId?: string;
6906
+ stripePriceId?: string;
6907
+ stripeProductId?: string;
6908
+ subscriptionId?: string;
6909
+ };
6910
+ sourceChargeId: string;
6911
+ };
6912
+ rollbackClaim?: {
6913
+ _creationTime: number;
6914
+ _id: string;
6915
+ accountId: string;
6916
+ amountDue: number;
6917
+ claimKey: string;
6918
+ collectedAmount: number;
6919
+ currency: string;
6920
+ openingCollection?: {
6921
+ amountDue: number;
6922
+ collectedAmount: number;
6923
+ operationKey: string;
6924
+ revision: number;
6925
+ };
6926
+ outstanding: number;
6927
+ reservedAmount: number;
6928
+ revision: number;
6929
+ scopeKey: string;
6930
+ sign: "positive" | "negative" | "zero";
6931
+ sourceChargeId: string;
6932
+ sourceGross: number;
6933
+ sourceProcessingFee: number;
6934
+ };
6935
+ };
6936
+ scopeKey: string;
6937
+ status: "completed";
6938
+ version: number;
6939
+ }
6940
+ | {
6941
+ accountId: string;
6942
+ currency: string;
6943
+ operationId: string;
6944
+ reason: string;
6945
+ retryable: boolean;
6946
+ scopeKey: string;
6947
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
6948
+ version: number;
6949
+ }
6950
+ | {
6951
+ reason: "provider_pending" | "fee_pending" | "history_incomplete";
6952
+ retryable: true;
6953
+ status: "not_ready";
6954
+ }
6955
+ | {
6956
+ reason: "scope_busy" | "revision_changed" | "identity_changed";
6957
+ retryable: false;
6958
+ status: "conflict";
6959
+ }
6960
+ | {
6961
+ reason:
6962
+ | "invalid_scope"
6963
+ | "unsupported_source"
6964
+ | "policy_invalid"
6965
+ | "payment_not_payable"
6966
+ | "currency_mismatch";
6967
+ retryable: false;
6968
+ status: "rejected";
6969
+ }
6970
+ | {
6971
+ reason: "provider_outcome_unknown" | "history_incomplete";
6972
+ retryable: false;
6973
+ status: "unknown";
6974
+ },
6975
+ Name
6976
+ >;
6977
+ };
6978
+ queries: {
6979
+ get: FunctionReference<
6980
+ "query",
6981
+ "internal",
6982
+ {
6983
+ accountId: string;
6984
+ currency: string;
6985
+ operationId: string;
6986
+ scopeKey: string;
6987
+ version: number;
6988
+ },
6989
+ | {
6990
+ accountId: string;
6991
+ currency: string;
6992
+ operationId: string;
6993
+ scopeKey: string;
6994
+ status: "queued" | "running";
6995
+ version: number;
6996
+ }
6997
+ | {
6998
+ accountId: string;
6999
+ currency: string;
7000
+ operationId: string;
7001
+ result: {
7002
+ claim: {
7003
+ _creationTime: number;
7004
+ _id: string;
7005
+ accountId: string;
7006
+ amountDue: number;
7007
+ claimKey: string;
7008
+ collectedAmount: number;
7009
+ currency: string;
7010
+ openingCollection?: {
7011
+ amountDue: number;
7012
+ collectedAmount: number;
7013
+ operationKey: string;
7014
+ revision: number;
7015
+ };
7016
+ outstanding: number;
7017
+ reservedAmount: number;
7018
+ revision: number;
7019
+ scopeKey: string;
7020
+ sign: "positive" | "negative" | "zero";
7021
+ sourceChargeId: string;
7022
+ sourceGross: number;
7023
+ sourceProcessingFee: number;
7024
+ };
7025
+ deficit: {
7026
+ amountDue: number;
7027
+ currency: string;
7028
+ disputeLiability: number;
7029
+ processingLiability: number;
7030
+ retainedFee: number;
7031
+ };
7032
+ observation: {
7033
+ currency: string;
7034
+ disputeFees: number;
7035
+ gross: number;
7036
+ originalProcessingFee: number;
7037
+ paymentIntentId: string;
7038
+ principalReturned: number;
7039
+ processingFee: number;
7040
+ provenance: {
7041
+ customerAccountId: string;
7042
+ invoiceId: string;
7043
+ invoicePaymentId: string;
7044
+ recoveryInvoiceItemId?: string;
7045
+ stripePriceId?: string;
7046
+ stripeProductId?: string;
7047
+ subscriptionId?: string;
7048
+ };
7049
+ sourceChargeId: string;
7050
+ };
7051
+ rollbackClaim?: {
7052
+ _creationTime: number;
7053
+ _id: string;
7054
+ accountId: string;
7055
+ amountDue: number;
7056
+ claimKey: string;
7057
+ collectedAmount: number;
7058
+ currency: string;
7059
+ openingCollection?: {
7060
+ amountDue: number;
7061
+ collectedAmount: number;
7062
+ operationKey: string;
7063
+ revision: number;
7064
+ };
7065
+ outstanding: number;
7066
+ reservedAmount: number;
7067
+ revision: number;
7068
+ scopeKey: string;
7069
+ sign: "positive" | "negative" | "zero";
7070
+ sourceChargeId: string;
7071
+ sourceGross: number;
7072
+ sourceProcessingFee: number;
7073
+ };
7074
+ };
7075
+ scopeKey: string;
7076
+ status: "completed";
7077
+ version: number;
7078
+ }
7079
+ | {
7080
+ accountId: string;
7081
+ currency: string;
7082
+ operationId: string;
7083
+ reason: string;
7084
+ retryable: boolean;
7085
+ scopeKey: string;
7086
+ status: "not_ready" | "conflict" | "rejected" | "unknown";
7087
+ version: number;
7088
+ },
7089
+ Name
7090
+ >;
7091
+ snapshot: FunctionReference<
7092
+ "query",
7093
+ "internal",
7094
+ {
7095
+ accountId: string;
7096
+ currency: string;
7097
+ operationId: string;
7098
+ scopeKey: string;
7099
+ version: number;
7100
+ },
7101
+ {
7102
+ _creationTime: number;
7103
+ _id: string;
7104
+ accountId: string;
7105
+ claimKey: string;
7106
+ currency: string;
7107
+ definitionVersion: number;
7108
+ expectedRevision: number;
7109
+ failure?:
7110
+ | {
7111
+ reason:
7112
+ "provider_pending" | "fee_pending" | "history_incomplete";
7113
+ retryable: true;
7114
+ status: "not_ready";
7115
+ }
7116
+ | {
7117
+ reason:
7118
+ "scope_busy" | "revision_changed" | "identity_changed";
7119
+ retryable: false;
7120
+ status: "conflict";
7121
+ }
7122
+ | {
7123
+ reason:
7124
+ | "invalid_scope"
7125
+ | "unsupported_source"
7126
+ | "policy_invalid"
7127
+ | "payment_not_payable"
7128
+ | "currency_mismatch";
7129
+ retryable: false;
7130
+ status: "rejected";
7131
+ }
7132
+ | {
7133
+ reason: "provider_outcome_unknown" | "history_incomplete";
7134
+ retryable: false;
7135
+ status: "unknown";
7136
+ };
7137
+ importHook?: string;
7138
+ maxAttempts: number;
7139
+ policy: {
7140
+ liability: {
7141
+ disputeCosts: "all" | "none";
7142
+ processingCosts: "uncovered" | "all" | "none";
7143
+ };
7144
+ rounding: "nearest" | "floor" | "ceil";
7145
+ sellingFee: number;
7146
+ };
7147
+ projection?: string;
7148
+ provider: string;
7149
+ providerApiVersion: string;
7150
+ requestKey: string;
7151
+ result?: {
7152
+ claim: {
7153
+ _creationTime: number;
7154
+ _id: string;
7155
+ accountId: string;
7156
+ amountDue: number;
7157
+ claimKey: string;
7158
+ collectedAmount: number;
7159
+ currency: string;
7160
+ openingCollection?: {
7161
+ amountDue: number;
7162
+ collectedAmount: number;
7163
+ operationKey: string;
7164
+ revision: number;
7165
+ };
7166
+ outstanding: number;
7167
+ reservedAmount: number;
7168
+ revision: number;
7169
+ scopeKey: string;
7170
+ sign: "positive" | "negative" | "zero";
7171
+ sourceChargeId: string;
7172
+ sourceGross: number;
7173
+ sourceProcessingFee: number;
7174
+ };
7175
+ deficit: {
7176
+ amountDue: number;
7177
+ currency: string;
7178
+ disputeLiability: number;
7179
+ processingLiability: number;
7180
+ retainedFee: number;
7181
+ };
7182
+ observation: {
7183
+ currency: string;
7184
+ disputeFees: number;
7185
+ gross: number;
7186
+ originalProcessingFee: number;
7187
+ paymentIntentId: string;
7188
+ principalReturned: number;
7189
+ processingFee: number;
7190
+ provenance: {
7191
+ customerAccountId: string;
7192
+ invoiceId: string;
7193
+ invoicePaymentId: string;
7194
+ recoveryInvoiceItemId?: string;
7195
+ stripePriceId?: string;
7196
+ stripeProductId?: string;
7197
+ subscriptionId?: string;
7198
+ };
7199
+ sourceChargeId: string;
7200
+ };
7201
+ rollbackClaim?: {
7202
+ _creationTime: number;
7203
+ _id: string;
7204
+ accountId: string;
7205
+ amountDue: number;
7206
+ claimKey: string;
7207
+ collectedAmount: number;
7208
+ currency: string;
7209
+ openingCollection?: {
7210
+ amountDue: number;
7211
+ collectedAmount: number;
7212
+ operationKey: string;
7213
+ revision: number;
7214
+ };
7215
+ outstanding: number;
7216
+ reservedAmount: number;
7217
+ revision: number;
7218
+ scopeKey: string;
7219
+ sign: "positive" | "negative" | "zero";
7220
+ sourceChargeId: string;
7221
+ sourceGross: number;
7222
+ sourceProcessingFee: number;
7223
+ };
7224
+ };
7225
+ retryDelayMs: number;
7226
+ rollback?: { expectedRevision: number; groupKey: string };
7227
+ scopeKey: string;
7228
+ source:
7229
+ | {
7230
+ customerAccountId: string;
7231
+ gross: number;
7232
+ invoiceId?: string;
7233
+ kind: "sale";
7234
+ paymentIntentId: string;
7235
+ stripeAccountId?: string;
7236
+ stripePriceId?: string;
7237
+ stripeProductId?: string;
7238
+ subscriptionId?: string;
7239
+ }
7240
+ | {
7241
+ gross: number;
7242
+ groupKey: string;
7243
+ kind: "invoice_recovery";
7244
+ paymentIntentId: string;
7245
+ };
7246
+ status:
7247
+ | "queued"
7248
+ | "running"
7249
+ | "waiting"
7250
+ | "completed"
7251
+ | "conflict"
7252
+ | "rejected"
7253
+ | "unknown";
7254
+ version: number;
7255
+ workflowId?: string;
7256
+ },
7257
+ Name
7258
+ >;
7259
+ };
7260
+ };
6167
7261
  products: {
6168
7262
  mutations: {
6169
7263
  adoptProduct: FunctionReference<