@fantastic.dev/better-stripe 0.38.0 → 0.40.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 (167) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/MIGRATION.md +9 -0
  3. package/README.md +21 -1
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +506 -2
  5. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +253 -1
  7. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +506 -2
  9. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts +253 -1
  11. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  12. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  13. package/dist/client/costRecovery-invoices.js +3 -5
  14. package/dist/client/costRecovery-invoices.js.map +1 -1
  15. package/dist/client/costRecovery.d.ts +18 -0
  16. package/dist/client/costRecovery.d.ts.map +1 -1
  17. package/dist/client/costRecovery.js +4 -0
  18. package/dist/client/costRecovery.js.map +1 -1
  19. package/dist/client/index.d.ts +4 -2
  20. package/dist/client/index.d.ts.map +1 -1
  21. package/dist/client/index.js +3 -2
  22. package/dist/client/index.js.map +1 -1
  23. package/dist/client/paymentSource/client.d.ts +21 -0
  24. package/dist/client/paymentSource/client.d.ts.map +1 -0
  25. package/dist/client/paymentSource/client.js +8 -0
  26. package/dist/client/paymentSource/client.js.map +1 -0
  27. package/dist/client/paymentSource/contracts.d.ts +30 -0
  28. package/dist/client/paymentSource/contracts.d.ts.map +1 -0
  29. package/dist/client/paymentSource/contracts.js +16 -0
  30. package/dist/client/paymentSource/contracts.js.map +1 -0
  31. package/dist/client/paymentSource/economics.d.ts +12 -0
  32. package/dist/client/paymentSource/economics.d.ts.map +1 -0
  33. package/dist/client/paymentSource/economics.js +13 -0
  34. package/dist/client/paymentSource/economics.js.map +1 -0
  35. package/dist/client/paymentSource/funding.d.ts +10 -0
  36. package/dist/client/paymentSource/funding.d.ts.map +1 -0
  37. package/dist/client/paymentSource/funding.js +12 -0
  38. package/dist/client/paymentSource/funding.js.map +1 -0
  39. package/dist/client/paymentSource/history.d.ts +13 -0
  40. package/dist/client/paymentSource/history.d.ts.map +1 -0
  41. package/dist/client/paymentSource/history.js +41 -0
  42. package/dist/client/paymentSource/history.js.map +1 -0
  43. package/dist/client/paymentSource/resolver.d.ts +6 -0
  44. package/dist/client/paymentSource/resolver.d.ts.map +1 -0
  45. package/dist/client/paymentSource/resolver.js +222 -0
  46. package/dist/client/paymentSource/resolver.js.map +1 -0
  47. package/dist/client/processingCostDeficit/index.d.ts +27 -0
  48. package/dist/client/processingCostDeficit/index.d.ts.map +1 -0
  49. package/dist/client/processingCostDeficit/index.js +54 -0
  50. package/dist/client/processingCostDeficit/index.js.map +1 -0
  51. package/dist/client/settlement/verifiedSale.d.ts.map +1 -1
  52. package/dist/client/settlement/verifiedSale.js +4 -6
  53. package/dist/client/settlement/verifiedSale.js.map +1 -1
  54. package/dist/component/_generated/api.d.ts +284 -0
  55. package/dist/component/_generated/api.d.ts.map +1 -0
  56. package/dist/component/_generated/api.js +31 -0
  57. package/dist/component/_generated/api.js.map +1 -0
  58. package/dist/component/_generated/component.d.ts +527 -0
  59. package/dist/component/_generated/component.d.ts.map +1 -1
  60. package/dist/component/balanceFunding/helpers.d.ts +86 -0
  61. package/dist/component/balanceFunding/helpers.d.ts.map +1 -0
  62. package/dist/component/balanceFunding/helpers.js +68 -0
  63. package/dist/component/balanceFunding/helpers.js.map +1 -0
  64. package/dist/component/balanceFunding/importHandler.d.ts +13 -0
  65. package/dist/component/balanceFunding/importHandler.d.ts.map +1 -0
  66. package/dist/component/balanceFunding/importHandler.js +130 -0
  67. package/dist/component/balanceFunding/importHandler.js.map +1 -0
  68. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +85 -0
  69. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -0
  70. package/dist/component/balanceFunding/lifecycleHandlers.js +60 -0
  71. package/dist/component/balanceFunding/lifecycleHandlers.js.map +1 -0
  72. package/dist/component/balanceFunding/mutationValidators.d.ts +238 -0
  73. package/dist/component/balanceFunding/mutationValidators.d.ts.map +1 -0
  74. package/dist/component/balanceFunding/mutationValidators.js +55 -0
  75. package/dist/component/balanceFunding/mutationValidators.js.map +1 -0
  76. package/dist/component/balanceFunding/mutations.d.ts +335 -0
  77. package/dist/component/balanceFunding/mutations.d.ts.map +1 -0
  78. package/dist/component/balanceFunding/mutations.js +106 -0
  79. package/dist/component/balanceFunding/mutations.js.map +1 -0
  80. package/dist/component/balanceFunding/preparationHandlers.d.ts +55 -0
  81. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -0
  82. package/dist/component/balanceFunding/preparationHandlers.js +165 -0
  83. package/dist/component/balanceFunding/preparationHandlers.js.map +1 -0
  84. package/dist/component/balanceFunding/queries.d.ts +151 -0
  85. package/dist/component/balanceFunding/queries.d.ts.map +1 -0
  86. package/dist/component/balanceFunding/queries.js +180 -0
  87. package/dist/component/balanceFunding/queries.js.map +1 -0
  88. package/dist/component/balanceFunding/schema.d.ts +748 -0
  89. package/dist/component/balanceFunding/schema.d.ts.map +1 -0
  90. package/dist/component/balanceFunding/schema.js +124 -0
  91. package/dist/component/balanceFunding/schema.js.map +1 -0
  92. package/dist/component/balanceFunding/stateHandlers.d.ts +58 -0
  93. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -0
  94. package/dist/component/balanceFunding/stateHandlers.js +160 -0
  95. package/dist/component/balanceFunding/stateHandlers.js.map +1 -0
  96. package/dist/component/convex.config.d.ts.map +1 -1
  97. package/dist/component/convex.config.js +2 -0
  98. package/dist/component/convex.config.js.map +1 -1
  99. package/dist/component/costRecovery/completion.d.ts +1 -0
  100. package/dist/component/costRecovery/completion.d.ts.map +1 -1
  101. package/dist/component/costRecovery/helpers.d.ts +1 -0
  102. package/dist/component/costRecovery/helpers.d.ts.map +1 -1
  103. package/dist/component/costRecovery/mutations.d.ts +5 -0
  104. package/dist/component/costRecovery/mutations.d.ts.map +1 -1
  105. package/dist/component/costRecovery/preparation.d.ts +50 -0
  106. package/dist/component/costRecovery/preparation.d.ts.map +1 -0
  107. package/dist/component/costRecovery/preparation.js +108 -0
  108. package/dist/component/costRecovery/preparation.js.map +1 -0
  109. package/dist/component/costRecovery/queries.d.ts +1 -0
  110. package/dist/component/costRecovery/queries.d.ts.map +1 -1
  111. package/dist/component/costRecovery/reservations.d.ts +2 -0
  112. package/dist/component/costRecovery/reservations.d.ts.map +1 -1
  113. package/dist/component/costRecovery/schema.d.ts +7 -2
  114. package/dist/component/costRecovery/schema.d.ts.map +1 -1
  115. package/dist/component/costRecovery/schema.js +1 -0
  116. package/dist/component/costRecovery/schema.js.map +1 -1
  117. package/dist/component/durableExecution/runtime.d.ts +3 -0
  118. package/dist/component/durableExecution/runtime.d.ts.map +1 -0
  119. package/dist/component/durableExecution/runtime.js +12 -0
  120. package/dist/component/durableExecution/runtime.js.map +1 -0
  121. package/dist/component/earnings/triggers.d.ts +242 -2
  122. package/dist/component/earnings/triggers.d.ts.map +1 -1
  123. package/dist/component/schema.d.ts +253 -1
  124. package/dist/component/schema.js +4 -0
  125. package/dist/component/schema.js.map +1 -1
  126. package/docs/settlement.md +48 -0
  127. package/package.json +4 -2
  128. package/src/client/costRecovery-invoices.ts +3 -7
  129. package/src/client/costRecovery.test.ts +34 -0
  130. package/src/client/costRecovery.ts +21 -0
  131. package/src/client/index.ts +7 -2
  132. package/src/client/paymentSource/client.ts +13 -0
  133. package/src/client/paymentSource/contracts.ts +33 -0
  134. package/src/client/paymentSource/economics.ts +20 -0
  135. package/src/client/paymentSource/funding.ts +23 -0
  136. package/src/client/paymentSource/history.ts +48 -0
  137. package/src/client/paymentSource/resolver.test.ts +582 -0
  138. package/src/client/paymentSource/resolver.ts +350 -0
  139. package/src/client/processingCostDeficit/README.md +35 -0
  140. package/src/client/processingCostDeficit/calculator.test.ts +176 -0
  141. package/src/client/processingCostDeficit/index.ts +91 -0
  142. package/src/client/settlement/verifiedSale.ts +4 -10
  143. package/src/component/_generated/api.ts +23 -1
  144. package/src/component/_generated/component.ts +693 -0
  145. package/src/component/balanceFunding/failure.test.ts +116 -0
  146. package/src/component/balanceFunding/helpers.ts +102 -0
  147. package/src/component/balanceFunding/import.test.ts +221 -0
  148. package/src/component/balanceFunding/importHandler.ts +146 -0
  149. package/src/component/balanceFunding/lifecycleHandlers.ts +90 -0
  150. package/src/component/balanceFunding/lookup.test.ts +113 -0
  151. package/src/component/balanceFunding/mutationValidators.ts +63 -0
  152. package/src/component/balanceFunding/mutations.ts +136 -0
  153. package/src/component/balanceFunding/preparation.test.ts +146 -0
  154. package/src/component/balanceFunding/preparationHandlers.ts +204 -0
  155. package/src/component/balanceFunding/queries.ts +221 -0
  156. package/src/component/balanceFunding/requestLookup.test.ts +160 -0
  157. package/src/component/balanceFunding/schema.ts +169 -0
  158. package/src/component/balanceFunding/state.test.ts +352 -0
  159. package/src/component/balanceFunding/stateHandlers.ts +198 -0
  160. package/src/component/balanceFunding/validation.test.ts +100 -0
  161. package/src/component/convex.config.ts +2 -0
  162. package/src/component/costRecovery/preparation.test.ts +355 -0
  163. package/src/component/costRecovery/preparation.ts +124 -0
  164. package/src/component/costRecovery/schema.ts +1 -0
  165. package/src/component/durableExecution/composition.test.ts +568 -0
  166. package/src/component/durableExecution/runtime.ts +12 -0
  167. package/src/component/schema.ts +8 -0
@@ -473,6 +473,477 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
473
473
  }, Name>;
474
474
  };
475
475
  };
476
+ balanceFunding: {
477
+ mutations: {
478
+ begin: FunctionReference<"mutation", "internal", {
479
+ accountId: string;
480
+ consent?: true;
481
+ enabled: boolean;
482
+ preparationId: string;
483
+ requestKey: string;
484
+ scopeKey: string;
485
+ }, {
486
+ operation: {
487
+ accountId: string;
488
+ operationId: string;
489
+ scopeKey: string;
490
+ version: number;
491
+ };
492
+ status: "accepted";
493
+ } | {
494
+ enabled: boolean;
495
+ status: "unchanged";
496
+ } | {
497
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
498
+ retryable: false;
499
+ status: "conflict";
500
+ } | {
501
+ reason: "policy_invalid";
502
+ retryable: false;
503
+ status: "rejected";
504
+ } | {
505
+ reason: "provider_pending";
506
+ retryable: true;
507
+ status: "not_ready";
508
+ }, Name>;
509
+ failBeforeStart: FunctionReference<"mutation", "internal", {
510
+ accountId: string;
511
+ failureCode: "invalid_scope" | "unsupported_source" | "policy_invalid";
512
+ operationId: string;
513
+ scopeKey: string;
514
+ version: number;
515
+ }, {
516
+ _creationTime: number;
517
+ _id: string;
518
+ accountId: string;
519
+ cancelRequested: boolean;
520
+ enabled: boolean;
521
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
522
+ kind: "prepare" | "apply";
523
+ preparationId: string;
524
+ providerKey: string;
525
+ providerKeys: {
526
+ attach?: string;
527
+ create?: string;
528
+ disable: string;
529
+ enable: string;
530
+ };
531
+ receipt?: {
532
+ customerAccount: string;
533
+ paymentMethodId: string | null;
534
+ paymentMethodTypes: Array<string> | null;
535
+ providerApiVersion: string;
536
+ stripeSubscriptionId: string;
537
+ };
538
+ scopeKey: string;
539
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
540
+ version: number;
541
+ }, Name>;
542
+ finish: FunctionReference<"mutation", "internal", {
543
+ accountId: string;
544
+ enabled: boolean;
545
+ operationId: string;
546
+ receipt: {
547
+ customerAccount: string;
548
+ paymentMethodId: string | null;
549
+ paymentMethodTypes: Array<string> | null;
550
+ providerApiVersion: string;
551
+ stripeSubscriptionId: string;
552
+ };
553
+ scopeKey: string;
554
+ version: number;
555
+ }, {
556
+ _creationTime: number;
557
+ _id: string;
558
+ accountId: string;
559
+ cancelRequested: boolean;
560
+ enabled: boolean;
561
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
562
+ kind: "prepare" | "apply";
563
+ preparationId: string;
564
+ providerKey: string;
565
+ providerKeys: {
566
+ attach?: string;
567
+ create?: string;
568
+ disable: string;
569
+ enable: string;
570
+ };
571
+ receipt?: {
572
+ customerAccount: string;
573
+ paymentMethodId: string | null;
574
+ paymentMethodTypes: Array<string> | null;
575
+ providerApiVersion: string;
576
+ stripeSubscriptionId: string;
577
+ };
578
+ scopeKey: string;
579
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
580
+ version: number;
581
+ }, Name>;
582
+ finishPreparation: FunctionReference<"mutation", "internal", {
583
+ accountId: string;
584
+ operationId: string;
585
+ preparation: {
586
+ customerAccount: string;
587
+ paymentMethodId: string;
588
+ previousPaymentMethodId: string | null;
589
+ previousPaymentMethodTypes: Array<string> | null;
590
+ stripeSubscriptionId: string;
591
+ };
592
+ providerApiVersion: string;
593
+ scopeKey: string;
594
+ version: number;
595
+ }, {
596
+ _creationTime: number;
597
+ _id: string;
598
+ accountId: string;
599
+ cancelRequested: boolean;
600
+ enabled: boolean;
601
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
602
+ kind: "prepare" | "apply";
603
+ preparationId: string;
604
+ providerKey: string;
605
+ providerKeys: {
606
+ attach?: string;
607
+ create?: string;
608
+ disable: string;
609
+ enable: string;
610
+ };
611
+ receipt?: {
612
+ customerAccount: string;
613
+ paymentMethodId: string | null;
614
+ paymentMethodTypes: Array<string> | null;
615
+ providerApiVersion: string;
616
+ stripeSubscriptionId: string;
617
+ };
618
+ scopeKey: string;
619
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
620
+ version: number;
621
+ }, Name>;
622
+ importPreparation: FunctionReference<"mutation", "internal", {
623
+ accountId: string;
624
+ consentAt: number;
625
+ consentReference: string;
626
+ enabled: boolean;
627
+ operationVersion: number;
628
+ pending?: {
629
+ enabled: boolean;
630
+ kind?: "prepare" | "apply";
631
+ providerKey: string;
632
+ requestKey: string;
633
+ };
634
+ preparation: {
635
+ customerAccount: string;
636
+ paymentMethodId?: string;
637
+ previousPaymentMethodId: string | null;
638
+ previousPaymentMethodTypes: Array<string> | null;
639
+ stripeSubscriptionId: string;
640
+ };
641
+ providerApiVersion: string;
642
+ scopeKey: string;
643
+ sourceKey: string;
644
+ }, {
645
+ operation?: {
646
+ accountId: string;
647
+ operationId: string;
648
+ scopeKey: string;
649
+ version: number;
650
+ };
651
+ preparationId: string;
652
+ }, Name>;
653
+ markUnknown: FunctionReference<"mutation", "internal", {
654
+ accountId: string;
655
+ operationId: string;
656
+ scopeKey: string;
657
+ version: number;
658
+ }, {
659
+ _creationTime: number;
660
+ _id: string;
661
+ accountId: string;
662
+ cancelRequested: boolean;
663
+ enabled: boolean;
664
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
665
+ kind: "prepare" | "apply";
666
+ preparationId: string;
667
+ providerKey: string;
668
+ providerKeys: {
669
+ attach?: string;
670
+ create?: string;
671
+ disable: string;
672
+ enable: string;
673
+ };
674
+ receipt?: {
675
+ customerAccount: string;
676
+ paymentMethodId: string | null;
677
+ paymentMethodTypes: Array<string> | null;
678
+ providerApiVersion: string;
679
+ stripeSubscriptionId: string;
680
+ };
681
+ scopeKey: string;
682
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
683
+ version: number;
684
+ }, Name>;
685
+ prepare: FunctionReference<"mutation", "internal", {
686
+ accountId: string;
687
+ consent: true;
688
+ consentAt: number;
689
+ consentReference: string;
690
+ preparation: {
691
+ customerAccount: string;
692
+ previousPaymentMethodId: string | null;
693
+ previousPaymentMethodTypes: Array<string> | null;
694
+ stripeSubscriptionId: string;
695
+ };
696
+ providerApiVersion: string;
697
+ requestKey: string;
698
+ scopeKey: string;
699
+ }, {
700
+ operation: {
701
+ accountId: string;
702
+ operationId: string;
703
+ scopeKey: string;
704
+ version: number;
705
+ };
706
+ status: "accepted";
707
+ } | {
708
+ enabled: boolean;
709
+ status: "unchanged";
710
+ } | {
711
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
712
+ retryable: false;
713
+ status: "conflict";
714
+ } | {
715
+ reason: "policy_invalid";
716
+ retryable: false;
717
+ status: "rejected";
718
+ } | {
719
+ reason: "provider_pending";
720
+ retryable: true;
721
+ status: "not_ready";
722
+ }, Name>;
723
+ requestCancel: FunctionReference<"mutation", "internal", {
724
+ accountId: string;
725
+ operationId: string;
726
+ scopeKey: string;
727
+ version: number;
728
+ }, {
729
+ _creationTime: number;
730
+ _id: string;
731
+ accountId: string;
732
+ cancelRequested: boolean;
733
+ enabled: boolean;
734
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
735
+ kind: "prepare" | "apply";
736
+ preparationId: string;
737
+ providerKey: string;
738
+ providerKeys: {
739
+ attach?: string;
740
+ create?: string;
741
+ disable: string;
742
+ enable: string;
743
+ };
744
+ receipt?: {
745
+ customerAccount: string;
746
+ paymentMethodId: string | null;
747
+ paymentMethodTypes: Array<string> | null;
748
+ providerApiVersion: string;
749
+ stripeSubscriptionId: string;
750
+ };
751
+ scopeKey: string;
752
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
753
+ version: number;
754
+ }, Name>;
755
+ savePreparation: FunctionReference<"mutation", "internal", {
756
+ accountId: string;
757
+ consentAt: number;
758
+ consentReference: string;
759
+ preparation: {
760
+ customerAccount: string;
761
+ paymentMethodId: string;
762
+ previousPaymentMethodId: string | null;
763
+ previousPaymentMethodTypes: Array<string> | null;
764
+ stripeSubscriptionId: string;
765
+ };
766
+ providerApiVersion: string;
767
+ scopeKey: string;
768
+ }, {
769
+ preparationId: string;
770
+ }, Name>;
771
+ setStartsPaused: FunctionReference<"mutation", "internal", {
772
+ accountId: string;
773
+ paused: boolean;
774
+ preparationId: string;
775
+ scopeKey: string;
776
+ stripeSubscriptionId: string;
777
+ }, null, Name>;
778
+ start: FunctionReference<"mutation", "internal", {
779
+ accountId: string;
780
+ operationId: string;
781
+ scopeKey: string;
782
+ version: number;
783
+ }, {
784
+ _creationTime: number;
785
+ _id: string;
786
+ accountId: string;
787
+ cancelRequested: boolean;
788
+ enabled: boolean;
789
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
790
+ kind: "prepare" | "apply";
791
+ preparationId: string;
792
+ providerKey: string;
793
+ providerKeys: {
794
+ attach?: string;
795
+ create?: string;
796
+ disable: string;
797
+ enable: string;
798
+ };
799
+ receipt?: {
800
+ customerAccount: string;
801
+ paymentMethodId: string | null;
802
+ paymentMethodTypes: Array<string> | null;
803
+ providerApiVersion: string;
804
+ stripeSubscriptionId: string;
805
+ };
806
+ scopeKey: string;
807
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
808
+ version: number;
809
+ }, Name>;
810
+ };
811
+ queries: {
812
+ findPreparationOperation: FunctionReference<"query", "internal", {
813
+ accountId: string;
814
+ consent: boolean;
815
+ providerApiVersion: string;
816
+ requestKey: string;
817
+ scopeKey: string;
818
+ stripeSubscriptionId: string;
819
+ }, {
820
+ accountId: string;
821
+ cancelRequested: boolean;
822
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
823
+ operationId: string;
824
+ scopeKey: string;
825
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
826
+ version: number;
827
+ } | {
828
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
829
+ retryable: false;
830
+ status: "conflict";
831
+ } | {
832
+ reason: "invalid_scope";
833
+ retryable: false;
834
+ status: "rejected";
835
+ } | null, Name>;
836
+ getOperation: FunctionReference<"query", "internal", {
837
+ accountId: string;
838
+ operationId: string;
839
+ scopeKey: string;
840
+ stripeSubscriptionId: string;
841
+ version: number;
842
+ }, {
843
+ accountId: string;
844
+ cancelRequested: boolean;
845
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
846
+ operationId: string;
847
+ scopeKey: string;
848
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
849
+ version: number;
850
+ } | null, Name>;
851
+ getPreparation: FunctionReference<"query", "internal", {
852
+ accountId: string;
853
+ operationId: string;
854
+ scopeKey: string;
855
+ stripeSubscriptionId: string;
856
+ version: number;
857
+ }, {
858
+ operation: {
859
+ accountId: string;
860
+ operationId: string;
861
+ scopeKey: string;
862
+ version: number;
863
+ };
864
+ preparationId: string;
865
+ status: "prepared";
866
+ stripeSubscriptionId: string;
867
+ } | {
868
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
869
+ operation: {
870
+ accountId: string;
871
+ operationId: string;
872
+ scopeKey: string;
873
+ version: number;
874
+ };
875
+ status: "pending" | "running" | "unknown" | "canceled" | "failed";
876
+ } | {
877
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
878
+ retryable: false;
879
+ status: "conflict";
880
+ } | {
881
+ reason: "invalid_scope";
882
+ retryable: false;
883
+ status: "rejected";
884
+ } | null, Name>;
885
+ inspectOperation: FunctionReference<"query", "internal", {
886
+ accountId: string;
887
+ operationId: string;
888
+ scopeKey: string;
889
+ stripeSubscriptionId: string;
890
+ version: number;
891
+ }, {
892
+ _creationTime: number;
893
+ _id: string;
894
+ accountId: string;
895
+ cancelRequested: boolean;
896
+ enabled: boolean;
897
+ failureCode?: "invalid_scope" | "unsupported_source" | "policy_invalid";
898
+ kind: "prepare" | "apply";
899
+ preparationId: string;
900
+ providerKey: string;
901
+ providerKeys: {
902
+ attach?: string;
903
+ create?: string;
904
+ disable: string;
905
+ enable: string;
906
+ };
907
+ receipt?: {
908
+ customerAccount: string;
909
+ paymentMethodId: string | null;
910
+ paymentMethodTypes: Array<string> | null;
911
+ providerApiVersion: string;
912
+ stripeSubscriptionId: string;
913
+ };
914
+ scopeKey: string;
915
+ state: "pending" | "running" | "unknown" | "succeeded" | "canceled" | "failed";
916
+ version: number;
917
+ } | null, Name>;
918
+ readPreparation: FunctionReference<"query", "internal", {
919
+ accountId: string;
920
+ preparationId: string;
921
+ scopeKey: string;
922
+ stripeSubscriptionId: string;
923
+ }, {
924
+ _creationTime: number;
925
+ _id: string;
926
+ accountId: string;
927
+ activeOperationId?: string;
928
+ consentAt: number;
929
+ consentReference: string;
930
+ enabled: boolean;
931
+ operationVersion: number;
932
+ preparation: {
933
+ customerAccount: string;
934
+ paymentMethodId?: string;
935
+ previousPaymentMethodId: string | null;
936
+ previousPaymentMethodTypes: Array<string> | null;
937
+ stripeSubscriptionId: string;
938
+ };
939
+ preparationOperationId?: string;
940
+ providerApiVersion: string;
941
+ scopeKey: string;
942
+ startsPaused: boolean;
943
+ verified: boolean;
944
+ } | null, Name>;
945
+ };
946
+ };
476
947
  billing: {
477
948
  mutations: {
478
949
  upsertCheckoutSession: FunctionReference<"mutation", "internal", {
@@ -1797,6 +2268,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1797
2268
  maxCredit: number;
1798
2269
  maxDebit: number;
1799
2270
  pendingOperations: number;
2271
+ preparationSequence?: number;
1800
2272
  scopeKey: string;
1801
2273
  sourceGross?: number;
1802
2274
  sourceId: string;
@@ -1823,6 +2295,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1823
2295
  maxCredit: number;
1824
2296
  maxDebit: number;
1825
2297
  pendingOperations: number;
2298
+ preparationSequence?: number;
1826
2299
  scopeKey: string;
1827
2300
  sourceGross?: number;
1828
2301
  sourceId: string;
@@ -1851,6 +2324,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1851
2324
  maxCredit: number;
1852
2325
  maxDebit: number;
1853
2326
  pendingOperations: number;
2327
+ preparationSequence?: number;
1854
2328
  scopeKey: string;
1855
2329
  sourceGross?: number;
1856
2330
  sourceId: string;
@@ -1958,6 +2432,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1958
2432
  maxCredit: number;
1959
2433
  maxDebit: number;
1960
2434
  pendingOperations: number;
2435
+ preparationSequence?: number;
1961
2436
  scopeKey: string;
1962
2437
  sourceGross?: number;
1963
2438
  sourceId: string;
@@ -2025,6 +2500,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2025
2500
  maxCredit: number;
2026
2501
  maxDebit: number;
2027
2502
  pendingOperations: number;
2503
+ preparationSequence?: number;
2028
2504
  scopeKey: string;
2029
2505
  sourceGross?: number;
2030
2506
  sourceId: string;
@@ -2033,6 +2509,56 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2033
2509
  status: "open" | "sealed" | "collecting" | "releasing" | "collected" | "released";
2034
2510
  }, Name>;
2035
2511
  };
2512
+ preparation: {
2513
+ prepare: FunctionReference<"mutation", "internal", {
2514
+ accountId: string;
2515
+ currency: string;
2516
+ groupKey: string;
2517
+ limit?: number;
2518
+ maxCredit: number;
2519
+ maxDebit: number;
2520
+ scopeKey: string;
2521
+ sourceGross?: number;
2522
+ sourceId: string;
2523
+ sourceKind: "settlement" | "invoice";
2524
+ sourceProcessingFee?: number;
2525
+ }, {
2526
+ group: {
2527
+ _creationTime: number;
2528
+ _id: string;
2529
+ accountId: string;
2530
+ amount: number;
2531
+ currency: string;
2532
+ groupKey: string;
2533
+ invoiceFunding?: {
2534
+ sourceChargeId: string;
2535
+ sourceGross: number;
2536
+ sourceProcessingFee: number;
2537
+ };
2538
+ invoiceItemId?: string;
2539
+ maxCredit: number;
2540
+ maxDebit: number;
2541
+ pendingOperations: number;
2542
+ preparationSequence?: number;
2543
+ scopeKey: string;
2544
+ sourceGross?: number;
2545
+ sourceId: string;
2546
+ sourceKind: "settlement" | "invoice";
2547
+ sourceProcessingFee?: number;
2548
+ status: "open" | "sealed" | "collecting" | "releasing" | "collected" | "released";
2549
+ };
2550
+ isDone: boolean;
2551
+ status: "prepared";
2552
+ } | {
2553
+ reason: "scope_busy" | "identity_changed";
2554
+ retryable: false;
2555
+ status: "conflict";
2556
+ } | {
2557
+ reason: "invalid_scope" | "policy_invalid";
2558
+ retryable: false;
2559
+ status: "rejected";
2560
+ }, Name>;
2561
+ };
2036
2562
  queries: {
2037
2563
  balance: FunctionReference<"query", "internal", {
2038
2564
  accountId: string;
@@ -2091,6 +2617,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2091
2617
  maxCredit: number;
2092
2618
  maxDebit: number;
2093
2619
  pendingOperations: number;
2620
+ preparationSequence?: number;
2094
2621
  scopeKey: string;
2095
2622
  sourceGross?: number;
2096
2623
  sourceId: string;