@fun-xyz/fiat-contract 0.46.0 → 0.47.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/README.md +10 -0
- package/dist/{chunk-IAKK466V.mjs → chunk-JMJ45E27.mjs} +1 -1
- package/dist/chunk-LTJWGDSA.mjs +0 -0
- package/dist/{chunk-2CCO7UIS.mjs → chunk-TIQALG7X.mjs} +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +131 -63
- package/dist/index.mjs +131 -63
- package/dist/providers/moonpay-guest.d.ts +12 -0
- package/dist/providers/moonpay-guest.js +18 -0
- package/dist/providers/moonpay-guest.mjs +1 -0
- package/dist/providers/moonpay-guest.schemas.d.ts +36 -0
- package/dist/providers/moonpay.d.ts +45 -16
- package/dist/providers/moonpay.schemas.d.ts +5 -2
- package/dist/routing.d.ts +2 -8
- package/dist/schemas.d.ts +1 -2
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/dist/terms.js +2 -1
- package/dist/terms.mjs +1 -1
- package/dist/types.d.ts +3 -13
- package/package.json +10 -2
package/dist/index.mjs
CHANGED
|
@@ -13,10 +13,11 @@ import {
|
|
|
13
13
|
tableEntry,
|
|
14
14
|
unofferedEndpoints,
|
|
15
15
|
unreachableStates
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JMJ45E27.mjs";
|
|
17
17
|
import {
|
|
18
18
|
MOONPAY_ENDPOINTS
|
|
19
19
|
} from "./chunk-TIEGTTFY.mjs";
|
|
20
|
+
import "./chunk-LTJWGDSA.mjs";
|
|
20
21
|
import {
|
|
21
22
|
COINBASE_ENDPOINTS,
|
|
22
23
|
COINBASE_TERMS
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
PROVIDER_CHECKOUT_DOCUMENTS,
|
|
28
29
|
PROVIDER_KYC_DOCUMENTS,
|
|
29
30
|
PUBLISHED_TERMS_DOCUMENTS
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-TIQALG7X.mjs";
|
|
31
32
|
import {
|
|
32
33
|
ROUTING_ENDPOINTS
|
|
33
34
|
} from "./chunk-2NZSOZHV.mjs";
|
|
@@ -377,15 +378,12 @@ var $provider = z.enum([
|
|
|
377
378
|
"SWAPPED",
|
|
378
379
|
"BANXA",
|
|
379
380
|
"MOONPAY",
|
|
381
|
+
"MOONPAY_GUEST",
|
|
380
382
|
"STRIPE",
|
|
381
383
|
"COINBASE",
|
|
382
384
|
"CROSSMINT"
|
|
383
385
|
]);
|
|
384
386
|
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");
|
|
389
387
|
var $kycProvider = z.enum(["SUMSUB"]);
|
|
390
388
|
var KYCProviderSchema = $kycProvider;
|
|
391
389
|
var $surfaceProvider = z.enum([...$provider.options, ...$kycProvider.options]);
|
|
@@ -567,9 +565,9 @@ var $clientExecutedDelivery = obj({
|
|
|
567
565
|
channel: z.literal("CLIENT_EXECUTED"),
|
|
568
566
|
source: z.literal("CURRENT_SESSION_INPUTS"),
|
|
569
567
|
allowedFieldIds: z.array($kycFieldId).min(1)
|
|
570
|
-
}).superRefine((delivery,
|
|
568
|
+
}).superRefine((delivery, context2) => {
|
|
571
569
|
if (new Set(delivery.allowedFieldIds).size !== delivery.allowedFieldIds.length) {
|
|
572
|
-
|
|
570
|
+
context2.addIssue({
|
|
573
571
|
code: "custom",
|
|
574
572
|
path: ["allowedFieldIds"],
|
|
575
573
|
message: "allowedFieldIds must be unique"
|
|
@@ -978,7 +976,7 @@ var compareDecimals = (left, right) => {
|
|
|
978
976
|
return leftDigits < rightDigits ? -1 : leftDigits > rightDigits ? 1 : 0;
|
|
979
977
|
};
|
|
980
978
|
var $countryCode = z.enum(Object.keys(CountryCode));
|
|
981
|
-
var $routingProvider = $provider.extract(["TRANSAK", "BANXA", "MOONPAY", "STRIPE", "COINBASE"]);
|
|
979
|
+
var $routingProvider = $provider.extract(["TRANSAK", "BANXA", "MOONPAY", "MOONPAY_GUEST", "STRIPE", "COINBASE"]);
|
|
982
980
|
var $optionalGeoField = z.union([$nonBlank, z.literal("")]).optional();
|
|
983
981
|
var US_REGION_REQUIRED = "a US buyer needs a US state code as region";
|
|
984
982
|
var hasUsRegion = (country, region) => country !== "US" || UsStateCodeSchema.safeParse(region).success;
|
|
@@ -1012,11 +1010,11 @@ var $routingTableInterval = obj({
|
|
|
1012
1010
|
var $routingTableMethod = obj({
|
|
1013
1011
|
method: z.enum(PAYMENT_METHOD_CATEGORIES),
|
|
1014
1012
|
unavailableReason: z.enum(["USER_LIMIT", "KYC_REJECTED", "PROVIDER_OUTAGE", "NOT_SERVED"]).optional(),
|
|
1015
|
-
intervals: z.array($routingTableInterval).superRefine((intervals,
|
|
1013
|
+
intervals: z.array($routingTableInterval).superRefine((intervals, context2) => {
|
|
1016
1014
|
intervals.forEach((interval, index) => {
|
|
1017
1015
|
const previous = intervals[index - 1];
|
|
1018
1016
|
if (previous !== void 0 && compareDecimals(interval.min, previous.max) <= 0) {
|
|
1019
|
-
|
|
1017
|
+
context2.addIssue({ code: "custom", path: [index, "min"], message: "intervals are sorted and do not overlap" });
|
|
1020
1018
|
}
|
|
1021
1019
|
});
|
|
1022
1020
|
})
|
|
@@ -1043,8 +1041,7 @@ var $routingQuoteTermsShape = {
|
|
|
1043
1041
|
prepareSessionAuth: z.boolean().optional(),
|
|
1044
1042
|
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
1045
1043
|
destinationAsset: $destinationAsset.optional(),
|
|
1046
|
-
depositAddress: $nonBlank.optional()
|
|
1047
|
-
handoffPaths: z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1044
|
+
depositAddress: $nonBlank.optional()
|
|
1048
1045
|
};
|
|
1049
1046
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1050
1047
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1133,38 +1130,31 @@ var $providerBoundStepResponse = obj({
|
|
|
1133
1130
|
state: $providerBoundFlowState,
|
|
1134
1131
|
provider: $provider,
|
|
1135
1132
|
preparedPayment: $preparedPayment.optional(),
|
|
1136
|
-
handoff: obj({ provider: $provider
|
|
1137
|
-
}).superRefine((response,
|
|
1133
|
+
handoff: obj({ provider: $provider }).optional()
|
|
1134
|
+
}).superRefine((response, context2) => {
|
|
1138
1135
|
if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
|
|
1139
|
-
|
|
1136
|
+
context2.addIssue({
|
|
1140
1137
|
code: "custom",
|
|
1141
1138
|
path: ["preparedPayment", "surface", "provider"],
|
|
1142
1139
|
message: "preparedPayment.surface.provider must match the response provider"
|
|
1143
1140
|
});
|
|
1144
1141
|
}
|
|
1145
1142
|
if (response.handoff !== void 0 && response.handoff.provider !== response.provider) {
|
|
1146
|
-
|
|
1143
|
+
context2.addIssue({
|
|
1147
1144
|
code: "custom",
|
|
1148
1145
|
path: ["handoff", "provider"],
|
|
1149
1146
|
message: "handoff.provider must match the response provider"
|
|
1150
1147
|
});
|
|
1151
1148
|
}
|
|
1152
|
-
if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
|
|
1153
|
-
context.addIssue({
|
|
1154
|
-
code: "custom",
|
|
1155
|
-
path: ["handoff", "path"],
|
|
1156
|
-
message: "handoff.path must name a handoff path of handoff.provider"
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
1149
|
if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
|
|
1160
|
-
|
|
1150
|
+
context2.addIssue({
|
|
1161
1151
|
code: "custom",
|
|
1162
1152
|
path: ["handoff"],
|
|
1163
1153
|
message: "only a QUOTE response hands off to a provider"
|
|
1164
1154
|
});
|
|
1165
1155
|
}
|
|
1166
1156
|
if (response.handoff !== void 0 && response.transitions.length > 0) {
|
|
1167
|
-
|
|
1157
|
+
context2.addIssue({
|
|
1168
1158
|
code: "custom",
|
|
1169
1159
|
path: ["transitions"],
|
|
1170
1160
|
message: "a handoff response carries no transitions"
|
|
@@ -1186,15 +1176,15 @@ var $funAuthStepResponse = obj({
|
|
|
1186
1176
|
state: $funAuthState,
|
|
1187
1177
|
provider: $provider.optional(),
|
|
1188
1178
|
session: $fiatSession.optional()
|
|
1189
|
-
}).superRefine((response,
|
|
1179
|
+
}).superRefine((response, context2) => {
|
|
1190
1180
|
const { phase } = response.state;
|
|
1191
1181
|
if (response.session !== void 0 && phase !== "VERIFIED") {
|
|
1192
|
-
|
|
1182
|
+
context2.addIssue({ code: "custom", path: ["session"], message: "only a FUN_AUTH response in phase VERIFIED carries session" });
|
|
1193
1183
|
}
|
|
1194
1184
|
const allowed = FUN_AUTH_TRANSITIONS_BY_PHASE[phase];
|
|
1195
1185
|
response.transitions.forEach((transition, index) => {
|
|
1196
1186
|
if (!allowed.includes(transition.id)) {
|
|
1197
|
-
|
|
1187
|
+
context2.addIssue({
|
|
1198
1188
|
code: "custom",
|
|
1199
1189
|
path: ["transitions", index, "id"],
|
|
1200
1190
|
message: `FUN_AUTH phase ${phase} offers ${allowed.join(" or ") || "no transitions"}, not "${transition.id}"`
|
|
@@ -2542,13 +2532,10 @@ var $checkout = obj2({
|
|
|
2542
2532
|
var MoonPayCheckoutSchema = $checkout;
|
|
2543
2533
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2544
2534
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2545
|
-
var $path = z2.literal("guest_checkout");
|
|
2546
|
-
var MoonPayPathSchema = $path;
|
|
2547
2535
|
var $context = {
|
|
2548
2536
|
checkout: $checkout,
|
|
2549
2537
|
credentials: $credentials.optional(),
|
|
2550
|
-
destinationAsset: DestinationAssetSchema.optional()
|
|
2551
|
-
path: $path.optional()
|
|
2538
|
+
destinationAsset: DestinationAssetSchema.optional()
|
|
2552
2539
|
};
|
|
2553
2540
|
var $requestContext = obj2($context);
|
|
2554
2541
|
var MoonPayRequestContextSchema = $requestContext;
|
|
@@ -2567,6 +2554,9 @@ var $consentFields = {
|
|
|
2567
2554
|
};
|
|
2568
2555
|
var $sessionFields = { action: z2.literal("session") };
|
|
2569
2556
|
var $connectFields = { action: z2.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
|
|
2557
|
+
var $phoneNumberFields = { action: z2.literal("phone"), phoneNumber: z2.string().regex(/^\+[1-9]\d{1,14}$/) };
|
|
2558
|
+
var $phoneResendFields = { action: z2.literal("phone"), resend: $nonEmpty };
|
|
2559
|
+
var $phoneCodeFields = { action: z2.literal("phoneCode"), verificationRef: $nonEmpty, otpCode: z2.string().regex(/^\d{6}$/) };
|
|
2570
2560
|
var $guestDeclineReason = z2.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
|
|
2571
2561
|
var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
|
|
2572
2562
|
var $declineFields = { action: z2.literal("decline"), reason: $guestDeclineReason };
|
|
@@ -2582,6 +2572,8 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
|
|
|
2582
2572
|
var $consentRequest = obj2({ ...$context, ...$consentFields });
|
|
2583
2573
|
var $sessionRequest = obj2({ ...$context, ...$sessionFields });
|
|
2584
2574
|
var $connectRequest = obj2({ ...$context, ...$connectFields });
|
|
2575
|
+
var $phoneRequest = z2.union([obj2({ ...$context, ...$phoneNumberFields }), obj2({ ...$context, ...$phoneResendFields })]);
|
|
2576
|
+
var $phoneCodeRequest = obj2({ ...$context, ...$phoneCodeFields });
|
|
2585
2577
|
var $declineRequest = obj2({ ...$context, ...$declineFields });
|
|
2586
2578
|
var $kycRequest = obj2({ ...$context, ...$kycFields });
|
|
2587
2579
|
var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
|
|
@@ -2591,17 +2583,18 @@ var MoonPayObserveRequestSchema = $observeRequest;
|
|
|
2591
2583
|
var MoonPayConsentRequestSchema = $consentRequest;
|
|
2592
2584
|
var MoonPaySessionRequestSchema = $sessionRequest;
|
|
2593
2585
|
var MoonPayConnectRequestSchema = $connectRequest;
|
|
2586
|
+
var MoonPayPhoneRequestSchema = $phoneRequest;
|
|
2587
|
+
var MoonPayPhoneCodeRequestSchema = $phoneCodeRequest;
|
|
2594
2588
|
var MoonPayDeclineRequestSchema = $declineRequest;
|
|
2595
2589
|
var MoonPayKycRequestSchema = $kycRequest;
|
|
2596
2590
|
var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
|
|
2597
2591
|
var MoonPayCaptureRequestSchema = $captureRequest;
|
|
2598
2592
|
var MoonPayOrderRequestSchema = $orderRequest;
|
|
2599
|
-
var $request = z2.
|
|
2593
|
+
var $request = z2.union([
|
|
2600
2594
|
$observeRequest,
|
|
2601
2595
|
$consentRequest,
|
|
2602
2596
|
$sessionRequest,
|
|
2603
2597
|
$connectRequest,
|
|
2604
|
-
$declineRequest,
|
|
2605
2598
|
$kycRequest,
|
|
2606
2599
|
$prepareCaptureRequest,
|
|
2607
2600
|
$captureRequest,
|
|
@@ -2609,12 +2602,11 @@ var $request = z2.discriminatedUnion("action", [
|
|
|
2609
2602
|
]);
|
|
2610
2603
|
var MoonPayRequestSchema = $request;
|
|
2611
2604
|
var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, depositAddress: $nonEmpty.optional(), ...$context };
|
|
2612
|
-
var $nextRequest2 = z2.
|
|
2605
|
+
var $nextRequest2 = z2.union([
|
|
2613
2606
|
obj2({ ...$envelope, ...$observeFields }),
|
|
2614
2607
|
obj2({ ...$envelope, ...$consentFields }),
|
|
2615
2608
|
obj2({ ...$envelope, ...$sessionFields }),
|
|
2616
2609
|
obj2({ ...$envelope, ...$connectFields }),
|
|
2617
|
-
obj2({ ...$envelope, ...$declineFields }),
|
|
2618
2610
|
obj2({ ...$envelope, ...$kycFields }),
|
|
2619
2611
|
obj2({ ...$envelope, ...$prepareCaptureFields }),
|
|
2620
2612
|
obj2({ ...$envelope, ...$captureFields }),
|
|
@@ -2631,6 +2623,13 @@ var $connectNextAction = obj2({
|
|
|
2631
2623
|
quoteInput: $quoteInput,
|
|
2632
2624
|
resetConnection: z2.literal(true).optional()
|
|
2633
2625
|
});
|
|
2626
|
+
var $phoneNextAction = obj2({ next: z2.literal("phone"), error: z2.literal("CODE_EXPIRED").nullable() });
|
|
2627
|
+
var $phoneCodeNextAction = obj2({
|
|
2628
|
+
next: z2.literal("phoneCode"),
|
|
2629
|
+
verificationRef: $nonEmpty,
|
|
2630
|
+
expiresAt: z2.string().datetime({ offset: true }),
|
|
2631
|
+
error: z2.literal("CODE_INVALID").nullable()
|
|
2632
|
+
});
|
|
2634
2633
|
var $payNextAction = obj2({ next: z2.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
2635
2634
|
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
2636
2635
|
var $captureDocument = z2.enum(CAPTURE_DOCUMENTS);
|
|
@@ -2662,35 +2661,37 @@ var $orderPendingNextAction = obj2({
|
|
|
2662
2661
|
retryAfterMs: z2.number().int().positive().max(6e4),
|
|
2663
2662
|
order: FiatStepResponseSchema.nullable()
|
|
2664
2663
|
});
|
|
2665
|
-
var checkConsent = (nextAction,
|
|
2664
|
+
var checkConsent = (nextAction, context2) => {
|
|
2666
2665
|
if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
|
|
2667
|
-
|
|
2666
|
+
context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
2668
2667
|
}
|
|
2669
2668
|
};
|
|
2670
|
-
var checkKyc = (nextAction,
|
|
2669
|
+
var checkKyc = (nextAction, context2) => {
|
|
2671
2670
|
const fieldIds = nextAction.fields.map((field) => field.id);
|
|
2672
2671
|
if (!hasUniqueIds2(fieldIds)) {
|
|
2673
|
-
|
|
2672
|
+
context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
|
|
2674
2673
|
}
|
|
2675
2674
|
if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
|
|
2676
|
-
|
|
2675
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
|
|
2677
2676
|
}
|
|
2678
2677
|
if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
|
|
2679
|
-
|
|
2678
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
|
|
2680
2679
|
}
|
|
2681
2680
|
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
2682
|
-
|
|
2681
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
2683
2682
|
}
|
|
2684
2683
|
};
|
|
2685
2684
|
var isCaptureDocument = (requirement) => CAPTURE_DOCUMENTS.includes(requirement);
|
|
2686
|
-
var checkCapture = (nextAction,
|
|
2685
|
+
var checkCapture = (nextAction, context2) => {
|
|
2687
2686
|
if (nextAction.reask?.requirements.some((requirement) => !isCaptureDocument(requirement))) {
|
|
2688
|
-
|
|
2687
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a capture reask must name documents only" });
|
|
2689
2688
|
}
|
|
2690
2689
|
};
|
|
2691
2690
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
2692
2691
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
2693
2692
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
2693
|
+
var MoonPayPhoneNextActionSchema = $phoneNextAction;
|
|
2694
|
+
var MoonPayPhoneCodeNextActionSchema = $phoneCodeNextAction;
|
|
2694
2695
|
var MoonPayPayNextActionSchema = $payNextAction;
|
|
2695
2696
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
2696
2697
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
@@ -2702,16 +2703,15 @@ var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
|
2702
2703
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
2703
2704
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
2704
2705
|
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
2705
|
-
var checkNextAction = (response,
|
|
2706
|
-
if (response.next === "consent") checkConsent(response,
|
|
2707
|
-
if (response.next === "kyc") checkKyc(response,
|
|
2708
|
-
if (response.next === "capture") checkCapture(response,
|
|
2706
|
+
var checkNextAction = (response, context2) => {
|
|
2707
|
+
if (response.next === "consent") checkConsent(response, context2);
|
|
2708
|
+
if (response.next === "kyc") checkKyc(response, context2);
|
|
2709
|
+
if (response.next === "capture") checkCapture(response, context2);
|
|
2709
2710
|
};
|
|
2710
2711
|
var $nextActionOptions = [
|
|
2711
2712
|
$consentShape,
|
|
2712
2713
|
$sessionNextAction,
|
|
2713
2714
|
$connectNextAction,
|
|
2714
|
-
$payNextAction,
|
|
2715
2715
|
$kycShape,
|
|
2716
2716
|
$prepareCaptureNextAction,
|
|
2717
2717
|
$captureShape,
|
|
@@ -2741,7 +2741,6 @@ var MoonPayResponseSchemaFor = {
|
|
|
2741
2741
|
consent: MoonPayStepResponseSchema,
|
|
2742
2742
|
session: MoonPayStepResponseSchema,
|
|
2743
2743
|
connect: MoonPayStepResponseSchema,
|
|
2744
|
-
decline: MoonPayStepResponseSchema,
|
|
2745
2744
|
kyc: MoonPayStepResponseSchema,
|
|
2746
2745
|
prepareCapture: MoonPayStepResponseSchema,
|
|
2747
2746
|
capture: MoonPayStepResponseSchema,
|
|
@@ -2857,21 +2856,21 @@ var $orderPendingNextAction2 = obj3({
|
|
|
2857
2856
|
retryAfterMs: $retryAfterMs,
|
|
2858
2857
|
order: FiatStepResponseSchema.nullable()
|
|
2859
2858
|
});
|
|
2860
|
-
var checkConsent2 = (nextAction,
|
|
2859
|
+
var checkConsent2 = (nextAction, context2) => {
|
|
2861
2860
|
if (!hasUniqueIds3(nextAction.documents.map((document) => document.id))) {
|
|
2862
|
-
|
|
2861
|
+
context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
2863
2862
|
}
|
|
2864
2863
|
};
|
|
2865
|
-
var checkKyc2 = (nextAction,
|
|
2864
|
+
var checkKyc2 = (nextAction, context2) => {
|
|
2866
2865
|
const fieldIds = nextAction.fields.map((field) => field.id);
|
|
2867
2866
|
if (!hasUniqueIds3(fieldIds)) {
|
|
2868
|
-
|
|
2867
|
+
context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
|
|
2869
2868
|
}
|
|
2870
2869
|
if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
|
|
2871
|
-
|
|
2870
|
+
context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
|
|
2872
2871
|
}
|
|
2873
2872
|
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
2874
|
-
|
|
2873
|
+
context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
2875
2874
|
}
|
|
2876
2875
|
};
|
|
2877
2876
|
var CoinbaseConsentNextActionSchema = $consentShape2.superRefine(checkConsent2);
|
|
@@ -2882,9 +2881,9 @@ var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
|
2882
2881
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
2883
2882
|
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
2884
2883
|
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
2885
|
-
var checkNextAction2 = (response,
|
|
2886
|
-
if (response.next === "consent") checkConsent2(response,
|
|
2887
|
-
if (response.next === "kyc") checkKyc2(response,
|
|
2884
|
+
var checkNextAction2 = (response, context2) => {
|
|
2885
|
+
if (response.next === "consent") checkConsent2(response, context2);
|
|
2886
|
+
if (response.next === "kyc") checkKyc2(response, context2);
|
|
2888
2887
|
};
|
|
2889
2888
|
var $nextActionOptions2 = [
|
|
2890
2889
|
$consentShape2,
|
|
@@ -2941,6 +2940,60 @@ var $errorBody2 = obj3({
|
|
|
2941
2940
|
retryAfterSeconds: z3.number().int().positive().optional()
|
|
2942
2941
|
});
|
|
2943
2942
|
var CoinbaseErrorBodySchema = $errorBody2;
|
|
2943
|
+
|
|
2944
|
+
// src/providers/moonpay-guest.schemas.ts
|
|
2945
|
+
import { z as z4 } from "zod";
|
|
2946
|
+
var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
|
|
2947
|
+
var obj4 = (shape) => z4.object(shape).strict();
|
|
2948
|
+
var nonEmpty = z4.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2949
|
+
var actions = [
|
|
2950
|
+
{ action: z4.literal("observe") },
|
|
2951
|
+
{ action: z4.literal("session") },
|
|
2952
|
+
{ action: z4.literal("consent"), acceptances: z4.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
|
|
2953
|
+
{ action: z4.literal("order"), orderId: nonEmpty, quotedAmount: FiatAmountSchema, transactionId: nonEmpty.optional() },
|
|
2954
|
+
{ action: z4.literal("phone"), phoneNumber: z4.string().regex(/^\+[1-9]\d{1,14}$/) },
|
|
2955
|
+
{ action: z4.literal("phone"), resend: nonEmpty },
|
|
2956
|
+
{ action: z4.literal("phoneCode"), verificationRef: nonEmpty, otpCode: z4.string().regex(/^\d{6}$/) },
|
|
2957
|
+
{ action: z4.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
|
|
2958
|
+
];
|
|
2959
|
+
var MoonPayGuestObserveRequestSchema = obj4({ ...context, ...actions[0] });
|
|
2960
|
+
var MoonPayGuestSessionRequestSchema = obj4({ ...context, ...actions[1] });
|
|
2961
|
+
var MoonPayGuestConsentRequestSchema = obj4({ ...context, ...actions[2] });
|
|
2962
|
+
var MoonPayGuestOrderRequestSchema = obj4({ ...context, ...actions[3] });
|
|
2963
|
+
var MoonPayGuestPhoneNumberRequestSchema = obj4({ ...context, ...actions[4] });
|
|
2964
|
+
var MoonPayGuestPhoneResendRequestSchema = obj4({ ...context, ...actions[5] });
|
|
2965
|
+
var MoonPayGuestPhoneCodeRequestSchema = obj4({ ...context, ...actions[6] });
|
|
2966
|
+
var MoonPayGuestDeclineRequestSchema = obj4({ ...context, ...actions[7] });
|
|
2967
|
+
var MoonPayGuestPhoneRequestSchema = z4.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
|
|
2968
|
+
var MoonPayGuestRequestSchema = z4.union([
|
|
2969
|
+
MoonPayGuestObserveRequestSchema,
|
|
2970
|
+
MoonPayGuestSessionRequestSchema,
|
|
2971
|
+
MoonPayGuestConsentRequestSchema,
|
|
2972
|
+
MoonPayGuestOrderRequestSchema,
|
|
2973
|
+
MoonPayGuestPhoneNumberRequestSchema,
|
|
2974
|
+
MoonPayGuestPhoneResendRequestSchema,
|
|
2975
|
+
MoonPayGuestPhoneCodeRequestSchema,
|
|
2976
|
+
MoonPayGuestDeclineRequestSchema
|
|
2977
|
+
]);
|
|
2978
|
+
var MoonPayGuestNextRequestSchema = z4.union([
|
|
2979
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[0] }),
|
|
2980
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[1] }),
|
|
2981
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[2] }),
|
|
2982
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[3] }),
|
|
2983
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[4] }),
|
|
2984
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[5] }),
|
|
2985
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[6] }),
|
|
2986
|
+
obj4({ provider: z4.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[7] })
|
|
2987
|
+
]);
|
|
2988
|
+
var MoonPayGuestStepResponseSchema = z4.union([
|
|
2989
|
+
MoonPayConsentNextActionSchema,
|
|
2990
|
+
MoonPaySessionNextActionSchema,
|
|
2991
|
+
MoonPayPhoneNextActionSchema,
|
|
2992
|
+
MoonPayPhoneCodeNextActionSchema,
|
|
2993
|
+
MoonPayPayNextActionSchema,
|
|
2994
|
+
obj4({ next: z4.literal("refused"), reason: z4.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: z4.enum(["REQUOTE", "NONE"]) })
|
|
2995
|
+
]);
|
|
2996
|
+
var MoonPayGuestResponseSchema = z4.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
|
|
2944
2997
|
export {
|
|
2945
2998
|
BlockedReasonSchema,
|
|
2946
2999
|
BlockedStateSchema,
|
|
@@ -3003,7 +3056,6 @@ export {
|
|
|
3003
3056
|
FiatCurrencyCode,
|
|
3004
3057
|
FiatEndpointSchema,
|
|
3005
3058
|
FiatGeoSchema,
|
|
3006
|
-
FiatHandoffPathSchema,
|
|
3007
3059
|
FiatNextRequestSchema,
|
|
3008
3060
|
FiatProviderSchema,
|
|
3009
3061
|
FiatRoutingQuoteErrorBodySchema,
|
|
@@ -3049,7 +3101,20 @@ export {
|
|
|
3049
3101
|
MoonPayDoneSchema,
|
|
3050
3102
|
MoonPayErrorBodySchema,
|
|
3051
3103
|
MoonPayFaultSchema,
|
|
3104
|
+
MoonPayGuestConsentRequestSchema,
|
|
3052
3105
|
MoonPayGuestDeclineReasonSchema,
|
|
3106
|
+
MoonPayGuestDeclineRequestSchema,
|
|
3107
|
+
MoonPayGuestNextRequestSchema,
|
|
3108
|
+
MoonPayGuestObserveRequestSchema,
|
|
3109
|
+
MoonPayGuestOrderRequestSchema,
|
|
3110
|
+
MoonPayGuestPhoneCodeRequestSchema,
|
|
3111
|
+
MoonPayGuestPhoneNumberRequestSchema,
|
|
3112
|
+
MoonPayGuestPhoneRequestSchema,
|
|
3113
|
+
MoonPayGuestPhoneResendRequestSchema,
|
|
3114
|
+
MoonPayGuestRequestSchema,
|
|
3115
|
+
MoonPayGuestResponseSchema,
|
|
3116
|
+
MoonPayGuestSessionRequestSchema,
|
|
3117
|
+
MoonPayGuestStepResponseSchema,
|
|
3053
3118
|
MoonPayKycNextActionSchema,
|
|
3054
3119
|
MoonPayKycRequestSchema,
|
|
3055
3120
|
MoonPayNextActionSchema,
|
|
@@ -3059,8 +3124,11 @@ export {
|
|
|
3059
3124
|
MoonPayOrderPendingNextActionSchema,
|
|
3060
3125
|
MoonPayOrderRequestSchema,
|
|
3061
3126
|
MoonPayOrderResponseSchema,
|
|
3062
|
-
MoonPayPathSchema,
|
|
3063
3127
|
MoonPayPayNextActionSchema,
|
|
3128
|
+
MoonPayPhoneCodeNextActionSchema,
|
|
3129
|
+
MoonPayPhoneCodeRequestSchema,
|
|
3130
|
+
MoonPayPhoneNextActionSchema,
|
|
3131
|
+
MoonPayPhoneRequestSchema,
|
|
3064
3132
|
MoonPayPrepareCaptureNextActionSchema,
|
|
3065
3133
|
MoonPayPrepareCaptureRequestSchema,
|
|
3066
3134
|
MoonPayQuoteInputSchema,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** MoonPay guest checkout is a separate provider; it never connects a MoonPay customer. */
|
|
2
|
+
import type { FiatGeo } from '../types';
|
|
3
|
+
import type { MoonPayRequestContext, MoonPayObserveRequest, MoonPayConsentRequest, MoonPaySessionRequest, MoonPayPhoneRequest, MoonPayPhoneCodeRequest, MoonPayDeclineRequest, MoonPayOrderRequest, MoonPayConsentNextAction, MoonPaySessionNextAction, MoonPayPhoneNextAction, MoonPayPhoneCodeNextAction, MoonPayPayNextAction, MoonPayRefused, MoonPayOrderResponse } from './moonpay';
|
|
4
|
+
export type MoonPayGuestRequestContext = Omit<MoonPayRequestContext, 'credentials'>;
|
|
5
|
+
export type MoonPayGuestRequest = MoonPayGuestRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayPhoneRequest | MoonPayPhoneCodeRequest | MoonPayDeclineRequest | MoonPayOrderRequest);
|
|
6
|
+
export type MoonPayGuestNextRequest = {
|
|
7
|
+
provider: 'MOONPAY_GUEST';
|
|
8
|
+
geo: FiatGeo;
|
|
9
|
+
depositAddress?: string;
|
|
10
|
+
} & MoonPayGuestRequest;
|
|
11
|
+
export type MoonPayGuestStepResponse = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayPhoneNextAction | MoonPayPhoneCodeNextAction | MoonPayPayNextAction | MoonPayRefused<'NOT_ELIGIBLE' | 'FINAL_REJECTION', 'REQUOTE' | 'NONE'>;
|
|
12
|
+
export type MoonPayGuestResponse = MoonPayGuestStepResponse | MoonPayOrderResponse;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/providers/moonpay-guest.ts
|
|
17
|
+
var moonpay_guest_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(moonpay_guest_exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../chunk-LTJWGDSA.mjs";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { MoonPayGuestRequest, MoonPayGuestNextRequest } from './moonpay-guest';
|
|
3
|
+
export declare const MoonPayGuestObserveRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
4
|
+
action: "observe";
|
|
5
|
+
}>>;
|
|
6
|
+
export declare const MoonPayGuestSessionRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
7
|
+
action: "session";
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const MoonPayGuestConsentRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
10
|
+
action: "consent";
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const MoonPayGuestOrderRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
13
|
+
action: "order";
|
|
14
|
+
}>>;
|
|
15
|
+
export declare const MoonPayGuestPhoneNumberRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
16
|
+
action: "phone";
|
|
17
|
+
phoneNumber: string;
|
|
18
|
+
}>>;
|
|
19
|
+
export declare const MoonPayGuestPhoneResendRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
20
|
+
action: "phone";
|
|
21
|
+
resend: string;
|
|
22
|
+
}>>;
|
|
23
|
+
export declare const MoonPayGuestPhoneCodeRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
24
|
+
action: "phoneCode";
|
|
25
|
+
}>>;
|
|
26
|
+
export declare const MoonPayGuestDeclineRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
27
|
+
action: "decline";
|
|
28
|
+
}>>;
|
|
29
|
+
export declare const MoonPayGuestPhoneRequestSchema: z.ZodType<Extract<MoonPayGuestRequest, {
|
|
30
|
+
action: "phone";
|
|
31
|
+
}>>;
|
|
32
|
+
export declare const MoonPayGuestRequestSchema: z.ZodType<MoonPayGuestRequest>;
|
|
33
|
+
export declare const MoonPayGuestNextRequestSchema: z.ZodType<MoonPayGuestNextRequest>;
|
|
34
|
+
import type { MoonPayGuestStepResponse, MoonPayGuestResponse } from './moonpay-guest';
|
|
35
|
+
export declare const MoonPayGuestStepResponseSchema: z.ZodType<MoonPayGuestStepResponse>;
|
|
36
|
+
export declare const MoonPayGuestResponseSchema: z.ZodType<MoonPayGuestResponse>;
|
|
@@ -8,10 +8,8 @@
|
|
|
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
|
|
12
|
-
*
|
|
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.
|
|
11
|
+
* Guest checkout uses provider `MOONPAY_GUEST` and its separate contract in `./moonpay-guest`.
|
|
12
|
+
* The phone and pay primitives below are shared MoonPay wire types, outside this provider's request and response unions.
|
|
15
13
|
*
|
|
16
14
|
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, a mode-2 client's `depositAddress`,
|
|
17
15
|
* the context (`checkout`, and `credentials` after `connect`), and the action's result. Identity comes
|
|
@@ -32,7 +30,7 @@ import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField
|
|
|
32
30
|
export declare const MOONPAY_ENDPOINTS: {
|
|
33
31
|
readonly next: "POST /fiat/next";
|
|
34
32
|
};
|
|
35
|
-
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
33
|
+
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'phone' | 'phoneCode' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
36
34
|
/** The checkout terms. The client holds them and sends them on every request. */
|
|
37
35
|
export interface MoonPayCheckout {
|
|
38
36
|
amount: FiatAmount;
|
|
@@ -51,17 +49,13 @@ export interface MoonPaySdkCredentials {
|
|
|
51
49
|
/**
|
|
52
50
|
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
53
51
|
* `destinationAsset` is the asset the user receives at the end; `checkout.destination` stays the quote's
|
|
54
|
-
* asset, which MoonPay delivers.
|
|
55
|
-
* normal flow.
|
|
52
|
+
* asset, which MoonPay delivers.
|
|
56
53
|
*/
|
|
57
54
|
export type MoonPayRequestContext = {
|
|
58
55
|
checkout: MoonPayCheckout;
|
|
59
56
|
credentials?: MoonPaySdkCredentials;
|
|
60
57
|
destinationAsset?: DestinationAsset;
|
|
61
|
-
path?: MoonPayPath;
|
|
62
58
|
};
|
|
63
|
-
/** A MoonPay routing path other than the normal flow, named by the quote's `handoff.path`. */
|
|
64
|
-
export type MoonPayPath = 'guest_checkout';
|
|
65
59
|
/**
|
|
66
60
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
|
67
61
|
* wallet must be the verified one and MoonPay's currency codes differ by environment.
|
|
@@ -127,6 +121,41 @@ export type MoonPayConnectRequest = {
|
|
|
127
121
|
customerId: string;
|
|
128
122
|
accessToken: string;
|
|
129
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* The guest path asks for the buyer's phone before `session`. `CODE_EXPIRED`: the last code's time ran out, or five
|
|
126
|
+
* wrong codes ended it. The same shape as Coinbase's `session` next action.
|
|
127
|
+
*/
|
|
128
|
+
export type MoonPayPhoneNextAction = {
|
|
129
|
+
next: 'phone';
|
|
130
|
+
error: 'CODE_EXPIRED' | null;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Text a code to `phoneNumber` (E.164), or send a new code to the phone of the live challenge `resend` names. Spends
|
|
134
|
+
* one unit of the per-login code budget only when a code is sent. The same shapes as Coinbase's `session` request.
|
|
135
|
+
*/
|
|
136
|
+
export type MoonPayPhoneRequest = {
|
|
137
|
+
action: 'phone';
|
|
138
|
+
phoneNumber: string;
|
|
139
|
+
} | {
|
|
140
|
+
action: 'phone';
|
|
141
|
+
resend: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Ask for the code just texted. `expiresAt` is ISO-8601. `CODE_INVALID`: the last code sent was wrong. The same
|
|
145
|
+
* shape as Coinbase's `otp` next action.
|
|
146
|
+
*/
|
|
147
|
+
export type MoonPayPhoneCodeNextAction = {
|
|
148
|
+
next: 'phoneCode';
|
|
149
|
+
verificationRef: string;
|
|
150
|
+
expiresAt: string;
|
|
151
|
+
error: 'CODE_INVALID' | null;
|
|
152
|
+
};
|
|
153
|
+
/** `otpCode` is six digits. Named so request logs redact it. A correct code answers `session`. */
|
|
154
|
+
export type MoonPayPhoneCodeRequest = {
|
|
155
|
+
action: 'phoneCode';
|
|
156
|
+
verificationRef: string;
|
|
157
|
+
otpCode: string;
|
|
158
|
+
};
|
|
130
159
|
/**
|
|
131
160
|
* The guest path's answer to `session`. Run the hidden connection check with `sessionToken`. When it returns
|
|
132
161
|
* `connectionRequired` with `capabilities.guestCheckout` and no `mismatch`, get the device quote from
|
|
@@ -267,7 +296,7 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
267
296
|
retryAfterMs: number;
|
|
268
297
|
order: FiatStepResponse | null;
|
|
269
298
|
};
|
|
270
|
-
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest |
|
|
299
|
+
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
271
300
|
/**
|
|
272
301
|
* The wire body. The orchestrator reads `provider`, `geo` and `depositAddress` (as on every
|
|
273
302
|
* `FiatNextRequest`); MoonPay's action schemas read the rest.
|
|
@@ -289,7 +318,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
289
318
|
* assertion's. `UNRECORDABLE`: a charge no retry can record, held for refund review.
|
|
290
319
|
*/
|
|
291
320
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
292
|
-
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction |
|
|
321
|
+
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
293
322
|
/**
|
|
294
323
|
* The order is terminal. `order` is its body, which the shared order screen renders. Nothing is left to
|
|
295
324
|
* send to `/fiat/next`. A converted order's `SETTLED` body offers the `delivery` transition: follow it.
|
|
@@ -304,7 +333,7 @@ export type MoonPayRefused<R, V> = {
|
|
|
304
333
|
reason: R;
|
|
305
334
|
recovery: V;
|
|
306
335
|
};
|
|
307
|
-
/** The answer to `observe`, `consent`, `session`, `connect`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
336
|
+
/** The answer to `observe`, `consent`, `session`, `connect`, `phone`, `phoneCode`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
308
337
|
export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
|
|
309
338
|
/**
|
|
310
339
|
* The answer to `order`. `done` once the order is terminal. A failed charge is recorded too: `done` with
|
|
@@ -321,7 +350,6 @@ export type MoonPayResponseFor = {
|
|
|
321
350
|
consent: MoonPayStepResponse;
|
|
322
351
|
session: MoonPayStepResponse;
|
|
323
352
|
connect: MoonPayStepResponse;
|
|
324
|
-
decline: MoonPayStepResponse;
|
|
325
353
|
kyc: MoonPayStepResponse;
|
|
326
354
|
prepareCapture: MoonPayStepResponse;
|
|
327
355
|
capture: MoonPayStepResponse;
|
|
@@ -330,8 +358,9 @@ export type MoonPayResponseFor = {
|
|
|
330
358
|
/** `RETRY` sends the same request again. `REQUOTE` goes back to routing. `NONE` ends the flow. */
|
|
331
359
|
export type MoonPayRecovery = 'RETRY' | 'REQUOTE' | 'NONE';
|
|
332
360
|
/**
|
|
333
|
-
* `SESSION_BUDGET_SPENT`: the per-login SDK session mint budget that `session` spends
|
|
334
|
-
* `
|
|
361
|
+
* `SESSION_BUDGET_SPENT`: the per-login SDK session mint budget that `session` spends, or the per-login code budget
|
|
362
|
+
* that `phone` spends (429).
|
|
363
|
+
* `RATE_LIMITED`: the action's request budget (429). `PROVIDER_UNAVAILABLE`: MoonPay, or the phone code sender, is down (503).
|
|
335
364
|
* `KYC_PROVIDER_UNAVAILABLE`: the KYC provider (Sumsub) is down (503). `SERVICE_UNAVAILABLE`: one of
|
|
336
365
|
* Fun's own stores is down (503). `INVALID_REQUEST`: a bad body (400).
|
|
337
366
|
*/
|