@fun-xyz/fiat-contract 0.50.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BK2XD3JT.mjs → chunk-JDI4TWPZ.mjs} +1 -1
- package/dist/index.js +37 -8
- package/dist/index.mjs +37 -8
- package/dist/providers/coinbase.d.ts +2 -1
- package/dist/providers/moonpay.d.ts +2 -1
- package/dist/providers/stripe.d.ts +12 -2
- package/dist/providers/stripe.schemas.d.ts +2 -1
- package/dist/schemas.d.ts +12 -1
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -172,6 +172,7 @@ __export(index_exports, {
|
|
|
172
172
|
MoonPayWaitNextActionSchema: () => MoonPayWaitNextActionSchema,
|
|
173
173
|
OrderAwaitingConfirmationStateSchema: () => OrderAwaitingConfirmationStateSchema,
|
|
174
174
|
OrderCreatedStateSchema: () => OrderCreatedStateSchema,
|
|
175
|
+
OrderPollSchema: () => OrderPollSchema,
|
|
175
176
|
OrderRefSchema: () => OrderRefSchema,
|
|
176
177
|
OrderStatusSchema: () => OrderStatusSchema,
|
|
177
178
|
OrderSummarySchema: () => OrderSummarySchema,
|
|
@@ -213,6 +214,7 @@ __export(index_exports, {
|
|
|
213
214
|
StripeErrorBodySchema: () => StripeErrorBodySchema,
|
|
214
215
|
StripeFaultSchema: () => StripeFaultSchema,
|
|
215
216
|
StripeIdentifiersNextActionSchema: () => StripeIdentifiersNextActionSchema,
|
|
217
|
+
StripeIdentityReaskSchema: () => StripeIdentityReaskSchema,
|
|
216
218
|
StripeKycNextActionSchema: () => StripeKycNextActionSchema,
|
|
217
219
|
StripeKycRequestSchema: () => StripeKycRequestSchema,
|
|
218
220
|
StripeLinkAuthTokenSchema: () => StripeLinkAuthTokenSchema,
|
|
@@ -260,6 +262,7 @@ __export(index_exports, {
|
|
|
260
262
|
assertLegalEmission: () => assertLegalEmission,
|
|
261
263
|
assertLegalReturn: () => assertLegalReturn,
|
|
262
264
|
checkLegalEmission: () => checkLegalEmission,
|
|
265
|
+
checkOrderPendingPoll: () => checkOrderPendingPoll,
|
|
263
266
|
endpointMatches: () => endpointMatches,
|
|
264
267
|
fixtureMeta: () => fixtureMeta,
|
|
265
268
|
isEeaCountry: () => isEeaCountry,
|
|
@@ -989,6 +992,21 @@ var $pollSpec = obj({
|
|
|
989
992
|
}
|
|
990
993
|
});
|
|
991
994
|
var PollSpecSchema = $pollSpec;
|
|
995
|
+
var OrderPollSchema = obj({
|
|
996
|
+
backoffFactor: import_zod.z.number().finite().min(1).max(4),
|
|
997
|
+
maxIntervalMs: import_zod.z.number().int().min(MIN_INTERVAL_MS).max(6e4),
|
|
998
|
+
giveUpAfterMs: import_zod.z.number().int().positive().max(60 * 60 * 1e3)
|
|
999
|
+
});
|
|
1000
|
+
function checkOrderPendingPoll(response, context2) {
|
|
1001
|
+
const { poll, retryAfterMs: retryAfterMs2 } = response;
|
|
1002
|
+
if (response.next !== "orderPending" || poll === void 0 || retryAfterMs2 === void 0) return;
|
|
1003
|
+
if (retryAfterMs2 < MIN_INTERVAL_MS) {
|
|
1004
|
+
context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
|
|
1005
|
+
}
|
|
1006
|
+
if (poll.maxIntervalMs < retryAfterMs2) {
|
|
1007
|
+
context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
992
1010
|
var $reportSpec = obj({
|
|
993
1011
|
endpoint: $endpoint,
|
|
994
1012
|
params: $params.optional(),
|
|
@@ -1473,7 +1491,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1473
1491
|
var FiatStepResponseSchema = $stepResponse;
|
|
1474
1492
|
|
|
1475
1493
|
// package.json
|
|
1476
|
-
var version = "0.
|
|
1494
|
+
var version = "0.52.0";
|
|
1477
1495
|
|
|
1478
1496
|
// src/table.ts
|
|
1479
1497
|
var TABLE_VERSION = version;
|
|
@@ -3605,6 +3623,7 @@ var $orderPendingNextAction = obj2({
|
|
|
3605
3623
|
next: import_zod2.z.literal("orderPending"),
|
|
3606
3624
|
orderId: $nonEmpty,
|
|
3607
3625
|
retryAfterMs: import_zod2.z.number().int().positive().max(6e4),
|
|
3626
|
+
poll: OrderPollSchema.optional(),
|
|
3608
3627
|
order: FiatStepResponseSchema.nullable()
|
|
3609
3628
|
});
|
|
3610
3629
|
var checkConsent = (nextAction, context2) => {
|
|
@@ -3648,7 +3667,7 @@ var MoonPayReaskSchema = $reask;
|
|
|
3648
3667
|
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
3649
3668
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
3650
3669
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
3651
|
-
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
3670
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
3652
3671
|
var checkNextAction = (response, context2) => {
|
|
3653
3672
|
if (response.next === "consent") checkConsent(response, context2);
|
|
3654
3673
|
if (response.next === "kyc") checkKyc(response, context2);
|
|
@@ -3680,7 +3699,7 @@ var $orderRefused = obj2({
|
|
|
3680
3699
|
});
|
|
3681
3700
|
var $stepResponse2 = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
3682
3701
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
3683
|
-
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
3702
|
+
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]).superRefine(checkOrderPendingPoll);
|
|
3684
3703
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
3685
3704
|
var MoonPayResponseSchemaFor = {
|
|
3686
3705
|
observe: MoonPayStepResponseSchema,
|
|
@@ -3818,6 +3837,7 @@ var $orderPendingNextAction2 = obj3({
|
|
|
3818
3837
|
next: import_zod3.z.literal("orderPending"),
|
|
3819
3838
|
orderId: $nonEmpty2,
|
|
3820
3839
|
retryAfterMs: $retryAfterMs,
|
|
3840
|
+
poll: OrderPollSchema.optional(),
|
|
3821
3841
|
order: FiatStepResponseSchema.nullable()
|
|
3822
3842
|
});
|
|
3823
3843
|
var checkConsent2 = (nextAction, context2) => {
|
|
@@ -3844,8 +3864,9 @@ var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
|
3844
3864
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
3845
3865
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
3846
3866
|
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
3847
|
-
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
3867
|
+
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2.superRefine(checkOrderPendingPoll);
|
|
3848
3868
|
var checkNextAction2 = (response, context2) => {
|
|
3869
|
+
checkOrderPendingPoll(response, context2);
|
|
3849
3870
|
if (response.next === "consent") checkConsent2(response, context2);
|
|
3850
3871
|
if (response.next === "kyc") checkKyc2(response, context2);
|
|
3851
3872
|
};
|
|
@@ -3879,7 +3900,7 @@ var $refused = import_zod3.z.union([
|
|
|
3879
3900
|
var CoinbaseRefusedSchema = $refused;
|
|
3880
3901
|
var $stepResponse3 = import_zod3.z.union([import_zod3.z.discriminatedUnion("next", [...$nextActionOptions2, $done2]), $refused]).superRefine(checkNextAction2);
|
|
3881
3902
|
var CoinbaseStepResponseSchema = $stepResponse3;
|
|
3882
|
-
var $orderResponse2 = import_zod3.z.discriminatedUnion("next", [$done2, $orderPendingNextAction2]);
|
|
3903
|
+
var $orderResponse2 = import_zod3.z.discriminatedUnion("next", [$done2, $orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
|
|
3883
3904
|
var CoinbaseOrderResponseSchema = $orderResponse2;
|
|
3884
3905
|
var CoinbaseResponseSchemaFor = {
|
|
3885
3906
|
observe: CoinbaseStepResponseSchema,
|
|
@@ -4019,7 +4040,13 @@ var kycShape = obj4({
|
|
|
4019
4040
|
});
|
|
4020
4041
|
var identifiersNextAction = obj4({ next: import_zod4.z.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
|
|
4021
4042
|
var attestationNextAction = obj4({ next: import_zod4.z.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
|
|
4022
|
-
var
|
|
4043
|
+
var identityReask = obj4({ reason: import_zod4.z.enum(["REJECTED"]).nullable() });
|
|
4044
|
+
var StripeIdentityReaskSchema = identityReask;
|
|
4045
|
+
var verifyIdentityNextAction = obj4({
|
|
4046
|
+
next: import_zod4.z.literal("verifyIdentity"),
|
|
4047
|
+
linkAuthToken: linkAuthToken.nullable(),
|
|
4048
|
+
reask: identityReask.nullable().optional()
|
|
4049
|
+
});
|
|
4023
4050
|
var waitNextAction = obj4({ next: import_zod4.z.literal("wait"), retryAfterMs });
|
|
4024
4051
|
var placeOrderNextAction = obj4({
|
|
4025
4052
|
next: import_zod4.z.literal("placeOrder"),
|
|
@@ -4034,6 +4061,7 @@ var orderPendingNextAction = obj4({
|
|
|
4034
4061
|
next: import_zod4.z.literal("orderPending"),
|
|
4035
4062
|
orderId: mintedOrderId,
|
|
4036
4063
|
retryAfterMs,
|
|
4064
|
+
poll: OrderPollSchema.optional(),
|
|
4037
4065
|
order: FiatStepResponseSchema.nullable()
|
|
4038
4066
|
});
|
|
4039
4067
|
var checkConsent3 = (nextAction, context2) => {
|
|
@@ -4078,8 +4106,9 @@ var StripeWaitNextActionSchema = waitNextAction;
|
|
|
4078
4106
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
4079
4107
|
var StripePayNextActionSchema = payNextAction;
|
|
4080
4108
|
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
4081
|
-
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
4109
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
4082
4110
|
var checkNextAction3 = (response, context2) => {
|
|
4111
|
+
checkOrderPendingPoll(response, context2);
|
|
4083
4112
|
if (response.next === "consent") checkConsent3(response, context2);
|
|
4084
4113
|
if (response.next === "kyc") checkKyc3(response, context2);
|
|
4085
4114
|
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
@@ -4119,7 +4148,7 @@ var stepResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next",
|
|
|
4119
4148
|
var StripeStepResponseSchema = stepResponse;
|
|
4120
4149
|
var checkoutResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
4121
4150
|
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
4122
|
-
var orderResponse = import_zod4.z.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
4151
|
+
var orderResponse = import_zod4.z.discriminatedUnion("next", [done, orderPendingNextAction]).superRefine(checkOrderPendingPoll);
|
|
4123
4152
|
var StripeOrderResponseSchema = orderResponse;
|
|
4124
4153
|
var StripeResponseSchemaFor = {
|
|
4125
4154
|
observe: StripeStepResponseSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tableEntry,
|
|
17
17
|
unofferedEndpoints,
|
|
18
18
|
unreachableStates
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JDI4TWPZ.mjs";
|
|
20
20
|
import {
|
|
21
21
|
MOONPAY_ENDPOINTS
|
|
22
22
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -749,6 +749,21 @@ var $pollSpec = obj({
|
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
var PollSpecSchema = $pollSpec;
|
|
752
|
+
var OrderPollSchema = obj({
|
|
753
|
+
backoffFactor: z.number().finite().min(1).max(4),
|
|
754
|
+
maxIntervalMs: z.number().int().min(MIN_INTERVAL_MS).max(6e4),
|
|
755
|
+
giveUpAfterMs: z.number().int().positive().max(60 * 60 * 1e3)
|
|
756
|
+
});
|
|
757
|
+
function checkOrderPendingPoll(response, context2) {
|
|
758
|
+
const { poll, retryAfterMs: retryAfterMs2 } = response;
|
|
759
|
+
if (response.next !== "orderPending" || poll === void 0 || retryAfterMs2 === void 0) return;
|
|
760
|
+
if (retryAfterMs2 < MIN_INTERVAL_MS) {
|
|
761
|
+
context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
|
|
762
|
+
}
|
|
763
|
+
if (poll.maxIntervalMs < retryAfterMs2) {
|
|
764
|
+
context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
|
|
765
|
+
}
|
|
766
|
+
}
|
|
752
767
|
var $reportSpec = obj({
|
|
753
768
|
endpoint: $endpoint,
|
|
754
769
|
params: $params.optional(),
|
|
@@ -2696,6 +2711,7 @@ var $orderPendingNextAction = obj2({
|
|
|
2696
2711
|
next: z2.literal("orderPending"),
|
|
2697
2712
|
orderId: $nonEmpty,
|
|
2698
2713
|
retryAfterMs: z2.number().int().positive().max(6e4),
|
|
2714
|
+
poll: OrderPollSchema.optional(),
|
|
2699
2715
|
order: FiatStepResponseSchema.nullable()
|
|
2700
2716
|
});
|
|
2701
2717
|
var checkConsent = (nextAction, context2) => {
|
|
@@ -2739,7 +2755,7 @@ var MoonPayReaskSchema = $reask;
|
|
|
2739
2755
|
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
2740
2756
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
2741
2757
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
2742
|
-
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
2758
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
2743
2759
|
var checkNextAction = (response, context2) => {
|
|
2744
2760
|
if (response.next === "consent") checkConsent(response, context2);
|
|
2745
2761
|
if (response.next === "kyc") checkKyc(response, context2);
|
|
@@ -2771,7 +2787,7 @@ var $orderRefused = obj2({
|
|
|
2771
2787
|
});
|
|
2772
2788
|
var $stepResponse2 = z2.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
2773
2789
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
2774
|
-
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
2790
|
+
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]).superRefine(checkOrderPendingPoll);
|
|
2775
2791
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
2776
2792
|
var MoonPayResponseSchemaFor = {
|
|
2777
2793
|
observe: MoonPayStepResponseSchema,
|
|
@@ -2896,6 +2912,7 @@ var $orderPendingNextAction2 = obj3({
|
|
|
2896
2912
|
next: z3.literal("orderPending"),
|
|
2897
2913
|
orderId: $nonEmpty2,
|
|
2898
2914
|
retryAfterMs: $retryAfterMs,
|
|
2915
|
+
poll: OrderPollSchema.optional(),
|
|
2899
2916
|
order: FiatStepResponseSchema.nullable()
|
|
2900
2917
|
});
|
|
2901
2918
|
var checkConsent2 = (nextAction, context2) => {
|
|
@@ -2922,8 +2939,9 @@ var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
|
2922
2939
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
2923
2940
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
2924
2941
|
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
2925
|
-
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
2942
|
+
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2.superRefine(checkOrderPendingPoll);
|
|
2926
2943
|
var checkNextAction2 = (response, context2) => {
|
|
2944
|
+
checkOrderPendingPoll(response, context2);
|
|
2927
2945
|
if (response.next === "consent") checkConsent2(response, context2);
|
|
2928
2946
|
if (response.next === "kyc") checkKyc2(response, context2);
|
|
2929
2947
|
};
|
|
@@ -2957,7 +2975,7 @@ var $refused = z3.union([
|
|
|
2957
2975
|
var CoinbaseRefusedSchema = $refused;
|
|
2958
2976
|
var $stepResponse3 = z3.union([z3.discriminatedUnion("next", [...$nextActionOptions2, $done2]), $refused]).superRefine(checkNextAction2);
|
|
2959
2977
|
var CoinbaseStepResponseSchema = $stepResponse3;
|
|
2960
|
-
var $orderResponse2 = z3.discriminatedUnion("next", [$done2, $orderPendingNextAction2]);
|
|
2978
|
+
var $orderResponse2 = z3.discriminatedUnion("next", [$done2, $orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
|
|
2961
2979
|
var CoinbaseOrderResponseSchema = $orderResponse2;
|
|
2962
2980
|
var CoinbaseResponseSchemaFor = {
|
|
2963
2981
|
observe: CoinbaseStepResponseSchema,
|
|
@@ -3092,7 +3110,13 @@ var kycShape = obj4({
|
|
|
3092
3110
|
});
|
|
3093
3111
|
var identifiersNextAction = obj4({ next: z4.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
|
|
3094
3112
|
var attestationNextAction = obj4({ next: z4.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
|
|
3095
|
-
var
|
|
3113
|
+
var identityReask = obj4({ reason: z4.enum(["REJECTED"]).nullable() });
|
|
3114
|
+
var StripeIdentityReaskSchema = identityReask;
|
|
3115
|
+
var verifyIdentityNextAction = obj4({
|
|
3116
|
+
next: z4.literal("verifyIdentity"),
|
|
3117
|
+
linkAuthToken: linkAuthToken.nullable(),
|
|
3118
|
+
reask: identityReask.nullable().optional()
|
|
3119
|
+
});
|
|
3096
3120
|
var waitNextAction = obj4({ next: z4.literal("wait"), retryAfterMs });
|
|
3097
3121
|
var placeOrderNextAction = obj4({
|
|
3098
3122
|
next: z4.literal("placeOrder"),
|
|
@@ -3107,6 +3131,7 @@ var orderPendingNextAction = obj4({
|
|
|
3107
3131
|
next: z4.literal("orderPending"),
|
|
3108
3132
|
orderId: mintedOrderId,
|
|
3109
3133
|
retryAfterMs,
|
|
3134
|
+
poll: OrderPollSchema.optional(),
|
|
3110
3135
|
order: FiatStepResponseSchema.nullable()
|
|
3111
3136
|
});
|
|
3112
3137
|
var checkConsent3 = (nextAction, context2) => {
|
|
@@ -3151,8 +3176,9 @@ var StripeWaitNextActionSchema = waitNextAction;
|
|
|
3151
3176
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
3152
3177
|
var StripePayNextActionSchema = payNextAction;
|
|
3153
3178
|
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
3154
|
-
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
3179
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
3155
3180
|
var checkNextAction3 = (response, context2) => {
|
|
3181
|
+
checkOrderPendingPoll(response, context2);
|
|
3156
3182
|
if (response.next === "consent") checkConsent3(response, context2);
|
|
3157
3183
|
if (response.next === "kyc") checkKyc3(response, context2);
|
|
3158
3184
|
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
@@ -3192,7 +3218,7 @@ var stepResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions
|
|
|
3192
3218
|
var StripeStepResponseSchema = stepResponse;
|
|
3193
3219
|
var checkoutResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
3194
3220
|
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
3195
|
-
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
3221
|
+
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]).superRefine(checkOrderPendingPoll);
|
|
3196
3222
|
var StripeOrderResponseSchema = orderResponse;
|
|
3197
3223
|
var StripeResponseSchemaFor = {
|
|
3198
3224
|
observe: StripeStepResponseSchema,
|
|
@@ -3425,6 +3451,7 @@ export {
|
|
|
3425
3451
|
MoonPayWaitNextActionSchema,
|
|
3426
3452
|
OrderAwaitingConfirmationStateSchema,
|
|
3427
3453
|
OrderCreatedStateSchema,
|
|
3454
|
+
OrderPollSchema,
|
|
3428
3455
|
OrderRefSchema,
|
|
3429
3456
|
OrderStatusSchema,
|
|
3430
3457
|
OrderSummarySchema,
|
|
@@ -3466,6 +3493,7 @@ export {
|
|
|
3466
3493
|
StripeErrorBodySchema,
|
|
3467
3494
|
StripeFaultSchema,
|
|
3468
3495
|
StripeIdentifiersNextActionSchema,
|
|
3496
|
+
StripeIdentityReaskSchema,
|
|
3469
3497
|
StripeKycNextActionSchema,
|
|
3470
3498
|
StripeKycRequestSchema,
|
|
3471
3499
|
StripeLinkAuthTokenSchema,
|
|
@@ -3513,6 +3541,7 @@ export {
|
|
|
3513
3541
|
assertLegalEmission,
|
|
3514
3542
|
assertLegalReturn,
|
|
3515
3543
|
checkLegalEmission,
|
|
3544
|
+
checkOrderPendingPoll,
|
|
3516
3545
|
endpointMatches,
|
|
3517
3546
|
fixtureMeta,
|
|
3518
3547
|
isEeaCountry,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* `./coinbase.schemas`, exported from the package root only.
|
|
14
14
|
*/
|
|
15
15
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
16
|
-
import type { DestinationAsset, FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId } from '../types';
|
|
16
|
+
import type { DestinationAsset, FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId, OrderPoll } from '../types';
|
|
17
17
|
export declare const COINBASE_ENDPOINTS: {
|
|
18
18
|
readonly next: "POST /fiat/next";
|
|
19
19
|
};
|
|
@@ -155,6 +155,7 @@ export type CoinbaseOrderPendingNextAction = {
|
|
|
155
155
|
next: 'orderPending';
|
|
156
156
|
orderId: string;
|
|
157
157
|
retryAfterMs: number;
|
|
158
|
+
poll?: OrderPoll;
|
|
158
159
|
order: FiatStepResponse | null;
|
|
159
160
|
};
|
|
160
161
|
export type CoinbaseRequest = CoinbaseRequestContext & (CoinbaseObserveRequest | CoinbaseConsentRequest | CoinbaseSessionRequest | CoinbaseOtpRequest | CoinbaseKycRequest | CoinbasePlaceOrderRequest | CoinbaseOrderRequest);
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import type { FiatCurrencyCode } from '../codes';
|
|
28
28
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
29
|
-
import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport } from '../types';
|
|
29
|
+
import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport, OrderPoll } from '../types';
|
|
30
30
|
export declare const MOONPAY_ENDPOINTS: {
|
|
31
31
|
readonly next: "POST /fiat/next";
|
|
32
32
|
};
|
|
@@ -294,6 +294,7 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
294
294
|
next: 'orderPending';
|
|
295
295
|
orderId: string;
|
|
296
296
|
retryAfterMs: number;
|
|
297
|
+
poll?: OrderPoll;
|
|
297
298
|
order: FiatStepResponse | null;
|
|
298
299
|
};
|
|
299
300
|
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { CountryCode } from '../codes';
|
|
16
16
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
17
|
-
import type { FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId } from '../types';
|
|
17
|
+
import type { FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId, OrderPoll } from '../types';
|
|
18
18
|
export declare const STRIPE_ENDPOINTS: {
|
|
19
19
|
readonly next: "POST /fiat/next";
|
|
20
20
|
};
|
|
@@ -145,10 +145,19 @@ export type StripeAttestationNextAction = {
|
|
|
145
145
|
next: 'attestation';
|
|
146
146
|
linkAuthToken: StripeLinkAuthToken | null;
|
|
147
147
|
};
|
|
148
|
-
/**
|
|
148
|
+
/** Why Stripe's ID check is asked again. `REJECTED`: Stripe did not accept the ID the buyer gave. */
|
|
149
|
+
export type StripeIdentityReask = {
|
|
150
|
+
reason: StripeReaskReason | null;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Sign in with `linkAuthToken`, run the SDK's `verifyIdentity`, then send `observe`. `reask` is set when the buyer
|
|
154
|
+
* already gave an ID that Stripe did not accept; an older backend leaves it out. Without it, a `verifyIdentity` right
|
|
155
|
+
* after the buyer finished the check means Stripe is still reviewing that ID: Stripe shows no document until it decides.
|
|
156
|
+
*/
|
|
149
157
|
export type StripeVerifyIdentityNextAction = {
|
|
150
158
|
next: 'verifyIdentity';
|
|
151
159
|
linkAuthToken: StripeLinkAuthToken | null;
|
|
160
|
+
reask?: StripeIdentityReask | null;
|
|
152
161
|
};
|
|
153
162
|
/** Stripe is reviewing, or a sign-in is settling. No request of its own: send `observe` after the delay. */
|
|
154
163
|
export type StripeWaitNextAction = {
|
|
@@ -230,6 +239,7 @@ export type StripeOrderPendingNextAction = {
|
|
|
230
239
|
next: 'orderPending';
|
|
231
240
|
orderId: string;
|
|
232
241
|
retryAfterMs: number;
|
|
242
|
+
poll?: OrderPoll;
|
|
233
243
|
order: FiatStepResponse | null;
|
|
234
244
|
};
|
|
235
245
|
export type StripeRequest = StripeRequestContext & (StripeObserveRequest | StripeConsentRequest | StripeSessionRequest | StripeAuthorizeRequest | StripeKycRequest | StripePlaceOrderRequest | StripeCheckoutRequest | StripeOrderRequest);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* exported from the package root, never from `./stripe`, so the production entry stays free of zod.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import type { StripeAttestationNextAction, StripeAuthorizeNextAction, StripeAuthorizeRequest, StripeCheckout, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSecretNextAction, StripeConsentNextAction, StripeConsentRequest, StripeDone, StripeErrorBody, StripeFault, StripeIdentifiersNextAction, StripeKycNextAction, StripeKycRequest, StripeLinkAuthToken, StripeNextAction, StripeNextRequest, StripeObserveRequest, StripeOrderPendingNextAction, StripeOrderRequest, StripeOrderResponse, StripePayNextAction, StripePaySheet, StripePlaceOrderNextAction, StripePlaceOrderRequest, StripePrice, StripeReask, StripeRefused, StripeRequest, StripeRequestContext, StripeResponseFor, StripeSessionNextAction, StripeSessionRequest, StripeStepResponse, StripeVerifyIdentityNextAction, StripeWaitNextAction } from './stripe';
|
|
6
|
+
import type { StripeAttestationNextAction, StripeAuthorizeNextAction, StripeAuthorizeRequest, StripeCheckout, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSecretNextAction, StripeConsentNextAction, StripeConsentRequest, StripeDone, StripeErrorBody, StripeFault, StripeIdentifiersNextAction, StripeKycNextAction, StripeKycRequest, StripeLinkAuthToken, StripeNextAction, StripeNextRequest, StripeObserveRequest, StripeOrderPendingNextAction, StripeOrderRequest, StripeOrderResponse, StripePayNextAction, StripePaySheet, StripePlaceOrderNextAction, StripePlaceOrderRequest, StripePrice, StripeReask, StripeIdentityReask, StripeRefused, StripeRequest, StripeRequestContext, StripeResponseFor, StripeSessionNextAction, StripeSessionRequest, StripeStepResponse, StripeVerifyIdentityNextAction, StripeWaitNextAction } from './stripe';
|
|
7
7
|
export declare const StripeCheckoutSchema: z.ZodType<StripeCheckout>;
|
|
8
8
|
export declare const StripeRequestContextSchema: z.ZodType<StripeRequestContext>;
|
|
9
9
|
export declare const StripeObserveRequestSchema: z.ZodType<StripeRequestContext & StripeObserveRequest>;
|
|
@@ -20,6 +20,7 @@ export declare const StripePriceSchema: z.ZodType<StripePrice>;
|
|
|
20
20
|
export declare const StripePaySheetSchema: z.ZodType<StripePaySheet>;
|
|
21
21
|
export declare const StripeLinkAuthTokenSchema: z.ZodType<StripeLinkAuthToken>;
|
|
22
22
|
export declare const StripeReaskSchema: z.ZodType<StripeReask>;
|
|
23
|
+
export declare const StripeIdentityReaskSchema: z.ZodType<StripeIdentityReask>;
|
|
23
24
|
export declare const StripeConsentNextActionSchema: z.ZodType<StripeConsentNextAction>;
|
|
24
25
|
export declare const StripeSessionNextActionSchema: z.ZodType<StripeSessionNextAction>;
|
|
25
26
|
export declare const StripeAuthorizeNextActionSchema: z.ZodType<StripeAuthorizeNextAction>;
|
package/dist/schemas.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { UsStateCode } from './codes';
|
|
31
|
-
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
|
|
31
|
+
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderPoll, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
|
|
32
32
|
import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
|
|
33
33
|
import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
|
|
34
34
|
export declare const JsonSchema: z.ZodType<JsonValue>;
|
|
@@ -81,6 +81,17 @@ export declare const looksLikeFieldSpec: (value: unknown) => boolean;
|
|
|
81
81
|
export declare const TransitionParamsSchema: z.ZodType<TransitionParams>;
|
|
82
82
|
export declare const TransitionInputsSchema: z.ZodType<TransitionInputs>;
|
|
83
83
|
export declare const PollSpecSchema: z.ZodType<PollSpec>;
|
|
84
|
+
/** A `/fiat/next` provider's order poll on `orderPending`; see {@link OrderPoll}. */
|
|
85
|
+
export declare const OrderPollSchema: z.ZodType<OrderPoll>;
|
|
86
|
+
/**
|
|
87
|
+
* `orderPending`'s cross-field rules, as {@link PollSpec}'s: with a `poll`, `retryAfterMs` is at least
|
|
88
|
+
* 500 and `maxIntervalMs` at least `retryAfterMs`, so no wait drops below the first one.
|
|
89
|
+
*/
|
|
90
|
+
export declare function checkOrderPendingPoll(response: {
|
|
91
|
+
next: string;
|
|
92
|
+
retryAfterMs?: number;
|
|
93
|
+
poll?: OrderPoll;
|
|
94
|
+
}, context: z.RefinementCtx): void;
|
|
84
95
|
export declare const ReportSpecSchema: z.ZodType<ReportSpec>;
|
|
85
96
|
export declare const KycSdkResultReportSchema: z.ZodType<KycSdkResultReport>;
|
|
86
97
|
export declare const TransitionSchema: z.ZodType<Transition>;
|
package/dist/table.js
CHANGED
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -800,6 +800,20 @@ type FiatStepResponseBase = {
|
|
|
800
800
|
*/
|
|
801
801
|
refreshLimits?: true;
|
|
802
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* How the client re-sends `order` while a `/fiat/next` provider answers `orderPending`: wait the
|
|
805
|
+
* answer's `retryAfterMs`, grow each later wait by `backoffFactor` up to `maxIntervalMs`, and stop
|
|
806
|
+
* reading once the waits add up to `giveUpAfterMs`. The window starts at the first `orderPending`
|
|
807
|
+
* for that `orderId`; a later answer does not restart it. Each provider's backend names its own.
|
|
808
|
+
* Bounds follow {@link PollSpec}: `backoffFactor` `1 … 4`; `maxIntervalMs` an integer `500 … 60000`
|
|
809
|
+
* and at least the answer's `retryAfterMs`, which is then at least 500; `giveUpAfterMs` an integer
|
|
810
|
+
* `1 … 3600000`.
|
|
811
|
+
*/
|
|
812
|
+
export type OrderPoll = {
|
|
813
|
+
backoffFactor: number;
|
|
814
|
+
maxIntervalMs: number;
|
|
815
|
+
giveUpAfterMs: number;
|
|
816
|
+
};
|
|
803
817
|
/**
|
|
804
818
|
* Provider is absent only when routing ended before a provider could be selected. A BLOCKED response
|
|
805
819
|
* may still name a provider for compatibility with provider-specific terminal decisions. `FUN_AUTH`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "Published conformance contract for Fun's headless fiat onramp: FlowState/Transition types, zod schemas, the transition table as data, recorded fixtures, assertion helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|