@fun-xyz/fiat-contract 0.47.0 → 0.49.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-JMJ45E27.mjs → chunk-6NZFTT7Q.mjs} +1 -1
- package/dist/chunk-KLAXY6H7.mjs +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +311 -43
- package/dist/index.mjs +312 -46
- package/dist/providers/coinbase.d.ts +6 -1
- package/dist/providers/stripe.d.ts +283 -0
- package/dist/providers/stripe.js +28 -0
- package/dist/providers/stripe.mjs +6 -0
- package/dist/providers/stripe.schemas.d.ts +44 -0
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/package.json +11 -1
- package/stripe.d.ts +1 -0
- package/stripe.js +2 -0
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ROUTING_ENDPOINTS
|
|
3
|
+
} from "./chunk-2NZSOZHV.mjs";
|
|
1
4
|
import "./chunk-WBQAMGXK.mjs";
|
|
2
5
|
import {
|
|
3
6
|
DOCUMENTED_ENDPOINTS,
|
|
@@ -13,7 +16,7 @@ import {
|
|
|
13
16
|
tableEntry,
|
|
14
17
|
unofferedEndpoints,
|
|
15
18
|
unreachableStates
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6NZFTT7Q.mjs";
|
|
17
20
|
import {
|
|
18
21
|
MOONPAY_ENDPOINTS
|
|
19
22
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -22,6 +25,9 @@ import {
|
|
|
22
25
|
COINBASE_ENDPOINTS,
|
|
23
26
|
COINBASE_TERMS
|
|
24
27
|
} from "./chunk-SFR4SCDU.mjs";
|
|
28
|
+
import {
|
|
29
|
+
STRIPE_ENDPOINTS
|
|
30
|
+
} from "./chunk-KLAXY6H7.mjs";
|
|
25
31
|
import {
|
|
26
32
|
FIAT_TERMS_ENDPOINT,
|
|
27
33
|
FUN_KYC_CONSENT_DOCUMENTS,
|
|
@@ -29,9 +35,6 @@ import {
|
|
|
29
35
|
PROVIDER_KYC_DOCUMENTS,
|
|
30
36
|
PUBLISHED_TERMS_DOCUMENTS
|
|
31
37
|
} from "./chunk-TIQALG7X.mjs";
|
|
32
|
-
import {
|
|
33
|
-
ROUTING_ENDPOINTS
|
|
34
|
-
} from "./chunk-2NZSOZHV.mjs";
|
|
35
38
|
|
|
36
39
|
// src/codes.ts
|
|
37
40
|
var US_STATE_CODES = [
|
|
@@ -994,7 +997,7 @@ var $routingTableRequest = obj({
|
|
|
994
997
|
providers: $routingTableProviderInputs.optional(),
|
|
995
998
|
destinationAsset: $destinationAsset.optional(),
|
|
996
999
|
depositAddress: $nonBlank.optional()
|
|
997
|
-
}).refine((
|
|
1000
|
+
}).refine((request2) => hasUsRegion(request2.country, request2.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
998
1001
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
999
1002
|
var $routingTableProvider = obj({
|
|
1000
1003
|
provider: $routingProvider,
|
|
@@ -1052,9 +1055,9 @@ var $routingQuoteRequest = z.union([
|
|
|
1052
1055
|
}),
|
|
1053
1056
|
obj({ ...$routingQuoteTermsShape, provider: $routingProvider })
|
|
1054
1057
|
]).refine(
|
|
1055
|
-
(
|
|
1056
|
-
const allowed =
|
|
1057
|
-
const selected = "providers" in
|
|
1058
|
+
(request2) => {
|
|
1059
|
+
const allowed = request2.routingOverrides?.providers;
|
|
1060
|
+
const selected = "providers" in request2 ? request2.providers : [request2.provider];
|
|
1058
1061
|
return allowed === void 0 || selected.every((provider) => allowed.includes(provider));
|
|
1059
1062
|
},
|
|
1060
1063
|
{ message: "requested providers must be allowed by routingOverrides", path: ["routingOverrides"] }
|
|
@@ -2505,14 +2508,14 @@ function walkTable(fn) {
|
|
|
2505
2508
|
function assertFixture(id) {
|
|
2506
2509
|
const meta = fixtureMeta(id);
|
|
2507
2510
|
const json = loadFixture(id);
|
|
2508
|
-
const
|
|
2509
|
-
if (stateKey(
|
|
2511
|
+
const stepResponse2 = assertFiatStepResponse(json);
|
|
2512
|
+
if (stateKey(stepResponse2.state) !== meta.stateKey) {
|
|
2510
2513
|
throw new ContractViolation(
|
|
2511
|
-
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(
|
|
2514
|
+
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse2.state)}`
|
|
2512
2515
|
);
|
|
2513
2516
|
}
|
|
2514
|
-
assertLegalEmission(
|
|
2515
|
-
return { meta, stepResponse };
|
|
2517
|
+
assertLegalEmission(stepResponse2.state, stepResponse2.transitions);
|
|
2518
|
+
return { meta, stepResponse: stepResponse2 };
|
|
2516
2519
|
}
|
|
2517
2520
|
function assertAllFixtures() {
|
|
2518
2521
|
return FIXTURES.map((meta) => assertFixture(meta.id));
|
|
@@ -2819,7 +2822,12 @@ var $nextRequest3 = z3.union([
|
|
|
2819
2822
|
obj3({ ...envelope, ...orderFields })
|
|
2820
2823
|
]);
|
|
2821
2824
|
var CoinbaseNextRequestSchema = $nextRequest3;
|
|
2822
|
-
var $price = obj3({
|
|
2825
|
+
var $price = obj3({
|
|
2826
|
+
total: FiatAmountSchema,
|
|
2827
|
+
fees: z3.array(FeeLineSchema),
|
|
2828
|
+
cryptoAmount: $nonEmpty2,
|
|
2829
|
+
feeSubsidy: FiatAmountSchema.optional()
|
|
2830
|
+
});
|
|
2823
2831
|
var CoinbasePriceSchema = $price;
|
|
2824
2832
|
var $reask2 = obj3({
|
|
2825
2833
|
requirements: z3.array(KycFieldIdSchema).min(1).refine(hasUniqueIds3, "requirements must be unique"),
|
|
@@ -2941,31 +2949,253 @@ var $errorBody2 = obj3({
|
|
|
2941
2949
|
});
|
|
2942
2950
|
var CoinbaseErrorBodySchema = $errorBody2;
|
|
2943
2951
|
|
|
2944
|
-
// src/providers/
|
|
2952
|
+
// src/providers/stripe.schemas.ts
|
|
2945
2953
|
import { z as z4 } from "zod";
|
|
2946
|
-
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
2947
2954
|
var obj4 = (shape) => z4.object(shape).strict();
|
|
2948
2955
|
var nonEmpty = z4.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2956
|
+
var hasUniqueIds4 = (ids) => new Set(ids).size === ids.length;
|
|
2957
|
+
var retryAfterMs = z4.number().int().positive().max(6e4);
|
|
2958
|
+
var usdAmount = z4.string().regex(/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/, "must be a USD amount in cents").refine((amount) => Number(amount) > 0, "must be positive");
|
|
2959
|
+
var kycValues = z4.record(KycFieldIdSchema, z4.string());
|
|
2960
|
+
var instant = z4.string().datetime({ offset: true });
|
|
2961
|
+
var checkout = obj4({
|
|
2962
|
+
amount: obj4({ currency: z4.literal("USD"), amount: usdAmount }),
|
|
2963
|
+
destination: obj4({ asset: nonEmpty, network: nonEmpty }),
|
|
2964
|
+
paymentMethod: z4.literal("apple_pay")
|
|
2965
|
+
});
|
|
2966
|
+
var StripeCheckoutSchema = checkout;
|
|
2967
|
+
var contextFields2 = { checkout };
|
|
2968
|
+
var requestContext = obj4(contextFields2);
|
|
2969
|
+
var StripeRequestContextSchema = requestContext;
|
|
2970
|
+
var mintedOrderId = z4.string().regex(/^sto_[A-Za-z0-9_-]{22}$/, "must be an order id a placeOrder answer minted");
|
|
2971
|
+
var heldOrder = { orderId: mintedOrderId.optional() };
|
|
2972
|
+
var observeFields2 = { action: z4.literal("observe"), ...heldOrder };
|
|
2973
|
+
var consentFields2 = {
|
|
2974
|
+
action: z4.literal("consent"),
|
|
2975
|
+
acceptances: z4.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds4(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once"),
|
|
2976
|
+
...heldOrder
|
|
2977
|
+
};
|
|
2978
|
+
var sessionFields = { action: z4.literal("session"), ...heldOrder };
|
|
2979
|
+
var authorizeConsentedFields = {
|
|
2980
|
+
action: z4.literal("authorize"),
|
|
2981
|
+
linkAuthIntentId: nonEmpty,
|
|
2982
|
+
outcome: z4.literal("Consented"),
|
|
2983
|
+
customerId: nonEmpty,
|
|
2984
|
+
...heldOrder
|
|
2985
|
+
};
|
|
2986
|
+
var authorizeDeclinedFields = { action: z4.literal("authorize"), linkAuthIntentId: nonEmpty, outcome: z4.enum(["Denied", "Cancelled"]), ...heldOrder };
|
|
2987
|
+
var correctionRound = z4.number().int().nonnegative();
|
|
2988
|
+
var kycFields2 = { action: z4.literal("kyc"), correctionRound, values: kycValues, ...heldOrder };
|
|
2989
|
+
var placeOrderFields2 = { action: z4.literal("placeOrder"), orderId: mintedOrderId, cryptoPaymentToken: nonEmpty };
|
|
2990
|
+
var checkoutFields = { action: z4.literal("checkout"), orderId: mintedOrderId, callbackId: z4.string().regex(/^[A-Za-z0-9_-]{1,200}$/) };
|
|
2991
|
+
var orderFields2 = { action: z4.literal("order"), orderId: mintedOrderId };
|
|
2992
|
+
var observeRequest = obj4({ ...contextFields2, ...observeFields2 });
|
|
2993
|
+
var consentRequest = obj4({ ...contextFields2, ...consentFields2 });
|
|
2994
|
+
var sessionRequest = obj4({ ...contextFields2, ...sessionFields });
|
|
2995
|
+
var authorizeRequest = z4.union([obj4({ ...contextFields2, ...authorizeConsentedFields }), obj4({ ...contextFields2, ...authorizeDeclinedFields })]);
|
|
2996
|
+
var kycRequest = obj4({ ...contextFields2, ...kycFields2 });
|
|
2997
|
+
var placeOrderRequest = obj4({ ...contextFields2, ...placeOrderFields2 });
|
|
2998
|
+
var checkoutRequest = obj4({ ...contextFields2, ...checkoutFields });
|
|
2999
|
+
var orderRequest = obj4({ ...contextFields2, ...orderFields2 });
|
|
3000
|
+
var StripeObserveRequestSchema = observeRequest;
|
|
3001
|
+
var StripeConsentRequestSchema = consentRequest;
|
|
3002
|
+
var StripeSessionRequestSchema = sessionRequest;
|
|
3003
|
+
var StripeAuthorizeRequestSchema = authorizeRequest;
|
|
3004
|
+
var StripeKycRequestSchema = kycRequest;
|
|
3005
|
+
var StripePlaceOrderRequestSchema = placeOrderRequest;
|
|
3006
|
+
var StripeCheckoutRequestSchema = checkoutRequest;
|
|
3007
|
+
var StripeOrderRequestSchema = orderRequest;
|
|
3008
|
+
var request = z4.union([observeRequest, consentRequest, sessionRequest, authorizeRequest, kycRequest, placeOrderRequest, checkoutRequest, orderRequest]);
|
|
3009
|
+
var StripeRequestSchema = request;
|
|
3010
|
+
var envelope2 = { provider: z4.literal("STRIPE"), geo: FiatGeoSchema, ...contextFields2 };
|
|
3011
|
+
var nextRequest = z4.union([
|
|
3012
|
+
obj4({ ...envelope2, ...observeFields2 }),
|
|
3013
|
+
obj4({ ...envelope2, ...consentFields2 }),
|
|
3014
|
+
obj4({ ...envelope2, ...sessionFields }),
|
|
3015
|
+
obj4({ ...envelope2, ...authorizeConsentedFields }),
|
|
3016
|
+
obj4({ ...envelope2, ...authorizeDeclinedFields }),
|
|
3017
|
+
obj4({ ...envelope2, ...kycFields2 }),
|
|
3018
|
+
obj4({ ...envelope2, ...placeOrderFields2 }),
|
|
3019
|
+
obj4({ ...envelope2, ...checkoutFields }),
|
|
3020
|
+
obj4({ ...envelope2, ...orderFields2 })
|
|
3021
|
+
]);
|
|
3022
|
+
var StripeNextRequestSchema = nextRequest;
|
|
3023
|
+
var price = obj4({ total: FiatAmountSchema, fees: z4.array(FeeLineSchema), cryptoAmount: nonEmpty });
|
|
3024
|
+
var StripePriceSchema = price;
|
|
3025
|
+
var paySheet = obj4({
|
|
3026
|
+
destinationCurrency: nonEmpty,
|
|
3027
|
+
destinationNetwork: nonEmpty,
|
|
3028
|
+
walletAddress: nonEmpty,
|
|
3029
|
+
merchantCountryCode: z4.literal("US"),
|
|
3030
|
+
currencyCode: z4.literal("USD"),
|
|
3031
|
+
amount: usdAmount,
|
|
3032
|
+
label: nonEmpty
|
|
3033
|
+
});
|
|
3034
|
+
var StripePaySheetSchema = paySheet;
|
|
3035
|
+
var linkAuthToken = obj4({ clientSecret: nonEmpty, expiresAt: instant });
|
|
3036
|
+
var StripeLinkAuthTokenSchema = linkAuthToken;
|
|
3037
|
+
var reask = obj4({
|
|
3038
|
+
requirements: z4.array(KycFieldIdSchema).min(1).refine(hasUniqueIds4, "requirements must be unique"),
|
|
3039
|
+
reason: z4.enum(["REJECTED"]).nullable()
|
|
3040
|
+
});
|
|
3041
|
+
var StripeReaskSchema = reask;
|
|
3042
|
+
var consentShape = obj4({ next: z4.literal("consent"), documents: z4.array(TermsDocumentSchema).min(1) });
|
|
3043
|
+
var sessionNextAction = obj4({ next: z4.literal("session") });
|
|
3044
|
+
var authorizeNextAction = obj4({ next: z4.literal("authorize"), linkAuthIntentId: nonEmpty, expiresAt: instant });
|
|
3045
|
+
var kycShape = obj4({
|
|
3046
|
+
next: z4.literal("kyc"),
|
|
3047
|
+
round: z4.enum(["ACCOUNT", "IDENTITY"]),
|
|
3048
|
+
tier: z4.enum(["l0", "l1"]),
|
|
3049
|
+
correctionRound,
|
|
3050
|
+
fields: z4.array(FormFieldSchema),
|
|
3051
|
+
heldValues: kycValues,
|
|
3052
|
+
verifiedEmail: nonEmpty.nullable(),
|
|
3053
|
+
linkAuthToken: linkAuthToken.nullable(),
|
|
3054
|
+
fieldErrors: z4.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
|
|
3055
|
+
reask: reask.nullable()
|
|
3056
|
+
});
|
|
3057
|
+
var verifyIdentityNextAction = obj4({ next: z4.literal("verifyIdentity"), linkAuthToken: linkAuthToken.nullable() });
|
|
3058
|
+
var waitNextAction = obj4({ next: z4.literal("wait"), retryAfterMs });
|
|
3059
|
+
var placeOrderNextAction = obj4({
|
|
3060
|
+
next: z4.literal("placeOrder"),
|
|
3061
|
+
orderId: mintedOrderId,
|
|
3062
|
+
price,
|
|
3063
|
+
paySheet,
|
|
3064
|
+
linkAuthToken: linkAuthToken.nullable()
|
|
3065
|
+
});
|
|
3066
|
+
var payNextAction = obj4({ next: z4.literal("pay"), orderId: mintedOrderId, sessionId: nonEmpty, linkAuthToken: linkAuthToken.nullable() });
|
|
3067
|
+
var checkoutSecretNextAction = obj4({ next: z4.literal("checkoutSecret"), clientSecret: nonEmpty });
|
|
3068
|
+
var orderPendingNextAction = obj4({
|
|
3069
|
+
next: z4.literal("orderPending"),
|
|
3070
|
+
orderId: mintedOrderId,
|
|
3071
|
+
retryAfterMs,
|
|
3072
|
+
order: FiatStepResponseSchema.nullable()
|
|
3073
|
+
});
|
|
3074
|
+
var checkConsent3 = (nextAction, context2) => {
|
|
3075
|
+
if (!hasUniqueIds4(nextAction.documents.map((document) => document.id))) {
|
|
3076
|
+
context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
3077
|
+
}
|
|
3078
|
+
};
|
|
3079
|
+
var checkKyc3 = (nextAction, context2) => {
|
|
3080
|
+
const fieldIds = nextAction.fields.map((field) => field.id);
|
|
3081
|
+
if (!hasUniqueIds4(fieldIds)) {
|
|
3082
|
+
context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
|
|
3083
|
+
}
|
|
3084
|
+
if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
|
|
3085
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
|
|
3086
|
+
}
|
|
3087
|
+
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
3088
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
3089
|
+
}
|
|
3090
|
+
if (nextAction.round === "ACCOUNT" !== (nextAction.verifiedEmail !== null)) {
|
|
3091
|
+
context2.addIssue({ code: "custom", path: ["verifiedEmail"], message: "only the account round carries the verified email" });
|
|
3092
|
+
}
|
|
3093
|
+
};
|
|
3094
|
+
var checkPlaceOrder = (nextAction, context2) => {
|
|
3095
|
+
if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
|
|
3096
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "amount"], message: "the sheet charges the price shown" });
|
|
3097
|
+
}
|
|
3098
|
+
};
|
|
3099
|
+
var StripeConsentNextActionSchema = consentShape.superRefine(checkConsent3);
|
|
3100
|
+
var StripeSessionNextActionSchema = sessionNextAction;
|
|
3101
|
+
var StripeAuthorizeNextActionSchema = authorizeNextAction;
|
|
3102
|
+
var StripeKycNextActionSchema = kycShape.superRefine(checkKyc3);
|
|
3103
|
+
var StripeVerifyIdentityNextActionSchema = verifyIdentityNextAction;
|
|
3104
|
+
var StripeWaitNextActionSchema = waitNextAction;
|
|
3105
|
+
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
3106
|
+
var StripePayNextActionSchema = payNextAction;
|
|
3107
|
+
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
3108
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
3109
|
+
var checkNextAction3 = (response, context2) => {
|
|
3110
|
+
if (response.next === "consent") checkConsent3(response, context2);
|
|
3111
|
+
if (response.next === "kyc") checkKyc3(response, context2);
|
|
3112
|
+
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
3113
|
+
};
|
|
3114
|
+
var nextActionOptions = [
|
|
3115
|
+
consentShape,
|
|
3116
|
+
sessionNextAction,
|
|
3117
|
+
authorizeNextAction,
|
|
3118
|
+
kycShape,
|
|
3119
|
+
verifyIdentityNextAction,
|
|
3120
|
+
waitNextAction,
|
|
3121
|
+
placeOrderNextAction,
|
|
3122
|
+
payNextAction,
|
|
3123
|
+
orderPendingNextAction
|
|
3124
|
+
];
|
|
3125
|
+
var anyNextAction = z4.discriminatedUnion("next", [...nextActionOptions]).superRefine(checkNextAction3);
|
|
3126
|
+
var StripeNextActionSchema = anyNextAction;
|
|
3127
|
+
var done = obj4({ next: z4.literal("done"), order: FiatStepResponseSchema });
|
|
3128
|
+
var StripeDoneSchema = done;
|
|
3129
|
+
var refused = z4.union([
|
|
3130
|
+
obj4({
|
|
3131
|
+
next: z4.literal("refused"),
|
|
3132
|
+
reason: z4.enum(["NOT_ELIGIBLE", "KYC_REJECTED", "FINAL_REJECTION", "TOTAL_MISMATCH"]),
|
|
3133
|
+
recovery: z4.enum(["REQUOTE", "NONE"])
|
|
3134
|
+
}),
|
|
3135
|
+
obj4({
|
|
3136
|
+
next: z4.literal("refused"),
|
|
3137
|
+
reason: z4.literal("LIMITS_EXCEEDED"),
|
|
3138
|
+
recovery: z4.literal("REQUOTE"),
|
|
3139
|
+
maxAmount: FiatAmountSchema.nullable()
|
|
3140
|
+
})
|
|
3141
|
+
]);
|
|
3142
|
+
var StripeRefusedSchema = refused;
|
|
3143
|
+
var stepResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done]), refused]).superRefine(checkNextAction3);
|
|
3144
|
+
var StripeStepResponseSchema = stepResponse;
|
|
3145
|
+
var checkoutResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
3146
|
+
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
3147
|
+
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
3148
|
+
var StripeOrderResponseSchema = orderResponse;
|
|
3149
|
+
var StripeResponseSchemaFor = {
|
|
3150
|
+
observe: StripeStepResponseSchema,
|
|
3151
|
+
consent: StripeStepResponseSchema,
|
|
3152
|
+
session: StripeStepResponseSchema,
|
|
3153
|
+
authorize: StripeStepResponseSchema,
|
|
3154
|
+
kyc: StripeStepResponseSchema,
|
|
3155
|
+
placeOrder: StripeStepResponseSchema,
|
|
3156
|
+
checkout: StripeCheckoutResponseSchema,
|
|
3157
|
+
order: StripeOrderResponseSchema
|
|
3158
|
+
};
|
|
3159
|
+
var faultFields2 = {
|
|
3160
|
+
reason: z4.enum(["SESSION_BUDGET_SPENT", "RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
|
|
3161
|
+
recovery: z4.enum(["RETRY", "REQUOTE", "NONE"])
|
|
3162
|
+
};
|
|
3163
|
+
var fault = obj4(faultFields2);
|
|
3164
|
+
var StripeFaultSchema = fault;
|
|
3165
|
+
var errorBody = obj4({
|
|
3166
|
+
...faultFields2,
|
|
3167
|
+
errorCode: nonEmpty,
|
|
3168
|
+
errorMsg: z4.string(),
|
|
3169
|
+
reqId: z4.string().optional(),
|
|
3170
|
+
retryAfterSeconds: z4.number().int().nonnegative().optional()
|
|
3171
|
+
});
|
|
3172
|
+
var StripeErrorBodySchema = errorBody;
|
|
3173
|
+
|
|
3174
|
+
// src/providers/moonpay-guest.schemas.ts
|
|
3175
|
+
import { z as z5 } from "zod";
|
|
3176
|
+
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
3177
|
+
var obj5 = (shape) => z5.object(shape).strict();
|
|
3178
|
+
var nonEmpty2 = z5.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2949
3179
|
var actions = [
|
|
2950
|
-
{ action:
|
|
2951
|
-
{ action:
|
|
2952
|
-
{ action:
|
|
2953
|
-
{ action:
|
|
2954
|
-
{ action:
|
|
2955
|
-
{ action:
|
|
2956
|
-
{ action:
|
|
2957
|
-
{ action:
|
|
3180
|
+
{ action: z5.literal("observe") },
|
|
3181
|
+
{ action: z5.literal("session") },
|
|
3182
|
+
{ action: z5.literal("consent"), acceptances: z5.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
|
|
3183
|
+
{ action: z5.literal("order"), orderId: nonEmpty2, quotedAmount: FiatAmountSchema, transactionId: nonEmpty2.optional() },
|
|
3184
|
+
{ action: z5.literal("phone"), phoneNumber: z5.string().regex(/^\+[1-9]\d{1,14}$/) },
|
|
3185
|
+
{ action: z5.literal("phone"), resend: nonEmpty2 },
|
|
3186
|
+
{ action: z5.literal("phoneCode"), verificationRef: nonEmpty2, otpCode: z5.string().regex(/^\d{6}$/) },
|
|
3187
|
+
{ action: z5.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
|
|
2958
3188
|
];
|
|
2959
|
-
var MoonPayGuestObserveRequestSchema =
|
|
2960
|
-
var MoonPayGuestSessionRequestSchema =
|
|
2961
|
-
var MoonPayGuestConsentRequestSchema =
|
|
2962
|
-
var MoonPayGuestOrderRequestSchema =
|
|
2963
|
-
var MoonPayGuestPhoneNumberRequestSchema =
|
|
2964
|
-
var MoonPayGuestPhoneResendRequestSchema =
|
|
2965
|
-
var MoonPayGuestPhoneCodeRequestSchema =
|
|
2966
|
-
var MoonPayGuestDeclineRequestSchema =
|
|
2967
|
-
var MoonPayGuestPhoneRequestSchema =
|
|
2968
|
-
var MoonPayGuestRequestSchema =
|
|
3189
|
+
var MoonPayGuestObserveRequestSchema = obj5({ ...context, ...actions[0] });
|
|
3190
|
+
var MoonPayGuestSessionRequestSchema = obj5({ ...context, ...actions[1] });
|
|
3191
|
+
var MoonPayGuestConsentRequestSchema = obj5({ ...context, ...actions[2] });
|
|
3192
|
+
var MoonPayGuestOrderRequestSchema = obj5({ ...context, ...actions[3] });
|
|
3193
|
+
var MoonPayGuestPhoneNumberRequestSchema = obj5({ ...context, ...actions[4] });
|
|
3194
|
+
var MoonPayGuestPhoneResendRequestSchema = obj5({ ...context, ...actions[5] });
|
|
3195
|
+
var MoonPayGuestPhoneCodeRequestSchema = obj5({ ...context, ...actions[6] });
|
|
3196
|
+
var MoonPayGuestDeclineRequestSchema = obj5({ ...context, ...actions[7] });
|
|
3197
|
+
var MoonPayGuestPhoneRequestSchema = z5.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
|
|
3198
|
+
var MoonPayGuestRequestSchema = z5.union([
|
|
2969
3199
|
MoonPayGuestObserveRequestSchema,
|
|
2970
3200
|
MoonPayGuestSessionRequestSchema,
|
|
2971
3201
|
MoonPayGuestConsentRequestSchema,
|
|
@@ -2975,25 +3205,25 @@ var MoonPayGuestRequestSchema = z4.union([
|
|
|
2975
3205
|
MoonPayGuestPhoneCodeRequestSchema,
|
|
2976
3206
|
MoonPayGuestDeclineRequestSchema
|
|
2977
3207
|
]);
|
|
2978
|
-
var MoonPayGuestNextRequestSchema =
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3208
|
+
var MoonPayGuestNextRequestSchema = z5.union([
|
|
3209
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[0] }),
|
|
3210
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[1] }),
|
|
3211
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[2] }),
|
|
3212
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[3] }),
|
|
3213
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[4] }),
|
|
3214
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[5] }),
|
|
3215
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[6] }),
|
|
3216
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[7] })
|
|
2987
3217
|
]);
|
|
2988
|
-
var MoonPayGuestStepResponseSchema =
|
|
3218
|
+
var MoonPayGuestStepResponseSchema = z5.union([
|
|
2989
3219
|
MoonPayConsentNextActionSchema,
|
|
2990
3220
|
MoonPaySessionNextActionSchema,
|
|
2991
3221
|
MoonPayPhoneNextActionSchema,
|
|
2992
3222
|
MoonPayPhoneCodeNextActionSchema,
|
|
2993
3223
|
MoonPayPayNextActionSchema,
|
|
2994
|
-
|
|
3224
|
+
obj5({ next: z5.literal("refused"), reason: z5.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: z5.enum(["REQUOTE", "NONE"]) })
|
|
2995
3225
|
]);
|
|
2996
|
-
var MoonPayGuestResponseSchema =
|
|
3226
|
+
var MoonPayGuestResponseSchema = z5.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
|
|
2997
3227
|
export {
|
|
2998
3228
|
BlockedReasonSchema,
|
|
2999
3229
|
BlockedStateSchema,
|
|
@@ -3169,9 +3399,45 @@ export {
|
|
|
3169
3399
|
ReportSpecSchema,
|
|
3170
3400
|
STANDARD_KYC_FIELD_IDS,
|
|
3171
3401
|
STATE_KEYS,
|
|
3402
|
+
STRIPE_ENDPOINTS,
|
|
3172
3403
|
SelectOptionSchema,
|
|
3173
3404
|
SessionAuthStateSchema,
|
|
3174
3405
|
StatusHistoryEntrySchema,
|
|
3406
|
+
StripeAuthorizeNextActionSchema,
|
|
3407
|
+
StripeAuthorizeRequestSchema,
|
|
3408
|
+
StripeCheckoutRequestSchema,
|
|
3409
|
+
StripeCheckoutResponseSchema,
|
|
3410
|
+
StripeCheckoutSchema,
|
|
3411
|
+
StripeCheckoutSecretNextActionSchema,
|
|
3412
|
+
StripeConsentNextActionSchema,
|
|
3413
|
+
StripeConsentRequestSchema,
|
|
3414
|
+
StripeDoneSchema,
|
|
3415
|
+
StripeErrorBodySchema,
|
|
3416
|
+
StripeFaultSchema,
|
|
3417
|
+
StripeKycNextActionSchema,
|
|
3418
|
+
StripeKycRequestSchema,
|
|
3419
|
+
StripeLinkAuthTokenSchema,
|
|
3420
|
+
StripeNextActionSchema,
|
|
3421
|
+
StripeNextRequestSchema,
|
|
3422
|
+
StripeObserveRequestSchema,
|
|
3423
|
+
StripeOrderPendingNextActionSchema,
|
|
3424
|
+
StripeOrderRequestSchema,
|
|
3425
|
+
StripeOrderResponseSchema,
|
|
3426
|
+
StripePayNextActionSchema,
|
|
3427
|
+
StripePaySheetSchema,
|
|
3428
|
+
StripePlaceOrderNextActionSchema,
|
|
3429
|
+
StripePlaceOrderRequestSchema,
|
|
3430
|
+
StripePriceSchema,
|
|
3431
|
+
StripeReaskSchema,
|
|
3432
|
+
StripeRefusedSchema,
|
|
3433
|
+
StripeRequestContextSchema,
|
|
3434
|
+
StripeRequestSchema,
|
|
3435
|
+
StripeResponseSchemaFor,
|
|
3436
|
+
StripeSessionNextActionSchema,
|
|
3437
|
+
StripeSessionRequestSchema,
|
|
3438
|
+
StripeStepResponseSchema,
|
|
3439
|
+
StripeVerifyIdentityNextActionSchema,
|
|
3440
|
+
StripeWaitNextActionSchema,
|
|
3175
3441
|
SurfaceKindSchema,
|
|
3176
3442
|
SurfaceProviderSchema,
|
|
3177
3443
|
SurfaceSchema,
|
|
@@ -107,11 +107,16 @@ export type CoinbaseWaitNextAction = {
|
|
|
107
107
|
next: 'wait';
|
|
108
108
|
retryAfterMs: number;
|
|
109
109
|
};
|
|
110
|
-
/** The order's price: Coinbase's own totals, never Fun's. */
|
|
110
|
+
/** The order's price: Coinbase's own totals, never Fun's, and the fee subsidy Fun decided on them. */
|
|
111
111
|
export interface CoinbasePrice {
|
|
112
112
|
total: FiatAmount;
|
|
113
113
|
fees: FeeLine[];
|
|
114
114
|
cryptoAmount: string;
|
|
115
|
+
/**
|
|
116
|
+
* The fee the partner reimburses after settlement, as on `Quote.feeSubsidy`. Absent when this deposit is not
|
|
117
|
+
* subsidized. A prediction: settlement decides again.
|
|
118
|
+
*/
|
|
119
|
+
feeSubsidy?: FiatAmount;
|
|
115
120
|
}
|
|
116
121
|
/**
|
|
117
122
|
* Coinbase priced the checkout. `orderId` is minted for this answer: send it back on `placeOrder`, and on every
|