@fun-xyz/fiat-contract 0.48.0 → 0.50.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-4ZHY4P3K.mjs → chunk-BK2XD3JT.mjs} +1 -1
- package/dist/chunk-KLAXY6H7.mjs +8 -0
- package/dist/codes.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +359 -42
- package/dist/index.mjs +360 -45
- package/dist/providers/stripe.d.ts +305 -0
- package/dist/providers/stripe.js +28 -0
- package/dist/providers/stripe.mjs +6 -0
- package/dist/providers/stripe.schemas.d.ts +46 -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-BK2XD3JT.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 = [
|
|
@@ -353,6 +356,40 @@ var COUNTRY_NAMES = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.count
|
|
|
353
356
|
var FIAT_CURRENCY_NAMES = Object.fromEntries(uniqueCurrencies);
|
|
354
357
|
var COUNTRY_TO_CURRENCY = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.country, e.currency]));
|
|
355
358
|
var PAYMENT_METHOD_CATEGORIES = ["card", "apple_pay", "google_pay", "bank_transfer"];
|
|
359
|
+
var EU_COUNTRIES = [
|
|
360
|
+
"AT",
|
|
361
|
+
"BE",
|
|
362
|
+
"BG",
|
|
363
|
+
"HR",
|
|
364
|
+
"CY",
|
|
365
|
+
"CZ",
|
|
366
|
+
"DK",
|
|
367
|
+
"EE",
|
|
368
|
+
"FI",
|
|
369
|
+
"FR",
|
|
370
|
+
"DE",
|
|
371
|
+
"GR",
|
|
372
|
+
"HU",
|
|
373
|
+
"IE",
|
|
374
|
+
"IT",
|
|
375
|
+
"LV",
|
|
376
|
+
"LT",
|
|
377
|
+
"LU",
|
|
378
|
+
"MT",
|
|
379
|
+
"NL",
|
|
380
|
+
"PL",
|
|
381
|
+
"PT",
|
|
382
|
+
"RO",
|
|
383
|
+
"SK",
|
|
384
|
+
"SI",
|
|
385
|
+
"ES",
|
|
386
|
+
"SE"
|
|
387
|
+
];
|
|
388
|
+
var EEA_COUNTRIES = [...EU_COUNTRIES, "IS", "LI", "NO"];
|
|
389
|
+
var EU_COUNTRY_SET = new Set(EU_COUNTRIES);
|
|
390
|
+
var EEA_COUNTRY_SET = new Set(EEA_COUNTRIES);
|
|
391
|
+
var isEuCountry = (country) => EU_COUNTRY_SET.has(country);
|
|
392
|
+
var isEeaCountry = (country) => EEA_COUNTRY_SET.has(country);
|
|
356
393
|
|
|
357
394
|
// src/schemas.ts
|
|
358
395
|
import { z } from "zod";
|
|
@@ -994,7 +1031,7 @@ var $routingTableRequest = obj({
|
|
|
994
1031
|
providers: $routingTableProviderInputs.optional(),
|
|
995
1032
|
destinationAsset: $destinationAsset.optional(),
|
|
996
1033
|
depositAddress: $nonBlank.optional()
|
|
997
|
-
}).refine((
|
|
1034
|
+
}).refine((request2) => hasUsRegion(request2.country, request2.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
998
1035
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
999
1036
|
var $routingTableProvider = obj({
|
|
1000
1037
|
provider: $routingProvider,
|
|
@@ -1052,9 +1089,9 @@ var $routingQuoteRequest = z.union([
|
|
|
1052
1089
|
}),
|
|
1053
1090
|
obj({ ...$routingQuoteTermsShape, provider: $routingProvider })
|
|
1054
1091
|
]).refine(
|
|
1055
|
-
(
|
|
1056
|
-
const allowed =
|
|
1057
|
-
const selected = "providers" in
|
|
1092
|
+
(request2) => {
|
|
1093
|
+
const allowed = request2.routingOverrides?.providers;
|
|
1094
|
+
const selected = "providers" in request2 ? request2.providers : [request2.provider];
|
|
1058
1095
|
return allowed === void 0 || selected.every((provider) => allowed.includes(provider));
|
|
1059
1096
|
},
|
|
1060
1097
|
{ message: "requested providers must be allowed by routingOverrides", path: ["routingOverrides"] }
|
|
@@ -2505,14 +2542,14 @@ function walkTable(fn) {
|
|
|
2505
2542
|
function assertFixture(id) {
|
|
2506
2543
|
const meta = fixtureMeta(id);
|
|
2507
2544
|
const json = loadFixture(id);
|
|
2508
|
-
const
|
|
2509
|
-
if (stateKey(
|
|
2545
|
+
const stepResponse2 = assertFiatStepResponse(json);
|
|
2546
|
+
if (stateKey(stepResponse2.state) !== meta.stateKey) {
|
|
2510
2547
|
throw new ContractViolation(
|
|
2511
|
-
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(
|
|
2548
|
+
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse2.state)}`
|
|
2512
2549
|
);
|
|
2513
2550
|
}
|
|
2514
|
-
assertLegalEmission(
|
|
2515
|
-
return { meta, stepResponse };
|
|
2551
|
+
assertLegalEmission(stepResponse2.state, stepResponse2.transitions);
|
|
2552
|
+
return { meta, stepResponse: stepResponse2 };
|
|
2516
2553
|
}
|
|
2517
2554
|
function assertAllFixtures() {
|
|
2518
2555
|
return FIXTURES.map((meta) => assertFixture(meta.id));
|
|
@@ -2946,31 +2983,267 @@ var $errorBody2 = obj3({
|
|
|
2946
2983
|
});
|
|
2947
2984
|
var CoinbaseErrorBodySchema = $errorBody2;
|
|
2948
2985
|
|
|
2949
|
-
// src/providers/
|
|
2986
|
+
// src/providers/stripe.schemas.ts
|
|
2950
2987
|
import { z as z4 } from "zod";
|
|
2951
|
-
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
2952
2988
|
var obj4 = (shape) => z4.object(shape).strict();
|
|
2953
2989
|
var nonEmpty = z4.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2990
|
+
var hasUniqueIds4 = (ids) => new Set(ids).size === ids.length;
|
|
2991
|
+
var retryAfterMs = z4.number().int().positive().max(6e4);
|
|
2992
|
+
var centsAmount = z4.string().regex(/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/, "must be an amount in cents").refine((amount) => Number(amount) > 0, "must be positive");
|
|
2993
|
+
var kycValues = z4.record(KycFieldIdSchema, z4.string());
|
|
2994
|
+
var instant = z4.string().datetime({ offset: true });
|
|
2995
|
+
var chargeCurrency = z4.enum(["USD", "EUR"]);
|
|
2996
|
+
var countryCode = z4.enum(Object.keys(CountryCode));
|
|
2997
|
+
var checkout = obj4({
|
|
2998
|
+
amount: obj4({ currency: chargeCurrency, amount: centsAmount }),
|
|
2999
|
+
destination: obj4({ asset: nonEmpty, network: nonEmpty }),
|
|
3000
|
+
paymentMethod: z4.literal("apple_pay")
|
|
3001
|
+
});
|
|
3002
|
+
var StripeCheckoutSchema = checkout;
|
|
3003
|
+
var contextFields2 = { checkout };
|
|
3004
|
+
var requestContext = obj4(contextFields2);
|
|
3005
|
+
var StripeRequestContextSchema = requestContext;
|
|
3006
|
+
var mintedOrderId = z4.string().regex(/^sto_[A-Za-z0-9_-]{22}$/, "must be an order id a placeOrder answer minted");
|
|
3007
|
+
var heldOrder = { orderId: mintedOrderId.optional() };
|
|
3008
|
+
var observeFields2 = { action: z4.literal("observe"), ...heldOrder };
|
|
3009
|
+
var consentFields2 = {
|
|
3010
|
+
action: z4.literal("consent"),
|
|
3011
|
+
acceptances: z4.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds4(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once"),
|
|
3012
|
+
...heldOrder
|
|
3013
|
+
};
|
|
3014
|
+
var sessionFields = { action: z4.literal("session"), ...heldOrder };
|
|
3015
|
+
var authorizeConsentedFields = {
|
|
3016
|
+
action: z4.literal("authorize"),
|
|
3017
|
+
linkAuthIntentId: nonEmpty,
|
|
3018
|
+
outcome: z4.literal("Consented"),
|
|
3019
|
+
customerId: nonEmpty,
|
|
3020
|
+
...heldOrder
|
|
3021
|
+
};
|
|
3022
|
+
var authorizeDeclinedFields = { action: z4.literal("authorize"), linkAuthIntentId: nonEmpty, outcome: z4.enum(["Denied", "Cancelled"]), ...heldOrder };
|
|
3023
|
+
var correctionRound = z4.number().int().nonnegative();
|
|
3024
|
+
var kycFields2 = { action: z4.literal("kyc"), correctionRound, values: kycValues, ...heldOrder };
|
|
3025
|
+
var placeOrderFields2 = { action: z4.literal("placeOrder"), orderId: mintedOrderId, cryptoPaymentToken: nonEmpty };
|
|
3026
|
+
var checkoutFields = { action: z4.literal("checkout"), orderId: mintedOrderId, callbackId: z4.string().regex(/^[A-Za-z0-9_-]{1,200}$/) };
|
|
3027
|
+
var orderFields2 = { action: z4.literal("order"), orderId: mintedOrderId };
|
|
3028
|
+
var observeRequest = obj4({ ...contextFields2, ...observeFields2 });
|
|
3029
|
+
var consentRequest = obj4({ ...contextFields2, ...consentFields2 });
|
|
3030
|
+
var sessionRequest = obj4({ ...contextFields2, ...sessionFields });
|
|
3031
|
+
var authorizeRequest = z4.union([obj4({ ...contextFields2, ...authorizeConsentedFields }), obj4({ ...contextFields2, ...authorizeDeclinedFields })]);
|
|
3032
|
+
var kycRequest = obj4({ ...contextFields2, ...kycFields2 });
|
|
3033
|
+
var placeOrderRequest = obj4({ ...contextFields2, ...placeOrderFields2 });
|
|
3034
|
+
var checkoutRequest = obj4({ ...contextFields2, ...checkoutFields });
|
|
3035
|
+
var orderRequest = obj4({ ...contextFields2, ...orderFields2 });
|
|
3036
|
+
var StripeObserveRequestSchema = observeRequest;
|
|
3037
|
+
var StripeConsentRequestSchema = consentRequest;
|
|
3038
|
+
var StripeSessionRequestSchema = sessionRequest;
|
|
3039
|
+
var StripeAuthorizeRequestSchema = authorizeRequest;
|
|
3040
|
+
var StripeKycRequestSchema = kycRequest;
|
|
3041
|
+
var StripePlaceOrderRequestSchema = placeOrderRequest;
|
|
3042
|
+
var StripeCheckoutRequestSchema = checkoutRequest;
|
|
3043
|
+
var StripeOrderRequestSchema = orderRequest;
|
|
3044
|
+
var request = z4.union([observeRequest, consentRequest, sessionRequest, authorizeRequest, kycRequest, placeOrderRequest, checkoutRequest, orderRequest]);
|
|
3045
|
+
var StripeRequestSchema = request;
|
|
3046
|
+
var envelope2 = { provider: z4.literal("STRIPE"), geo: FiatGeoSchema, ...contextFields2 };
|
|
3047
|
+
var nextRequest = z4.union([
|
|
3048
|
+
obj4({ ...envelope2, ...observeFields2 }),
|
|
3049
|
+
obj4({ ...envelope2, ...consentFields2 }),
|
|
3050
|
+
obj4({ ...envelope2, ...sessionFields }),
|
|
3051
|
+
obj4({ ...envelope2, ...authorizeConsentedFields }),
|
|
3052
|
+
obj4({ ...envelope2, ...authorizeDeclinedFields }),
|
|
3053
|
+
obj4({ ...envelope2, ...kycFields2 }),
|
|
3054
|
+
obj4({ ...envelope2, ...placeOrderFields2 }),
|
|
3055
|
+
obj4({ ...envelope2, ...checkoutFields }),
|
|
3056
|
+
obj4({ ...envelope2, ...orderFields2 })
|
|
3057
|
+
]);
|
|
3058
|
+
var StripeNextRequestSchema = nextRequest;
|
|
3059
|
+
var price = obj4({ total: FiatAmountSchema, fees: z4.array(FeeLineSchema), cryptoAmount: nonEmpty });
|
|
3060
|
+
var StripePriceSchema = price;
|
|
3061
|
+
var paySheet = obj4({
|
|
3062
|
+
destinationCurrency: nonEmpty,
|
|
3063
|
+
destinationNetwork: nonEmpty,
|
|
3064
|
+
walletAddress: nonEmpty,
|
|
3065
|
+
merchantCountryCode: countryCode,
|
|
3066
|
+
currencyCode: chargeCurrency,
|
|
3067
|
+
amount: centsAmount,
|
|
3068
|
+
label: nonEmpty
|
|
3069
|
+
});
|
|
3070
|
+
var StripePaySheetSchema = paySheet;
|
|
3071
|
+
var linkAuthToken = obj4({ clientSecret: nonEmpty, expiresAt: instant });
|
|
3072
|
+
var StripeLinkAuthTokenSchema = linkAuthToken;
|
|
3073
|
+
var reask = obj4({
|
|
3074
|
+
requirements: z4.array(KycFieldIdSchema).min(1).refine(hasUniqueIds4, "requirements must be unique"),
|
|
3075
|
+
reason: z4.enum(["REJECTED"]).nullable()
|
|
3076
|
+
});
|
|
3077
|
+
var StripeReaskSchema = reask;
|
|
3078
|
+
var consentShape = obj4({ next: z4.literal("consent"), documents: z4.array(TermsDocumentSchema).min(1) });
|
|
3079
|
+
var sessionNextAction = obj4({ next: z4.literal("session") });
|
|
3080
|
+
var authorizeNextAction = obj4({ next: z4.literal("authorize"), linkAuthIntentId: nonEmpty, expiresAt: instant });
|
|
3081
|
+
var kycShape = obj4({
|
|
3082
|
+
next: z4.literal("kyc"),
|
|
3083
|
+
round: z4.enum(["ACCOUNT", "IDENTITY"]),
|
|
3084
|
+
tier: z4.enum(["l0", "l1", "l2"]),
|
|
3085
|
+
correctionRound,
|
|
3086
|
+
fields: z4.array(FormFieldSchema),
|
|
3087
|
+
heldValues: kycValues,
|
|
3088
|
+
verifiedEmail: nonEmpty.nullable(),
|
|
3089
|
+
linkAuthToken: linkAuthToken.nullable(),
|
|
3090
|
+
fieldErrors: z4.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
|
|
3091
|
+
reask: reask.nullable()
|
|
3092
|
+
});
|
|
3093
|
+
var identifiersNextAction = obj4({ next: z4.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
|
|
3094
|
+
var attestationNextAction = obj4({ next: z4.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
|
|
3095
|
+
var verifyIdentityNextAction = obj4({ next: z4.literal("verifyIdentity"), linkAuthToken: linkAuthToken.nullable() });
|
|
3096
|
+
var waitNextAction = obj4({ next: z4.literal("wait"), retryAfterMs });
|
|
3097
|
+
var placeOrderNextAction = obj4({
|
|
3098
|
+
next: z4.literal("placeOrder"),
|
|
3099
|
+
orderId: mintedOrderId,
|
|
3100
|
+
price,
|
|
3101
|
+
paySheet,
|
|
3102
|
+
linkAuthToken: linkAuthToken.nullable()
|
|
3103
|
+
});
|
|
3104
|
+
var payNextAction = obj4({ next: z4.literal("pay"), orderId: mintedOrderId, sessionId: nonEmpty, linkAuthToken: linkAuthToken.nullable() });
|
|
3105
|
+
var checkoutSecretNextAction = obj4({ next: z4.literal("checkoutSecret"), clientSecret: nonEmpty });
|
|
3106
|
+
var orderPendingNextAction = obj4({
|
|
3107
|
+
next: z4.literal("orderPending"),
|
|
3108
|
+
orderId: mintedOrderId,
|
|
3109
|
+
retryAfterMs,
|
|
3110
|
+
order: FiatStepResponseSchema.nullable()
|
|
3111
|
+
});
|
|
3112
|
+
var checkConsent3 = (nextAction, context2) => {
|
|
3113
|
+
if (!hasUniqueIds4(nextAction.documents.map((document) => document.id))) {
|
|
3114
|
+
context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
3115
|
+
}
|
|
3116
|
+
};
|
|
3117
|
+
var checkKyc3 = (nextAction, context2) => {
|
|
3118
|
+
const fieldIds = nextAction.fields.map((field) => field.id);
|
|
3119
|
+
if (!hasUniqueIds4(fieldIds)) {
|
|
3120
|
+
context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
|
|
3121
|
+
}
|
|
3122
|
+
if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
|
|
3123
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
|
|
3124
|
+
}
|
|
3125
|
+
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
3126
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
3127
|
+
}
|
|
3128
|
+
if (nextAction.round === "ACCOUNT" !== (nextAction.verifiedEmail !== null)) {
|
|
3129
|
+
context2.addIssue({ code: "custom", path: ["verifiedEmail"], message: "only the account round carries the verified email" });
|
|
3130
|
+
}
|
|
3131
|
+
if (nextAction.tier === "l2" && nextAction.round !== "IDENTITY") {
|
|
3132
|
+
context2.addIssue({ code: "custom", path: ["tier"], message: "l2 is an identity round" });
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
var checkPlaceOrder = (nextAction, context2) => {
|
|
3136
|
+
if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
|
|
3137
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "amount"], message: "the sheet charges the price shown" });
|
|
3138
|
+
}
|
|
3139
|
+
if (nextAction.paySheet.currencyCode !== nextAction.price.total.currency) {
|
|
3140
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "currencyCode"], message: "the sheet charges the price currency" });
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
var StripeConsentNextActionSchema = consentShape.superRefine(checkConsent3);
|
|
3144
|
+
var StripeSessionNextActionSchema = sessionNextAction;
|
|
3145
|
+
var StripeAuthorizeNextActionSchema = authorizeNextAction;
|
|
3146
|
+
var StripeKycNextActionSchema = kycShape.superRefine(checkKyc3);
|
|
3147
|
+
var StripeIdentifiersNextActionSchema = identifiersNextAction;
|
|
3148
|
+
var StripeAttestationNextActionSchema = attestationNextAction;
|
|
3149
|
+
var StripeVerifyIdentityNextActionSchema = verifyIdentityNextAction;
|
|
3150
|
+
var StripeWaitNextActionSchema = waitNextAction;
|
|
3151
|
+
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
3152
|
+
var StripePayNextActionSchema = payNextAction;
|
|
3153
|
+
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
3154
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
3155
|
+
var checkNextAction3 = (response, context2) => {
|
|
3156
|
+
if (response.next === "consent") checkConsent3(response, context2);
|
|
3157
|
+
if (response.next === "kyc") checkKyc3(response, context2);
|
|
3158
|
+
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
3159
|
+
};
|
|
3160
|
+
var nextActionOptions = [
|
|
3161
|
+
consentShape,
|
|
3162
|
+
sessionNextAction,
|
|
3163
|
+
authorizeNextAction,
|
|
3164
|
+
kycShape,
|
|
3165
|
+
identifiersNextAction,
|
|
3166
|
+
attestationNextAction,
|
|
3167
|
+
verifyIdentityNextAction,
|
|
3168
|
+
waitNextAction,
|
|
3169
|
+
placeOrderNextAction,
|
|
3170
|
+
payNextAction,
|
|
3171
|
+
orderPendingNextAction
|
|
3172
|
+
];
|
|
3173
|
+
var anyNextAction = z4.discriminatedUnion("next", [...nextActionOptions]).superRefine(checkNextAction3);
|
|
3174
|
+
var StripeNextActionSchema = anyNextAction;
|
|
3175
|
+
var done = obj4({ next: z4.literal("done"), order: FiatStepResponseSchema });
|
|
3176
|
+
var StripeDoneSchema = done;
|
|
3177
|
+
var refused = z4.union([
|
|
3178
|
+
obj4({
|
|
3179
|
+
next: z4.literal("refused"),
|
|
3180
|
+
reason: z4.enum(["NOT_ELIGIBLE", "KYC_REJECTED", "FINAL_REJECTION", "TOTAL_MISMATCH"]),
|
|
3181
|
+
recovery: z4.enum(["REQUOTE", "NONE"])
|
|
3182
|
+
}),
|
|
3183
|
+
obj4({
|
|
3184
|
+
next: z4.literal("refused"),
|
|
3185
|
+
reason: z4.literal("LIMITS_EXCEEDED"),
|
|
3186
|
+
recovery: z4.literal("REQUOTE"),
|
|
3187
|
+
maxAmount: FiatAmountSchema.nullable()
|
|
3188
|
+
})
|
|
3189
|
+
]);
|
|
3190
|
+
var StripeRefusedSchema = refused;
|
|
3191
|
+
var stepResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done]), refused]).superRefine(checkNextAction3);
|
|
3192
|
+
var StripeStepResponseSchema = stepResponse;
|
|
3193
|
+
var checkoutResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
3194
|
+
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
3195
|
+
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
3196
|
+
var StripeOrderResponseSchema = orderResponse;
|
|
3197
|
+
var StripeResponseSchemaFor = {
|
|
3198
|
+
observe: StripeStepResponseSchema,
|
|
3199
|
+
consent: StripeStepResponseSchema,
|
|
3200
|
+
session: StripeStepResponseSchema,
|
|
3201
|
+
authorize: StripeStepResponseSchema,
|
|
3202
|
+
kyc: StripeStepResponseSchema,
|
|
3203
|
+
placeOrder: StripeStepResponseSchema,
|
|
3204
|
+
checkout: StripeCheckoutResponseSchema,
|
|
3205
|
+
order: StripeOrderResponseSchema
|
|
3206
|
+
};
|
|
3207
|
+
var faultFields2 = {
|
|
3208
|
+
reason: z4.enum(["SESSION_BUDGET_SPENT", "RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
|
|
3209
|
+
recovery: z4.enum(["RETRY", "REQUOTE", "NONE"])
|
|
3210
|
+
};
|
|
3211
|
+
var fault = obj4(faultFields2);
|
|
3212
|
+
var StripeFaultSchema = fault;
|
|
3213
|
+
var errorBody = obj4({
|
|
3214
|
+
...faultFields2,
|
|
3215
|
+
errorCode: nonEmpty,
|
|
3216
|
+
errorMsg: z4.string(),
|
|
3217
|
+
reqId: z4.string().optional(),
|
|
3218
|
+
retryAfterSeconds: z4.number().int().nonnegative().optional()
|
|
3219
|
+
});
|
|
3220
|
+
var StripeErrorBodySchema = errorBody;
|
|
3221
|
+
|
|
3222
|
+
// src/providers/moonpay-guest.schemas.ts
|
|
3223
|
+
import { z as z5 } from "zod";
|
|
3224
|
+
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
3225
|
+
var obj5 = (shape) => z5.object(shape).strict();
|
|
3226
|
+
var nonEmpty2 = z5.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2954
3227
|
var actions = [
|
|
2955
|
-
{ action:
|
|
2956
|
-
{ action:
|
|
2957
|
-
{ action:
|
|
2958
|
-
{ action:
|
|
2959
|
-
{ action:
|
|
2960
|
-
{ action:
|
|
2961
|
-
{ action:
|
|
2962
|
-
{ action:
|
|
3228
|
+
{ action: z5.literal("observe") },
|
|
3229
|
+
{ action: z5.literal("session") },
|
|
3230
|
+
{ 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") },
|
|
3231
|
+
{ action: z5.literal("order"), orderId: nonEmpty2, quotedAmount: FiatAmountSchema, transactionId: nonEmpty2.optional() },
|
|
3232
|
+
{ action: z5.literal("phone"), phoneNumber: z5.string().regex(/^\+[1-9]\d{1,14}$/) },
|
|
3233
|
+
{ action: z5.literal("phone"), resend: nonEmpty2 },
|
|
3234
|
+
{ action: z5.literal("phoneCode"), verificationRef: nonEmpty2, otpCode: z5.string().regex(/^\d{6}$/) },
|
|
3235
|
+
{ action: z5.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
|
|
2963
3236
|
];
|
|
2964
|
-
var MoonPayGuestObserveRequestSchema =
|
|
2965
|
-
var MoonPayGuestSessionRequestSchema =
|
|
2966
|
-
var MoonPayGuestConsentRequestSchema =
|
|
2967
|
-
var MoonPayGuestOrderRequestSchema =
|
|
2968
|
-
var MoonPayGuestPhoneNumberRequestSchema =
|
|
2969
|
-
var MoonPayGuestPhoneResendRequestSchema =
|
|
2970
|
-
var MoonPayGuestPhoneCodeRequestSchema =
|
|
2971
|
-
var MoonPayGuestDeclineRequestSchema =
|
|
2972
|
-
var MoonPayGuestPhoneRequestSchema =
|
|
2973
|
-
var MoonPayGuestRequestSchema =
|
|
3237
|
+
var MoonPayGuestObserveRequestSchema = obj5({ ...context, ...actions[0] });
|
|
3238
|
+
var MoonPayGuestSessionRequestSchema = obj5({ ...context, ...actions[1] });
|
|
3239
|
+
var MoonPayGuestConsentRequestSchema = obj5({ ...context, ...actions[2] });
|
|
3240
|
+
var MoonPayGuestOrderRequestSchema = obj5({ ...context, ...actions[3] });
|
|
3241
|
+
var MoonPayGuestPhoneNumberRequestSchema = obj5({ ...context, ...actions[4] });
|
|
3242
|
+
var MoonPayGuestPhoneResendRequestSchema = obj5({ ...context, ...actions[5] });
|
|
3243
|
+
var MoonPayGuestPhoneCodeRequestSchema = obj5({ ...context, ...actions[6] });
|
|
3244
|
+
var MoonPayGuestDeclineRequestSchema = obj5({ ...context, ...actions[7] });
|
|
3245
|
+
var MoonPayGuestPhoneRequestSchema = z5.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
|
|
3246
|
+
var MoonPayGuestRequestSchema = z5.union([
|
|
2974
3247
|
MoonPayGuestObserveRequestSchema,
|
|
2975
3248
|
MoonPayGuestSessionRequestSchema,
|
|
2976
3249
|
MoonPayGuestConsentRequestSchema,
|
|
@@ -2980,25 +3253,25 @@ var MoonPayGuestRequestSchema = z4.union([
|
|
|
2980
3253
|
MoonPayGuestPhoneCodeRequestSchema,
|
|
2981
3254
|
MoonPayGuestDeclineRequestSchema
|
|
2982
3255
|
]);
|
|
2983
|
-
var MoonPayGuestNextRequestSchema =
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3256
|
+
var MoonPayGuestNextRequestSchema = z5.union([
|
|
3257
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[0] }),
|
|
3258
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[1] }),
|
|
3259
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[2] }),
|
|
3260
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[3] }),
|
|
3261
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[4] }),
|
|
3262
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[5] }),
|
|
3263
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[6] }),
|
|
3264
|
+
obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[7] })
|
|
2992
3265
|
]);
|
|
2993
|
-
var MoonPayGuestStepResponseSchema =
|
|
3266
|
+
var MoonPayGuestStepResponseSchema = z5.union([
|
|
2994
3267
|
MoonPayConsentNextActionSchema,
|
|
2995
3268
|
MoonPaySessionNextActionSchema,
|
|
2996
3269
|
MoonPayPhoneNextActionSchema,
|
|
2997
3270
|
MoonPayPhoneCodeNextActionSchema,
|
|
2998
3271
|
MoonPayPayNextActionSchema,
|
|
2999
|
-
|
|
3272
|
+
obj5({ next: z5.literal("refused"), reason: z5.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: z5.enum(["REQUOTE", "NONE"]) })
|
|
3000
3273
|
]);
|
|
3001
|
-
var MoonPayGuestResponseSchema =
|
|
3274
|
+
var MoonPayGuestResponseSchema = z5.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
|
|
3002
3275
|
export {
|
|
3003
3276
|
BlockedReasonSchema,
|
|
3004
3277
|
BlockedStateSchema,
|
|
@@ -3042,7 +3315,9 @@ export {
|
|
|
3042
3315
|
DOCUMENTED_ENDPOINTS,
|
|
3043
3316
|
DeliveryStateSchema,
|
|
3044
3317
|
DestinationAssetSchema,
|
|
3318
|
+
EEA_COUNTRIES,
|
|
3045
3319
|
ENDPOINT_PATTERN,
|
|
3320
|
+
EU_COUNTRIES,
|
|
3046
3321
|
FIAT_CURRENCY_NAMES,
|
|
3047
3322
|
FIAT_TERMS_ENDPOINT,
|
|
3048
3323
|
FIELD_SPEC_TYPES,
|
|
@@ -3174,9 +3449,47 @@ export {
|
|
|
3174
3449
|
ReportSpecSchema,
|
|
3175
3450
|
STANDARD_KYC_FIELD_IDS,
|
|
3176
3451
|
STATE_KEYS,
|
|
3452
|
+
STRIPE_ENDPOINTS,
|
|
3177
3453
|
SelectOptionSchema,
|
|
3178
3454
|
SessionAuthStateSchema,
|
|
3179
3455
|
StatusHistoryEntrySchema,
|
|
3456
|
+
StripeAttestationNextActionSchema,
|
|
3457
|
+
StripeAuthorizeNextActionSchema,
|
|
3458
|
+
StripeAuthorizeRequestSchema,
|
|
3459
|
+
StripeCheckoutRequestSchema,
|
|
3460
|
+
StripeCheckoutResponseSchema,
|
|
3461
|
+
StripeCheckoutSchema,
|
|
3462
|
+
StripeCheckoutSecretNextActionSchema,
|
|
3463
|
+
StripeConsentNextActionSchema,
|
|
3464
|
+
StripeConsentRequestSchema,
|
|
3465
|
+
StripeDoneSchema,
|
|
3466
|
+
StripeErrorBodySchema,
|
|
3467
|
+
StripeFaultSchema,
|
|
3468
|
+
StripeIdentifiersNextActionSchema,
|
|
3469
|
+
StripeKycNextActionSchema,
|
|
3470
|
+
StripeKycRequestSchema,
|
|
3471
|
+
StripeLinkAuthTokenSchema,
|
|
3472
|
+
StripeNextActionSchema,
|
|
3473
|
+
StripeNextRequestSchema,
|
|
3474
|
+
StripeObserveRequestSchema,
|
|
3475
|
+
StripeOrderPendingNextActionSchema,
|
|
3476
|
+
StripeOrderRequestSchema,
|
|
3477
|
+
StripeOrderResponseSchema,
|
|
3478
|
+
StripePayNextActionSchema,
|
|
3479
|
+
StripePaySheetSchema,
|
|
3480
|
+
StripePlaceOrderNextActionSchema,
|
|
3481
|
+
StripePlaceOrderRequestSchema,
|
|
3482
|
+
StripePriceSchema,
|
|
3483
|
+
StripeReaskSchema,
|
|
3484
|
+
StripeRefusedSchema,
|
|
3485
|
+
StripeRequestContextSchema,
|
|
3486
|
+
StripeRequestSchema,
|
|
3487
|
+
StripeResponseSchemaFor,
|
|
3488
|
+
StripeSessionNextActionSchema,
|
|
3489
|
+
StripeSessionRequestSchema,
|
|
3490
|
+
StripeStepResponseSchema,
|
|
3491
|
+
StripeVerifyIdentityNextActionSchema,
|
|
3492
|
+
StripeWaitNextActionSchema,
|
|
3180
3493
|
SurfaceKindSchema,
|
|
3181
3494
|
SurfaceProviderSchema,
|
|
3182
3495
|
SurfaceSchema,
|
|
@@ -3202,6 +3515,8 @@ export {
|
|
|
3202
3515
|
checkLegalEmission,
|
|
3203
3516
|
endpointMatches,
|
|
3204
3517
|
fixtureMeta,
|
|
3518
|
+
isEeaCountry,
|
|
3519
|
+
isEuCountry,
|
|
3205
3520
|
isTerminal,
|
|
3206
3521
|
loadFixture,
|
|
3207
3522
|
loadFixtures,
|