@fun-xyz/fiat-contract 0.43.0 → 0.44.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-6O7Z7WYW.mjs → chunk-XENZL32Y.mjs} +1 -1
- package/dist/index.js +62 -9
- package/dist/index.mjs +62 -9
- package/dist/providers/moonpay.d.ts +38 -5
- package/dist/providers/moonpay.schemas.d.ts +5 -1
- package/dist/routing.d.ts +7 -1
- package/dist/schemas.d.ts +2 -1
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +11 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -83,6 +83,7 @@ __export(index_exports, {
|
|
|
83
83
|
FiatCurrencyCode: () => FiatCurrencyCode,
|
|
84
84
|
FiatEndpointSchema: () => FiatEndpointSchema,
|
|
85
85
|
FiatGeoSchema: () => FiatGeoSchema,
|
|
86
|
+
FiatHandoffPathSchema: () => FiatHandoffPathSchema,
|
|
86
87
|
FiatNextRequestSchema: () => FiatNextRequestSchema,
|
|
87
88
|
FiatProviderSchema: () => FiatProviderSchema,
|
|
88
89
|
FiatRoutingQuoteErrorBodySchema: () => FiatRoutingQuoteErrorBodySchema,
|
|
@@ -124,9 +125,11 @@ __export(index_exports, {
|
|
|
124
125
|
MoonPayConnectRequestSchema: () => MoonPayConnectRequestSchema,
|
|
125
126
|
MoonPayConsentNextActionSchema: () => MoonPayConsentNextActionSchema,
|
|
126
127
|
MoonPayConsentRequestSchema: () => MoonPayConsentRequestSchema,
|
|
128
|
+
MoonPayDeclineRequestSchema: () => MoonPayDeclineRequestSchema,
|
|
127
129
|
MoonPayDoneSchema: () => MoonPayDoneSchema,
|
|
128
130
|
MoonPayErrorBodySchema: () => MoonPayErrorBodySchema,
|
|
129
131
|
MoonPayFaultSchema: () => MoonPayFaultSchema,
|
|
132
|
+
MoonPayGuestDeclineReasonSchema: () => MoonPayGuestDeclineReasonSchema,
|
|
130
133
|
MoonPayKycNextActionSchema: () => MoonPayKycNextActionSchema,
|
|
131
134
|
MoonPayKycRequestSchema: () => MoonPayKycRequestSchema,
|
|
132
135
|
MoonPayNextActionSchema: () => MoonPayNextActionSchema,
|
|
@@ -136,6 +139,8 @@ __export(index_exports, {
|
|
|
136
139
|
MoonPayOrderPendingNextActionSchema: () => MoonPayOrderPendingNextActionSchema,
|
|
137
140
|
MoonPayOrderRequestSchema: () => MoonPayOrderRequestSchema,
|
|
138
141
|
MoonPayOrderResponseSchema: () => MoonPayOrderResponseSchema,
|
|
142
|
+
MoonPayPathSchema: () => MoonPayPathSchema,
|
|
143
|
+
MoonPayPayNextActionSchema: () => MoonPayPayNextActionSchema,
|
|
139
144
|
MoonPayPrepareCaptureNextActionSchema: () => MoonPayPrepareCaptureNextActionSchema,
|
|
140
145
|
MoonPayPrepareCaptureRequestSchema: () => MoonPayPrepareCaptureRequestSchema,
|
|
141
146
|
MoonPayQuoteInputSchema: () => MoonPayQuoteInputSchema,
|
|
@@ -566,6 +571,10 @@ var $provider = import_zod.z.enum([
|
|
|
566
571
|
"CROSSMINT"
|
|
567
572
|
]);
|
|
568
573
|
var FiatProviderSchema = $provider;
|
|
574
|
+
var HANDOFF_PATHS = ["MOONPAY/guest_checkout"];
|
|
575
|
+
var $handoffPath = import_zod.z.enum(HANDOFF_PATHS);
|
|
576
|
+
var FiatHandoffPathSchema = $handoffPath;
|
|
577
|
+
var $handoffPathName = import_zod.z.literal("guest_checkout");
|
|
569
578
|
var $kycProvider = import_zod.z.enum(["SUMSUB"]);
|
|
570
579
|
var KYCProviderSchema = $kycProvider;
|
|
571
580
|
var $surfaceProvider = import_zod.z.enum([...$provider.options, ...$kycProvider.options]);
|
|
@@ -1221,7 +1230,8 @@ var $routingQuoteTermsShape = {
|
|
|
1221
1230
|
),
|
|
1222
1231
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1223
1232
|
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1224
|
-
destinationAsset: $destinationAsset.optional()
|
|
1233
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1234
|
+
handoffPaths: import_zod.z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1225
1235
|
};
|
|
1226
1236
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1227
1237
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1314,7 +1324,7 @@ var $providerBoundStepResponse = obj({
|
|
|
1314
1324
|
state: $providerBoundFlowState,
|
|
1315
1325
|
provider: $provider,
|
|
1316
1326
|
preparedPayment: $preparedPayment.optional(),
|
|
1317
|
-
handoff: obj({ provider: $provider }).optional()
|
|
1327
|
+
handoff: obj({ provider: $provider, path: $handoffPathName.optional() }).optional()
|
|
1318
1328
|
}).superRefine((response, context) => {
|
|
1319
1329
|
if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
|
|
1320
1330
|
context.addIssue({
|
|
@@ -1330,6 +1340,13 @@ var $providerBoundStepResponse = obj({
|
|
|
1330
1340
|
message: "handoff.provider must match the response provider"
|
|
1331
1341
|
});
|
|
1332
1342
|
}
|
|
1343
|
+
if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
|
|
1344
|
+
context.addIssue({
|
|
1345
|
+
code: "custom",
|
|
1346
|
+
path: ["handoff", "path"],
|
|
1347
|
+
message: "handoff.path must name a handoff path of handoff.provider"
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1333
1350
|
if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
|
|
1334
1351
|
context.addIssue({
|
|
1335
1352
|
code: "custom",
|
|
@@ -1380,7 +1397,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1380
1397
|
var FiatStepResponseSchema = $stepResponse;
|
|
1381
1398
|
|
|
1382
1399
|
// package.json
|
|
1383
|
-
var version = "0.
|
|
1400
|
+
var version = "0.44.0";
|
|
1384
1401
|
|
|
1385
1402
|
// src/table.ts
|
|
1386
1403
|
var TABLE_VERSION = version;
|
|
@@ -3389,7 +3406,14 @@ var $checkout = obj2({
|
|
|
3389
3406
|
var MoonPayCheckoutSchema = $checkout;
|
|
3390
3407
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
3391
3408
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
3392
|
-
var $
|
|
3409
|
+
var $path = import_zod2.z.literal("guest_checkout");
|
|
3410
|
+
var MoonPayPathSchema = $path;
|
|
3411
|
+
var $context = {
|
|
3412
|
+
checkout: $checkout,
|
|
3413
|
+
credentials: $credentials.optional(),
|
|
3414
|
+
destinationAsset: DestinationAssetSchema.optional(),
|
|
3415
|
+
path: $path.optional()
|
|
3416
|
+
};
|
|
3393
3417
|
var $requestContext = obj2($context);
|
|
3394
3418
|
var MoonPayRequestContextSchema = $requestContext;
|
|
3395
3419
|
var $quoteInput = obj2({
|
|
@@ -3407,6 +3431,9 @@ var $consentFields = {
|
|
|
3407
3431
|
};
|
|
3408
3432
|
var $sessionFields = { action: import_zod2.z.literal("session") };
|
|
3409
3433
|
var $connectFields = { action: import_zod2.z.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
|
|
3434
|
+
var $guestDeclineReason = import_zod2.z.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
|
|
3435
|
+
var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
|
|
3436
|
+
var $declineFields = { action: import_zod2.z.literal("decline"), reason: $guestDeclineReason };
|
|
3410
3437
|
var $kycFields = {
|
|
3411
3438
|
action: import_zod2.z.literal("kyc"),
|
|
3412
3439
|
credentials: $credentials,
|
|
@@ -3419,6 +3446,7 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
|
|
|
3419
3446
|
var $consentRequest = obj2({ ...$context, ...$consentFields });
|
|
3420
3447
|
var $sessionRequest = obj2({ ...$context, ...$sessionFields });
|
|
3421
3448
|
var $connectRequest = obj2({ ...$context, ...$connectFields });
|
|
3449
|
+
var $declineRequest = obj2({ ...$context, ...$declineFields });
|
|
3422
3450
|
var $kycRequest = obj2({ ...$context, ...$kycFields });
|
|
3423
3451
|
var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
|
|
3424
3452
|
var $captureRequest = obj2({ ...$context, ...$captureFields });
|
|
@@ -3427,11 +3455,22 @@ var MoonPayObserveRequestSchema = $observeRequest;
|
|
|
3427
3455
|
var MoonPayConsentRequestSchema = $consentRequest;
|
|
3428
3456
|
var MoonPaySessionRequestSchema = $sessionRequest;
|
|
3429
3457
|
var MoonPayConnectRequestSchema = $connectRequest;
|
|
3458
|
+
var MoonPayDeclineRequestSchema = $declineRequest;
|
|
3430
3459
|
var MoonPayKycRequestSchema = $kycRequest;
|
|
3431
3460
|
var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
|
|
3432
3461
|
var MoonPayCaptureRequestSchema = $captureRequest;
|
|
3433
3462
|
var MoonPayOrderRequestSchema = $orderRequest;
|
|
3434
|
-
var $request = import_zod2.z.discriminatedUnion("action", [
|
|
3463
|
+
var $request = import_zod2.z.discriminatedUnion("action", [
|
|
3464
|
+
$observeRequest,
|
|
3465
|
+
$consentRequest,
|
|
3466
|
+
$sessionRequest,
|
|
3467
|
+
$connectRequest,
|
|
3468
|
+
$declineRequest,
|
|
3469
|
+
$kycRequest,
|
|
3470
|
+
$prepareCaptureRequest,
|
|
3471
|
+
$captureRequest,
|
|
3472
|
+
$orderRequest
|
|
3473
|
+
]);
|
|
3435
3474
|
var MoonPayRequestSchema = $request;
|
|
3436
3475
|
var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
3437
3476
|
var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
|
|
@@ -3439,6 +3478,7 @@ var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
|
|
|
3439
3478
|
obj2({ ...$envelope, ...$consentFields }),
|
|
3440
3479
|
obj2({ ...$envelope, ...$sessionFields }),
|
|
3441
3480
|
obj2({ ...$envelope, ...$connectFields }),
|
|
3481
|
+
obj2({ ...$envelope, ...$declineFields }),
|
|
3442
3482
|
obj2({ ...$envelope, ...$kycFields }),
|
|
3443
3483
|
obj2({ ...$envelope, ...$prepareCaptureFields }),
|
|
3444
3484
|
obj2({ ...$envelope, ...$captureFields }),
|
|
@@ -3455,6 +3495,7 @@ var $connectNextAction = obj2({
|
|
|
3455
3495
|
quoteInput: $quoteInput,
|
|
3456
3496
|
resetConnection: import_zod2.z.literal(true).optional()
|
|
3457
3497
|
});
|
|
3498
|
+
var $payNextAction = obj2({ next: import_zod2.z.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
3458
3499
|
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
3459
3500
|
var $captureDocument = import_zod2.z.enum(CAPTURE_DOCUMENTS);
|
|
3460
3501
|
var $reaskRequirement = import_zod2.z.union([KycFieldIdSchema, $captureDocument]);
|
|
@@ -3514,6 +3555,7 @@ var checkCapture = (nextAction, context) => {
|
|
|
3514
3555
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
3515
3556
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
3516
3557
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
3558
|
+
var MoonPayPayNextActionSchema = $payNextAction;
|
|
3517
3559
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
3518
3560
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
3519
3561
|
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
@@ -3529,7 +3571,17 @@ var checkNextAction = (response, context) => {
|
|
|
3529
3571
|
if (response.next === "kyc") checkKyc(response, context);
|
|
3530
3572
|
if (response.next === "capture") checkCapture(response, context);
|
|
3531
3573
|
};
|
|
3532
|
-
var $nextActionOptions = [
|
|
3574
|
+
var $nextActionOptions = [
|
|
3575
|
+
$consentShape,
|
|
3576
|
+
$sessionNextAction,
|
|
3577
|
+
$connectNextAction,
|
|
3578
|
+
$payNextAction,
|
|
3579
|
+
$kycShape,
|
|
3580
|
+
$prepareCaptureNextAction,
|
|
3581
|
+
$captureShape,
|
|
3582
|
+
$waitNextAction,
|
|
3583
|
+
$orderNextAction
|
|
3584
|
+
];
|
|
3533
3585
|
var $nextAction = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
3534
3586
|
var MoonPayNextActionSchema = $nextAction;
|
|
3535
3587
|
var $done = obj2({ next: import_zod2.z.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -3553,6 +3605,7 @@ var MoonPayResponseSchemaFor = {
|
|
|
3553
3605
|
consent: MoonPayStepResponseSchema,
|
|
3554
3606
|
session: MoonPayStepResponseSchema,
|
|
3555
3607
|
connect: MoonPayStepResponseSchema,
|
|
3608
|
+
decline: MoonPayStepResponseSchema,
|
|
3556
3609
|
kyc: MoonPayStepResponseSchema,
|
|
3557
3610
|
prepareCapture: MoonPayStepResponseSchema,
|
|
3558
3611
|
capture: MoonPayStepResponseSchema,
|
|
@@ -3667,7 +3720,7 @@ var $kycShape2 = obj3({
|
|
|
3667
3720
|
});
|
|
3668
3721
|
var $waitNextAction2 = obj3({ next: import_zod3.z.literal("wait"), retryAfterMs: $retryAfterMs });
|
|
3669
3722
|
var $placeOrderNextAction = obj3({ next: import_zod3.z.literal("placeOrder"), price: $price, orderId: $nonEmpty2 });
|
|
3670
|
-
var $
|
|
3723
|
+
var $payNextAction2 = obj3({
|
|
3671
3724
|
next: import_zod3.z.literal("pay"),
|
|
3672
3725
|
orderId: $nonEmpty2,
|
|
3673
3726
|
price: $price,
|
|
@@ -3704,7 +3757,7 @@ var CoinbaseOtpNextActionSchema = $otpNextAction;
|
|
|
3704
3757
|
var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
3705
3758
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
3706
3759
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
3707
|
-
var CoinbasePayNextActionSchema = $
|
|
3760
|
+
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
3708
3761
|
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
3709
3762
|
var checkNextAction2 = (response, context) => {
|
|
3710
3763
|
if (response.next === "consent") checkConsent2(response, context);
|
|
@@ -3717,7 +3770,7 @@ var $nextActionOptions2 = [
|
|
|
3717
3770
|
$kycShape2,
|
|
3718
3771
|
$waitNextAction2,
|
|
3719
3772
|
$placeOrderNextAction,
|
|
3720
|
-
$
|
|
3773
|
+
$payNextAction2,
|
|
3721
3774
|
$orderPendingNextAction2
|
|
3722
3775
|
];
|
|
3723
3776
|
var $nextAction2 = import_zod3.z.discriminatedUnion("next", [...$nextActionOptions2]).superRefine(checkNextAction2);
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
tableEntry,
|
|
14
14
|
unofferedEndpoints,
|
|
15
15
|
unreachableStates
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XENZL32Y.mjs";
|
|
17
17
|
import {
|
|
18
18
|
MOONPAY_ENDPOINTS
|
|
19
19
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -382,6 +382,10 @@ var $provider = z.enum([
|
|
|
382
382
|
"CROSSMINT"
|
|
383
383
|
]);
|
|
384
384
|
var FiatProviderSchema = $provider;
|
|
385
|
+
var HANDOFF_PATHS = ["MOONPAY/guest_checkout"];
|
|
386
|
+
var $handoffPath = z.enum(HANDOFF_PATHS);
|
|
387
|
+
var FiatHandoffPathSchema = $handoffPath;
|
|
388
|
+
var $handoffPathName = z.literal("guest_checkout");
|
|
385
389
|
var $kycProvider = z.enum(["SUMSUB"]);
|
|
386
390
|
var KYCProviderSchema = $kycProvider;
|
|
387
391
|
var $surfaceProvider = z.enum([...$provider.options, ...$kycProvider.options]);
|
|
@@ -1037,7 +1041,8 @@ var $routingQuoteTermsShape = {
|
|
|
1037
1041
|
),
|
|
1038
1042
|
prepareSessionAuth: z.boolean().optional(),
|
|
1039
1043
|
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
1040
|
-
destinationAsset: $destinationAsset.optional()
|
|
1044
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1045
|
+
handoffPaths: z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1041
1046
|
};
|
|
1042
1047
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1043
1048
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1130,7 +1135,7 @@ var $providerBoundStepResponse = obj({
|
|
|
1130
1135
|
state: $providerBoundFlowState,
|
|
1131
1136
|
provider: $provider,
|
|
1132
1137
|
preparedPayment: $preparedPayment.optional(),
|
|
1133
|
-
handoff: obj({ provider: $provider }).optional()
|
|
1138
|
+
handoff: obj({ provider: $provider, path: $handoffPathName.optional() }).optional()
|
|
1134
1139
|
}).superRefine((response, context) => {
|
|
1135
1140
|
if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
|
|
1136
1141
|
context.addIssue({
|
|
@@ -1146,6 +1151,13 @@ var $providerBoundStepResponse = obj({
|
|
|
1146
1151
|
message: "handoff.provider must match the response provider"
|
|
1147
1152
|
});
|
|
1148
1153
|
}
|
|
1154
|
+
if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
|
|
1155
|
+
context.addIssue({
|
|
1156
|
+
code: "custom",
|
|
1157
|
+
path: ["handoff", "path"],
|
|
1158
|
+
message: "handoff.path must name a handoff path of handoff.provider"
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1149
1161
|
if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
|
|
1150
1162
|
context.addIssue({
|
|
1151
1163
|
code: "custom",
|
|
@@ -2532,7 +2544,14 @@ var $checkout = obj2({
|
|
|
2532
2544
|
var MoonPayCheckoutSchema = $checkout;
|
|
2533
2545
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2534
2546
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2535
|
-
var $
|
|
2547
|
+
var $path = z2.literal("guest_checkout");
|
|
2548
|
+
var MoonPayPathSchema = $path;
|
|
2549
|
+
var $context = {
|
|
2550
|
+
checkout: $checkout,
|
|
2551
|
+
credentials: $credentials.optional(),
|
|
2552
|
+
destinationAsset: DestinationAssetSchema.optional(),
|
|
2553
|
+
path: $path.optional()
|
|
2554
|
+
};
|
|
2536
2555
|
var $requestContext = obj2($context);
|
|
2537
2556
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2538
2557
|
var $quoteInput = obj2({
|
|
@@ -2550,6 +2569,9 @@ var $consentFields = {
|
|
|
2550
2569
|
};
|
|
2551
2570
|
var $sessionFields = { action: z2.literal("session") };
|
|
2552
2571
|
var $connectFields = { action: z2.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
|
|
2572
|
+
var $guestDeclineReason = z2.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
|
|
2573
|
+
var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
|
|
2574
|
+
var $declineFields = { action: z2.literal("decline"), reason: $guestDeclineReason };
|
|
2553
2575
|
var $kycFields = {
|
|
2554
2576
|
action: z2.literal("kyc"),
|
|
2555
2577
|
credentials: $credentials,
|
|
@@ -2562,6 +2584,7 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
|
|
|
2562
2584
|
var $consentRequest = obj2({ ...$context, ...$consentFields });
|
|
2563
2585
|
var $sessionRequest = obj2({ ...$context, ...$sessionFields });
|
|
2564
2586
|
var $connectRequest = obj2({ ...$context, ...$connectFields });
|
|
2587
|
+
var $declineRequest = obj2({ ...$context, ...$declineFields });
|
|
2565
2588
|
var $kycRequest = obj2({ ...$context, ...$kycFields });
|
|
2566
2589
|
var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
|
|
2567
2590
|
var $captureRequest = obj2({ ...$context, ...$captureFields });
|
|
@@ -2570,11 +2593,22 @@ var MoonPayObserveRequestSchema = $observeRequest;
|
|
|
2570
2593
|
var MoonPayConsentRequestSchema = $consentRequest;
|
|
2571
2594
|
var MoonPaySessionRequestSchema = $sessionRequest;
|
|
2572
2595
|
var MoonPayConnectRequestSchema = $connectRequest;
|
|
2596
|
+
var MoonPayDeclineRequestSchema = $declineRequest;
|
|
2573
2597
|
var MoonPayKycRequestSchema = $kycRequest;
|
|
2574
2598
|
var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
|
|
2575
2599
|
var MoonPayCaptureRequestSchema = $captureRequest;
|
|
2576
2600
|
var MoonPayOrderRequestSchema = $orderRequest;
|
|
2577
|
-
var $request = z2.discriminatedUnion("action", [
|
|
2601
|
+
var $request = z2.discriminatedUnion("action", [
|
|
2602
|
+
$observeRequest,
|
|
2603
|
+
$consentRequest,
|
|
2604
|
+
$sessionRequest,
|
|
2605
|
+
$connectRequest,
|
|
2606
|
+
$declineRequest,
|
|
2607
|
+
$kycRequest,
|
|
2608
|
+
$prepareCaptureRequest,
|
|
2609
|
+
$captureRequest,
|
|
2610
|
+
$orderRequest
|
|
2611
|
+
]);
|
|
2578
2612
|
var MoonPayRequestSchema = $request;
|
|
2579
2613
|
var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
2580
2614
|
var $nextRequest2 = z2.discriminatedUnion("action", [
|
|
@@ -2582,6 +2616,7 @@ var $nextRequest2 = z2.discriminatedUnion("action", [
|
|
|
2582
2616
|
obj2({ ...$envelope, ...$consentFields }),
|
|
2583
2617
|
obj2({ ...$envelope, ...$sessionFields }),
|
|
2584
2618
|
obj2({ ...$envelope, ...$connectFields }),
|
|
2619
|
+
obj2({ ...$envelope, ...$declineFields }),
|
|
2585
2620
|
obj2({ ...$envelope, ...$kycFields }),
|
|
2586
2621
|
obj2({ ...$envelope, ...$prepareCaptureFields }),
|
|
2587
2622
|
obj2({ ...$envelope, ...$captureFields }),
|
|
@@ -2598,6 +2633,7 @@ var $connectNextAction = obj2({
|
|
|
2598
2633
|
quoteInput: $quoteInput,
|
|
2599
2634
|
resetConnection: z2.literal(true).optional()
|
|
2600
2635
|
});
|
|
2636
|
+
var $payNextAction = obj2({ next: z2.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
2601
2637
|
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
2602
2638
|
var $captureDocument = z2.enum(CAPTURE_DOCUMENTS);
|
|
2603
2639
|
var $reaskRequirement = z2.union([KycFieldIdSchema, $captureDocument]);
|
|
@@ -2657,6 +2693,7 @@ var checkCapture = (nextAction, context) => {
|
|
|
2657
2693
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
2658
2694
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
2659
2695
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
2696
|
+
var MoonPayPayNextActionSchema = $payNextAction;
|
|
2660
2697
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
2661
2698
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
2662
2699
|
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
@@ -2672,7 +2709,17 @@ var checkNextAction = (response, context) => {
|
|
|
2672
2709
|
if (response.next === "kyc") checkKyc(response, context);
|
|
2673
2710
|
if (response.next === "capture") checkCapture(response, context);
|
|
2674
2711
|
};
|
|
2675
|
-
var $nextActionOptions = [
|
|
2712
|
+
var $nextActionOptions = [
|
|
2713
|
+
$consentShape,
|
|
2714
|
+
$sessionNextAction,
|
|
2715
|
+
$connectNextAction,
|
|
2716
|
+
$payNextAction,
|
|
2717
|
+
$kycShape,
|
|
2718
|
+
$prepareCaptureNextAction,
|
|
2719
|
+
$captureShape,
|
|
2720
|
+
$waitNextAction,
|
|
2721
|
+
$orderNextAction
|
|
2722
|
+
];
|
|
2676
2723
|
var $nextAction = z2.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
2677
2724
|
var MoonPayNextActionSchema = $nextAction;
|
|
2678
2725
|
var $done = obj2({ next: z2.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -2696,6 +2743,7 @@ var MoonPayResponseSchemaFor = {
|
|
|
2696
2743
|
consent: MoonPayStepResponseSchema,
|
|
2697
2744
|
session: MoonPayStepResponseSchema,
|
|
2698
2745
|
connect: MoonPayStepResponseSchema,
|
|
2746
|
+
decline: MoonPayStepResponseSchema,
|
|
2699
2747
|
kyc: MoonPayStepResponseSchema,
|
|
2700
2748
|
prepareCapture: MoonPayStepResponseSchema,
|
|
2701
2749
|
capture: MoonPayStepResponseSchema,
|
|
@@ -2797,7 +2845,7 @@ var $kycShape2 = obj3({
|
|
|
2797
2845
|
});
|
|
2798
2846
|
var $waitNextAction2 = obj3({ next: z3.literal("wait"), retryAfterMs: $retryAfterMs });
|
|
2799
2847
|
var $placeOrderNextAction = obj3({ next: z3.literal("placeOrder"), price: $price, orderId: $nonEmpty2 });
|
|
2800
|
-
var $
|
|
2848
|
+
var $payNextAction2 = obj3({
|
|
2801
2849
|
next: z3.literal("pay"),
|
|
2802
2850
|
orderId: $nonEmpty2,
|
|
2803
2851
|
price: $price,
|
|
@@ -2834,7 +2882,7 @@ var CoinbaseOtpNextActionSchema = $otpNextAction;
|
|
|
2834
2882
|
var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
2835
2883
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
2836
2884
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
2837
|
-
var CoinbasePayNextActionSchema = $
|
|
2885
|
+
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
2838
2886
|
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
2839
2887
|
var checkNextAction2 = (response, context) => {
|
|
2840
2888
|
if (response.next === "consent") checkConsent2(response, context);
|
|
@@ -2847,7 +2895,7 @@ var $nextActionOptions2 = [
|
|
|
2847
2895
|
$kycShape2,
|
|
2848
2896
|
$waitNextAction2,
|
|
2849
2897
|
$placeOrderNextAction,
|
|
2850
|
-
$
|
|
2898
|
+
$payNextAction2,
|
|
2851
2899
|
$orderPendingNextAction2
|
|
2852
2900
|
];
|
|
2853
2901
|
var $nextAction2 = z3.discriminatedUnion("next", [...$nextActionOptions2]).superRefine(checkNextAction2);
|
|
@@ -2959,6 +3007,7 @@ export {
|
|
|
2959
3007
|
FiatCurrencyCode,
|
|
2960
3008
|
FiatEndpointSchema,
|
|
2961
3009
|
FiatGeoSchema,
|
|
3010
|
+
FiatHandoffPathSchema,
|
|
2962
3011
|
FiatNextRequestSchema,
|
|
2963
3012
|
FiatProviderSchema,
|
|
2964
3013
|
FiatRoutingQuoteErrorBodySchema,
|
|
@@ -3000,9 +3049,11 @@ export {
|
|
|
3000
3049
|
MoonPayConnectRequestSchema,
|
|
3001
3050
|
MoonPayConsentNextActionSchema,
|
|
3002
3051
|
MoonPayConsentRequestSchema,
|
|
3052
|
+
MoonPayDeclineRequestSchema,
|
|
3003
3053
|
MoonPayDoneSchema,
|
|
3004
3054
|
MoonPayErrorBodySchema,
|
|
3005
3055
|
MoonPayFaultSchema,
|
|
3056
|
+
MoonPayGuestDeclineReasonSchema,
|
|
3006
3057
|
MoonPayKycNextActionSchema,
|
|
3007
3058
|
MoonPayKycRequestSchema,
|
|
3008
3059
|
MoonPayNextActionSchema,
|
|
@@ -3012,6 +3063,8 @@ export {
|
|
|
3012
3063
|
MoonPayOrderPendingNextActionSchema,
|
|
3013
3064
|
MoonPayOrderRequestSchema,
|
|
3014
3065
|
MoonPayOrderResponseSchema,
|
|
3066
|
+
MoonPayPathSchema,
|
|
3067
|
+
MoonPayPayNextActionSchema,
|
|
3015
3068
|
MoonPayPrepareCaptureNextActionSchema,
|
|
3016
3069
|
MoonPayPrepareCaptureRequestSchema,
|
|
3017
3070
|
MoonPayQuoteInputSchema,
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
* `orderPending` answers only `order` and has no request either: the client follows its order body's `delivery`
|
|
9
9
|
* transition when it offers one, and otherwise sends the same `order` after it.
|
|
10
10
|
*
|
|
11
|
+
* Guest checkout is the routing path `MOONPAY/guest_checkout`. A quote whose `handoff.path` is `guest_checkout`
|
|
12
|
+
* runs this flow with `path: 'guest_checkout'` on every request: `session` answers `pay`, and after `pay` the
|
|
13
|
+
* client sends `order`, or `decline` when the device cannot pay as a guest. `decline` is request-only, like
|
|
14
|
+
* `observe`, and is answered `refused NOT_ELIGIBLE / REQUOTE`; the requote then leaves the guest path out.
|
|
15
|
+
*
|
|
11
16
|
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, the context (`checkout`, and
|
|
12
17
|
* `credentials` after `connect`), and the action's result. Identity and the deposit wallet always
|
|
13
18
|
* come from the verified partner assertion, never from a request body.
|
|
@@ -26,7 +31,7 @@ import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField
|
|
|
26
31
|
export declare const MOONPAY_ENDPOINTS: {
|
|
27
32
|
readonly next: "POST /fiat/next";
|
|
28
33
|
};
|
|
29
|
-
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
34
|
+
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
30
35
|
/** The checkout terms. The client holds them and sends them on every request. */
|
|
31
36
|
export interface MoonPayCheckout {
|
|
32
37
|
amount: FiatAmount;
|
|
@@ -45,13 +50,17 @@ export interface MoonPaySdkCredentials {
|
|
|
45
50
|
/**
|
|
46
51
|
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
47
52
|
* `destinationAsset` is the asset the user receives at the end; `checkout.destination` stays the quote's
|
|
48
|
-
* asset, which MoonPay delivers.
|
|
53
|
+
* asset, which MoonPay delivers. `path` is `guest_checkout` when the quote's `handoff.path` was; absent is the
|
|
54
|
+
* normal flow.
|
|
49
55
|
*/
|
|
50
56
|
export type MoonPayRequestContext = {
|
|
51
57
|
checkout: MoonPayCheckout;
|
|
52
58
|
credentials?: MoonPaySdkCredentials;
|
|
53
59
|
destinationAsset?: DestinationAsset;
|
|
60
|
+
path?: MoonPayPath;
|
|
54
61
|
};
|
|
62
|
+
/** A MoonPay routing path other than the normal flow, named by the quote's `handoff.path`. */
|
|
63
|
+
export type MoonPayPath = 'guest_checkout';
|
|
55
64
|
/**
|
|
56
65
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
|
57
66
|
* wallet must be the verified one and MoonPay's currency codes differ by environment.
|
|
@@ -117,6 +126,29 @@ export type MoonPayConnectRequest = {
|
|
|
117
126
|
customerId: string;
|
|
118
127
|
accessToken: string;
|
|
119
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The guest path's answer to `session`. Run the hidden connection check with `sessionToken`. When it returns
|
|
131
|
+
* `connectionRequired` with `capabilities.guestCheckout` and no `mismatch`, get the device quote from
|
|
132
|
+
* `quoteInput`. When that quote is executable with no `challenge`, mount Apple Pay with
|
|
133
|
+
* `externalTransactionId = orderId`, then send `order`. Otherwise send `decline`. Every `pay` answer carries a new
|
|
134
|
+
* `orderId`, so after a retried `session` the device must use the `orderId` of the latest `pay`.
|
|
135
|
+
*/
|
|
136
|
+
export type MoonPayPayNextAction = {
|
|
137
|
+
next: 'pay';
|
|
138
|
+
sessionToken: string;
|
|
139
|
+
orderId: string;
|
|
140
|
+
quoteInput: MoonPayQuoteInput;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Why the device cannot pay as a guest. `NOT_OFFERED`: the check did not offer guest checkout. `MISMATCH`: the
|
|
144
|
+
* check named a `mismatch`. `OVER_LIMIT`: the device quote was not executable or carried a `challenge`.
|
|
145
|
+
*/
|
|
146
|
+
export type MoonPayGuestDeclineReason = 'NOT_OFFERED' | 'MISMATCH' | 'OVER_LIMIT';
|
|
147
|
+
/** Request-only, after `pay`, before any charge. Answered `refused NOT_ELIGIBLE / REQUOTE`. */
|
|
148
|
+
export type MoonPayDeclineRequest = {
|
|
149
|
+
action: 'decline';
|
|
150
|
+
reason: MoonPayGuestDeclineReason;
|
|
151
|
+
};
|
|
120
152
|
/** Another MoonPay customer already holds the value; only a different one goes through. */
|
|
121
153
|
export type MoonPayFieldErrorCode = 'PHONE_IN_USE' | 'TAX_ID_IN_USE';
|
|
122
154
|
/**
|
|
@@ -234,7 +266,7 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
234
266
|
retryAfterMs: number;
|
|
235
267
|
order: FiatStepResponse | null;
|
|
236
268
|
};
|
|
237
|
-
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
269
|
+
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayDeclineRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
238
270
|
/** The wire body. The orchestrator reads `provider` and `geo`; MoonPay's action schemas read the rest. */
|
|
239
271
|
export type MoonPayNextRequest = {
|
|
240
272
|
provider: 'MOONPAY';
|
|
@@ -252,7 +284,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
252
284
|
* assertion's. `UNRECORDABLE`: a charge no retry can record, held for refund review.
|
|
253
285
|
*/
|
|
254
286
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
255
|
-
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
287
|
+
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayPayNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
256
288
|
/**
|
|
257
289
|
* The order is terminal. `order` is its body, which the shared order screen renders. Nothing is left to
|
|
258
290
|
* send to `/fiat/next`. A converted order's `SETTLED` body offers the `delivery` transition: follow it.
|
|
@@ -267,7 +299,7 @@ export type MoonPayRefused<R, V> = {
|
|
|
267
299
|
reason: R;
|
|
268
300
|
recovery: V;
|
|
269
301
|
};
|
|
270
|
-
/** The answer to `observe`, `consent`, `session`, `connect`, `kyc`, `prepareCapture` and `capture`. */
|
|
302
|
+
/** The answer to `observe`, `consent`, `session`, `connect`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
271
303
|
export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
|
|
272
304
|
/**
|
|
273
305
|
* The answer to `order`. `done` once the order is terminal. A failed charge is recorded too: `done` with
|
|
@@ -284,6 +316,7 @@ export type MoonPayResponseFor = {
|
|
|
284
316
|
consent: MoonPayStepResponse;
|
|
285
317
|
session: MoonPayStepResponse;
|
|
286
318
|
connect: MoonPayStepResponse;
|
|
319
|
+
decline: MoonPayStepResponse;
|
|
287
320
|
kyc: MoonPayStepResponse;
|
|
288
321
|
prepareCapture: MoonPayStepResponse;
|
|
289
322
|
capture: MoonPayStepResponse;
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
* exported from the package root, never from `./moonpay`, so the production entry stays free of zod.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import type { MoonPayCaptureDocument, MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPrepareCaptureNextAction, MoonPayPrepareCaptureRequest, MoonPayReask, MoonPayReaskReason, MoonPayReaskRequirement, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPaySessionNextAction, MoonPaySessionRequest, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
|
|
6
|
+
import type { MoonPayCaptureDocument, MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDeclineRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayGuestDeclineReason, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPath, MoonPayPayNextAction, MoonPayPrepareCaptureNextAction, MoonPayPrepareCaptureRequest, MoonPayReask, MoonPayReaskReason, MoonPayReaskRequirement, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPaySessionNextAction, MoonPaySessionRequest, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
|
|
7
7
|
export declare const MoonPayCheckoutSchema: z.ZodType<MoonPayCheckout>;
|
|
8
8
|
export declare const MoonPaySdkCredentialsSchema: z.ZodType<MoonPaySdkCredentials>;
|
|
9
|
+
export declare const MoonPayPathSchema: z.ZodType<MoonPayPath>;
|
|
9
10
|
export declare const MoonPayRequestContextSchema: z.ZodType<MoonPayRequestContext>;
|
|
10
11
|
export declare const MoonPayQuoteInputSchema: z.ZodType<MoonPayQuoteInput>;
|
|
12
|
+
export declare const MoonPayGuestDeclineReasonSchema: z.ZodType<MoonPayGuestDeclineReason>;
|
|
11
13
|
export declare const MoonPayObserveRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayObserveRequest>;
|
|
12
14
|
export declare const MoonPayConsentRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConsentRequest>;
|
|
13
15
|
export declare const MoonPaySessionRequestSchema: z.ZodType<MoonPayRequestContext & MoonPaySessionRequest>;
|
|
14
16
|
export declare const MoonPayConnectRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConnectRequest>;
|
|
17
|
+
export declare const MoonPayDeclineRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayDeclineRequest>;
|
|
15
18
|
export declare const MoonPayKycRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayKycRequest>;
|
|
16
19
|
export declare const MoonPayPrepareCaptureRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayPrepareCaptureRequest>;
|
|
17
20
|
export declare const MoonPayCaptureRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayCaptureRequest>;
|
|
@@ -21,6 +24,7 @@ export declare const MoonPayNextRequestSchema: z.ZodType<MoonPayNextRequest>;
|
|
|
21
24
|
export declare const MoonPayConsentNextActionSchema: z.ZodType<MoonPayConsentNextAction>;
|
|
22
25
|
export declare const MoonPaySessionNextActionSchema: z.ZodType<MoonPaySessionNextAction>;
|
|
23
26
|
export declare const MoonPayConnectNextActionSchema: z.ZodType<MoonPayConnectNextAction>;
|
|
27
|
+
export declare const MoonPayPayNextActionSchema: z.ZodType<MoonPayPayNextAction>;
|
|
24
28
|
export declare const MoonPayKycNextActionSchema: z.ZodType<MoonPayKycNextAction>;
|
|
25
29
|
export declare const MoonPayPrepareCaptureNextActionSchema: z.ZodType<MoonPayPrepareCaptureNextAction>;
|
|
26
30
|
export declare const MoonPayCaptureDocumentSchema: z.ZodType<MoonPayCaptureDocument>;
|
package/dist/routing.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* an extra key or a blank string fails them, so send only the declared fields.
|
|
22
22
|
*/
|
|
23
23
|
import type { CountryCode, FiatCurrencyCode, PaymentMethodCategory } from './codes';
|
|
24
|
-
import type { FiatAmount, DestinationAsset, FiatProvider, QuoteLimitRange } from './types';
|
|
24
|
+
import type { FiatAmount, DestinationAsset, FiatHandoffPath, FiatProvider, QuoteLimitRange } from './types';
|
|
25
25
|
export declare const ROUTING_ENDPOINTS: {
|
|
26
26
|
readonly table: "POST /fiat/routing/table";
|
|
27
27
|
/** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
|
|
@@ -146,6 +146,12 @@ export interface FiatRoutingQuoteTerms {
|
|
|
146
146
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
147
147
|
*/
|
|
148
148
|
destinationAsset?: DestinationAsset;
|
|
149
|
+
/**
|
|
150
|
+
* Provider paths this client can run, each at most once. Routing considers such a path only when it is
|
|
151
|
+
* listed, and a quote that picks one carries `handoff.path`. Leave a path out of the requote after its
|
|
152
|
+
* flow answers `refused` with `REQUOTE`, so routing can still pick the provider's other paths.
|
|
153
|
+
*/
|
|
154
|
+
handoffPaths?: FiatHandoffPath[];
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
157
|
* `POST /fiat/routing/quote`: the terms plus which providers to price, in one of two forms.
|
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, FiatAuthRecipientRequest, FiatAuthRecipientResponse, 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, FiatHandoffPath, FiatProvider, FiatAuthRecipientRequest, FiatAuthRecipientResponse, 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';
|
|
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>;
|
|
@@ -38,6 +38,7 @@ export declare const ENDPOINT_PATTERN: RegExp;
|
|
|
38
38
|
export declare const FiatEndpointSchema: z.ZodType<FiatEndpoint>;
|
|
39
39
|
export declare const UsStateCodeSchema: z.ZodType<UsStateCode>;
|
|
40
40
|
export declare const FiatProviderSchema: z.ZodType<FiatProvider>;
|
|
41
|
+
export declare const FiatHandoffPathSchema: z.ZodType<FiatHandoffPath>;
|
|
41
42
|
export declare const KYCProviderSchema: z.ZodType<KYCProvider>;
|
|
42
43
|
export declare const SurfaceProviderSchema: z.ZodType<SurfaceProvider>;
|
|
43
44
|
export declare const OrderStatusSchema: z.ZodType<OrderStatus>;
|
package/dist/table.js
CHANGED
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -870,12 +870,22 @@ export type FiatStepResponse = (FiatStepResponseBase & {
|
|
|
870
870
|
/**
|
|
871
871
|
* The provider runs its own flow from here (`POST /fiat/next`). Present
|
|
872
872
|
* only on a `QUOTE`, when the request's `handoffs` named this provider; the response then
|
|
873
|
-
* carries no transitions.
|
|
873
|
+
* carries no transitions. `path` names a provider path the request offered in `handoffPaths`
|
|
874
|
+
* (`guest_checkout` for `MOONPAY/guest_checkout`); the client sends it on every `/fiat/next` request.
|
|
874
875
|
*/
|
|
875
876
|
handoff?: {
|
|
876
877
|
provider: FiatProvider;
|
|
878
|
+
path?: FiatHandoffPathName;
|
|
877
879
|
};
|
|
878
880
|
});
|
|
881
|
+
/**
|
|
882
|
+
* A provider path the client can run, offered on the quote request in `handoffPaths`. Routing considers
|
|
883
|
+
* a path listed here only when the request offers it, so leaving it out of a requote excludes that path
|
|
884
|
+
* alone and keeps its provider's other paths.
|
|
885
|
+
*/
|
|
886
|
+
export type FiatHandoffPath = 'MOONPAY/guest_checkout';
|
|
887
|
+
/** The path part of a `FiatHandoffPath`, as `handoff.path` names it. */
|
|
888
|
+
export type FiatHandoffPathName = FiatHandoffPath extends `${string}/${infer Path}` ? Path : never;
|
|
879
889
|
/**
|
|
880
890
|
* The asset the user receives at the end of the purchase. The client always sends it. The backend
|
|
881
891
|
* compares it with the partner's configured asset and adds a conversion only when they differ,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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": {
|