@fiatconnect/fiatconnect-types
Advanced tools
Comparing version 10.1.0 to 10.2.0
@@ -12,2 +12,2 @@ import { z } from 'zod'; | ||
}>; | ||
export declare type AuthRequestBody = z.infer<typeof authRequestBodySchema>; | ||
export type AuthRequestBody = z.infer<typeof authRequestBodySchema>; |
@@ -9,2 +9,2 @@ import { z } from 'zod'; | ||
}>; | ||
export declare type ClockResponse = z.infer<typeof clockResponseSchema>; | ||
export type ClockResponse = z.infer<typeof clockResponseSchema>; |
@@ -7,3 +7,4 @@ import { z } from 'zod'; | ||
IBANNumber = "IBANNumber", | ||
IFSCAccount = "IFSCAccount" | ||
IFSCAccount = "IFSCAccount", | ||
PIXAccount = "PIXAccount" | ||
} | ||
@@ -17,2 +18,9 @@ export declare const fiatAccountSchemaSchema: z.ZodNativeEnum<typeof FiatAccountSchema>; | ||
export declare const fiatAccountTypeSchema: z.ZodNativeEnum<typeof FiatAccountType>; | ||
export declare enum PIXKeyTypeEnum { | ||
EMAIL = "EMAIL", | ||
PHONE = "PHONE", | ||
CPF = "CPF", | ||
RANDOM = "RANDOM" | ||
} | ||
export declare const pixKeyTypeEnumSchema: z.ZodNativeEnum<typeof PIXKeyTypeEnum>; | ||
export declare enum SupportedOperatorEnum { | ||
@@ -25,2 +33,62 @@ ORANGE = "ORANGE", | ||
export declare const supportedOperatorEnumSchema: z.ZodNativeEnum<typeof SupportedOperatorEnum>; | ||
export declare const PIX_EMAIL_KEY_REGEX: RegExp; | ||
export declare const PIX_CPF_KEY_REGEX: RegExp; | ||
export declare const PIX_PHONE_KEY_REGEX: RegExp; | ||
export declare const PIX_RANDOM_KEY_REGEX: RegExp; | ||
export declare const pixAccountSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{ | ||
accountName: z.ZodString; | ||
institutionName: z.ZodString; | ||
fiatAccountType: z.ZodNativeEnum<typeof FiatAccountType>; | ||
}, "strip", z.ZodTypeAny, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}>, z.ZodObject<{ | ||
fiatAccountType: z.ZodLiteral<FiatAccountType.BankAccount>; | ||
}, "strip", z.ZodTypeAny, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}>>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.EMAIL>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.CPF>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.PHONE>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.RANDOM>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}>]>>; | ||
export type PIXAccount = z.infer<typeof pixAccountSchema>; | ||
export declare const accountNumberSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -51,3 +119,3 @@ accountName: z.ZodString; | ||
}>>; | ||
export declare type AccountNumber = z.infer<typeof accountNumberSchema>; | ||
export type AccountNumber = z.infer<typeof accountNumberSchema>; | ||
export declare const duniaWalletSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -75,3 +143,3 @@ accountName: z.ZodString; | ||
}>>; | ||
export declare type DuniaWallet = z.infer<typeof duniaWalletSchema>; | ||
export type DuniaWallet = z.infer<typeof duniaWalletSchema>; | ||
export declare const mobileMoneySchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -105,3 +173,3 @@ accountName: z.ZodString; | ||
}>>; | ||
export declare type MobileMoney = z.infer<typeof mobileMoneySchema>; | ||
export type MobileMoney = z.infer<typeof mobileMoneySchema>; | ||
export declare const iBANNumberSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -132,3 +200,3 @@ accountName: z.ZodString; | ||
}>>; | ||
export declare type IBANNumber = z.infer<typeof iBANNumberSchema>; | ||
export type IBANNumber = z.infer<typeof iBANNumberSchema>; | ||
export declare const iFSCAccountSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -162,3 +230,3 @@ accountName: z.ZodString; | ||
}>>; | ||
export declare type IFSCAccount = z.infer<typeof iFSCAccountSchema>; | ||
export type IFSCAccount = z.infer<typeof iFSCAccountSchema>; | ||
export declare const fiatAccountSchemasSchema: z.ZodObject<{ | ||
@@ -293,2 +361,57 @@ AccountNumber: z.ZodIntersection<z.ZodObject<{ | ||
}>>; | ||
PIXAccount: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{ | ||
accountName: z.ZodString; | ||
institutionName: z.ZodString; | ||
fiatAccountType: z.ZodNativeEnum<typeof FiatAccountType>; | ||
}, "strip", z.ZodTypeAny, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}>, z.ZodObject<{ | ||
fiatAccountType: z.ZodLiteral<FiatAccountType.BankAccount>; | ||
}, "strip", z.ZodTypeAny, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}>>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.EMAIL>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.CPF>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.PHONE>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.RANDOM>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}>]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -341,2 +464,21 @@ AccountNumber: { | ||
}; | ||
PIXAccount: { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
} & { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
} & ({ | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}); | ||
}, { | ||
@@ -389,6 +531,25 @@ AccountNumber: { | ||
}; | ||
PIXAccount: { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
} & { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
} & ({ | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}); | ||
}>; | ||
export declare type FiatAccountSchemas = z.infer<typeof fiatAccountSchemasSchema>; | ||
export type FiatAccountSchemas = z.infer<typeof fiatAccountSchemasSchema>; | ||
export declare const fiatAccountIdSchema: z.ZodString; | ||
export declare type FiatAccountId = z.infer<typeof fiatAccountIdSchema>; | ||
export type FiatAccountId = z.infer<typeof fiatAccountIdSchema>; | ||
export declare const obfuscatedFiatAccountDataSchema: z.ZodObject<{ | ||
@@ -413,3 +574,3 @@ fiatAccountId: z.ZodString; | ||
}>; | ||
export declare type ObfuscatedFiatAccountData = z.infer<typeof obfuscatedFiatAccountDataSchema>; | ||
export type ObfuscatedFiatAccountData = z.infer<typeof obfuscatedFiatAccountDataSchema>; | ||
export declare const postFiatAccountRequestBodySchema: z.ZodUnion<[z.ZodObject<{ | ||
@@ -665,4 +826,103 @@ fiatAccountSchema: z.ZodLiteral<FiatAccountSchema.AccountNumber>; | ||
fiatAccountSchema: FiatAccountSchema.IFSCAccount; | ||
}>, z.ZodObject<{ | ||
fiatAccountSchema: z.ZodLiteral<FiatAccountSchema.PIXAccount>; | ||
data: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{ | ||
accountName: z.ZodString; | ||
institutionName: z.ZodString; | ||
fiatAccountType: z.ZodNativeEnum<typeof FiatAccountType>; | ||
}, "strip", z.ZodTypeAny, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}, { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
}>, z.ZodObject<{ | ||
fiatAccountType: z.ZodLiteral<FiatAccountType.BankAccount>; | ||
}, "strip", z.ZodTypeAny, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}, { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
}>>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.EMAIL>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
}>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.CPF>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.PHONE>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
}>]>, z.ZodObject<{ | ||
keyType: z.ZodLiteral<PIXKeyTypeEnum.RANDOM>; | ||
key: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}, { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}>]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
data: { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
} & { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
} & ({ | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}); | ||
fiatAccountSchema: FiatAccountSchema.PIXAccount; | ||
}, { | ||
data: { | ||
accountName: string; | ||
institutionName: string; | ||
fiatAccountType: FiatAccountType; | ||
} & { | ||
fiatAccountType: FiatAccountType.BankAccount; | ||
} & ({ | ||
keyType: PIXKeyTypeEnum.EMAIL; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.CPF; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.PHONE; | ||
key: string; | ||
} | { | ||
keyType: PIXKeyTypeEnum.RANDOM; | ||
key: string; | ||
}); | ||
fiatAccountSchema: FiatAccountSchema.PIXAccount; | ||
}>]>; | ||
export declare type PostFiatAccountRequestBody = z.infer<typeof postFiatAccountRequestBodySchema>; | ||
export type PostFiatAccountRequestBody = z.infer<typeof postFiatAccountRequestBodySchema>; | ||
export declare const deleteFiatAccountRequestParamsSchema: z.ZodObject<{ | ||
@@ -675,3 +935,3 @@ fiatAccountId: z.ZodString; | ||
}>; | ||
export declare type DeleteFiatAccountRequestParams = z.infer<typeof deleteFiatAccountRequestParamsSchema>; | ||
export type DeleteFiatAccountRequestParams = z.infer<typeof deleteFiatAccountRequestParamsSchema>; | ||
export declare const getFiatAccountsResponseSchema: z.ZodRecord<z.ZodNativeEnum<typeof FiatAccountType>, z.ZodArray<z.ZodObject<{ | ||
@@ -696,3 +956,3 @@ fiatAccountId: z.ZodString; | ||
}>, "many">>; | ||
export declare type GetFiatAccountsResponse = z.infer<typeof getFiatAccountsResponseSchema>; | ||
export type GetFiatAccountsResponse = z.infer<typeof getFiatAccountsResponseSchema>; | ||
export declare const postFiatAccountResponseSchema: z.ZodObject<{ | ||
@@ -717,2 +977,2 @@ fiatAccountId: z.ZodString; | ||
}>; | ||
export declare type PostFiatAccountResponse = z.infer<typeof postFiatAccountResponseSchema>; | ||
export type PostFiatAccountResponse = z.infer<typeof postFiatAccountResponseSchema>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.postFiatAccountResponseSchema = exports.getFiatAccountsResponseSchema = exports.deleteFiatAccountRequestParamsSchema = exports.postFiatAccountRequestBodySchema = exports.obfuscatedFiatAccountDataSchema = exports.fiatAccountIdSchema = exports.fiatAccountSchemasSchema = exports.iFSCAccountSchema = exports.iBANNumberSchema = exports.mobileMoneySchema = exports.duniaWalletSchema = exports.accountNumberSchema = exports.supportedOperatorEnumSchema = exports.SupportedOperatorEnum = exports.fiatAccountTypeSchema = exports.FiatAccountType = exports.fiatAccountSchemaSchema = exports.FiatAccountSchema = void 0; | ||
exports.postFiatAccountResponseSchema = exports.getFiatAccountsResponseSchema = exports.deleteFiatAccountRequestParamsSchema = exports.postFiatAccountRequestBodySchema = exports.obfuscatedFiatAccountDataSchema = exports.fiatAccountIdSchema = exports.fiatAccountSchemasSchema = exports.iFSCAccountSchema = exports.iBANNumberSchema = exports.mobileMoneySchema = exports.duniaWalletSchema = exports.accountNumberSchema = exports.pixAccountSchema = exports.PIX_RANDOM_KEY_REGEX = exports.PIX_PHONE_KEY_REGEX = exports.PIX_CPF_KEY_REGEX = exports.PIX_EMAIL_KEY_REGEX = exports.supportedOperatorEnumSchema = exports.SupportedOperatorEnum = exports.pixKeyTypeEnumSchema = exports.PIXKeyTypeEnum = exports.fiatAccountTypeSchema = exports.FiatAccountType = exports.fiatAccountSchemaSchema = exports.FiatAccountSchema = void 0; | ||
const zod_1 = require("zod"); | ||
@@ -21,2 +21,3 @@ /* | ||
FiatAccountSchema["IFSCAccount"] = "IFSCAccount"; | ||
FiatAccountSchema["PIXAccount"] = "PIXAccount"; | ||
})(FiatAccountSchema = exports.FiatAccountSchema || (exports.FiatAccountSchema = {})); | ||
@@ -35,2 +36,12 @@ exports.fiatAccountSchemaSchema = zod_1.z.nativeEnum(FiatAccountSchema, { | ||
}); | ||
var PIXKeyTypeEnum; | ||
(function (PIXKeyTypeEnum) { | ||
PIXKeyTypeEnum["EMAIL"] = "EMAIL"; | ||
PIXKeyTypeEnum["PHONE"] = "PHONE"; | ||
PIXKeyTypeEnum["CPF"] = "CPF"; | ||
PIXKeyTypeEnum["RANDOM"] = "RANDOM"; | ||
})(PIXKeyTypeEnum = exports.PIXKeyTypeEnum || (exports.PIXKeyTypeEnum = {})); | ||
exports.pixKeyTypeEnumSchema = zod_1.z.nativeEnum(PIXKeyTypeEnum, { | ||
description: 'pixKeyTypeEnumSchema', | ||
}); | ||
var SupportedOperatorEnum; | ||
@@ -51,2 +62,29 @@ (function (SupportedOperatorEnum) { | ||
}); | ||
exports.PIX_EMAIL_KEY_REGEX = | ||
/* eslint-disable-next-line no-useless-escape */ // For some reason, eslint thinks the escaped \[ and /] are useless. they are indeed useful. | ||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // credit to http://emailregex.com/ | ||
exports.PIX_CPF_KEY_REGEX = /^([0-9]{3}\.){2}[0-9]{3}[-]([0-9]{2})$/; // example: 000.000.000-00, see https://en.wikipedia.org/wiki/CPF_number | ||
exports.PIX_PHONE_KEY_REGEX = /^[0-9]{11}$/; | ||
exports.PIX_RANDOM_KEY_REGEX = /^[a-zA-Z0-9]{32}$/; | ||
exports.pixAccountSchema = requiredFiatAccountSchemaFieldsSchema | ||
.and(zod_1.z.object({ | ||
fiatAccountType: zod_1.z.literal(FiatAccountType.BankAccount), | ||
}, { description: 'PIXAccountSchema' })) | ||
.and(zod_1.z | ||
.object({ | ||
keyType: zod_1.z.literal(PIXKeyTypeEnum.EMAIL), | ||
key: zod_1.z.string().regex(exports.PIX_EMAIL_KEY_REGEX), | ||
}) | ||
.or(zod_1.z.object({ | ||
keyType: zod_1.z.literal(PIXKeyTypeEnum.CPF), | ||
key: zod_1.z.string().regex(exports.PIX_CPF_KEY_REGEX), | ||
})) | ||
.or(zod_1.z.object({ | ||
keyType: zod_1.z.literal(PIXKeyTypeEnum.PHONE), | ||
key: zod_1.z.string().regex(exports.PIX_PHONE_KEY_REGEX), | ||
})) | ||
.or(zod_1.z.object({ | ||
keyType: zod_1.z.literal(PIXKeyTypeEnum.RANDOM), | ||
key: zod_1.z.string().regex(exports.PIX_RANDOM_KEY_REGEX), | ||
}))); | ||
exports.accountNumberSchema = requiredFiatAccountSchemaFieldsSchema.and(zod_1.z.object({ | ||
@@ -85,2 +123,3 @@ accountNumber: zod_1.z.string(), | ||
[FiatAccountSchema.IFSCAccount]: exports.iFSCAccountSchema, | ||
[FiatAccountSchema.PIXAccount]: exports.pixAccountSchema, | ||
}, { description: 'fiatAccountSchemasSchema' }); | ||
@@ -122,2 +161,6 @@ exports.fiatAccountIdSchema = zod_1.z.string({ | ||
}), | ||
zod_1.z.object({ | ||
fiatAccountSchema: zod_1.z.literal(exports.fiatAccountSchemaSchema.enum.PIXAccount), | ||
data: exports.pixAccountSchema, | ||
}), | ||
], { description: 'postFiatAccountRequestBodySchema' }); | ||
@@ -124,0 +167,0 @@ exports.deleteFiatAccountRequestParamsSchema = zod_1.z.object({ |
@@ -97,3 +97,3 @@ import { z } from 'zod'; | ||
}>; | ||
export declare type PersonalDataAndDocumentsKyc = z.infer<typeof personalDataAndDocumentsKycSchema>; | ||
export type PersonalDataAndDocumentsKyc = z.infer<typeof personalDataAndDocumentsKycSchema>; | ||
export declare const kycSchemasSchema: z.ZodObject<{ | ||
@@ -228,3 +228,3 @@ PersonalDataAndDocuments: z.ZodObject<{ | ||
}>; | ||
export declare type KycSchemas = z.infer<typeof kycSchemasSchema>; | ||
export type KycSchemas = z.infer<typeof kycSchemasSchema>; | ||
export declare const kycRequestParamsSchema: z.ZodObject<{ | ||
@@ -237,3 +237,3 @@ kycSchema: z.ZodNativeEnum<typeof KycSchema>; | ||
}>; | ||
export declare type KycRequestParams = z.infer<typeof kycRequestParamsSchema>; | ||
export type KycRequestParams = z.infer<typeof kycRequestParamsSchema>; | ||
export declare const kycStatusResponseSchema: z.ZodObject<{ | ||
@@ -246,2 +246,2 @@ kycStatus: z.ZodNativeEnum<typeof KycStatus>; | ||
}>; | ||
export declare type KycStatusResponse = z.infer<typeof kycStatusResponseSchema>; | ||
export type KycStatusResponse = z.infer<typeof kycStatusResponseSchema>; |
@@ -40,3 +40,3 @@ import { z } from 'zod'; | ||
}>; | ||
export declare type QuoteRequestBody = z.infer<typeof quoteRequestBodySchema>; | ||
export type QuoteRequestBody = z.infer<typeof quoteRequestBodySchema>; | ||
export declare const quoteErrorResponseSchema: z.ZodObject<{ | ||
@@ -61,3 +61,3 @@ error: z.ZodNativeEnum<typeof import("./common").FiatConnectError>; | ||
}>; | ||
export declare type QuoteErrorResponse = z.infer<typeof quoteErrorResponseSchema>; | ||
export type QuoteErrorResponse = z.infer<typeof quoteErrorResponseSchema>; | ||
export declare const quoteResponseKycSchemaSchema: z.ZodObject<{ | ||
@@ -73,3 +73,3 @@ kycSchema: z.ZodNativeEnum<typeof import("./kyc").KycSchema>; | ||
}>; | ||
export declare type QuoteResponseKycSchema = z.infer<typeof quoteResponseKycSchemaSchema>; | ||
export type QuoteResponseKycSchema = z.infer<typeof quoteResponseKycSchemaSchema>; | ||
export declare const quoteResponseFiatAccountSchemaSchema: z.ZodObject<{ | ||
@@ -85,3 +85,3 @@ fiatAccountSchema: z.ZodNativeEnum<typeof import("./fiat-account").FiatAccountSchema>; | ||
}>; | ||
export declare type QuoteResponseFiatAccountSchema = z.infer<typeof quoteResponseFiatAccountSchemaSchema>; | ||
export type QuoteResponseFiatAccountSchema = z.infer<typeof quoteResponseFiatAccountSchemaSchema>; | ||
export declare const fiatAccountTypeQuoteDataSchema: z.ZodObject<{ | ||
@@ -115,3 +115,3 @@ fiatAccountSchemas: z.ZodArray<z.ZodObject<{ | ||
}>; | ||
export declare type FiatAccountTypeQuoteData = z.infer<typeof fiatAccountTypeQuoteDataSchema>; | ||
export type FiatAccountTypeQuoteData = z.infer<typeof fiatAccountTypeQuoteDataSchema>; | ||
export declare const quoteResponseSchema: z.ZodObject<{ | ||
@@ -267,3 +267,3 @@ quote: z.ZodIntersection<z.ZodObject<{ | ||
}>; | ||
export declare type QuoteResponse = z.infer<typeof quoteResponseSchema>; | ||
export type QuoteResponse = z.infer<typeof quoteResponseSchema>; | ||
export declare const quotePreviewResponseSchema: z.ZodObject<{ | ||
@@ -409,2 +409,2 @@ quote: z.ZodObject<{ | ||
}>; | ||
export declare type QuotePreviewResponse = z.infer<typeof quotePreviewResponseSchema>; | ||
export type QuotePreviewResponse = z.infer<typeof quotePreviewResponseSchema>; |
@@ -28,3 +28,3 @@ import { z } from 'zod'; | ||
}>; | ||
export declare type TransferRequestBody = z.infer<typeof transferRequestBodySchema>; | ||
export type TransferRequestBody = z.infer<typeof transferRequestBodySchema>; | ||
export declare const transferResponseSchema: z.ZodObject<{ | ||
@@ -43,3 +43,3 @@ transferId: z.ZodString; | ||
}>; | ||
export declare type TransferResponse = z.infer<typeof transferResponseSchema>; | ||
export type TransferResponse = z.infer<typeof transferResponseSchema>; | ||
export declare const transferStatusRequestParamsSchema: z.ZodObject<{ | ||
@@ -52,3 +52,3 @@ transferId: z.ZodString; | ||
}>; | ||
export declare type TransferStatusRequestParams = z.infer<typeof transferStatusRequestParamsSchema>; | ||
export type TransferStatusRequestParams = z.infer<typeof transferStatusRequestParamsSchema>; | ||
export declare const transferStatusResponseSchema: z.ZodObject<{ | ||
@@ -88,2 +88,2 @@ status: z.ZodNativeEnum<typeof TransferStatus>; | ||
}>; | ||
export declare type TransferStatusResponse = z.infer<typeof transferStatusResponseSchema>; | ||
export type TransferStatusResponse = z.infer<typeof transferStatusResponseSchema>; |
@@ -88,3 +88,3 @@ import { z } from 'zod'; | ||
}>>; | ||
export declare type WebhookRequestBodyTransferIn = z.infer<typeof webhookRequestBodyTransferInSchema>; | ||
export type WebhookRequestBodyTransferIn = z.infer<typeof webhookRequestBodyTransferInSchema>; | ||
export declare const webhookRequestBodyTransferOutSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -170,3 +170,3 @@ provider: z.ZodString; | ||
}>>; | ||
export declare type WebhookRequestBodyTransferOut = z.infer<typeof webhookRequestBodyTransferOutSchema>; | ||
export type WebhookRequestBodyTransferOut = z.infer<typeof webhookRequestBodyTransferOutSchema>; | ||
export declare const webhookRequestBodyKycSchema: z.ZodIntersection<z.ZodObject<{ | ||
@@ -212,3 +212,3 @@ provider: z.ZodString; | ||
}>>; | ||
export declare type WebhookRequestBodyKyc = z.infer<typeof webhookRequestBodyKycSchema>; | ||
export type WebhookRequestBodyKyc = z.infer<typeof webhookRequestBodyKycSchema>; | ||
export declare const webhookRequestBodySchema: z.ZodUnion<[z.ZodIntersection<z.ZodObject<{ | ||
@@ -412,2 +412,2 @@ provider: z.ZodString; | ||
}>>]>; | ||
export declare type WebhookRequestBody = z.infer<typeof webhookRequestBodySchema>; | ||
export type WebhookRequestBody = z.infer<typeof webhookRequestBodySchema>; |
{ | ||
"name": "@fiatconnect/fiatconnect-types", | ||
"version": "10.1.0", | ||
"version": "10.2.0", | ||
"description": "Types used in the FiatConnect specification. Offered as standalone module for payment providers and wallets to both use for FiatConnect APIs and integrations.", | ||
@@ -30,16 +30,16 @@ "scripts": { | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@valora/eslint-config-typescript": "^1.0.1", | ||
"@valora/prettier-config": "^0.0.1", | ||
"conventional-changelog-conventionalcommits": "^5.0.0", | ||
"eslint": "^8.26.0", | ||
"eslint": "^8.28.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^27.1.3", | ||
"eslint-plugin-react": "^7.31.10", | ||
"eslint-plugin-jest": "^27.1.6", | ||
"eslint-plugin-react": "^7.31.11", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-native": "^4.0.0", | ||
"jest": "^29.2.2", | ||
"prettier": "^2.7.1", | ||
"jest": "^29.3.1", | ||
"prettier": "^2.8.0", | ||
"semantic-release": "^19.0.5", | ||
"typescript": "^4.8.4" | ||
"typescript": "^4.9.3" | ||
}, | ||
@@ -46,0 +46,0 @@ "prettier": "@valora/prettier-config", |
@@ -19,2 +19,3 @@ import { z } from 'zod' | ||
IFSCAccount = 'IFSCAccount', | ||
PIXAccount = 'PIXAccount', | ||
} | ||
@@ -34,2 +35,12 @@ export const fiatAccountSchemaSchema = z.nativeEnum(FiatAccountSchema, { | ||
export enum PIXKeyTypeEnum { | ||
EMAIL = 'EMAIL', | ||
PHONE = 'PHONE', | ||
CPF = 'CPF', | ||
RANDOM = 'RANDOM', | ||
} | ||
export const pixKeyTypeEnumSchema = z.nativeEnum(PIXKeyTypeEnum, { | ||
description: 'pixKeyTypeEnumSchema', | ||
}) | ||
export enum SupportedOperatorEnum { | ||
@@ -51,2 +62,45 @@ ORANGE = 'ORANGE', | ||
export const PIX_EMAIL_KEY_REGEX = | ||
/* eslint-disable-next-line no-useless-escape */ // For some reason, eslint thinks the escaped \[ and /] are useless. they are indeed useful. | ||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ // credit to http://emailregex.com/ | ||
export const PIX_CPF_KEY_REGEX = /^([0-9]{3}\.){2}[0-9]{3}[-]([0-9]{2})$/ // example: 000.000.000-00, see https://en.wikipedia.org/wiki/CPF_number | ||
export const PIX_PHONE_KEY_REGEX = /^[0-9]{11}$/ | ||
export const PIX_RANDOM_KEY_REGEX = /^[a-zA-Z0-9]{32}$/ | ||
export const pixAccountSchema = requiredFiatAccountSchemaFieldsSchema | ||
.and( | ||
z.object( | ||
{ | ||
fiatAccountType: z.literal(FiatAccountType.BankAccount), | ||
}, | ||
{ description: 'PIXAccountSchema' }, | ||
), | ||
) | ||
.and( | ||
z | ||
.object({ | ||
keyType: z.literal(PIXKeyTypeEnum.EMAIL), | ||
key: z.string().regex(PIX_EMAIL_KEY_REGEX), | ||
}) | ||
.or( | ||
z.object({ | ||
keyType: z.literal(PIXKeyTypeEnum.CPF), | ||
key: z.string().regex(PIX_CPF_KEY_REGEX), | ||
}), | ||
) | ||
.or( | ||
z.object({ | ||
keyType: z.literal(PIXKeyTypeEnum.PHONE), | ||
key: z.string().regex(PIX_PHONE_KEY_REGEX), | ||
}), | ||
) | ||
.or( | ||
z.object({ | ||
keyType: z.literal(PIXKeyTypeEnum.RANDOM), | ||
key: z.string().regex(PIX_RANDOM_KEY_REGEX), | ||
}), | ||
), | ||
) | ||
export type PIXAccount = z.infer<typeof pixAccountSchema> | ||
export const accountNumberSchema = requiredFiatAccountSchemaFieldsSchema.and( | ||
@@ -121,2 +175,3 @@ z.object( | ||
[FiatAccountSchema.IFSCAccount]: iFSCAccountSchema, | ||
[FiatAccountSchema.PIXAccount]: pixAccountSchema, | ||
}, | ||
@@ -173,2 +228,6 @@ { description: 'fiatAccountSchemasSchema' }, | ||
}), | ||
z.object({ | ||
fiatAccountSchema: z.literal(fiatAccountSchemaSchema.enum.PIXAccount), | ||
data: pixAccountSchema, | ||
}), | ||
], | ||
@@ -175,0 +234,0 @@ { description: 'postFiatAccountRequestBodySchema' }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155337
3491