@fun-xyz/fiat-contract 0.33.0 → 0.34.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/index.js
CHANGED
|
@@ -75,6 +75,7 @@ __export(index_exports, {
|
|
|
75
75
|
KycReviewDurationSchema: () => KycReviewDurationSchema,
|
|
76
76
|
KycSdkResultReportSchema: () => KycSdkResultReportSchema,
|
|
77
77
|
MOONPAY_ENDPOINTS: () => MOONPAY_ENDPOINTS,
|
|
78
|
+
MoonPayCaptureDocumentSchema: () => MoonPayCaptureDocumentSchema,
|
|
78
79
|
MoonPayCaptureNextActionSchema: () => MoonPayCaptureNextActionSchema,
|
|
79
80
|
MoonPayCaptureRequestSchema: () => MoonPayCaptureRequestSchema,
|
|
80
81
|
MoonPayCheckoutSchema: () => MoonPayCheckoutSchema,
|
|
@@ -91,11 +92,15 @@ __export(index_exports, {
|
|
|
91
92
|
MoonPayNextRequestSchema: () => MoonPayNextRequestSchema,
|
|
92
93
|
MoonPayObserveRequestSchema: () => MoonPayObserveRequestSchema,
|
|
93
94
|
MoonPayOrderNextActionSchema: () => MoonPayOrderNextActionSchema,
|
|
95
|
+
MoonPayOrderPendingNextActionSchema: () => MoonPayOrderPendingNextActionSchema,
|
|
94
96
|
MoonPayOrderRequestSchema: () => MoonPayOrderRequestSchema,
|
|
95
97
|
MoonPayOrderResponseSchema: () => MoonPayOrderResponseSchema,
|
|
96
98
|
MoonPayPrepareCaptureNextActionSchema: () => MoonPayPrepareCaptureNextActionSchema,
|
|
97
99
|
MoonPayPrepareCaptureRequestSchema: () => MoonPayPrepareCaptureRequestSchema,
|
|
98
100
|
MoonPayQuoteInputSchema: () => MoonPayQuoteInputSchema,
|
|
101
|
+
MoonPayReaskReasonSchema: () => MoonPayReaskReasonSchema,
|
|
102
|
+
MoonPayReaskRequirementSchema: () => MoonPayReaskRequirementSchema,
|
|
103
|
+
MoonPayReaskSchema: () => MoonPayReaskSchema,
|
|
99
104
|
MoonPayRequestContextSchema: () => MoonPayRequestContextSchema,
|
|
100
105
|
MoonPayRequestSchema: () => MoonPayRequestSchema,
|
|
101
106
|
MoonPayResponseSchemaFor: () => MoonPayResponseSchemaFor,
|
|
@@ -1237,7 +1242,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1237
1242
|
var FiatStepResponseSchema = $stepResponse;
|
|
1238
1243
|
|
|
1239
1244
|
// package.json
|
|
1240
|
-
var version = "0.
|
|
1245
|
+
var version = "0.34.0";
|
|
1241
1246
|
|
|
1242
1247
|
// src/table.ts
|
|
1243
1248
|
var TABLE_VERSION = version;
|
|
@@ -2959,17 +2964,36 @@ var $connectNextAction = obj2({
|
|
|
2959
2964
|
quoteInput: $quoteInput,
|
|
2960
2965
|
resetConnection: import_zod2.z.literal(true).optional()
|
|
2961
2966
|
});
|
|
2962
|
-
var
|
|
2967
|
+
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
2968
|
+
var $captureDocument = import_zod2.z.enum(CAPTURE_DOCUMENTS);
|
|
2969
|
+
var $reaskRequirement = import_zod2.z.union([KycFieldIdSchema, $captureDocument]);
|
|
2970
|
+
var $reaskReason = import_zod2.z.enum(["EXPIRED", "POOR_QUALITY", "MISMATCH", "REJECTED"]);
|
|
2971
|
+
var $reask = obj2({
|
|
2972
|
+
requirements: import_zod2.z.array($reaskRequirement).min(1).refine(hasUniqueIds2, "requirements must be unique"),
|
|
2973
|
+
reason: $reaskReason.nullable()
|
|
2974
|
+
});
|
|
2975
|
+
var $kycShape = obj2({
|
|
2976
|
+
next: import_zod2.z.literal("kyc"),
|
|
2977
|
+
fields: import_zod2.z.array(FormFieldSchema),
|
|
2978
|
+
fieldErrors: import_zod2.z.array($fieldError).min(1).optional(),
|
|
2979
|
+
reask: $reask.nullable()
|
|
2980
|
+
});
|
|
2963
2981
|
var $prepareCaptureNextAction = obj2({ next: import_zod2.z.literal("prepareCapture") });
|
|
2964
|
-
var $
|
|
2982
|
+
var $captureShape = obj2({
|
|
2965
2983
|
next: import_zod2.z.literal("capture"),
|
|
2966
2984
|
kycProvider: KYCProviderSchema,
|
|
2967
2985
|
accessToken: $nonEmpty,
|
|
2968
2986
|
expiresAt: import_zod2.z.string().datetime({ offset: true }),
|
|
2969
|
-
|
|
2987
|
+
reask: $reask.nullable()
|
|
2970
2988
|
});
|
|
2971
2989
|
var $waitNextAction = obj2({ next: import_zod2.z.literal("wait"), retryAfterMs: import_zod2.z.number().int().positive().max(6e4) });
|
|
2972
2990
|
var $orderNextAction = obj2({ next: import_zod2.z.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
2991
|
+
var $orderPendingNextAction = obj2({
|
|
2992
|
+
next: import_zod2.z.literal("orderPending"),
|
|
2993
|
+
orderId: $nonEmpty,
|
|
2994
|
+
retryAfterMs: import_zod2.z.number().int().positive().max(6e4),
|
|
2995
|
+
order: FiatStepResponseSchema.nullable()
|
|
2996
|
+
});
|
|
2973
2997
|
var checkConsent = (nextAction, context) => {
|
|
2974
2998
|
if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
|
|
2975
2999
|
context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
@@ -2986,20 +3010,35 @@ var checkKyc = (nextAction, context) => {
|
|
|
2986
3010
|
if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
|
|
2987
3011
|
context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
|
|
2988
3012
|
}
|
|
3013
|
+
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
3014
|
+
context.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
3015
|
+
}
|
|
3016
|
+
};
|
|
3017
|
+
var isCaptureDocument = (requirement) => CAPTURE_DOCUMENTS.includes(requirement);
|
|
3018
|
+
var checkCapture = (nextAction, context) => {
|
|
3019
|
+
if (nextAction.reask?.requirements.some((requirement) => !isCaptureDocument(requirement))) {
|
|
3020
|
+
context.addIssue({ code: "custom", path: ["reask"], message: "a capture reask must name documents only" });
|
|
3021
|
+
}
|
|
2989
3022
|
};
|
|
2990
3023
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
2991
3024
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
2992
3025
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
2993
3026
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
2994
3027
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
2995
|
-
var
|
|
3028
|
+
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
3029
|
+
var MoonPayReaskRequirementSchema = $reaskRequirement;
|
|
3030
|
+
var MoonPayReaskReasonSchema = $reaskReason;
|
|
3031
|
+
var MoonPayReaskSchema = $reask;
|
|
3032
|
+
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
2996
3033
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
2997
3034
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
3035
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
2998
3036
|
var checkNextAction = (response, context) => {
|
|
2999
3037
|
if (response.next === "consent") checkConsent(response, context);
|
|
3000
3038
|
if (response.next === "kyc") checkKyc(response, context);
|
|
3039
|
+
if (response.next === "capture") checkCapture(response, context);
|
|
3001
3040
|
};
|
|
3002
|
-
var $nextActionOptions = [$consentShape, $sessionNextAction, $connectNextAction, $kycShape, $prepareCaptureNextAction, $
|
|
3041
|
+
var $nextActionOptions = [$consentShape, $sessionNextAction, $connectNextAction, $kycShape, $prepareCaptureNextAction, $captureShape, $waitNextAction, $orderNextAction];
|
|
3003
3042
|
var $nextAction = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
3004
3043
|
var MoonPayNextActionSchema = $nextAction;
|
|
3005
3044
|
var $done = obj2({ next: import_zod2.z.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -3016,7 +3055,7 @@ var $orderRefused = obj2({
|
|
|
3016
3055
|
});
|
|
3017
3056
|
var $stepResponse2 = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
3018
3057
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
3019
|
-
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderRefused]);
|
|
3058
|
+
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
3020
3059
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
3021
3060
|
var MoonPayResponseSchemaFor = {
|
|
3022
3061
|
observe: MoonPayStepResponseSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
tableEntry,
|
|
13
13
|
unofferedEndpoints,
|
|
14
14
|
unreachableStates
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5ZGSYLC3.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MOONPAY_ENDPOINTS
|
|
18
18
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -2238,17 +2238,36 @@ var $connectNextAction = obj2({
|
|
|
2238
2238
|
quoteInput: $quoteInput,
|
|
2239
2239
|
resetConnection: z2.literal(true).optional()
|
|
2240
2240
|
});
|
|
2241
|
-
var
|
|
2241
|
+
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
2242
|
+
var $captureDocument = z2.enum(CAPTURE_DOCUMENTS);
|
|
2243
|
+
var $reaskRequirement = z2.union([KycFieldIdSchema, $captureDocument]);
|
|
2244
|
+
var $reaskReason = z2.enum(["EXPIRED", "POOR_QUALITY", "MISMATCH", "REJECTED"]);
|
|
2245
|
+
var $reask = obj2({
|
|
2246
|
+
requirements: z2.array($reaskRequirement).min(1).refine(hasUniqueIds2, "requirements must be unique"),
|
|
2247
|
+
reason: $reaskReason.nullable()
|
|
2248
|
+
});
|
|
2249
|
+
var $kycShape = obj2({
|
|
2250
|
+
next: z2.literal("kyc"),
|
|
2251
|
+
fields: z2.array(FormFieldSchema),
|
|
2252
|
+
fieldErrors: z2.array($fieldError).min(1).optional(),
|
|
2253
|
+
reask: $reask.nullable()
|
|
2254
|
+
});
|
|
2242
2255
|
var $prepareCaptureNextAction = obj2({ next: z2.literal("prepareCapture") });
|
|
2243
|
-
var $
|
|
2256
|
+
var $captureShape = obj2({
|
|
2244
2257
|
next: z2.literal("capture"),
|
|
2245
2258
|
kycProvider: KYCProviderSchema,
|
|
2246
2259
|
accessToken: $nonEmpty,
|
|
2247
2260
|
expiresAt: z2.string().datetime({ offset: true }),
|
|
2248
|
-
|
|
2261
|
+
reask: $reask.nullable()
|
|
2249
2262
|
});
|
|
2250
2263
|
var $waitNextAction = obj2({ next: z2.literal("wait"), retryAfterMs: z2.number().int().positive().max(6e4) });
|
|
2251
2264
|
var $orderNextAction = obj2({ next: z2.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
2265
|
+
var $orderPendingNextAction = obj2({
|
|
2266
|
+
next: z2.literal("orderPending"),
|
|
2267
|
+
orderId: $nonEmpty,
|
|
2268
|
+
retryAfterMs: z2.number().int().positive().max(6e4),
|
|
2269
|
+
order: FiatStepResponseSchema.nullable()
|
|
2270
|
+
});
|
|
2252
2271
|
var checkConsent = (nextAction, context) => {
|
|
2253
2272
|
if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
|
|
2254
2273
|
context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
|
|
@@ -2265,20 +2284,35 @@ var checkKyc = (nextAction, context) => {
|
|
|
2265
2284
|
if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
|
|
2266
2285
|
context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
|
|
2267
2286
|
}
|
|
2287
|
+
if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
|
|
2288
|
+
context.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
var isCaptureDocument = (requirement) => CAPTURE_DOCUMENTS.includes(requirement);
|
|
2292
|
+
var checkCapture = (nextAction, context) => {
|
|
2293
|
+
if (nextAction.reask?.requirements.some((requirement) => !isCaptureDocument(requirement))) {
|
|
2294
|
+
context.addIssue({ code: "custom", path: ["reask"], message: "a capture reask must name documents only" });
|
|
2295
|
+
}
|
|
2268
2296
|
};
|
|
2269
2297
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
2270
2298
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
2271
2299
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
2272
2300
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
2273
2301
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
2274
|
-
var
|
|
2302
|
+
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
2303
|
+
var MoonPayReaskRequirementSchema = $reaskRequirement;
|
|
2304
|
+
var MoonPayReaskReasonSchema = $reaskReason;
|
|
2305
|
+
var MoonPayReaskSchema = $reask;
|
|
2306
|
+
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
2275
2307
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
2276
2308
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
2309
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
2277
2310
|
var checkNextAction = (response, context) => {
|
|
2278
2311
|
if (response.next === "consent") checkConsent(response, context);
|
|
2279
2312
|
if (response.next === "kyc") checkKyc(response, context);
|
|
2313
|
+
if (response.next === "capture") checkCapture(response, context);
|
|
2280
2314
|
};
|
|
2281
|
-
var $nextActionOptions = [$consentShape, $sessionNextAction, $connectNextAction, $kycShape, $prepareCaptureNextAction, $
|
|
2315
|
+
var $nextActionOptions = [$consentShape, $sessionNextAction, $connectNextAction, $kycShape, $prepareCaptureNextAction, $captureShape, $waitNextAction, $orderNextAction];
|
|
2282
2316
|
var $nextAction = z2.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
2283
2317
|
var MoonPayNextActionSchema = $nextAction;
|
|
2284
2318
|
var $done = obj2({ next: z2.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -2295,7 +2329,7 @@ var $orderRefused = obj2({
|
|
|
2295
2329
|
});
|
|
2296
2330
|
var $stepResponse2 = z2.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
2297
2331
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
2298
|
-
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderRefused]);
|
|
2332
|
+
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
2299
2333
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
2300
2334
|
var MoonPayResponseSchemaFor = {
|
|
2301
2335
|
observe: MoonPayStepResponseSchema,
|
|
@@ -2378,6 +2412,7 @@ export {
|
|
|
2378
2412
|
KycReviewDurationSchema,
|
|
2379
2413
|
KycSdkResultReportSchema,
|
|
2380
2414
|
MOONPAY_ENDPOINTS,
|
|
2415
|
+
MoonPayCaptureDocumentSchema,
|
|
2381
2416
|
MoonPayCaptureNextActionSchema,
|
|
2382
2417
|
MoonPayCaptureRequestSchema,
|
|
2383
2418
|
MoonPayCheckoutSchema,
|
|
@@ -2394,11 +2429,15 @@ export {
|
|
|
2394
2429
|
MoonPayNextRequestSchema,
|
|
2395
2430
|
MoonPayObserveRequestSchema,
|
|
2396
2431
|
MoonPayOrderNextActionSchema,
|
|
2432
|
+
MoonPayOrderPendingNextActionSchema,
|
|
2397
2433
|
MoonPayOrderRequestSchema,
|
|
2398
2434
|
MoonPayOrderResponseSchema,
|
|
2399
2435
|
MoonPayPrepareCaptureNextActionSchema,
|
|
2400
2436
|
MoonPayPrepareCaptureRequestSchema,
|
|
2401
2437
|
MoonPayQuoteInputSchema,
|
|
2438
|
+
MoonPayReaskReasonSchema,
|
|
2439
|
+
MoonPayReaskRequirementSchema,
|
|
2440
|
+
MoonPayReaskSchema,
|
|
2402
2441
|
MoonPayRequestContextSchema,
|
|
2403
2442
|
MoonPayRequestSchema,
|
|
2404
2443
|
MoonPayResponseSchemaFor,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the client needs to do it. The client's request names it in `action` and carries the result. Every
|
|
6
6
|
* response is the next action, `done`, or `refused` (`MoonPayResponseFor`). `observe` carries no
|
|
7
7
|
* result and answers the current next action. `wait` has no request: the client sends `observe` after it.
|
|
8
|
+
* `orderPending` answers only `order` and has no request either: the client sends the same `order` after it.
|
|
8
9
|
*
|
|
9
10
|
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, the context (`checkout`, and
|
|
10
11
|
* `credentials` after `connect`), and the action's result. Identity and the deposit wallet always
|
|
@@ -124,11 +125,13 @@ export interface MoonPayFieldError {
|
|
|
124
125
|
/**
|
|
125
126
|
* Show the shared form. Empty `fields` means nothing for the buyer to type: the client sends
|
|
126
127
|
* `{ action: 'kyc', values: {} }` at once and the backend shares the KYC data it already holds.
|
|
128
|
+
* `reask` names fields of this form the buyer gave before and MoonPay asks for again; `null` otherwise.
|
|
127
129
|
*/
|
|
128
130
|
export type MoonPayKycNextAction = {
|
|
129
131
|
next: 'kyc';
|
|
130
132
|
fields: FormField[];
|
|
131
133
|
fieldErrors?: MoonPayFieldError[];
|
|
134
|
+
reask: MoonPayReask | null;
|
|
132
135
|
};
|
|
133
136
|
/**
|
|
134
137
|
* Keyed by the ids of the next action's fields; there is no form id. `values` is empty when the next
|
|
@@ -151,9 +154,29 @@ export type MoonPayPrepareCaptureRequest = {
|
|
|
151
154
|
action: 'prepareCapture';
|
|
152
155
|
credentials: MoonPaySdkCredentials;
|
|
153
156
|
};
|
|
157
|
+
/** A document the Sumsub SDK captures for MoonPay. No shared type names documents, so this one does. */
|
|
158
|
+
export type MoonPayCaptureDocument = 'IDENTITY_DOCUMENT' | 'SELFIE' | 'PROOF_OF_ADDRESS' | 'PROOF_OF_INCOME';
|
|
159
|
+
/** What a re-ask names: a declarative value by its `KycFieldId`, or a captured document. */
|
|
160
|
+
export type MoonPayReaskRequirement = KycFieldId | MoonPayCaptureDocument;
|
|
161
|
+
/**
|
|
162
|
+
* Why a re-ask asks again, as a code: the backend sends no display text, and the client owns every word.
|
|
163
|
+
* `EXPIRED`: the document on file is too old. `POOR_QUALITY`: the upload could not be read. `MISMATCH`: the
|
|
164
|
+
* data or the selfie does not match. `REJECTED`: any other retryable rejection. Treat an unknown code like
|
|
165
|
+
* `null`: adding a code is a minor contract change.
|
|
166
|
+
*/
|
|
167
|
+
export type MoonPayReaskReason = 'EXPIRED' | 'POOR_QUALITY' | 'MISMATCH' | 'REJECTED';
|
|
168
|
+
/**
|
|
169
|
+
* Something the buyer gave before is asked again: `requirements`, never empty, on the `kyc` form or in the
|
|
170
|
+
* `capture`. One shape for every cause, so the client shows each the same way and may ignore `reason`
|
|
171
|
+
* (`null` when there is no code). Not `fieldErrors`: those check the value this request just submitted.
|
|
172
|
+
*/
|
|
173
|
+
export type MoonPayReask = {
|
|
174
|
+
requirements: MoonPayReaskRequirement[];
|
|
175
|
+
reason: MoonPayReaskReason | null;
|
|
176
|
+
};
|
|
154
177
|
/**
|
|
155
178
|
* Open the Sumsub SDK with `accessToken` to capture what MoonPay still needs (an ID, a selfie, a
|
|
156
|
-
* proof of address). `
|
|
179
|
+
* proof of address). `reask` is `null` on a first capture; on a retake it names documents only. To refresh
|
|
157
180
|
* an expired token, send `observe`.
|
|
158
181
|
*/
|
|
159
182
|
export type MoonPayCaptureNextAction = {
|
|
@@ -162,7 +185,7 @@ export type MoonPayCaptureNextAction = {
|
|
|
162
185
|
accessToken: string;
|
|
163
186
|
/** ISO-8601. */
|
|
164
187
|
expiresAt: string;
|
|
165
|
-
|
|
188
|
+
reask: MoonPayReask | null;
|
|
166
189
|
};
|
|
167
190
|
/** When the SDK closes. A report only: the backend reads Sumsub itself. */
|
|
168
191
|
export type MoonPayCaptureRequest = {
|
|
@@ -192,6 +215,18 @@ export type MoonPayOrderRequest = {
|
|
|
192
215
|
quotedAmount: FiatAmount;
|
|
193
216
|
transactionId?: string;
|
|
194
217
|
};
|
|
218
|
+
/**
|
|
219
|
+
* The charge is made or in flight and its order is not terminal yet. `order` is the order's current body
|
|
220
|
+
* (status, and the settlement transaction once observed) for the client to show, or `null` while MoonPay
|
|
221
|
+
* does not list or price the charge and no order exists yet. Do not mount Apple Pay. After `retryAfterMs`,
|
|
222
|
+
* send the same `order` request again: each one reads MoonPay and moves the order forward.
|
|
223
|
+
*/
|
|
224
|
+
export type MoonPayOrderPendingNextAction = {
|
|
225
|
+
next: 'orderPending';
|
|
226
|
+
orderId: string;
|
|
227
|
+
retryAfterMs: number;
|
|
228
|
+
order: FiatStepResponse | null;
|
|
229
|
+
};
|
|
195
230
|
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
196
231
|
/** The wire body. The orchestrator reads `provider` and `geo`; MoonPay's action schemas read the rest. */
|
|
197
232
|
export type MoonPayNextRequest = {
|
|
@@ -211,7 +246,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
211
246
|
*/
|
|
212
247
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
213
248
|
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
214
|
-
/**
|
|
249
|
+
/** The order is terminal. `order` is its body, which the shared order screen renders; nothing is left to poll. */
|
|
215
250
|
export type MoonPayDone = {
|
|
216
251
|
next: 'done';
|
|
217
252
|
order: FiatStepResponse;
|
|
@@ -225,11 +260,13 @@ export type MoonPayRefused<R, V> = {
|
|
|
225
260
|
/** The answer to `observe`, `consent`, `session`, `connect`, `kyc`, `prepareCapture` and `capture`. */
|
|
226
261
|
export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
|
|
227
262
|
/**
|
|
228
|
-
* The answer to `order`. A failed charge is recorded too: `done` with
|
|
229
|
-
* client requotes for a new `orderId`. `
|
|
230
|
-
*
|
|
263
|
+
* The answer to `order`. `done` once the order is terminal. A failed charge is recorded too: `done` with
|
|
264
|
+
* the order in `FAILED`, and the client requotes for a new `orderId`. `orderPending` while the order is
|
|
265
|
+
* not terminal, or MoonPay does not list or price the transaction yet: the client polls by sending the
|
|
266
|
+
* same `order` request, never `GET /fiat/orders/:orderId`. A refusal after a charge never requotes:
|
|
267
|
+
* that would start a second payment.
|
|
231
268
|
*/
|
|
232
|
-
export type MoonPayOrderResponse = MoonPayDone | MoonPayOrderNextAction | MoonPayRefused<MoonPayOrderRefusal, 'NONE'>;
|
|
269
|
+
export type MoonPayOrderResponse = MoonPayDone | MoonPayOrderNextAction | MoonPayOrderPendingNextAction | MoonPayRefused<MoonPayOrderRefusal, 'NONE'>;
|
|
233
270
|
export type MoonPayResponseFor = {
|
|
234
271
|
observe: MoonPayStepResponse;
|
|
235
272
|
consent: MoonPayStepResponse;
|
|
@@ -3,7 +3,7 @@
|
|
|
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 { MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPrepareCaptureNextAction, MoonPayPrepareCaptureRequest, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPaySessionNextAction, MoonPaySessionRequest, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
|
|
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';
|
|
7
7
|
export declare const MoonPayCheckoutSchema: z.ZodType<MoonPayCheckout>;
|
|
8
8
|
export declare const MoonPaySdkCredentialsSchema: z.ZodType<MoonPaySdkCredentials>;
|
|
9
9
|
export declare const MoonPayRequestContextSchema: z.ZodType<MoonPayRequestContext>;
|
|
@@ -23,9 +23,14 @@ export declare const MoonPaySessionNextActionSchema: z.ZodType<MoonPaySessionNex
|
|
|
23
23
|
export declare const MoonPayConnectNextActionSchema: z.ZodType<MoonPayConnectNextAction>;
|
|
24
24
|
export declare const MoonPayKycNextActionSchema: z.ZodType<MoonPayKycNextAction>;
|
|
25
25
|
export declare const MoonPayPrepareCaptureNextActionSchema: z.ZodType<MoonPayPrepareCaptureNextAction>;
|
|
26
|
+
export declare const MoonPayCaptureDocumentSchema: z.ZodType<MoonPayCaptureDocument>;
|
|
27
|
+
export declare const MoonPayReaskRequirementSchema: z.ZodType<MoonPayReaskRequirement>;
|
|
28
|
+
export declare const MoonPayReaskReasonSchema: z.ZodType<MoonPayReaskReason>;
|
|
29
|
+
export declare const MoonPayReaskSchema: z.ZodType<MoonPayReask>;
|
|
26
30
|
export declare const MoonPayCaptureNextActionSchema: z.ZodType<MoonPayCaptureNextAction>;
|
|
27
31
|
export declare const MoonPayWaitNextActionSchema: z.ZodType<MoonPayWaitNextAction>;
|
|
28
32
|
export declare const MoonPayOrderNextActionSchema: z.ZodType<MoonPayOrderNextAction>;
|
|
33
|
+
export declare const MoonPayOrderPendingNextActionSchema: z.ZodType<MoonPayOrderPendingNextAction>;
|
|
29
34
|
export declare const MoonPayNextActionSchema: z.ZodType<MoonPayNextAction>;
|
|
30
35
|
export declare const MoonPayDoneSchema: z.ZodType<MoonPayDone>;
|
|
31
36
|
export declare const MoonPayStepResponseSchema: z.ZodType<MoonPayStepResponse>;
|
package/dist/table.js
CHANGED
package/dist/table.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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": {
|