@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.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './providers/moonpay';
|
|
|
16
16
|
export * from './providers/moonpay.schemas';
|
|
17
17
|
export * from './providers/coinbase';
|
|
18
18
|
export * from './providers/coinbase.schemas';
|
|
19
|
+
export * from './providers/stripe';
|
|
20
|
+
export * from './providers/stripe.schemas';
|
|
19
21
|
export { FIXTURES, FIXTURE_COVERAGE_GAPS, fixtureMeta, loadFixture, loadFixtures, type FixtureMeta, type FixtureSource, type LoadedFixture, } from './fixtures/index';
|
|
20
22
|
export * from './providers/moonpay-guest';
|
|
21
23
|
export * from './providers/moonpay-guest.schemas';
|
package/dist/index.js
CHANGED
|
@@ -194,9 +194,45 @@ __export(index_exports, {
|
|
|
194
194
|
ReportSpecSchema: () => ReportSpecSchema,
|
|
195
195
|
STANDARD_KYC_FIELD_IDS: () => STANDARD_KYC_FIELD_IDS,
|
|
196
196
|
STATE_KEYS: () => STATE_KEYS,
|
|
197
|
+
STRIPE_ENDPOINTS: () => STRIPE_ENDPOINTS,
|
|
197
198
|
SelectOptionSchema: () => SelectOptionSchema,
|
|
198
199
|
SessionAuthStateSchema: () => SessionAuthStateSchema,
|
|
199
200
|
StatusHistoryEntrySchema: () => StatusHistoryEntrySchema,
|
|
201
|
+
StripeAuthorizeNextActionSchema: () => StripeAuthorizeNextActionSchema,
|
|
202
|
+
StripeAuthorizeRequestSchema: () => StripeAuthorizeRequestSchema,
|
|
203
|
+
StripeCheckoutRequestSchema: () => StripeCheckoutRequestSchema,
|
|
204
|
+
StripeCheckoutResponseSchema: () => StripeCheckoutResponseSchema,
|
|
205
|
+
StripeCheckoutSchema: () => StripeCheckoutSchema,
|
|
206
|
+
StripeCheckoutSecretNextActionSchema: () => StripeCheckoutSecretNextActionSchema,
|
|
207
|
+
StripeConsentNextActionSchema: () => StripeConsentNextActionSchema,
|
|
208
|
+
StripeConsentRequestSchema: () => StripeConsentRequestSchema,
|
|
209
|
+
StripeDoneSchema: () => StripeDoneSchema,
|
|
210
|
+
StripeErrorBodySchema: () => StripeErrorBodySchema,
|
|
211
|
+
StripeFaultSchema: () => StripeFaultSchema,
|
|
212
|
+
StripeKycNextActionSchema: () => StripeKycNextActionSchema,
|
|
213
|
+
StripeKycRequestSchema: () => StripeKycRequestSchema,
|
|
214
|
+
StripeLinkAuthTokenSchema: () => StripeLinkAuthTokenSchema,
|
|
215
|
+
StripeNextActionSchema: () => StripeNextActionSchema,
|
|
216
|
+
StripeNextRequestSchema: () => StripeNextRequestSchema,
|
|
217
|
+
StripeObserveRequestSchema: () => StripeObserveRequestSchema,
|
|
218
|
+
StripeOrderPendingNextActionSchema: () => StripeOrderPendingNextActionSchema,
|
|
219
|
+
StripeOrderRequestSchema: () => StripeOrderRequestSchema,
|
|
220
|
+
StripeOrderResponseSchema: () => StripeOrderResponseSchema,
|
|
221
|
+
StripePayNextActionSchema: () => StripePayNextActionSchema,
|
|
222
|
+
StripePaySheetSchema: () => StripePaySheetSchema,
|
|
223
|
+
StripePlaceOrderNextActionSchema: () => StripePlaceOrderNextActionSchema,
|
|
224
|
+
StripePlaceOrderRequestSchema: () => StripePlaceOrderRequestSchema,
|
|
225
|
+
StripePriceSchema: () => StripePriceSchema,
|
|
226
|
+
StripeReaskSchema: () => StripeReaskSchema,
|
|
227
|
+
StripeRefusedSchema: () => StripeRefusedSchema,
|
|
228
|
+
StripeRequestContextSchema: () => StripeRequestContextSchema,
|
|
229
|
+
StripeRequestSchema: () => StripeRequestSchema,
|
|
230
|
+
StripeResponseSchemaFor: () => StripeResponseSchemaFor,
|
|
231
|
+
StripeSessionNextActionSchema: () => StripeSessionNextActionSchema,
|
|
232
|
+
StripeSessionRequestSchema: () => StripeSessionRequestSchema,
|
|
233
|
+
StripeStepResponseSchema: () => StripeStepResponseSchema,
|
|
234
|
+
StripeVerifyIdentityNextActionSchema: () => StripeVerifyIdentityNextActionSchema,
|
|
235
|
+
StripeWaitNextActionSchema: () => StripeWaitNextActionSchema,
|
|
200
236
|
SurfaceKindSchema: () => SurfaceKindSchema,
|
|
201
237
|
SurfaceProviderSchema: () => SurfaceProviderSchema,
|
|
202
238
|
SurfaceSchema: () => SurfaceSchema,
|
|
@@ -1195,7 +1231,7 @@ var $routingTableRequest = obj({
|
|
|
1195
1231
|
providers: $routingTableProviderInputs.optional(),
|
|
1196
1232
|
destinationAsset: $destinationAsset.optional(),
|
|
1197
1233
|
depositAddress: $nonBlank.optional()
|
|
1198
|
-
}).refine((
|
|
1234
|
+
}).refine((request2) => hasUsRegion(request2.country, request2.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
1199
1235
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
1200
1236
|
var $routingTableProvider = obj({
|
|
1201
1237
|
provider: $routingProvider,
|
|
@@ -1253,9 +1289,9 @@ var $routingQuoteRequest = import_zod.z.union([
|
|
|
1253
1289
|
}),
|
|
1254
1290
|
obj({ ...$routingQuoteTermsShape, provider: $routingProvider })
|
|
1255
1291
|
]).refine(
|
|
1256
|
-
(
|
|
1257
|
-
const allowed =
|
|
1258
|
-
const selected = "providers" in
|
|
1292
|
+
(request2) => {
|
|
1293
|
+
const allowed = request2.routingOverrides?.providers;
|
|
1294
|
+
const selected = "providers" in request2 ? request2.providers : [request2.provider];
|
|
1259
1295
|
return allowed === void 0 || selected.every((provider) => allowed.includes(provider));
|
|
1260
1296
|
},
|
|
1261
1297
|
{ message: "requested providers must be allowed by routingOverrides", path: ["routingOverrides"] }
|
|
@@ -1397,7 +1433,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1397
1433
|
var FiatStepResponseSchema = $stepResponse;
|
|
1398
1434
|
|
|
1399
1435
|
// package.json
|
|
1400
|
-
var version = "0.
|
|
1436
|
+
var version = "0.49.0";
|
|
1401
1437
|
|
|
1402
1438
|
// src/table.ts
|
|
1403
1439
|
var TABLE_VERSION = version;
|
|
@@ -3298,14 +3334,14 @@ function walkTable(fn) {
|
|
|
3298
3334
|
function assertFixture(id) {
|
|
3299
3335
|
const meta = fixtureMeta(id);
|
|
3300
3336
|
const json = loadFixture(id);
|
|
3301
|
-
const
|
|
3302
|
-
if (stateKey(
|
|
3337
|
+
const stepResponse2 = assertFiatStepResponse(json);
|
|
3338
|
+
if (stateKey(stepResponse2.state) !== meta.stateKey) {
|
|
3303
3339
|
throw new ContractViolation(
|
|
3304
|
-
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(
|
|
3340
|
+
`fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse2.state)}`
|
|
3305
3341
|
);
|
|
3306
3342
|
}
|
|
3307
|
-
assertLegalEmission(
|
|
3308
|
-
return { meta, stepResponse };
|
|
3343
|
+
assertLegalEmission(stepResponse2.state, stepResponse2.transitions);
|
|
3344
|
+
return { meta, stepResponse: stepResponse2 };
|
|
3309
3345
|
}
|
|
3310
3346
|
function assertAllFixtures() {
|
|
3311
3347
|
return FIXTURES.map((meta) => assertFixture(meta.id));
|
|
@@ -3702,7 +3738,12 @@ var $nextRequest3 = import_zod3.z.union([
|
|
|
3702
3738
|
obj3({ ...envelope, ...orderFields })
|
|
3703
3739
|
]);
|
|
3704
3740
|
var CoinbaseNextRequestSchema = $nextRequest3;
|
|
3705
|
-
var $price = obj3({
|
|
3741
|
+
var $price = obj3({
|
|
3742
|
+
total: FiatAmountSchema,
|
|
3743
|
+
fees: import_zod3.z.array(FeeLineSchema),
|
|
3744
|
+
cryptoAmount: $nonEmpty2,
|
|
3745
|
+
feeSubsidy: FiatAmountSchema.optional()
|
|
3746
|
+
});
|
|
3706
3747
|
var CoinbasePriceSchema = $price;
|
|
3707
3748
|
var $reask2 = obj3({
|
|
3708
3749
|
requirements: import_zod3.z.array(KycFieldIdSchema).min(1).refine(hasUniqueIds3, "requirements must be unique"),
|
|
@@ -3824,31 +3865,258 @@ var $errorBody2 = obj3({
|
|
|
3824
3865
|
});
|
|
3825
3866
|
var CoinbaseErrorBodySchema = $errorBody2;
|
|
3826
3867
|
|
|
3827
|
-
// src/providers/
|
|
3868
|
+
// src/providers/stripe.ts
|
|
3869
|
+
var STRIPE_ENDPOINTS = {
|
|
3870
|
+
next: "POST /fiat/next"
|
|
3871
|
+
};
|
|
3872
|
+
|
|
3873
|
+
// src/providers/stripe.schemas.ts
|
|
3828
3874
|
var import_zod4 = require("zod");
|
|
3829
|
-
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
3830
3875
|
var obj4 = (shape) => import_zod4.z.object(shape).strict();
|
|
3831
3876
|
var nonEmpty = import_zod4.z.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
3877
|
+
var hasUniqueIds4 = (ids) => new Set(ids).size === ids.length;
|
|
3878
|
+
var retryAfterMs = import_zod4.z.number().int().positive().max(6e4);
|
|
3879
|
+
var usdAmount = import_zod4.z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/, "must be a USD amount in cents").refine((amount) => Number(amount) > 0, "must be positive");
|
|
3880
|
+
var kycValues = import_zod4.z.record(KycFieldIdSchema, import_zod4.z.string());
|
|
3881
|
+
var instant = import_zod4.z.string().datetime({ offset: true });
|
|
3882
|
+
var checkout = obj4({
|
|
3883
|
+
amount: obj4({ currency: import_zod4.z.literal("USD"), amount: usdAmount }),
|
|
3884
|
+
destination: obj4({ asset: nonEmpty, network: nonEmpty }),
|
|
3885
|
+
paymentMethod: import_zod4.z.literal("apple_pay")
|
|
3886
|
+
});
|
|
3887
|
+
var StripeCheckoutSchema = checkout;
|
|
3888
|
+
var contextFields2 = { checkout };
|
|
3889
|
+
var requestContext = obj4(contextFields2);
|
|
3890
|
+
var StripeRequestContextSchema = requestContext;
|
|
3891
|
+
var mintedOrderId = import_zod4.z.string().regex(/^sto_[A-Za-z0-9_-]{22}$/, "must be an order id a placeOrder answer minted");
|
|
3892
|
+
var heldOrder = { orderId: mintedOrderId.optional() };
|
|
3893
|
+
var observeFields2 = { action: import_zod4.z.literal("observe"), ...heldOrder };
|
|
3894
|
+
var consentFields2 = {
|
|
3895
|
+
action: import_zod4.z.literal("consent"),
|
|
3896
|
+
acceptances: import_zod4.z.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds4(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once"),
|
|
3897
|
+
...heldOrder
|
|
3898
|
+
};
|
|
3899
|
+
var sessionFields = { action: import_zod4.z.literal("session"), ...heldOrder };
|
|
3900
|
+
var authorizeConsentedFields = {
|
|
3901
|
+
action: import_zod4.z.literal("authorize"),
|
|
3902
|
+
linkAuthIntentId: nonEmpty,
|
|
3903
|
+
outcome: import_zod4.z.literal("Consented"),
|
|
3904
|
+
customerId: nonEmpty,
|
|
3905
|
+
...heldOrder
|
|
3906
|
+
};
|
|
3907
|
+
var authorizeDeclinedFields = { action: import_zod4.z.literal("authorize"), linkAuthIntentId: nonEmpty, outcome: import_zod4.z.enum(["Denied", "Cancelled"]), ...heldOrder };
|
|
3908
|
+
var correctionRound = import_zod4.z.number().int().nonnegative();
|
|
3909
|
+
var kycFields2 = { action: import_zod4.z.literal("kyc"), correctionRound, values: kycValues, ...heldOrder };
|
|
3910
|
+
var placeOrderFields2 = { action: import_zod4.z.literal("placeOrder"), orderId: mintedOrderId, cryptoPaymentToken: nonEmpty };
|
|
3911
|
+
var checkoutFields = { action: import_zod4.z.literal("checkout"), orderId: mintedOrderId, callbackId: import_zod4.z.string().regex(/^[A-Za-z0-9_-]{1,200}$/) };
|
|
3912
|
+
var orderFields2 = { action: import_zod4.z.literal("order"), orderId: mintedOrderId };
|
|
3913
|
+
var observeRequest = obj4({ ...contextFields2, ...observeFields2 });
|
|
3914
|
+
var consentRequest = obj4({ ...contextFields2, ...consentFields2 });
|
|
3915
|
+
var sessionRequest = obj4({ ...contextFields2, ...sessionFields });
|
|
3916
|
+
var authorizeRequest = import_zod4.z.union([obj4({ ...contextFields2, ...authorizeConsentedFields }), obj4({ ...contextFields2, ...authorizeDeclinedFields })]);
|
|
3917
|
+
var kycRequest = obj4({ ...contextFields2, ...kycFields2 });
|
|
3918
|
+
var placeOrderRequest = obj4({ ...contextFields2, ...placeOrderFields2 });
|
|
3919
|
+
var checkoutRequest = obj4({ ...contextFields2, ...checkoutFields });
|
|
3920
|
+
var orderRequest = obj4({ ...contextFields2, ...orderFields2 });
|
|
3921
|
+
var StripeObserveRequestSchema = observeRequest;
|
|
3922
|
+
var StripeConsentRequestSchema = consentRequest;
|
|
3923
|
+
var StripeSessionRequestSchema = sessionRequest;
|
|
3924
|
+
var StripeAuthorizeRequestSchema = authorizeRequest;
|
|
3925
|
+
var StripeKycRequestSchema = kycRequest;
|
|
3926
|
+
var StripePlaceOrderRequestSchema = placeOrderRequest;
|
|
3927
|
+
var StripeCheckoutRequestSchema = checkoutRequest;
|
|
3928
|
+
var StripeOrderRequestSchema = orderRequest;
|
|
3929
|
+
var request = import_zod4.z.union([observeRequest, consentRequest, sessionRequest, authorizeRequest, kycRequest, placeOrderRequest, checkoutRequest, orderRequest]);
|
|
3930
|
+
var StripeRequestSchema = request;
|
|
3931
|
+
var envelope2 = { provider: import_zod4.z.literal("STRIPE"), geo: FiatGeoSchema, ...contextFields2 };
|
|
3932
|
+
var nextRequest = import_zod4.z.union([
|
|
3933
|
+
obj4({ ...envelope2, ...observeFields2 }),
|
|
3934
|
+
obj4({ ...envelope2, ...consentFields2 }),
|
|
3935
|
+
obj4({ ...envelope2, ...sessionFields }),
|
|
3936
|
+
obj4({ ...envelope2, ...authorizeConsentedFields }),
|
|
3937
|
+
obj4({ ...envelope2, ...authorizeDeclinedFields }),
|
|
3938
|
+
obj4({ ...envelope2, ...kycFields2 }),
|
|
3939
|
+
obj4({ ...envelope2, ...placeOrderFields2 }),
|
|
3940
|
+
obj4({ ...envelope2, ...checkoutFields }),
|
|
3941
|
+
obj4({ ...envelope2, ...orderFields2 })
|
|
3942
|
+
]);
|
|
3943
|
+
var StripeNextRequestSchema = nextRequest;
|
|
3944
|
+
var price = obj4({ total: FiatAmountSchema, fees: import_zod4.z.array(FeeLineSchema), cryptoAmount: nonEmpty });
|
|
3945
|
+
var StripePriceSchema = price;
|
|
3946
|
+
var paySheet = obj4({
|
|
3947
|
+
destinationCurrency: nonEmpty,
|
|
3948
|
+
destinationNetwork: nonEmpty,
|
|
3949
|
+
walletAddress: nonEmpty,
|
|
3950
|
+
merchantCountryCode: import_zod4.z.literal("US"),
|
|
3951
|
+
currencyCode: import_zod4.z.literal("USD"),
|
|
3952
|
+
amount: usdAmount,
|
|
3953
|
+
label: nonEmpty
|
|
3954
|
+
});
|
|
3955
|
+
var StripePaySheetSchema = paySheet;
|
|
3956
|
+
var linkAuthToken = obj4({ clientSecret: nonEmpty, expiresAt: instant });
|
|
3957
|
+
var StripeLinkAuthTokenSchema = linkAuthToken;
|
|
3958
|
+
var reask = obj4({
|
|
3959
|
+
requirements: import_zod4.z.array(KycFieldIdSchema).min(1).refine(hasUniqueIds4, "requirements must be unique"),
|
|
3960
|
+
reason: import_zod4.z.enum(["REJECTED"]).nullable()
|
|
3961
|
+
});
|
|
3962
|
+
var StripeReaskSchema = reask;
|
|
3963
|
+
var consentShape = obj4({ next: import_zod4.z.literal("consent"), documents: import_zod4.z.array(TermsDocumentSchema).min(1) });
|
|
3964
|
+
var sessionNextAction = obj4({ next: import_zod4.z.literal("session") });
|
|
3965
|
+
var authorizeNextAction = obj4({ next: import_zod4.z.literal("authorize"), linkAuthIntentId: nonEmpty, expiresAt: instant });
|
|
3966
|
+
var kycShape = obj4({
|
|
3967
|
+
next: import_zod4.z.literal("kyc"),
|
|
3968
|
+
round: import_zod4.z.enum(["ACCOUNT", "IDENTITY"]),
|
|
3969
|
+
tier: import_zod4.z.enum(["l0", "l1"]),
|
|
3970
|
+
correctionRound,
|
|
3971
|
+
fields: import_zod4.z.array(FormFieldSchema),
|
|
3972
|
+
heldValues: kycValues,
|
|
3973
|
+
verifiedEmail: nonEmpty.nullable(),
|
|
3974
|
+
linkAuthToken: linkAuthToken.nullable(),
|
|
3975
|
+
fieldErrors: import_zod4.z.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
|
|
3976
|
+
reask: reask.nullable()
|
|
3977
|
+
});
|
|
3978
|
+
var verifyIdentityNextAction = obj4({ next: import_zod4.z.literal("verifyIdentity"), linkAuthToken: linkAuthToken.nullable() });
|
|
3979
|
+
var waitNextAction = obj4({ next: import_zod4.z.literal("wait"), retryAfterMs });
|
|
3980
|
+
var placeOrderNextAction = obj4({
|
|
3981
|
+
next: import_zod4.z.literal("placeOrder"),
|
|
3982
|
+
orderId: mintedOrderId,
|
|
3983
|
+
price,
|
|
3984
|
+
paySheet,
|
|
3985
|
+
linkAuthToken: linkAuthToken.nullable()
|
|
3986
|
+
});
|
|
3987
|
+
var payNextAction = obj4({ next: import_zod4.z.literal("pay"), orderId: mintedOrderId, sessionId: nonEmpty, linkAuthToken: linkAuthToken.nullable() });
|
|
3988
|
+
var checkoutSecretNextAction = obj4({ next: import_zod4.z.literal("checkoutSecret"), clientSecret: nonEmpty });
|
|
3989
|
+
var orderPendingNextAction = obj4({
|
|
3990
|
+
next: import_zod4.z.literal("orderPending"),
|
|
3991
|
+
orderId: mintedOrderId,
|
|
3992
|
+
retryAfterMs,
|
|
3993
|
+
order: FiatStepResponseSchema.nullable()
|
|
3994
|
+
});
|
|
3995
|
+
var checkConsent3 = (nextAction, context2) => {
|
|
3996
|
+
if (!hasUniqueIds4(nextAction.documents.map((document) => document.id))) {
|
|
3997
|
+
context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
3998
|
+
}
|
|
3999
|
+
};
|
|
4000
|
+
var checkKyc3 = (nextAction, context2) => {
|
|
4001
|
+
const fieldIds = nextAction.fields.map((field) => field.id);
|
|
4002
|
+
if (!hasUniqueIds4(fieldIds)) {
|
|
4003
|
+
context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
|
|
4004
|
+
}
|
|
4005
|
+
if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
|
|
4006
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
|
|
4007
|
+
}
|
|
4008
|
+
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
4009
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
4010
|
+
}
|
|
4011
|
+
if (nextAction.round === "ACCOUNT" !== (nextAction.verifiedEmail !== null)) {
|
|
4012
|
+
context2.addIssue({ code: "custom", path: ["verifiedEmail"], message: "only the account round carries the verified email" });
|
|
4013
|
+
}
|
|
4014
|
+
};
|
|
4015
|
+
var checkPlaceOrder = (nextAction, context2) => {
|
|
4016
|
+
if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
|
|
4017
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "amount"], message: "the sheet charges the price shown" });
|
|
4018
|
+
}
|
|
4019
|
+
};
|
|
4020
|
+
var StripeConsentNextActionSchema = consentShape.superRefine(checkConsent3);
|
|
4021
|
+
var StripeSessionNextActionSchema = sessionNextAction;
|
|
4022
|
+
var StripeAuthorizeNextActionSchema = authorizeNextAction;
|
|
4023
|
+
var StripeKycNextActionSchema = kycShape.superRefine(checkKyc3);
|
|
4024
|
+
var StripeVerifyIdentityNextActionSchema = verifyIdentityNextAction;
|
|
4025
|
+
var StripeWaitNextActionSchema = waitNextAction;
|
|
4026
|
+
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
4027
|
+
var StripePayNextActionSchema = payNextAction;
|
|
4028
|
+
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
4029
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
4030
|
+
var checkNextAction3 = (response, context2) => {
|
|
4031
|
+
if (response.next === "consent") checkConsent3(response, context2);
|
|
4032
|
+
if (response.next === "kyc") checkKyc3(response, context2);
|
|
4033
|
+
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
4034
|
+
};
|
|
4035
|
+
var nextActionOptions = [
|
|
4036
|
+
consentShape,
|
|
4037
|
+
sessionNextAction,
|
|
4038
|
+
authorizeNextAction,
|
|
4039
|
+
kycShape,
|
|
4040
|
+
verifyIdentityNextAction,
|
|
4041
|
+
waitNextAction,
|
|
4042
|
+
placeOrderNextAction,
|
|
4043
|
+
payNextAction,
|
|
4044
|
+
orderPendingNextAction
|
|
4045
|
+
];
|
|
4046
|
+
var anyNextAction = import_zod4.z.discriminatedUnion("next", [...nextActionOptions]).superRefine(checkNextAction3);
|
|
4047
|
+
var StripeNextActionSchema = anyNextAction;
|
|
4048
|
+
var done = obj4({ next: import_zod4.z.literal("done"), order: FiatStepResponseSchema });
|
|
4049
|
+
var StripeDoneSchema = done;
|
|
4050
|
+
var refused = import_zod4.z.union([
|
|
4051
|
+
obj4({
|
|
4052
|
+
next: import_zod4.z.literal("refused"),
|
|
4053
|
+
reason: import_zod4.z.enum(["NOT_ELIGIBLE", "KYC_REJECTED", "FINAL_REJECTION", "TOTAL_MISMATCH"]),
|
|
4054
|
+
recovery: import_zod4.z.enum(["REQUOTE", "NONE"])
|
|
4055
|
+
}),
|
|
4056
|
+
obj4({
|
|
4057
|
+
next: import_zod4.z.literal("refused"),
|
|
4058
|
+
reason: import_zod4.z.literal("LIMITS_EXCEEDED"),
|
|
4059
|
+
recovery: import_zod4.z.literal("REQUOTE"),
|
|
4060
|
+
maxAmount: FiatAmountSchema.nullable()
|
|
4061
|
+
})
|
|
4062
|
+
]);
|
|
4063
|
+
var StripeRefusedSchema = refused;
|
|
4064
|
+
var stepResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next", [...nextActionOptions, done]), refused]).superRefine(checkNextAction3);
|
|
4065
|
+
var StripeStepResponseSchema = stepResponse;
|
|
4066
|
+
var checkoutResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
4067
|
+
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
4068
|
+
var orderResponse = import_zod4.z.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
4069
|
+
var StripeOrderResponseSchema = orderResponse;
|
|
4070
|
+
var StripeResponseSchemaFor = {
|
|
4071
|
+
observe: StripeStepResponseSchema,
|
|
4072
|
+
consent: StripeStepResponseSchema,
|
|
4073
|
+
session: StripeStepResponseSchema,
|
|
4074
|
+
authorize: StripeStepResponseSchema,
|
|
4075
|
+
kyc: StripeStepResponseSchema,
|
|
4076
|
+
placeOrder: StripeStepResponseSchema,
|
|
4077
|
+
checkout: StripeCheckoutResponseSchema,
|
|
4078
|
+
order: StripeOrderResponseSchema
|
|
4079
|
+
};
|
|
4080
|
+
var faultFields2 = {
|
|
4081
|
+
reason: import_zod4.z.enum(["SESSION_BUDGET_SPENT", "RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
|
|
4082
|
+
recovery: import_zod4.z.enum(["RETRY", "REQUOTE", "NONE"])
|
|
4083
|
+
};
|
|
4084
|
+
var fault = obj4(faultFields2);
|
|
4085
|
+
var StripeFaultSchema = fault;
|
|
4086
|
+
var errorBody = obj4({
|
|
4087
|
+
...faultFields2,
|
|
4088
|
+
errorCode: nonEmpty,
|
|
4089
|
+
errorMsg: import_zod4.z.string(),
|
|
4090
|
+
reqId: import_zod4.z.string().optional(),
|
|
4091
|
+
retryAfterSeconds: import_zod4.z.number().int().nonnegative().optional()
|
|
4092
|
+
});
|
|
4093
|
+
var StripeErrorBodySchema = errorBody;
|
|
4094
|
+
|
|
4095
|
+
// src/providers/moonpay-guest.schemas.ts
|
|
4096
|
+
var import_zod5 = require("zod");
|
|
4097
|
+
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
4098
|
+
var obj5 = (shape) => import_zod5.z.object(shape).strict();
|
|
4099
|
+
var nonEmpty2 = import_zod5.z.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
3832
4100
|
var actions = [
|
|
3833
|
-
{ action:
|
|
3834
|
-
{ action:
|
|
3835
|
-
{ action:
|
|
3836
|
-
{ action:
|
|
3837
|
-
{ action:
|
|
3838
|
-
{ action:
|
|
3839
|
-
{ action:
|
|
3840
|
-
{ action:
|
|
4101
|
+
{ action: import_zod5.z.literal("observe") },
|
|
4102
|
+
{ action: import_zod5.z.literal("session") },
|
|
4103
|
+
{ action: import_zod5.z.literal("consent"), acceptances: import_zod5.z.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
|
|
4104
|
+
{ action: import_zod5.z.literal("order"), orderId: nonEmpty2, quotedAmount: FiatAmountSchema, transactionId: nonEmpty2.optional() },
|
|
4105
|
+
{ action: import_zod5.z.literal("phone"), phoneNumber: import_zod5.z.string().regex(/^\+[1-9]\d{1,14}$/) },
|
|
4106
|
+
{ action: import_zod5.z.literal("phone"), resend: nonEmpty2 },
|
|
4107
|
+
{ action: import_zod5.z.literal("phoneCode"), verificationRef: nonEmpty2, otpCode: import_zod5.z.string().regex(/^\d{6}$/) },
|
|
4108
|
+
{ action: import_zod5.z.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
|
|
3841
4109
|
];
|
|
3842
|
-
var MoonPayGuestObserveRequestSchema =
|
|
3843
|
-
var MoonPayGuestSessionRequestSchema =
|
|
3844
|
-
var MoonPayGuestConsentRequestSchema =
|
|
3845
|
-
var MoonPayGuestOrderRequestSchema =
|
|
3846
|
-
var MoonPayGuestPhoneNumberRequestSchema =
|
|
3847
|
-
var MoonPayGuestPhoneResendRequestSchema =
|
|
3848
|
-
var MoonPayGuestPhoneCodeRequestSchema =
|
|
3849
|
-
var MoonPayGuestDeclineRequestSchema =
|
|
3850
|
-
var MoonPayGuestPhoneRequestSchema =
|
|
3851
|
-
var MoonPayGuestRequestSchema =
|
|
4110
|
+
var MoonPayGuestObserveRequestSchema = obj5({ ...context, ...actions[0] });
|
|
4111
|
+
var MoonPayGuestSessionRequestSchema = obj5({ ...context, ...actions[1] });
|
|
4112
|
+
var MoonPayGuestConsentRequestSchema = obj5({ ...context, ...actions[2] });
|
|
4113
|
+
var MoonPayGuestOrderRequestSchema = obj5({ ...context, ...actions[3] });
|
|
4114
|
+
var MoonPayGuestPhoneNumberRequestSchema = obj5({ ...context, ...actions[4] });
|
|
4115
|
+
var MoonPayGuestPhoneResendRequestSchema = obj5({ ...context, ...actions[5] });
|
|
4116
|
+
var MoonPayGuestPhoneCodeRequestSchema = obj5({ ...context, ...actions[6] });
|
|
4117
|
+
var MoonPayGuestDeclineRequestSchema = obj5({ ...context, ...actions[7] });
|
|
4118
|
+
var MoonPayGuestPhoneRequestSchema = import_zod5.z.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
|
|
4119
|
+
var MoonPayGuestRequestSchema = import_zod5.z.union([
|
|
3852
4120
|
MoonPayGuestObserveRequestSchema,
|
|
3853
4121
|
MoonPayGuestSessionRequestSchema,
|
|
3854
4122
|
MoonPayGuestConsentRequestSchema,
|
|
@@ -3858,22 +4126,22 @@ var MoonPayGuestRequestSchema = import_zod4.z.union([
|
|
|
3858
4126
|
MoonPayGuestPhoneCodeRequestSchema,
|
|
3859
4127
|
MoonPayGuestDeclineRequestSchema
|
|
3860
4128
|
]);
|
|
3861
|
-
var MoonPayGuestNextRequestSchema =
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
4129
|
+
var MoonPayGuestNextRequestSchema = import_zod5.z.union([
|
|
4130
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[0] }),
|
|
4131
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[1] }),
|
|
4132
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[2] }),
|
|
4133
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[3] }),
|
|
4134
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[4] }),
|
|
4135
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[5] }),
|
|
4136
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[6] }),
|
|
4137
|
+
obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[7] })
|
|
3870
4138
|
]);
|
|
3871
|
-
var MoonPayGuestStepResponseSchema =
|
|
4139
|
+
var MoonPayGuestStepResponseSchema = import_zod5.z.union([
|
|
3872
4140
|
MoonPayConsentNextActionSchema,
|
|
3873
4141
|
MoonPaySessionNextActionSchema,
|
|
3874
4142
|
MoonPayPhoneNextActionSchema,
|
|
3875
4143
|
MoonPayPhoneCodeNextActionSchema,
|
|
3876
4144
|
MoonPayPayNextActionSchema,
|
|
3877
|
-
|
|
4145
|
+
obj5({ next: import_zod5.z.literal("refused"), reason: import_zod5.z.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: import_zod5.z.enum(["REQUOTE", "NONE"]) })
|
|
3878
4146
|
]);
|
|
3879
|
-
var MoonPayGuestResponseSchema =
|
|
4147
|
+
var MoonPayGuestResponseSchema = import_zod5.z.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
|