@fun-xyz/fiat-contract 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6NZFTT7Q.mjs → chunk-BK2XD3JT.mjs} +1 -1
- package/dist/codes.d.ts +6 -0
- package/dist/index.js +61 -7
- package/dist/index.mjs +61 -7
- package/dist/providers/stripe.d.ts +34 -12
- package/dist/providers/stripe.schemas.d.ts +3 -1
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/package.json +1 -1
package/dist/codes.d.ts
CHANGED
|
@@ -1269,4 +1269,10 @@ export declare const COUNTRY_TO_CURRENCY: { [K in CountryCodeLiteral]: FiatCurre
|
|
|
1269
1269
|
/** fun-backend/provider vocabulary, not a standard — extend when a new payment rail ships. */
|
|
1270
1270
|
export declare const PAYMENT_METHOD_CATEGORIES: readonly ["card", "apple_pay", "google_pay", "bank_transfer"];
|
|
1271
1271
|
export type PaymentMethodCategory = (typeof PAYMENT_METHOD_CATEGORIES)[number];
|
|
1272
|
+
/** The EU-27 member states. */
|
|
1273
|
+
export declare const EU_COUNTRIES: readonly ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE"];
|
|
1274
|
+
/** The EEA-30: the EU-27 plus Iceland, Liechtenstein and Norway. */
|
|
1275
|
+
export declare const EEA_COUNTRIES: readonly ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "IS", "LI", "NO"];
|
|
1276
|
+
export declare const isEuCountry: (country: string) => boolean;
|
|
1277
|
+
export declare const isEeaCountry: (country: string) => boolean;
|
|
1272
1278
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,9 @@ __export(index_exports, {
|
|
|
62
62
|
DOCUMENTED_ENDPOINTS: () => DOCUMENTED_ENDPOINTS,
|
|
63
63
|
DeliveryStateSchema: () => DeliveryStateSchema,
|
|
64
64
|
DestinationAssetSchema: () => DestinationAssetSchema,
|
|
65
|
+
EEA_COUNTRIES: () => EEA_COUNTRIES,
|
|
65
66
|
ENDPOINT_PATTERN: () => ENDPOINT_PATTERN,
|
|
67
|
+
EU_COUNTRIES: () => EU_COUNTRIES,
|
|
66
68
|
FIAT_CURRENCY_NAMES: () => FIAT_CURRENCY_NAMES,
|
|
67
69
|
FIAT_TERMS_ENDPOINT: () => FIAT_TERMS_ENDPOINT,
|
|
68
70
|
FIELD_SPEC_TYPES: () => FIELD_SPEC_TYPES,
|
|
@@ -198,6 +200,7 @@ __export(index_exports, {
|
|
|
198
200
|
SelectOptionSchema: () => SelectOptionSchema,
|
|
199
201
|
SessionAuthStateSchema: () => SessionAuthStateSchema,
|
|
200
202
|
StatusHistoryEntrySchema: () => StatusHistoryEntrySchema,
|
|
203
|
+
StripeAttestationNextActionSchema: () => StripeAttestationNextActionSchema,
|
|
201
204
|
StripeAuthorizeNextActionSchema: () => StripeAuthorizeNextActionSchema,
|
|
202
205
|
StripeAuthorizeRequestSchema: () => StripeAuthorizeRequestSchema,
|
|
203
206
|
StripeCheckoutRequestSchema: () => StripeCheckoutRequestSchema,
|
|
@@ -209,6 +212,7 @@ __export(index_exports, {
|
|
|
209
212
|
StripeDoneSchema: () => StripeDoneSchema,
|
|
210
213
|
StripeErrorBodySchema: () => StripeErrorBodySchema,
|
|
211
214
|
StripeFaultSchema: () => StripeFaultSchema,
|
|
215
|
+
StripeIdentifiersNextActionSchema: () => StripeIdentifiersNextActionSchema,
|
|
212
216
|
StripeKycNextActionSchema: () => StripeKycNextActionSchema,
|
|
213
217
|
StripeKycRequestSchema: () => StripeKycRequestSchema,
|
|
214
218
|
StripeLinkAuthTokenSchema: () => StripeLinkAuthTokenSchema,
|
|
@@ -258,6 +262,8 @@ __export(index_exports, {
|
|
|
258
262
|
checkLegalEmission: () => checkLegalEmission,
|
|
259
263
|
endpointMatches: () => endpointMatches,
|
|
260
264
|
fixtureMeta: () => fixtureMeta,
|
|
265
|
+
isEeaCountry: () => isEeaCountry,
|
|
266
|
+
isEuCountry: () => isEuCountry,
|
|
261
267
|
isTerminal: () => isTerminal,
|
|
262
268
|
loadFixture: () => loadFixture,
|
|
263
269
|
loadFixtures: () => loadFixtures,
|
|
@@ -590,6 +596,40 @@ var COUNTRY_NAMES = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.count
|
|
|
590
596
|
var FIAT_CURRENCY_NAMES = Object.fromEntries(uniqueCurrencies);
|
|
591
597
|
var COUNTRY_TO_CURRENCY = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.country, e.currency]));
|
|
592
598
|
var PAYMENT_METHOD_CATEGORIES = ["card", "apple_pay", "google_pay", "bank_transfer"];
|
|
599
|
+
var EU_COUNTRIES = [
|
|
600
|
+
"AT",
|
|
601
|
+
"BE",
|
|
602
|
+
"BG",
|
|
603
|
+
"HR",
|
|
604
|
+
"CY",
|
|
605
|
+
"CZ",
|
|
606
|
+
"DK",
|
|
607
|
+
"EE",
|
|
608
|
+
"FI",
|
|
609
|
+
"FR",
|
|
610
|
+
"DE",
|
|
611
|
+
"GR",
|
|
612
|
+
"HU",
|
|
613
|
+
"IE",
|
|
614
|
+
"IT",
|
|
615
|
+
"LV",
|
|
616
|
+
"LT",
|
|
617
|
+
"LU",
|
|
618
|
+
"MT",
|
|
619
|
+
"NL",
|
|
620
|
+
"PL",
|
|
621
|
+
"PT",
|
|
622
|
+
"RO",
|
|
623
|
+
"SK",
|
|
624
|
+
"SI",
|
|
625
|
+
"ES",
|
|
626
|
+
"SE"
|
|
627
|
+
];
|
|
628
|
+
var EEA_COUNTRIES = [...EU_COUNTRIES, "IS", "LI", "NO"];
|
|
629
|
+
var EU_COUNTRY_SET = new Set(EU_COUNTRIES);
|
|
630
|
+
var EEA_COUNTRY_SET = new Set(EEA_COUNTRIES);
|
|
631
|
+
var isEuCountry = (country) => EU_COUNTRY_SET.has(country);
|
|
632
|
+
var isEeaCountry = (country) => EEA_COUNTRY_SET.has(country);
|
|
593
633
|
|
|
594
634
|
// src/schemas.ts
|
|
595
635
|
var import_zod = require("zod");
|
|
@@ -1433,7 +1473,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1433
1473
|
var FiatStepResponseSchema = $stepResponse;
|
|
1434
1474
|
|
|
1435
1475
|
// package.json
|
|
1436
|
-
var version = "0.
|
|
1476
|
+
var version = "0.50.0";
|
|
1437
1477
|
|
|
1438
1478
|
// src/table.ts
|
|
1439
1479
|
var TABLE_VERSION = version;
|
|
@@ -3876,11 +3916,13 @@ var obj4 = (shape) => import_zod4.z.object(shape).strict();
|
|
|
3876
3916
|
var nonEmpty = import_zod4.z.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
3877
3917
|
var hasUniqueIds4 = (ids) => new Set(ids).size === ids.length;
|
|
3878
3918
|
var retryAfterMs = import_zod4.z.number().int().positive().max(6e4);
|
|
3879
|
-
var
|
|
3919
|
+
var centsAmount = import_zod4.z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/, "must be an amount in cents").refine((amount) => Number(amount) > 0, "must be positive");
|
|
3880
3920
|
var kycValues = import_zod4.z.record(KycFieldIdSchema, import_zod4.z.string());
|
|
3881
3921
|
var instant = import_zod4.z.string().datetime({ offset: true });
|
|
3922
|
+
var chargeCurrency = import_zod4.z.enum(["USD", "EUR"]);
|
|
3923
|
+
var countryCode = import_zod4.z.enum(Object.keys(CountryCode));
|
|
3882
3924
|
var checkout = obj4({
|
|
3883
|
-
amount: obj4({ currency:
|
|
3925
|
+
amount: obj4({ currency: chargeCurrency, amount: centsAmount }),
|
|
3884
3926
|
destination: obj4({ asset: nonEmpty, network: nonEmpty }),
|
|
3885
3927
|
paymentMethod: import_zod4.z.literal("apple_pay")
|
|
3886
3928
|
});
|
|
@@ -3947,9 +3989,9 @@ var paySheet = obj4({
|
|
|
3947
3989
|
destinationCurrency: nonEmpty,
|
|
3948
3990
|
destinationNetwork: nonEmpty,
|
|
3949
3991
|
walletAddress: nonEmpty,
|
|
3950
|
-
merchantCountryCode:
|
|
3951
|
-
currencyCode:
|
|
3952
|
-
amount:
|
|
3992
|
+
merchantCountryCode: countryCode,
|
|
3993
|
+
currencyCode: chargeCurrency,
|
|
3994
|
+
amount: centsAmount,
|
|
3953
3995
|
label: nonEmpty
|
|
3954
3996
|
});
|
|
3955
3997
|
var StripePaySheetSchema = paySheet;
|
|
@@ -3966,7 +4008,7 @@ var authorizeNextAction = obj4({ next: import_zod4.z.literal("authorize"), linkA
|
|
|
3966
4008
|
var kycShape = obj4({
|
|
3967
4009
|
next: import_zod4.z.literal("kyc"),
|
|
3968
4010
|
round: import_zod4.z.enum(["ACCOUNT", "IDENTITY"]),
|
|
3969
|
-
tier: import_zod4.z.enum(["l0", "l1"]),
|
|
4011
|
+
tier: import_zod4.z.enum(["l0", "l1", "l2"]),
|
|
3970
4012
|
correctionRound,
|
|
3971
4013
|
fields: import_zod4.z.array(FormFieldSchema),
|
|
3972
4014
|
heldValues: kycValues,
|
|
@@ -3975,6 +4017,8 @@ var kycShape = obj4({
|
|
|
3975
4017
|
fieldErrors: import_zod4.z.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
|
|
3976
4018
|
reask: reask.nullable()
|
|
3977
4019
|
});
|
|
4020
|
+
var identifiersNextAction = obj4({ next: import_zod4.z.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
|
|
4021
|
+
var attestationNextAction = obj4({ next: import_zod4.z.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
|
|
3978
4022
|
var verifyIdentityNextAction = obj4({ next: import_zod4.z.literal("verifyIdentity"), linkAuthToken: linkAuthToken.nullable() });
|
|
3979
4023
|
var waitNextAction = obj4({ next: import_zod4.z.literal("wait"), retryAfterMs });
|
|
3980
4024
|
var placeOrderNextAction = obj4({
|
|
@@ -4011,16 +4055,24 @@ var checkKyc3 = (nextAction, context2) => {
|
|
|
4011
4055
|
if (nextAction.round === "ACCOUNT" !== (nextAction.verifiedEmail !== null)) {
|
|
4012
4056
|
context2.addIssue({ code: "custom", path: ["verifiedEmail"], message: "only the account round carries the verified email" });
|
|
4013
4057
|
}
|
|
4058
|
+
if (nextAction.tier === "l2" && nextAction.round !== "IDENTITY") {
|
|
4059
|
+
context2.addIssue({ code: "custom", path: ["tier"], message: "l2 is an identity round" });
|
|
4060
|
+
}
|
|
4014
4061
|
};
|
|
4015
4062
|
var checkPlaceOrder = (nextAction, context2) => {
|
|
4016
4063
|
if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
|
|
4017
4064
|
context2.addIssue({ code: "custom", path: ["paySheet", "amount"], message: "the sheet charges the price shown" });
|
|
4018
4065
|
}
|
|
4066
|
+
if (nextAction.paySheet.currencyCode !== nextAction.price.total.currency) {
|
|
4067
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "currencyCode"], message: "the sheet charges the price currency" });
|
|
4068
|
+
}
|
|
4019
4069
|
};
|
|
4020
4070
|
var StripeConsentNextActionSchema = consentShape.superRefine(checkConsent3);
|
|
4021
4071
|
var StripeSessionNextActionSchema = sessionNextAction;
|
|
4022
4072
|
var StripeAuthorizeNextActionSchema = authorizeNextAction;
|
|
4023
4073
|
var StripeKycNextActionSchema = kycShape.superRefine(checkKyc3);
|
|
4074
|
+
var StripeIdentifiersNextActionSchema = identifiersNextAction;
|
|
4075
|
+
var StripeAttestationNextActionSchema = attestationNextAction;
|
|
4024
4076
|
var StripeVerifyIdentityNextActionSchema = verifyIdentityNextAction;
|
|
4025
4077
|
var StripeWaitNextActionSchema = waitNextAction;
|
|
4026
4078
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
@@ -4037,6 +4089,8 @@ var nextActionOptions = [
|
|
|
4037
4089
|
sessionNextAction,
|
|
4038
4090
|
authorizeNextAction,
|
|
4039
4091
|
kycShape,
|
|
4092
|
+
identifiersNextAction,
|
|
4093
|
+
attestationNextAction,
|
|
4040
4094
|
verifyIdentityNextAction,
|
|
4041
4095
|
waitNextAction,
|
|
4042
4096
|
placeOrderNextAction,
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tableEntry,
|
|
17
17
|
unofferedEndpoints,
|
|
18
18
|
unreachableStates
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BK2XD3JT.mjs";
|
|
20
20
|
import {
|
|
21
21
|
MOONPAY_ENDPOINTS
|
|
22
22
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -356,6 +356,40 @@ var COUNTRY_NAMES = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.count
|
|
|
356
356
|
var FIAT_CURRENCY_NAMES = Object.fromEntries(uniqueCurrencies);
|
|
357
357
|
var COUNTRY_TO_CURRENCY = Object.fromEntries(COUNTRY_CURRENCY_LIST.map((e) => [e.country, e.currency]));
|
|
358
358
|
var PAYMENT_METHOD_CATEGORIES = ["card", "apple_pay", "google_pay", "bank_transfer"];
|
|
359
|
+
var EU_COUNTRIES = [
|
|
360
|
+
"AT",
|
|
361
|
+
"BE",
|
|
362
|
+
"BG",
|
|
363
|
+
"HR",
|
|
364
|
+
"CY",
|
|
365
|
+
"CZ",
|
|
366
|
+
"DK",
|
|
367
|
+
"EE",
|
|
368
|
+
"FI",
|
|
369
|
+
"FR",
|
|
370
|
+
"DE",
|
|
371
|
+
"GR",
|
|
372
|
+
"HU",
|
|
373
|
+
"IE",
|
|
374
|
+
"IT",
|
|
375
|
+
"LV",
|
|
376
|
+
"LT",
|
|
377
|
+
"LU",
|
|
378
|
+
"MT",
|
|
379
|
+
"NL",
|
|
380
|
+
"PL",
|
|
381
|
+
"PT",
|
|
382
|
+
"RO",
|
|
383
|
+
"SK",
|
|
384
|
+
"SI",
|
|
385
|
+
"ES",
|
|
386
|
+
"SE"
|
|
387
|
+
];
|
|
388
|
+
var EEA_COUNTRIES = [...EU_COUNTRIES, "IS", "LI", "NO"];
|
|
389
|
+
var EU_COUNTRY_SET = new Set(EU_COUNTRIES);
|
|
390
|
+
var EEA_COUNTRY_SET = new Set(EEA_COUNTRIES);
|
|
391
|
+
var isEuCountry = (country) => EU_COUNTRY_SET.has(country);
|
|
392
|
+
var isEeaCountry = (country) => EEA_COUNTRY_SET.has(country);
|
|
359
393
|
|
|
360
394
|
// src/schemas.ts
|
|
361
395
|
import { z } from "zod";
|
|
@@ -2955,11 +2989,13 @@ var obj4 = (shape) => z4.object(shape).strict();
|
|
|
2955
2989
|
var nonEmpty = z4.string().refine((value) => value.trim().length > 0, "must not be blank");
|
|
2956
2990
|
var hasUniqueIds4 = (ids) => new Set(ids).size === ids.length;
|
|
2957
2991
|
var retryAfterMs = z4.number().int().positive().max(6e4);
|
|
2958
|
-
var
|
|
2992
|
+
var centsAmount = z4.string().regex(/^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/, "must be an amount in cents").refine((amount) => Number(amount) > 0, "must be positive");
|
|
2959
2993
|
var kycValues = z4.record(KycFieldIdSchema, z4.string());
|
|
2960
2994
|
var instant = z4.string().datetime({ offset: true });
|
|
2995
|
+
var chargeCurrency = z4.enum(["USD", "EUR"]);
|
|
2996
|
+
var countryCode = z4.enum(Object.keys(CountryCode));
|
|
2961
2997
|
var checkout = obj4({
|
|
2962
|
-
amount: obj4({ currency:
|
|
2998
|
+
amount: obj4({ currency: chargeCurrency, amount: centsAmount }),
|
|
2963
2999
|
destination: obj4({ asset: nonEmpty, network: nonEmpty }),
|
|
2964
3000
|
paymentMethod: z4.literal("apple_pay")
|
|
2965
3001
|
});
|
|
@@ -3026,9 +3062,9 @@ var paySheet = obj4({
|
|
|
3026
3062
|
destinationCurrency: nonEmpty,
|
|
3027
3063
|
destinationNetwork: nonEmpty,
|
|
3028
3064
|
walletAddress: nonEmpty,
|
|
3029
|
-
merchantCountryCode:
|
|
3030
|
-
currencyCode:
|
|
3031
|
-
amount:
|
|
3065
|
+
merchantCountryCode: countryCode,
|
|
3066
|
+
currencyCode: chargeCurrency,
|
|
3067
|
+
amount: centsAmount,
|
|
3032
3068
|
label: nonEmpty
|
|
3033
3069
|
});
|
|
3034
3070
|
var StripePaySheetSchema = paySheet;
|
|
@@ -3045,7 +3081,7 @@ var authorizeNextAction = obj4({ next: z4.literal("authorize"), linkAuthIntentId
|
|
|
3045
3081
|
var kycShape = obj4({
|
|
3046
3082
|
next: z4.literal("kyc"),
|
|
3047
3083
|
round: z4.enum(["ACCOUNT", "IDENTITY"]),
|
|
3048
|
-
tier: z4.enum(["l0", "l1"]),
|
|
3084
|
+
tier: z4.enum(["l0", "l1", "l2"]),
|
|
3049
3085
|
correctionRound,
|
|
3050
3086
|
fields: z4.array(FormFieldSchema),
|
|
3051
3087
|
heldValues: kycValues,
|
|
@@ -3054,6 +3090,8 @@ var kycShape = obj4({
|
|
|
3054
3090
|
fieldErrors: z4.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
|
|
3055
3091
|
reask: reask.nullable()
|
|
3056
3092
|
});
|
|
3093
|
+
var identifiersNextAction = obj4({ next: z4.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
|
|
3094
|
+
var attestationNextAction = obj4({ next: z4.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
|
|
3057
3095
|
var verifyIdentityNextAction = obj4({ next: z4.literal("verifyIdentity"), linkAuthToken: linkAuthToken.nullable() });
|
|
3058
3096
|
var waitNextAction = obj4({ next: z4.literal("wait"), retryAfterMs });
|
|
3059
3097
|
var placeOrderNextAction = obj4({
|
|
@@ -3090,16 +3128,24 @@ var checkKyc3 = (nextAction, context2) => {
|
|
|
3090
3128
|
if (nextAction.round === "ACCOUNT" !== (nextAction.verifiedEmail !== null)) {
|
|
3091
3129
|
context2.addIssue({ code: "custom", path: ["verifiedEmail"], message: "only the account round carries the verified email" });
|
|
3092
3130
|
}
|
|
3131
|
+
if (nextAction.tier === "l2" && nextAction.round !== "IDENTITY") {
|
|
3132
|
+
context2.addIssue({ code: "custom", path: ["tier"], message: "l2 is an identity round" });
|
|
3133
|
+
}
|
|
3093
3134
|
};
|
|
3094
3135
|
var checkPlaceOrder = (nextAction, context2) => {
|
|
3095
3136
|
if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
|
|
3096
3137
|
context2.addIssue({ code: "custom", path: ["paySheet", "amount"], message: "the sheet charges the price shown" });
|
|
3097
3138
|
}
|
|
3139
|
+
if (nextAction.paySheet.currencyCode !== nextAction.price.total.currency) {
|
|
3140
|
+
context2.addIssue({ code: "custom", path: ["paySheet", "currencyCode"], message: "the sheet charges the price currency" });
|
|
3141
|
+
}
|
|
3098
3142
|
};
|
|
3099
3143
|
var StripeConsentNextActionSchema = consentShape.superRefine(checkConsent3);
|
|
3100
3144
|
var StripeSessionNextActionSchema = sessionNextAction;
|
|
3101
3145
|
var StripeAuthorizeNextActionSchema = authorizeNextAction;
|
|
3102
3146
|
var StripeKycNextActionSchema = kycShape.superRefine(checkKyc3);
|
|
3147
|
+
var StripeIdentifiersNextActionSchema = identifiersNextAction;
|
|
3148
|
+
var StripeAttestationNextActionSchema = attestationNextAction;
|
|
3103
3149
|
var StripeVerifyIdentityNextActionSchema = verifyIdentityNextAction;
|
|
3104
3150
|
var StripeWaitNextActionSchema = waitNextAction;
|
|
3105
3151
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
@@ -3116,6 +3162,8 @@ var nextActionOptions = [
|
|
|
3116
3162
|
sessionNextAction,
|
|
3117
3163
|
authorizeNextAction,
|
|
3118
3164
|
kycShape,
|
|
3165
|
+
identifiersNextAction,
|
|
3166
|
+
attestationNextAction,
|
|
3119
3167
|
verifyIdentityNextAction,
|
|
3120
3168
|
waitNextAction,
|
|
3121
3169
|
placeOrderNextAction,
|
|
@@ -3267,7 +3315,9 @@ export {
|
|
|
3267
3315
|
DOCUMENTED_ENDPOINTS,
|
|
3268
3316
|
DeliveryStateSchema,
|
|
3269
3317
|
DestinationAssetSchema,
|
|
3318
|
+
EEA_COUNTRIES,
|
|
3270
3319
|
ENDPOINT_PATTERN,
|
|
3320
|
+
EU_COUNTRIES,
|
|
3271
3321
|
FIAT_CURRENCY_NAMES,
|
|
3272
3322
|
FIAT_TERMS_ENDPOINT,
|
|
3273
3323
|
FIELD_SPEC_TYPES,
|
|
@@ -3403,6 +3453,7 @@ export {
|
|
|
3403
3453
|
SelectOptionSchema,
|
|
3404
3454
|
SessionAuthStateSchema,
|
|
3405
3455
|
StatusHistoryEntrySchema,
|
|
3456
|
+
StripeAttestationNextActionSchema,
|
|
3406
3457
|
StripeAuthorizeNextActionSchema,
|
|
3407
3458
|
StripeAuthorizeRequestSchema,
|
|
3408
3459
|
StripeCheckoutRequestSchema,
|
|
@@ -3414,6 +3465,7 @@ export {
|
|
|
3414
3465
|
StripeDoneSchema,
|
|
3415
3466
|
StripeErrorBodySchema,
|
|
3416
3467
|
StripeFaultSchema,
|
|
3468
|
+
StripeIdentifiersNextActionSchema,
|
|
3417
3469
|
StripeKycNextActionSchema,
|
|
3418
3470
|
StripeKycRequestSchema,
|
|
3419
3471
|
StripeLinkAuthTokenSchema,
|
|
@@ -3463,6 +3515,8 @@ export {
|
|
|
3463
3515
|
checkLegalEmission,
|
|
3464
3516
|
endpointMatches,
|
|
3465
3517
|
fixtureMeta,
|
|
3518
|
+
isEeaCountry,
|
|
3519
|
+
isEuCountry,
|
|
3466
3520
|
isTerminal,
|
|
3467
3521
|
loadFixture,
|
|
3468
3522
|
loadFixtures,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* The Stripe flow on `POST /fiat/next`.
|
|
3
3
|
*
|
|
4
4
|
* A response names the next action in `next`; the client's request names it in `action`. `observe` answers the
|
|
5
|
-
* current next action. `wait` and `verifyIdentity` have no request: send `observe` after
|
|
6
|
-
* answered by `order`. Identity, the verified email and the deposit wallet come from the
|
|
7
|
-
* never from a request body.
|
|
5
|
+
* current next action. `wait`, `identifiers`, `attestation` and `verifyIdentity` have no request: send `observe` after
|
|
6
|
+
* them. `orderPending` is answered by `order`. Identity, the verified email and the deposit wallet come from the
|
|
7
|
+
* verified partner assertion, never from a request body.
|
|
8
8
|
*
|
|
9
9
|
* A retry sends the same request and gets the current response. A fault is a 4xx/5xx whose body is
|
|
10
10
|
* `StripeErrorBody`; anything the buyer can act on is a 200.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* Zero runtime dependencies, so production React Native code can import it. The zod schemas are in
|
|
13
13
|
* `./stripe.schemas`, exported from the package root only.
|
|
14
14
|
*/
|
|
15
|
+
import type { CountryCode } from '../codes';
|
|
15
16
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
16
17
|
import type { FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId } from '../types';
|
|
17
18
|
export declare const STRIPE_ENDPOINTS: {
|
|
@@ -23,9 +24,9 @@ export declare const STRIPE_ENDPOINTS: {
|
|
|
23
24
|
* retried under the same `orderId` places nothing new.
|
|
24
25
|
*/
|
|
25
26
|
export interface StripeCheckout {
|
|
26
|
-
/**
|
|
27
|
+
/** USD for a US buyer, EUR for an EU buyer. */
|
|
27
28
|
amount: FiatAmount & {
|
|
28
|
-
currency: 'USD';
|
|
29
|
+
currency: 'USD' | 'EUR';
|
|
29
30
|
};
|
|
30
31
|
/** The asset and its network, as the routing table or `/fiat/quote` named them. */
|
|
31
32
|
destination: {
|
|
@@ -102,13 +103,17 @@ export type StripeReask = {
|
|
|
102
103
|
/**
|
|
103
104
|
* Show the shared form, prefilled with `heldValues`. `ACCOUNT`: call `registerLinkUser` with the values and
|
|
104
105
|
* `verifiedEmail`. `IDENTITY`: sign in with `linkAuthToken`, then call `attachKycInfo` with the values. Then send `kyc`
|
|
105
|
-
* with `correctionRound`, which names this form: how many
|
|
106
|
-
* `null` when the backend could not mint one: the device pushes under the Link session `authorize` left it.
|
|
106
|
+
* with `correctionRound`, which names this form: how many identity forms Stripe was handed before it. `linkAuthToken`
|
|
107
|
+
* is `null` when the backend could not mint one: the device pushes under the Link session `authorize` left it.
|
|
108
|
+
*
|
|
109
|
+
* An EU buyer gets `round: 'IDENTITY'`, `tier: 'l2'`: Stripe reads `l0` and `l1` as not available there. Its fields add
|
|
110
|
+
* `NATIONALITY`, `CITY_OF_BIRTH` and `COUNTRY_OF_BIRTH`, which the device passes to `attachKycInfo`. The backend sends
|
|
111
|
+
* `l2`, `identifiers` and `attestation` only for an EUR checkout, so a client that sends only USD never gets them.
|
|
107
112
|
*/
|
|
108
113
|
export type StripeKycNextAction = {
|
|
109
114
|
next: 'kyc';
|
|
110
115
|
round: 'ACCOUNT' | 'IDENTITY';
|
|
111
|
-
tier: 'l0' | 'l1';
|
|
116
|
+
tier: 'l0' | 'l1' | 'l2';
|
|
112
117
|
correctionRound: number;
|
|
113
118
|
fields: FormField[];
|
|
114
119
|
heldValues: Partial<Record<KycFieldId, string>>;
|
|
@@ -127,6 +132,19 @@ export type StripeKycRequest = {
|
|
|
127
132
|
correctionRound: number;
|
|
128
133
|
values: Partial<Record<KycFieldId, string>>;
|
|
129
134
|
} & StripeHeldOrder;
|
|
135
|
+
/**
|
|
136
|
+
* Sign in with `linkAuthToken` and run the SDK's `retrieveMissingIdentifiers`. Collect each listed identifier from the
|
|
137
|
+
* buyer, pass them to `submitIdentifiers`, then send `observe`. Fun stores none of them.
|
|
138
|
+
*/
|
|
139
|
+
export type StripeIdentifiersNextAction = {
|
|
140
|
+
next: 'identifiers';
|
|
141
|
+
linkAuthToken: StripeLinkAuthToken | null;
|
|
142
|
+
};
|
|
143
|
+
/** Sign in with `linkAuthToken`, run the SDK's `presentUserAttestation` (Stripe's terms), then send `observe`. */
|
|
144
|
+
export type StripeAttestationNextAction = {
|
|
145
|
+
next: 'attestation';
|
|
146
|
+
linkAuthToken: StripeLinkAuthToken | null;
|
|
147
|
+
};
|
|
130
148
|
/** Sign in with `linkAuthToken`, run the SDK's `verifyIdentity`, then send `observe`. */
|
|
131
149
|
export type StripeVerifyIdentityNextAction = {
|
|
132
150
|
next: 'verifyIdentity';
|
|
@@ -148,8 +166,9 @@ export interface StripePaySheet {
|
|
|
148
166
|
destinationCurrency: string;
|
|
149
167
|
destinationNetwork: string;
|
|
150
168
|
walletAddress: string;
|
|
151
|
-
merchantCountryCode:
|
|
152
|
-
|
|
169
|
+
merchantCountryCode: CountryCode;
|
|
170
|
+
/** The charge currency: the checkout's. */
|
|
171
|
+
currencyCode: 'USD' | 'EUR';
|
|
153
172
|
amount: string;
|
|
154
173
|
label: string;
|
|
155
174
|
}
|
|
@@ -214,7 +233,10 @@ export type StripeOrderPendingNextAction = {
|
|
|
214
233
|
order: FiatStepResponse | null;
|
|
215
234
|
};
|
|
216
235
|
export type StripeRequest = StripeRequestContext & (StripeObserveRequest | StripeConsentRequest | StripeSessionRequest | StripeAuthorizeRequest | StripeKycRequest | StripePlaceOrderRequest | StripeCheckoutRequest | StripeOrderRequest);
|
|
217
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* Every `action` a Stripe request names. `wait`, `identifiers`, `attestation` and `verifyIdentity` are next actions the
|
|
238
|
+
* client answers with `observe`.
|
|
239
|
+
*/
|
|
218
240
|
export type StripeAction = StripeRequest['action'];
|
|
219
241
|
/** The wire body. The orchestrator reads `provider` and `geo`; Stripe's action schemas read the rest. */
|
|
220
242
|
export type StripeNextRequest = {
|
|
@@ -222,7 +244,7 @@ export type StripeNextRequest = {
|
|
|
222
244
|
geo: FiatGeo;
|
|
223
245
|
} & StripeRequest;
|
|
224
246
|
/** Every next action but `checkoutSecret`, which only `checkout` answers. */
|
|
225
|
-
export type StripeNextAction = StripeConsentNextAction | StripeSessionNextAction | StripeAuthorizeNextAction | StripeKycNextAction | StripeVerifyIdentityNextAction | StripeWaitNextAction | StripePlaceOrderNextAction | StripePayNextAction | StripeOrderPendingNextAction;
|
|
247
|
+
export type StripeNextAction = StripeConsentNextAction | StripeSessionNextAction | StripeAuthorizeNextAction | StripeKycNextAction | StripeIdentifiersNextAction | StripeAttestationNextAction | StripeVerifyIdentityNextAction | StripeWaitNextAction | StripePlaceOrderNextAction | StripePayNextAction | StripeOrderPendingNextAction;
|
|
226
248
|
/** The order is terminal. `order` is its body, which the shared order screen renders. */
|
|
227
249
|
export type StripeDone = {
|
|
228
250
|
next: 'done';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* exported from the package root, never from `./stripe`, so the production entry stays free of zod.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import type { StripeAuthorizeNextAction, StripeAuthorizeRequest, StripeCheckout, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSecretNextAction, StripeConsentNextAction, StripeConsentRequest, StripeDone, StripeErrorBody, StripeFault, StripeKycNextAction, StripeKycRequest, StripeLinkAuthToken, StripeNextAction, StripeNextRequest, StripeObserveRequest, StripeOrderPendingNextAction, StripeOrderRequest, StripeOrderResponse, StripePayNextAction, StripePaySheet, StripePlaceOrderNextAction, StripePlaceOrderRequest, StripePrice, StripeReask, StripeRefused, StripeRequest, StripeRequestContext, StripeResponseFor, StripeSessionNextAction, StripeSessionRequest, StripeStepResponse, StripeVerifyIdentityNextAction, StripeWaitNextAction } from './stripe';
|
|
6
|
+
import type { StripeAttestationNextAction, StripeAuthorizeNextAction, StripeAuthorizeRequest, StripeCheckout, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSecretNextAction, StripeConsentNextAction, StripeConsentRequest, StripeDone, StripeErrorBody, StripeFault, StripeIdentifiersNextAction, StripeKycNextAction, StripeKycRequest, StripeLinkAuthToken, StripeNextAction, StripeNextRequest, StripeObserveRequest, StripeOrderPendingNextAction, StripeOrderRequest, StripeOrderResponse, StripePayNextAction, StripePaySheet, StripePlaceOrderNextAction, StripePlaceOrderRequest, StripePrice, StripeReask, StripeRefused, StripeRequest, StripeRequestContext, StripeResponseFor, StripeSessionNextAction, StripeSessionRequest, StripeStepResponse, StripeVerifyIdentityNextAction, StripeWaitNextAction } from './stripe';
|
|
7
7
|
export declare const StripeCheckoutSchema: z.ZodType<StripeCheckout>;
|
|
8
8
|
export declare const StripeRequestContextSchema: z.ZodType<StripeRequestContext>;
|
|
9
9
|
export declare const StripeObserveRequestSchema: z.ZodType<StripeRequestContext & StripeObserveRequest>;
|
|
@@ -24,6 +24,8 @@ export declare const StripeConsentNextActionSchema: z.ZodType<StripeConsentNextA
|
|
|
24
24
|
export declare const StripeSessionNextActionSchema: z.ZodType<StripeSessionNextAction>;
|
|
25
25
|
export declare const StripeAuthorizeNextActionSchema: z.ZodType<StripeAuthorizeNextAction>;
|
|
26
26
|
export declare const StripeKycNextActionSchema: z.ZodType<StripeKycNextAction>;
|
|
27
|
+
export declare const StripeIdentifiersNextActionSchema: z.ZodType<StripeIdentifiersNextAction>;
|
|
28
|
+
export declare const StripeAttestationNextActionSchema: z.ZodType<StripeAttestationNextAction>;
|
|
27
29
|
export declare const StripeVerifyIdentityNextActionSchema: z.ZodType<StripeVerifyIdentityNextAction>;
|
|
28
30
|
export declare const StripeWaitNextActionSchema: z.ZodType<StripeWaitNextAction>;
|
|
29
31
|
export declare const StripePlaceOrderNextActionSchema: z.ZodType<StripePlaceOrderNextAction>;
|
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.50.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": {
|