@transfergratis/react-native-sdk 0.1.23 → 0.1.25
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/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
- package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
- package/android/src/main/AndroidManifest.xml +13 -5
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +26 -3
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +21 -0
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
- package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
- package/build/components/KYCElements/CameraCapture.js +4 -3
- package/build/components/KYCElements/CameraCapture.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
- package/build/components/KYCElements/FileUpload.js +5 -4
- package/build/components/KYCElements/FileUpload.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +5 -4
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +356 -227
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCapture.js +4 -3
- package/build/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
- package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/WelcomeTemplate.js +243 -0
- package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
- package/build/components/TemplateKYCExample.d.ts +8 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +10 -97
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +108 -11
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/DynamicTemplateExample.d.ts +10 -0
- package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
- package/build/components/example/DynamicTemplateExample.js +241 -0
- package/build/components/example/DynamicTemplateExample.js.map +1 -0
- package/build/config/KYCConfig.d.ts +14 -0
- package/build/config/KYCConfig.d.ts.map +1 -0
- package/build/config/KYCConfig.js +26 -0
- package/build/config/KYCConfig.js.map +1 -0
- package/build/config/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +112 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +2 -1
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +3 -3
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +317 -34
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/hooks/useTemplateLoader.d.ts +14 -0
- package/build/hooks/useTemplateLoader.d.ts.map +1 -0
- package/build/hooks/useTemplateLoader.js +85 -0
- package/build/hooks/useTemplateLoader.js.map +1 -0
- package/build/i18n/en/index.d.ts +49 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +50 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +35 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +36 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +24 -3
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +69 -10
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +7 -7
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +108 -39
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -1
- package/build/modules/api/SelfieVerification.d.ts.map +1 -1
- package/build/modules/api/SelfieVerification.js +17 -1
- package/build/modules/api/SelfieVerification.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +44 -0
- package/build/modules/api/TemplateService.d.ts.map +1 -0
- package/build/modules/api/TemplateService.js +145 -0
- package/build/modules/api/TemplateService.js.map +1 -0
- package/build/types/KYC.types.d.ts +265 -4
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +15 -0
- package/build/types/KYC.types.js.map +1 -1
- package/build/types/env.types.d.ts +13 -0
- package/build/types/env.types.d.ts.map +1 -0
- package/build/types/env.types.js +2 -0
- package/build/types/env.types.js.map +1 -0
- package/build/utils/cropByObb.d.ts +1 -0
- package/build/utils/cropByObb.d.ts.map +1 -1
- package/build/utils/cropByObb.js +70 -0
- package/build/utils/cropByObb.js.map +1 -1
- package/build/utils/deviceDetection.d.ts +6 -0
- package/build/utils/deviceDetection.d.ts.map +1 -0
- package/build/utils/deviceDetection.js +12 -0
- package/build/utils/deviceDetection.js.map +1 -0
- package/build/utils/platformAlert.d.ts +20 -0
- package/build/utils/platformAlert.d.ts.map +1 -0
- package/build/utils/platformAlert.js +67 -0
- package/build/utils/platformAlert.js.map +1 -0
- package/build/utils/template-transformer.d.ts +10 -0
- package/build/utils/template-transformer.d.ts.map +1 -0
- package/build/utils/template-transformer.js +365 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +158 -32
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.ts +3 -4
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +397 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
- package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +37 -108
- package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/KYCConfig.ts +34 -0
- package/src/config/allowedDomains.ts +133 -0
- package/src/hooks/useOrientationVideo.ts +5 -4
- package/src/hooks/useTemplateKYCFlow.tsx +347 -32
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +53 -2
- package/src/i18n/fr/index.ts +37 -1
- package/src/index.ts +14 -0
- package/src/modules/api/CardAuthentification.ts +76 -11
- package/src/modules/api/KYCService.ts +129 -45
- package/src/modules/api/SelfieVerification.ts +25 -3
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/types/KYC.types.ts +331 -3
- package/src/types/env.types.ts +13 -0
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/deviceDetection.ts +11 -0
- package/src/utils/platformAlert.ts +86 -0
- package/src/utils/template-transformer.ts +445 -0
- package/src/web/WebKYCEntry.tsx +199 -50
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OrientationVideoResponse } from '../../types/KYC.types';
|
|
2
2
|
import { SessionResponse, VerificationResult, VerificationSessionRequest } from './types';
|
|
3
|
+
import { KycEnvironment } from '../../types/env.types';
|
|
3
4
|
export interface KYCRequest {
|
|
4
5
|
userId: string;
|
|
5
6
|
documentImage: string;
|
|
@@ -37,7 +38,6 @@ export declare class KYCService {
|
|
|
37
38
|
private mrzServiceURL;
|
|
38
39
|
private barcodeServiceURL;
|
|
39
40
|
private orientationServiceURL;
|
|
40
|
-
private backendServiceURL;
|
|
41
41
|
constructor(baseURL: string, apiKey: string);
|
|
42
42
|
private getHeaders;
|
|
43
43
|
submitKYC(data: KYCRequest): Promise<KYCResponse>;
|
|
@@ -45,8 +45,8 @@ export declare class KYCService {
|
|
|
45
45
|
validateDocument(documentImage: string, documentType: string): Promise<any>;
|
|
46
46
|
getKYCStatus(verificationId: string): Promise<KYCResponse>;
|
|
47
47
|
processSelfieOrientationPicture(videoFile: string, token: string): Promise<SelfieVideoResponse[]>;
|
|
48
|
-
processOrientationVideo(videoFile: string): Promise<OrientationVideoResponse>;
|
|
49
|
-
detectFaceOnId(idCardImageUri: string, token: string, docType: string): Promise<{
|
|
48
|
+
processOrientationVideo(videoFile: string, env?: KycEnvironment): Promise<OrientationVideoResponse>;
|
|
49
|
+
detectFaceOnId(idCardImageUri: string, token: string, docType: string, env?: KycEnvironment): Promise<{
|
|
50
50
|
result: boolean;
|
|
51
51
|
detail: any[];
|
|
52
52
|
}>;
|
|
@@ -56,7 +56,7 @@ export declare class KYCService {
|
|
|
56
56
|
docRegion: string;
|
|
57
57
|
token: string;
|
|
58
58
|
postfix: string;
|
|
59
|
-
}): Promise<any>;
|
|
59
|
+
}, env?: KycEnvironment): Promise<any>;
|
|
60
60
|
extractDocumentInformation(params: {
|
|
61
61
|
fileUri: string;
|
|
62
62
|
docType: string;
|
|
@@ -66,7 +66,7 @@ export declare class KYCService {
|
|
|
66
66
|
extractBarcode(params: {
|
|
67
67
|
fileUri: string;
|
|
68
68
|
token: string;
|
|
69
|
-
}): Promise<any>;
|
|
69
|
+
}, env?: KycEnvironment): Promise<any>;
|
|
70
70
|
extractMrzText(params: {
|
|
71
71
|
fileUri: string;
|
|
72
72
|
docType: string;
|
|
@@ -75,11 +75,11 @@ export declare class KYCService {
|
|
|
75
75
|
token: string;
|
|
76
76
|
template_path: string;
|
|
77
77
|
mrz_type: string;
|
|
78
|
-
}): Promise<any>;
|
|
78
|
+
}, env?: KycEnvironment): Promise<any>;
|
|
79
79
|
recognizeFace(params: {
|
|
80
80
|
idPhotoUri: string;
|
|
81
81
|
selfiePhotoUri: string;
|
|
82
|
-
}): Promise<{
|
|
82
|
+
}, env?: KycEnvironment): Promise<{
|
|
83
83
|
is_match: boolean;
|
|
84
84
|
similarity: number;
|
|
85
85
|
id_bbox?: number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KYCService.d.ts","sourceRoot":"","sources":["../../../src/modules/api/KYCService.ts"],"names":[],"mappings":"AACA,OAAO,EAAyD,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAExH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"KYCService.d.ts","sourceRoot":"","sources":["../../../src/modules/api/KYCService.ts"],"names":[],"mappings":"AACA,OAAO,EAAyD,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAExH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAgBvD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,iBAAiB,CAAC;CAC1D;A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} from '../../types/KYC.types';
|
|
3
3
|
import { logger } from '../../utils/logger';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
import KYCConfig from '../../config/KYCConfig';
|
|
6
|
+
const appendFileToFormData = async (formData, key, uri, name = 'file.jpg', type = 'image/jpeg') => {
|
|
7
|
+
if (Platform.OS === 'web') {
|
|
8
|
+
const response = await fetch(uri);
|
|
9
|
+
const blob = await response.blob();
|
|
10
|
+
formData.append(key, blob, name);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
formData.append(key, { uri, type, name });
|
|
14
|
+
}
|
|
15
|
+
};
|
|
4
16
|
export class KYCService {
|
|
5
17
|
baseURL;
|
|
6
18
|
apiKey;
|
|
@@ -10,7 +22,6 @@ export class KYCService {
|
|
|
10
22
|
mrzServiceURL = 'https://kyc-engine.transfergratis.net:8002';
|
|
11
23
|
barcodeServiceURL = 'https://kyc-engine.transfergratis.net:8000';
|
|
12
24
|
orientationServiceURL = 'http://18.188.180.154:8080';
|
|
13
|
-
backendServiceURL = 'https://service.sanctumkey.com/api/v1';
|
|
14
25
|
constructor(baseURL, apiKey) {
|
|
15
26
|
this.baseURL = baseURL;
|
|
16
27
|
this.apiKey = apiKey;
|
|
@@ -64,12 +75,7 @@ export class KYCService {
|
|
|
64
75
|
async processSelfieOrientationPicture(videoFile, token) {
|
|
65
76
|
try {
|
|
66
77
|
const formData = new FormData();
|
|
67
|
-
|
|
68
|
-
uri: videoFile,
|
|
69
|
-
type: 'image/jpeg',
|
|
70
|
-
name: 'selfie_picture.jpg',
|
|
71
|
-
};
|
|
72
|
-
formData.append('file', rnFile);
|
|
78
|
+
await appendFileToFormData(formData, 'file', videoFile, 'selfie_picture.jpg', 'image/jpeg');
|
|
73
79
|
const response = await axios.post(`${this.faceServiceURL}/detect_face_orientation/`, formData, {
|
|
74
80
|
timeout: 20000,
|
|
75
81
|
headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },
|
|
@@ -81,17 +87,25 @@ export class KYCService {
|
|
|
81
87
|
throw error;
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
|
-
async processOrientationVideo(videoFile) {
|
|
90
|
+
async processOrientationVideo(videoFile, env = 'PRODUCTION') {
|
|
85
91
|
try {
|
|
92
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
93
|
+
if (env === 'SANDBOX') {
|
|
94
|
+
console.log("SANDBOX mode: Skipping AI orientation video processing");
|
|
95
|
+
logger.log("SANDBOX mode: Returning mock orientation video response");
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
data: {
|
|
99
|
+
center: { captured: true, frame: 10 },
|
|
100
|
+
left: { captured: true, frame: 30 },
|
|
101
|
+
right: { captured: true, frame: 50 }
|
|
102
|
+
},
|
|
103
|
+
message: 'SANDBOX: Orientation video processed successfully (mocked)'
|
|
104
|
+
};
|
|
105
|
+
}
|
|
86
106
|
// Create FormData for multipart/form-data request
|
|
87
107
|
const formData = new FormData();
|
|
88
|
-
|
|
89
|
-
const rnFile = {
|
|
90
|
-
uri: videoFile,
|
|
91
|
-
type: 'video/mp4',
|
|
92
|
-
name: 'orientation_video.mp4',
|
|
93
|
-
};
|
|
94
|
-
formData.append('file', rnFile);
|
|
108
|
+
await appendFileToFormData(formData, 'file', videoFile, 'orientation_video.mp4', 'video/mp4');
|
|
95
109
|
const response = await axios.post(`${this.orientationServiceURL}/process_orientation_video_stream/`, formData, {
|
|
96
110
|
// Let axios set the proper multipart boundary header automatically
|
|
97
111
|
timeout: 90000,
|
|
@@ -128,11 +142,22 @@ export class KYCService {
|
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
144
|
// STEP 1 - ID CARD VALIDATION
|
|
131
|
-
async detectFaceOnId(idCardImageUri, token, docType) {
|
|
145
|
+
async detectFaceOnId(idCardImageUri, token, docType, env = 'PRODUCTION') {
|
|
146
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
147
|
+
if (env === 'SANDBOX') {
|
|
148
|
+
console.log("SANDBOX mode: Skipping AI face detection on ID");
|
|
149
|
+
logger.log("SANDBOX mode: Returning mock face detection response");
|
|
150
|
+
return {
|
|
151
|
+
result: true,
|
|
152
|
+
detail: [{ confidence: 0.95, bbox: [50, 50, 200, 200] }],
|
|
153
|
+
card_obb: { x: 50, y: 50, width: 200, height: 200 }
|
|
154
|
+
};
|
|
155
|
+
}
|
|
132
156
|
const formData = new FormData();
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
await appendFileToFormData(formData, 'file', idCardImageUri, 'id_card_photo.jpg', 'image/jpeg');
|
|
158
|
+
logger.log('detectFaceOnId formData', JSON.stringify(formData, null, 2));
|
|
135
159
|
const docTypeShorted = GovernmentDocumentTypeShorted[docType];
|
|
160
|
+
logger.log('detectFaceOnId docTypeShorted', docTypeShorted);
|
|
136
161
|
try {
|
|
137
162
|
const res = await axios.post(`${this.faceServiceURL}/detect_face/?doc_type=${docTypeShorted}`, formData, {
|
|
138
163
|
headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },
|
|
@@ -149,11 +174,20 @@ export class KYCService {
|
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
176
|
//check templatetemplate_type
|
|
152
|
-
async checkTemplateType(params) {
|
|
177
|
+
async checkTemplateType(params, env = 'PRODUCTION') {
|
|
178
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
179
|
+
if (env === 'SANDBOX') {
|
|
180
|
+
console.log("SANDBOX mode: Skipping AI template type check");
|
|
181
|
+
logger.log("SANDBOX mode: Returning mock template type response");
|
|
182
|
+
const { docType, docRegion, postfix } = params;
|
|
183
|
+
return {
|
|
184
|
+
template_path: `templates/${docType}_${docRegion}_${postfix}.jpg`,
|
|
185
|
+
card_obb: { x: 50, y: 50, width: 200, height: 200 }
|
|
186
|
+
};
|
|
187
|
+
}
|
|
153
188
|
const { fileUri, docType, docRegion, token, postfix } = params;
|
|
154
189
|
const formData = new FormData();
|
|
155
|
-
|
|
156
|
-
formData.append('file', rnFile);
|
|
190
|
+
await appendFileToFormData(formData, 'file', fileUri, 'id_card_front.jpg', 'image/jpeg');
|
|
157
191
|
const docTypeShorted = GovernmentDocumentTypeShorted[docType];
|
|
158
192
|
const url = `${this.mrzServiceURL}/get_template_version/?doc_type=${encodeURIComponent(docTypeShorted)}&doc_region=${encodeURIComponent(docRegion)}&postfix=${postfix}`;
|
|
159
193
|
logger.log('checkTemplateType params', this.mrzServiceURL, JSON.stringify({ fileUri, docTypeShorted, docRegion, token, postfix, url }, null, 2));
|
|
@@ -173,8 +207,7 @@ export class KYCService {
|
|
|
173
207
|
async extractDocumentInformation(params) {
|
|
174
208
|
const { fileUri, docType, docRegion, token } = params;
|
|
175
209
|
const formData = new FormData();
|
|
176
|
-
|
|
177
|
-
formData.append('file', rnFile);
|
|
210
|
+
await appendFileToFormData(formData, 'file', fileUri, 'id_card_front.jpg', 'image/jpeg');
|
|
178
211
|
const url = `${this.textExtractionServiceURL}/extract_doc_information/?doc_type=${encodeURIComponent(docType)}&doc_region=${encodeURIComponent(docRegion)}`;
|
|
179
212
|
const attempt = async () => {
|
|
180
213
|
const res = await axios.post(url, formData, {
|
|
@@ -197,11 +230,19 @@ export class KYCService {
|
|
|
197
230
|
}
|
|
198
231
|
}
|
|
199
232
|
// STEP 2 - barcode extraction
|
|
200
|
-
async extractBarcode(params) {
|
|
233
|
+
async extractBarcode(params, env = 'PRODUCTION') {
|
|
234
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
235
|
+
if (env === 'SANDBOX') {
|
|
236
|
+
console.log("SANDBOX mode: Skipping AI barcode extraction");
|
|
237
|
+
logger.log("SANDBOX mode: Returning mock barcode response");
|
|
238
|
+
return {
|
|
239
|
+
barcode_data: 'SANDBOX_MOCK_BARCODE_DATA',
|
|
240
|
+
card_obb: { x: 50, y: 50, width: 200, height: 200 }
|
|
241
|
+
};
|
|
242
|
+
}
|
|
201
243
|
const { fileUri, token } = params;
|
|
202
244
|
const formData = new FormData();
|
|
203
|
-
|
|
204
|
-
formData.append('file', rnFile);
|
|
245
|
+
await appendFileToFormData(formData, 'file', fileUri, 'id_card_back.jpg', 'image/jpeg');
|
|
205
246
|
const url = `${this.barcodeServiceURL}/decode_barcode/`;
|
|
206
247
|
const attempt = async () => {
|
|
207
248
|
try {
|
|
@@ -228,11 +269,27 @@ export class KYCService {
|
|
|
228
269
|
}
|
|
229
270
|
}
|
|
230
271
|
// STEP 3 - MRZ TEXT EXTRACTION
|
|
231
|
-
async extractMrzText(params) {
|
|
272
|
+
async extractMrzText(params, env = 'PRODUCTION') {
|
|
273
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
274
|
+
if (env === 'SANDBOX') {
|
|
275
|
+
console.log("SANDBOX mode: Skipping AI MRZ extraction");
|
|
276
|
+
logger.log("SANDBOX mode: Returning mock MRZ response");
|
|
277
|
+
const { docType, docRegion, postfix = 'back', mrz_type } = params;
|
|
278
|
+
return {
|
|
279
|
+
success: true,
|
|
280
|
+
parsed_data: {
|
|
281
|
+
status: 'success',
|
|
282
|
+
document_type: docType,
|
|
283
|
+
mrz_type: mrz_type || 'TD1',
|
|
284
|
+
doc_region: docRegion,
|
|
285
|
+
postfix: postfix
|
|
286
|
+
},
|
|
287
|
+
card_obb: { x: 50, y: 50, width: 200, height: 200 }
|
|
288
|
+
};
|
|
289
|
+
}
|
|
232
290
|
const { fileUri, docType, docRegion, postfix = 'back', token, template_path, mrz_type } = params;
|
|
233
291
|
const formData = new FormData();
|
|
234
|
-
|
|
235
|
-
formData.append('file', rnFile);
|
|
292
|
+
await appendFileToFormData(formData, 'file', fileUri, 'id_card_back.jpg', 'image/jpeg');
|
|
236
293
|
const docTypeShorted = GovernmentDocumentTypeShorted[docType];
|
|
237
294
|
logger.log("docTypeShorted", docTypeShorted, docRegion, postfix);
|
|
238
295
|
const url = `${this.mrzServiceURL}/extract_mrz_text/?doc_type=${docTypeShorted}&doc_region=${docRegion}&postfix=${postfix}&template_path=${template_path}&mrz_type=${mrz_type}`;
|
|
@@ -264,13 +321,22 @@ export class KYCService {
|
|
|
264
321
|
}
|
|
265
322
|
}
|
|
266
323
|
// STEP 2 - SELFIE VALIDATION
|
|
267
|
-
async recognizeFace(params) {
|
|
324
|
+
async recognizeFace(params, env = 'PRODUCTION') {
|
|
325
|
+
// SANDBOX mode: skip AI verification and return mock response
|
|
326
|
+
if (env === 'SANDBOX') {
|
|
327
|
+
console.log("SANDBOX mode: Skipping AI face recognition");
|
|
328
|
+
logger.log("SANDBOX mode: Returning mock face recognition response");
|
|
329
|
+
return {
|
|
330
|
+
is_match: true,
|
|
331
|
+
similarity: 0.95,
|
|
332
|
+
id_bbox: [50, 50, 200, 200],
|
|
333
|
+
selfie_bbox: [50, 50, 200, 200]
|
|
334
|
+
};
|
|
335
|
+
}
|
|
268
336
|
const { idPhotoUri, selfiePhotoUri } = params;
|
|
269
337
|
const formData = new FormData();
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
formData.append('id_photo', idFile);
|
|
273
|
-
formData.append('selfie_photo', selfieFile);
|
|
338
|
+
await appendFileToFormData(formData, 'id_photo', idPhotoUri, 'id_card_photo.jpg', 'image/jpeg');
|
|
339
|
+
await appendFileToFormData(formData, 'selfie_photo', selfiePhotoUri, 'selfie_final.jpg', 'image/jpeg');
|
|
274
340
|
const res = await axios.post(`${this.faceServiceURL}/recognize_face/`, formData, { timeout: 45000 });
|
|
275
341
|
if (res.data?.detail)
|
|
276
342
|
throw new Error(res.data.detail);
|
|
@@ -299,7 +365,7 @@ export class KYCService {
|
|
|
299
365
|
"status": "PENDING",
|
|
300
366
|
"metadata": {},
|
|
301
367
|
};
|
|
302
|
-
const res = await axios.post(`${
|
|
368
|
+
const res = await axios.post(`${KYCConfig.getBackendUrl()}/verification/sessions/`, data, {
|
|
303
369
|
headers: {
|
|
304
370
|
'Content-Type': 'application/json',
|
|
305
371
|
...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` })
|
|
@@ -336,12 +402,14 @@ export class KYCService {
|
|
|
336
402
|
...({ session_id: session_id }),
|
|
337
403
|
timestamp: new Date().toISOString()
|
|
338
404
|
};
|
|
339
|
-
const url = `${
|
|
405
|
+
const url = `${KYCConfig.getBackendUrl()}/verification/api/kyc/sessions/${session_id}/steps/${step}/`;
|
|
340
406
|
const logPayload = truncateFields({ payloadData, session_id, step });
|
|
341
407
|
logger.log('verificationSession payload', JSON.stringify(truncateFields({ logPayload, token: token ?? "-", path: url, apiKey }), null, 2));
|
|
342
408
|
const res = await axios.post(url, payloadData, {
|
|
343
|
-
headers: {
|
|
344
|
-
|
|
409
|
+
headers: {
|
|
410
|
+
'Content-Type': 'application/json',
|
|
411
|
+
...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` })
|
|
412
|
+
}
|
|
345
413
|
});
|
|
346
414
|
logger.log('verificationSession res', JSON.stringify(truncateFields(res.data), null, 2));
|
|
347
415
|
return res.data;
|
|
@@ -355,7 +423,7 @@ export class KYCService {
|
|
|
355
423
|
async getVerificationResult(session_id) {
|
|
356
424
|
try {
|
|
357
425
|
const token = await authentification();
|
|
358
|
-
const url = `${
|
|
426
|
+
const url = `${KYCConfig.getBackendUrl()}/verification/api/kyc/result/?session_id=${session_id}`;
|
|
359
427
|
const res = await axios.get(url, { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` } });
|
|
360
428
|
logger.log('getVerificationResult res', JSON.stringify(truncateFields(res.data), null, 2));
|
|
361
429
|
return res.data;
|
|
@@ -393,6 +461,7 @@ export function truncateFields(obj, maxLength = 420) {
|
|
|
393
461
|
}
|
|
394
462
|
export const authentification = async () => {
|
|
395
463
|
try {
|
|
464
|
+
logger.log('authentification params', 'kyc_frontend', 'ZCW4mGaJXWR0UuI40lM1pHNQmYLw2xvX');
|
|
396
465
|
const params = new URLSearchParams();
|
|
397
466
|
params.append('client_id', 'kyc_frontend');
|
|
398
467
|
params.append('client_secret', 'ZCW4mGaJXWR0UuI40lM1pHNQmYLw2xv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GovernmentDocumentTypeShorted, OrientationVideoResponse } from '../../types/KYC.types';\nimport { CheckTemplateTypeResponse, ExtractMrzTextResponse } from '../../components/OverLay/type';\nimport { SessionResponse, VerificationResult, VerificationSessionRequest } from './types';\nimport { logger } from '../../utils/logger';\n\nexport interface KYCRequest {\n userId: string;\n documentImage: string;\n selfieImage: string;\n documentType: 'passport' | 'id_card' | 'drivers_license';\n}\n\nexport interface KYCResponse {\n success: boolean;\n verificationId: string;\n status: 'pending' | 'approved' | 'rejected';\n message?: string;\n}\n\nexport interface FaceDetectionRequest {\n selfieImage: string;\n documentImage: string;\n}\n\nexport interface FaceDetectionResponse {\n match: boolean;\n confidence: number;\n message: string;\n}\n\nexport interface SelfieVideoResponse {\n orientation_direction: \"center\" | \"left\" | \"right\",\n turn_score: number;\n bbox: number[];\n capture: boolean;\n instruction: string;\n error: string;\n}\n\n\nexport class KYCService {\n private baseURL: string;\n private apiKey: string;\n // Additional service base URLs (fixed as per current infra)\n private faceServiceURL = 'https://kyc-engine.transfergratis.net:8000';\n private textExtractionServiceURL = 'https://kyc-engine.transfergratis.net:8006';\n private mrzServiceURL = 'https://kyc-engine.transfergratis.net:8002';\n private barcodeServiceURL = 'https://kyc-engine.transfergratis.net:8000';\n private orientationServiceURL = 'http://18.188.180.154:8080';\n private backendServiceURL = 'https://service.sanctumkey.com/api/v1';\n\n constructor(baseURL: string, apiKey: string) {\n this.baseURL = baseURL;\n this.apiKey = apiKey;\n }\n\n private getHeaders() {\n return {\n 'Authorization': `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n };\n }\n\n async submitKYC(data: KYCRequest): Promise<KYCResponse> {\n try {\n const response = await axios.post(\n `${this.baseURL}/kyc/submit`,\n data,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error submitting KYC:', error);\n throw error;\n }\n }\n\n async detectFace(data: FaceDetectionRequest): Promise<FaceDetectionResponse> {\n try {\n const response = await axios.post(\n `${this.baseURL}/ai/face-detection`,\n data,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error detecting face:', error);\n throw error;\n }\n }\n\n async validateDocument(documentImage: string, documentType: string): Promise<any> {\n try {\n const response = await axios.post(\n `${this.baseURL}/ai/document-validation`,\n { documentImage, documentType },\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error validating document:', error);\n throw error;\n }\n }\n\n async getKYCStatus(verificationId: string): Promise<KYCResponse> {\n try {\n const response = await axios.get(\n `${this.baseURL}/kyc/status/${verificationId}`,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error getting KYC status:', error);\n throw error;\n }\n }\n\n async processSelfieOrientationPicture(videoFile: string, token: string): Promise<SelfieVideoResponse[]> {\n try {\n const formData = new FormData();\n const rnFile: any = {\n uri: videoFile,\n type: 'image/jpeg',\n name: 'selfie_picture.jpg',\n };\n formData.append('file', rnFile);\n const response = await axios.post<SelfieVideoResponse[]>(\n `${this.faceServiceURL}/detect_face_orientation/`,\n formData,\n {\n timeout: 20000,\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n }\n );\n return response.data;\n } catch (error) {\n logger.error('Error processing selfie orientation:', error);\n throw error;\n }\n }\n\n async processOrientationVideo(videoFile: string): Promise<OrientationVideoResponse> {\n try {\n // Create FormData for multipart/form-data request\n const formData = new FormData();\n // In React Native, prefer the { uri, type, name } pattern rather than Blob\n const rnFile: any = {\n uri: videoFile,\n type: 'video/mp4',\n name: 'orientation_video.mp4',\n };\n formData.append('file', rnFile);\n\n const response = await axios.post(\n `${this.orientationServiceURL}/process_orientation_video_stream/`,\n formData,\n {\n // Let axios set the proper multipart boundary header automatically\n timeout: 90000,\n }\n );\n\n return {\n success: true,\n data: response.data,\n message: 'Orientation video processed successfully'\n };\n } catch (error: any) {\n logger.error('Error processing orientation video:', JSON.stringify(error, null, 2));\n\n // Handle specific error cases\n if (error.response?.status === 503) {\n return {\n success: false,\n error: {\n code: 'SERVICE_UNAVAILABLE',\n message: 'Service not ready, model not initialized.',\n details: error.response.data\n },\n message: 'Service temporarily unavailable'\n };\n }\n\n return {\n success: false,\n error: {\n code: 'PROCESSING_ERROR',\n message: error.response?.data?.detail || error.message || 'Unknown error occurred',\n details: error.response?.data\n },\n message: 'Failed to process orientation video'\n };\n }\n }\n\n // STEP 1 - ID CARD VALIDATION\n async detectFaceOnId(idCardImageUri: string, token: string, docType: string): Promise<{ result: boolean, detail: any[] }> {\n const formData = new FormData();\n const rnFile: any = { uri: idCardImageUri, type: 'image/jpeg', name: 'id_card_photo.jpg' };\n formData.append('file', rnFile);\n\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n\n try {\n const res = await axios.post(`${this.faceServiceURL}/detect_face/?doc_type=${docTypeShorted}`, formData,\n {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 20000\n });\n logger.log('detectFaceOnId res', JSON.stringify(res.data, null, 2));\n\n if (res.data?.result) return res.data;\n throw new Error(res.data?.detail || 'detect_face failed');\n } catch (error) {\n logger.error('Error detecting face on id:', JSON.stringify(error));\n throw error;\n }\n }\n\n //check templatetemplate_type\n async checkTemplateType(params: { fileUri: string; docType: string; docRegion: string; token: string; postfix: string }): Promise<any> {\n const { fileUri, docType, docRegion, token, postfix } = params;\n const formData = new FormData();\n const rnFile: any = { uri: fileUri, type: 'image/jpeg', name: 'id_card_front.jpg' };\n formData.append('file', rnFile);\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n const url = `${this.mrzServiceURL}/get_template_version/?doc_type=${encodeURIComponent(docTypeShorted)}&doc_region=${encodeURIComponent(docRegion)}&postfix=${postfix}`;\n\n logger.log('checkTemplateType params', this.mrzServiceURL, JSON.stringify({ fileUri, docTypeShorted, docRegion, token, postfix, url }, null, 2));\n try {\n const res = await axios.post<CheckTemplateTypeResponse>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('checkTemplateType res', JSON.stringify(res.data, null, 2));\n return res.data;\n } catch (e: any) {\n logger.error('Error checking template type:', JSON.stringify(e));\n throw e;\n }\n\n }\n\n async extractDocumentInformation(params: { fileUri: string; docType: string; docRegion: string; token: string }): Promise<any> {\n const { fileUri, docType, docRegion, token } = params;\n const formData = new FormData();\n const rnFile: any = { uri: fileUri, type: 'image/jpeg', name: 'id_card_front.jpg' };\n formData.append('file', rnFile);\n\n const url = `${this.textExtractionServiceURL}/extract_doc_information/?doc_type=${encodeURIComponent(docType)}&doc_region=${encodeURIComponent(docRegion)}`;\n const attempt = async () => {\n const res = await axios.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractDocumentInformation res', JSON.stringify(truncateFields(res)));\n\n if (res.data?.detail) throw new Error(res.data.detail);\n return res.data;\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting document information:', JSON.stringify(truncateFields(e)));\n throw e;\n // await new Promise(r => setTimeout(r, 1500));\n // return await attempt();\n }\n }\n // STEP 2 - barcode extraction\n async extractBarcode(params: { fileUri: string; token: string }): Promise<any> {\n const { fileUri, token } = params;\n const formData = new FormData();\n const rnFile: any = { uri: fileUri, type: 'image/jpeg', name: 'id_card_back.jpg' };\n formData.append('file', rnFile);\n\n const url = `${this.barcodeServiceURL}/decode_barcode/`;\n const attempt = async () => {\n try {\n const res = await axios.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractBarcode res', JSON.stringify(res.data, null, 2));\n //check if res.data has aleast one key\n if (Object.keys(res.data).length === 0) throw new Error('No data found');\n return res.data;\n } catch (e: any) {\n throw new Error(e?.message || 'Erreur de détection du barcode');\n }\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting Barcode text:', JSON.stringify(e));\n throw e;\n }\n }\n // STEP 3 - MRZ TEXT EXTRACTION\n async extractMrzText(params: { fileUri: string; docType: string; docRegion: string; postfix?: string; token: string; template_path: string; mrz_type: string }): Promise<any> {\n const { fileUri, docType, docRegion, postfix = 'back', token, template_path, mrz_type } = params;\n const formData = new FormData();\n const rnFile: any = { uri: fileUri, type: 'image/jpeg', name: 'id_card_back.jpg' };\n formData.append('file', rnFile);\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n logger.log(\"docTypeShorted\", docTypeShorted, docRegion, postfix);\n\n const url = `${this.mrzServiceURL}/extract_mrz_text/?doc_type=${docTypeShorted}&doc_region=${docRegion}&postfix=${postfix}&template_path=${template_path}&mrz_type=${mrz_type}`;\n logger.log(\"url\", url);\n\n const attempt = async () => {\n try {\n const res = await axios.post<ExtractMrzTextResponse>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractMrzText res', JSON.stringify(res.data, null, 2));\n //check if res.data has aleast one key\n if (Object.keys(res.data).length === 0) throw new Error('No data found');\n if (res.data?.success === false) throw new Error(res.data.parsed_data.status);\n return res.data;\n } catch (e: any) {\n throw new Error(e?.message || 'Erreur de détection du MRZ');\n }\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting MRZ text:', JSON.stringify(errorMessage(e), null, 2));\n throw e;\n }\n }\n\n // STEP 2 - SELFIE VALIDATION\n async recognizeFace(params: { idPhotoUri: string; selfiePhotoUri: string }): Promise<{ is_match: boolean; similarity: number; id_bbox?: number[]; selfie_bbox?: number[] }> {\n const { idPhotoUri, selfiePhotoUri } = params;\n const formData = new FormData();\n const idFile: any = { uri: idPhotoUri, type: 'image/jpeg', name: 'id_card_photo.jpg' };\n const selfieFile: any = { uri: selfiePhotoUri, type: 'image/jpeg', name: 'selfie_final.jpg' };\n formData.append('id_photo', idFile);\n formData.append('selfie_photo', selfieFile);\n\n const res = await axios.post(`${this.faceServiceURL}/recognize_face/`, formData, { timeout: 45000 });\n if (res.data?.detail) throw new Error(res.data.detail);\n return res.data;\n }\n\n // HEALTH CHECKS\n async healthFaceDetection(): Promise<any> {\n const res = await axios.get(`${this.faceServiceURL}/health`);\n return res.data;\n }\n\n async healthTextExtraction(): Promise<any> {\n const res = await axios.get(`${this.textExtractionServiceURL}/health`);\n return res.data;\n }\n\n async healthMrzService(): Promise<any> {\n const res = await axios.get(`${this.mrzServiceURL}/health`);\n return res.data;\n }\n\n async healthOrientationService(): Promise<any> {\n const res = await axios.get(`${this.orientationServiceURL}/health`);\n return res.data;\n }\n\n async newSession({ token, apiKey }: { token?: string, apiKey?: string }): Promise<SessionResponse> {\n try {\n const data = {\n \"status\": \"PENDING\",\n \"metadata\": {},\n }\n const res = await axios.post<SessionResponse>(`${this.backendServiceURL}/verification/sessions/`,\n data, {\n headers: {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` })\n }\n });\n return res.data;\n } catch (error: any) {\n logger.error('Error creating session:', JSON.stringify(errorMessage(error), null, 2));\n\n // Extract backend error message if available\n const backendMessage = errorMessage(error);\n\n if (backendMessage) {\n logger.error('Backend error message:', JSON.stringify(truncateFields(backendMessage), null, 2));\n throw new Error(`Backend error: ${JSON.stringify(truncateFields(backendMessage))}`);\n }\n\n throw error;\n }\n }\n\n async verificationSession(payload: VerificationSessionRequest): Promise<any> {\n console.log('apiKey in verificationSession', payload.apiKey);\n try {\n\n\n // /api/v1/verification/api/kyc/sessions/{session_id}/steps/{step}/\n const { session_id, step, data, templateId, action, apiKey } = payload;\n\n const token = apiKey ? undefined : await authentification();\n // const session_id = \"kyc-8b4e069258d8\";\n const payloadData = {\n action: action,\n data: {\n step,\n templateId,\n ...(action === \"location_permission\" ? { permissionGranted: true, } : {}),\n ...data,\n },\n ...({ session_id: session_id }),\n timestamp: new Date().toISOString()\n }\n const url = `${this.backendServiceURL}/verification/api/kyc/sessions/${session_id}/steps/${step}/`;\n\n\n const logPayload = truncateFields({ payloadData, session_id, step });\n logger.log('verificationSession payload',\n JSON.stringify(truncateFields({ logPayload, token:token??\"-\", path: url, apiKey }),\n null, 2))\n\n const res = await axios.post<SessionResponse>(url,\n payloadData,\n {\n headers: { 'Content-Type': 'application/json', \n ...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` }) }\n });\n logger.log('verificationSession res', JSON.stringify(truncateFields(res.data), null, 2));\n return res.data;\n\n\n } catch (error) {\n logger.error('Error validating component:', JSON.stringify(error, null, 2));\n throw new Error(errorMessage(error));\n }\n }\n // reultat de la verification\n async getVerificationResult(session_id: string): Promise<VerificationResult> {\n try {\n const token = await authentification();\n const url = `${this.backendServiceURL}/verification/api/kyc/result/?session_id=${session_id}`;\n const res = await axios.get<VerificationResult>(url,\n { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` } });\n logger.log('getVerificationResult res', JSON.stringify(truncateFields(res.data), null, 2));\n return res.data;\n } catch (error) {\n logger.error('Error getting verification result:', JSON.stringify(errorMessage(error), null, 2));\n throw error;\n }\n }\n}\n\n\nconst kycService = new KYCService(\"\", \"\");\nexport default kycService;\n\n\n// Pour éviter d'afficher des champs trop longs, on tronque les valeurs longues dans le log\nexport function truncateFields(obj: any, maxLength = 420): any {\n if (typeof obj !== 'object' || obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(item => truncateFields(item, maxLength));\n const truncated: any = {};\n for (const key in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;\n const value = obj[key];\n if (typeof value === 'string' && value.length > maxLength) {\n truncated[key] = value.slice(0, maxLength) + '... [truncated]';\n } else if (typeof value === 'object' && value !== null) {\n truncated[key] = truncateFields(value, maxLength);\n } else {\n truncated[key] = value;\n }\n }\n return truncated;\n}\nexport const authentification = async () => {\n try {\n const params = new URLSearchParams();\n params.append('client_id', 'kyc_frontend');\n params.append('client_secret', 'ZCW4mGaJXWR0UuI40lM1pHNQmYLw2xvX');\n params.append('grant_type', 'client_credentials');\n const res = await axios.post(`https://keycloak.transfergratis.net/realms/kyc/protocol/openid-connect/token`,\n params,\n {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n }\n );\n logger.log('authentification res', JSON.stringify(truncateFields(res.data)));\n return res.data.access_token;\n } catch (error: any) {\n logger.error('Error authentifying:', {\n message: error.message,\n status: error.response?.status,\n statusText: error.response?.statusText,\n data: error.response?.data,\n url: error.config?.url,\n method: error.config?.method\n });\n\n // Extract backend error message if available\n const backendMessage = errorMessage(error);\n\n if (backendMessage) {\n logger.error('Backend authentication error:', JSON.stringify(truncateFields(backendMessage), null, 2));\n throw new Error(`Authentication failed: ${JSON.stringify(truncateFields(backendMessage))}`);\n }\n\n throw error;\n }\n}\n\n\n\nexport const errorMessage = (error: any) => {\n return error.response?.data?.message ||\n error.response?.data?.detail ||\n error.response?.data?.error ||\n error.response?.data;\n}"]}
|
|
1
|
+
{"version":3,"file":"KYCService.js","sourceRoot":"","sources":["../../../src/modules/api/KYCService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,6BAA6B,EAA4B,MAAM,uBAAuB,CAAC;AAIxH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,MAAM,oBAAoB,GAAG,KAAK,EAAE,QAAkB,EAAE,GAAW,EAAE,GAAW,EAAE,OAAe,UAAU,EAAE,OAAe,YAAY,EAAE,EAAE;IAC1I,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,QAAQ,CAAC,MAA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B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACnC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM;YAC9B,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU;YACtC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI;YAC1B,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM;SAC7B,CAAC,CAAC;QAEH,6CAA6C;QAC7C,MAAM,cAAc,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACvG,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9F,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA;AAID,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAE,EAAE;IACzC,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO;QAClC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM;QAC5B,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK;QAC3B,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;AACzB,CAAC,CAAA","sourcesContent":["import axios from 'axios';\nimport { GovernmentDocumentType, GovernmentDocumentTypeShorted, OrientationVideoResponse } from '../../types/KYC.types';\nimport { CheckTemplateTypeResponse, ExtractMrzTextResponse } from '../../components/OverLay/type';\nimport { SessionResponse, VerificationResult, VerificationSessionRequest } from './types';\nimport { KycEnvironment } from '../../types/env.types';\nimport { logger } from '../../utils/logger';\nimport { Platform } from 'react-native';\nimport KYCConfig from '../../config/KYCConfig';\n\nconst appendFileToFormData = async (formData: FormData, key: string, uri: string, name: string = 'file.jpg', type: string = 'image/jpeg') => {\n if (Platform.OS === 'web') {\n const response = await fetch(uri);\n const blob = await response.blob();\n formData.append(key, blob, name);\n } else {\n formData.append(key, { uri, type, name } as any);\n }\n};\n\n\nexport interface KYCRequest {\n userId: string;\n documentImage: string;\n selfieImage: string;\n documentType: 'passport' | 'id_card' | 'drivers_license';\n}\n\nexport interface KYCResponse {\n success: boolean;\n verificationId: string;\n status: 'pending' | 'approved' | 'rejected';\n message?: string;\n}\n\nexport interface FaceDetectionRequest {\n selfieImage: string;\n documentImage: string;\n}\n\nexport interface FaceDetectionResponse {\n match: boolean;\n confidence: number;\n message: string;\n}\n\nexport interface SelfieVideoResponse {\n orientation_direction: \"center\" | \"left\" | \"right\",\n turn_score: number;\n bbox: number[];\n capture: boolean;\n instruction: string;\n error: string;\n}\n\n\nexport class KYCService {\n private baseURL: string;\n private apiKey: string;\n // Additional service base URLs (fixed as per current infra)\n private faceServiceURL = 'https://kyc-engine.transfergratis.net:8000';\n private textExtractionServiceURL = 'https://kyc-engine.transfergratis.net:8006';\n private mrzServiceURL = 'https://kyc-engine.transfergratis.net:8002';\n private barcodeServiceURL = 'https://kyc-engine.transfergratis.net:8000';\n private orientationServiceURL = 'http://18.188.180.154:8080';\n\n constructor(baseURL: string, apiKey: string) {\n this.baseURL = baseURL;\n this.apiKey = apiKey;\n }\n\n private getHeaders() {\n return {\n 'Authorization': `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n };\n }\n\n async submitKYC(data: KYCRequest): Promise<KYCResponse> {\n try {\n const response = await axios.post(\n `${this.baseURL}/kyc/submit`,\n data,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error submitting KYC:', error);\n throw error;\n }\n }\n\n async detectFace(data: FaceDetectionRequest): Promise<FaceDetectionResponse> {\n try {\n const response = await axios.post(\n `${this.baseURL}/ai/face-detection`,\n data,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error detecting face:', error);\n throw error;\n }\n }\n\n async validateDocument(documentImage: string, documentType: string): Promise<any> {\n try {\n const response = await axios.post(\n `${this.baseURL}/ai/document-validation`,\n { documentImage, documentType },\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error validating document:', error);\n throw error;\n }\n }\n\n async getKYCStatus(verificationId: string): Promise<KYCResponse> {\n try {\n const response = await axios.get(\n `${this.baseURL}/kyc/status/${verificationId}`,\n { headers: this.getHeaders() }\n );\n return response.data;\n } catch (error) {\n logger.error('Error getting KYC status:', error);\n throw error;\n }\n }\n\n async processSelfieOrientationPicture(videoFile: string, token: string): Promise<SelfieVideoResponse[]> {\n try {\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', videoFile, 'selfie_picture.jpg', 'image/jpeg');\n\n const response = await axios.post<SelfieVideoResponse[]>(\n `${this.faceServiceURL}/detect_face_orientation/`,\n formData,\n {\n timeout: 20000,\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n }\n );\n return response.data;\n } catch (error) {\n logger.error('Error processing selfie orientation:', error);\n throw error;\n }\n }\n\n async processOrientationVideo(videoFile: string, env: KycEnvironment = 'PRODUCTION'): Promise<OrientationVideoResponse> {\n try {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI orientation video processing\");\n logger.log(\"SANDBOX mode: Returning mock orientation video response\");\n return {\n success: true,\n data: {\n center: { captured: true, frame: 10 },\n left: { captured: true, frame: 30 },\n right: { captured: true, frame: 50 }\n },\n message: 'SANDBOX: Orientation video processed successfully (mocked)'\n };\n }\n\n // Create FormData for multipart/form-data request\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', videoFile, 'orientation_video.mp4', 'video/mp4');\n\n\n const response = await axios.post(\n `${this.orientationServiceURL}/process_orientation_video_stream/`,\n formData,\n {\n // Let axios set the proper multipart boundary header automatically\n timeout: 90000,\n }\n );\n\n return {\n success: true,\n data: response.data,\n message: 'Orientation video processed successfully'\n };\n } catch (error: any) {\n logger.error('Error processing orientation video:', JSON.stringify(error, null, 2));\n\n // Handle specific error cases\n if (error.response?.status === 503) {\n return {\n success: false,\n error: {\n code: 'SERVICE_UNAVAILABLE',\n message: 'Service not ready, model not initialized.',\n details: error.response.data\n },\n message: 'Service temporarily unavailable'\n };\n }\n\n return {\n success: false,\n error: {\n code: 'PROCESSING_ERROR',\n message: error.response?.data?.detail || error.message || 'Unknown error occurred',\n details: error.response?.data\n },\n message: 'Failed to process orientation video'\n };\n }\n }\n\n // STEP 1 - ID CARD VALIDATION\n async detectFaceOnId(idCardImageUri: string, token: string, docType: string, env: KycEnvironment = 'PRODUCTION'): Promise<{ result: boolean, detail: any[] }> {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI face detection on ID\");\n logger.log(\"SANDBOX mode: Returning mock face detection response\");\n return {\n result: true,\n detail: [{ confidence: 0.95, bbox: [50, 50, 200, 200] }],\n card_obb: { x: 50, y: 50, width: 200, height: 200 }\n } as any;\n }\n\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', idCardImageUri, 'id_card_photo.jpg', 'image/jpeg');\n\n logger.log('detectFaceOnId formData', JSON.stringify(formData, null, 2));\n\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n logger.log('detectFaceOnId docTypeShorted', docTypeShorted);\n try {\n const res = await axios.post(`${this.faceServiceURL}/detect_face/?doc_type=${docTypeShorted}`, formData,\n {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 20000\n });\n logger.log('detectFaceOnId res', JSON.stringify(res.data, null, 2));\n\n if (res.data?.result) return res.data;\n throw new Error(res.data?.detail || 'detect_face failed');\n } catch (error) {\n logger.error('Error detecting face on id:', JSON.stringify(error));\n throw error;\n }\n }\n\n //check templatetemplate_type\n async checkTemplateType(params: { fileUri: string; docType: string; docRegion: string; token: string; postfix: string }, env: KycEnvironment = 'PRODUCTION'): Promise<any> {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI template type check\");\n logger.log(\"SANDBOX mode: Returning mock template type response\");\n const { docType, docRegion, postfix } = params;\n return {\n template_path: `templates/${docType}_${docRegion}_${postfix}.jpg`,\n card_obb: { x: 50, y: 50, width: 200, height: 200 }\n };\n }\n\n const { fileUri, docType, docRegion, token, postfix } = params;\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', fileUri, 'id_card_front.jpg', 'image/jpeg');\n\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n const url = `${this.mrzServiceURL}/get_template_version/?doc_type=${encodeURIComponent(docTypeShorted)}&doc_region=${encodeURIComponent(docRegion)}&postfix=${postfix}`;\n\n logger.log('checkTemplateType params', this.mrzServiceURL, JSON.stringify({ fileUri, docTypeShorted, docRegion, token, postfix, url }, null, 2));\n try {\n const res = await axios.post<CheckTemplateTypeResponse>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('checkTemplateType res', JSON.stringify(res.data, null, 2));\n return res.data;\n } catch (e: any) {\n logger.error('Error checking template type:', JSON.stringify(e));\n throw e;\n }\n\n }\n\n async extractDocumentInformation(params: { fileUri: string; docType: string; docRegion: string; token: string }): Promise<any> {\n const { fileUri, docType, docRegion, token } = params;\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', fileUri, 'id_card_front.jpg', 'image/jpeg');\n\n\n const url = `${this.textExtractionServiceURL}/extract_doc_information/?doc_type=${encodeURIComponent(docType)}&doc_region=${encodeURIComponent(docRegion)}`;\n const attempt = async () => {\n const res = await axios.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractDocumentInformation res', JSON.stringify(truncateFields(res)));\n\n if (res.data?.detail) throw new Error(res.data.detail);\n return res.data;\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting document information:', JSON.stringify(truncateFields(e)));\n throw e;\n // await new Promise(r => setTimeout(r, 1500));\n // return await attempt();\n }\n }\n // STEP 2 - barcode extraction\n async extractBarcode(params: { fileUri: string; token: string }, env: KycEnvironment = 'PRODUCTION'): Promise<any> {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI barcode extraction\");\n logger.log(\"SANDBOX mode: Returning mock barcode response\");\n return {\n barcode_data: 'SANDBOX_MOCK_BARCODE_DATA',\n card_obb: { x: 50, y: 50, width: 200, height: 200 }\n };\n }\n\n const { fileUri, token } = params;\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', fileUri, 'id_card_back.jpg', 'image/jpeg');\n\n\n const url = `${this.barcodeServiceURL}/decode_barcode/`;\n const attempt = async () => {\n try {\n const res = await axios.post(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractBarcode res', JSON.stringify(res.data, null, 2));\n //check if res.data has aleast one key\n if (Object.keys(res.data).length === 0) throw new Error('No data found');\n return res.data;\n } catch (e: any) {\n throw new Error(e?.message || 'Erreur de détection du barcode');\n }\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting Barcode text:', JSON.stringify(e));\n throw e;\n }\n }\n // STEP 3 - MRZ TEXT EXTRACTION\n async extractMrzText(params: { fileUri: string; docType: string; docRegion: string; postfix?: string; token: string; template_path: string; mrz_type: string }, env: KycEnvironment = 'PRODUCTION'): Promise<any> {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI MRZ extraction\");\n logger.log(\"SANDBOX mode: Returning mock MRZ response\");\n const { docType, docRegion, postfix = 'back', mrz_type } = params;\n return {\n success: true,\n parsed_data: {\n status: 'success',\n document_type: docType,\n mrz_type: mrz_type || 'TD1',\n doc_region: docRegion,\n postfix: postfix\n },\n card_obb: { x: 50, y: 50, width: 200, height: 200 }\n };\n }\n\n const { fileUri, docType, docRegion, postfix = 'back', token, template_path, mrz_type } = params;\n const formData = new FormData();\n await appendFileToFormData(formData, 'file', fileUri, 'id_card_back.jpg', 'image/jpeg');\n\n const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];\n logger.log(\"docTypeShorted\", docTypeShorted, docRegion, postfix);\n\n const url = `${this.mrzServiceURL}/extract_mrz_text/?doc_type=${docTypeShorted}&doc_region=${docRegion}&postfix=${postfix}&template_path=${template_path}&mrz_type=${mrz_type}`;\n logger.log(\"url\", url);\n\n const attempt = async () => {\n try {\n const res = await axios.post<ExtractMrzTextResponse>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },\n timeout: 60000,\n });\n logger.log('extractMrzText res', JSON.stringify(res.data, null, 2));\n //check if res.data has aleast one key\n if (Object.keys(res.data).length === 0) throw new Error('No data found');\n if (res.data?.success === false) throw new Error(res.data.parsed_data.status);\n return res.data;\n } catch (e: any) {\n throw new Error(e?.message || 'Erreur de détection du MRZ');\n }\n };\n try {\n return await attempt();\n } catch (e) {\n logger.error('Error extracting MRZ text:', JSON.stringify(errorMessage(e), null, 2));\n throw e;\n }\n }\n\n // STEP 2 - SELFIE VALIDATION\n async recognizeFace(params: { idPhotoUri: string; selfiePhotoUri: string }, env: KycEnvironment = 'PRODUCTION'): Promise<{ is_match: boolean; similarity: number; id_bbox?: number[]; selfie_bbox?: number[] }> {\n // SANDBOX mode: skip AI verification and return mock response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI face recognition\");\n logger.log(\"SANDBOX mode: Returning mock face recognition response\");\n return {\n is_match: true,\n similarity: 0.95,\n id_bbox: [50, 50, 200, 200],\n selfie_bbox: [50, 50, 200, 200]\n };\n }\n\n const { idPhotoUri, selfiePhotoUri } = params;\n const formData = new FormData();\n await appendFileToFormData(formData, 'id_photo', idPhotoUri, 'id_card_photo.jpg', 'image/jpeg');\n await appendFileToFormData(formData, 'selfie_photo', selfiePhotoUri, 'selfie_final.jpg', 'image/jpeg');\n\n\n const res = await axios.post(`${this.faceServiceURL}/recognize_face/`, formData, { timeout: 45000 });\n if (res.data?.detail) throw new Error(res.data.detail);\n return res.data;\n }\n\n // HEALTH CHECKS\n async healthFaceDetection(): Promise<any> {\n const res = await axios.get(`${this.faceServiceURL}/health`);\n return res.data;\n }\n\n async healthTextExtraction(): Promise<any> {\n const res = await axios.get(`${this.textExtractionServiceURL}/health`);\n return res.data;\n }\n\n async healthMrzService(): Promise<any> {\n const res = await axios.get(`${this.mrzServiceURL}/health`);\n return res.data;\n }\n\n async healthOrientationService(): Promise<any> {\n const res = await axios.get(`${this.orientationServiceURL}/health`);\n return res.data;\n }\n\n async newSession({ token, apiKey }: { token?: string, apiKey?: string }): Promise<SessionResponse> {\n try {\n const data = {\n \"status\": \"PENDING\",\n \"metadata\": {},\n }\n const res = await axios.post<SessionResponse>(`${KYCConfig.getBackendUrl()}/verification/sessions/`,\n data, {\n headers: {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` })\n }\n });\n return res.data;\n } catch (error: any) {\n logger.error('Error creating session:', JSON.stringify(errorMessage(error), null, 2));\n\n // Extract backend error message if available\n const backendMessage = errorMessage(error);\n\n if (backendMessage) {\n logger.error('Backend error message:', JSON.stringify(truncateFields(backendMessage), null, 2));\n throw new Error(`Backend error: ${JSON.stringify(truncateFields(backendMessage))}`);\n }\n\n throw error;\n }\n }\n\n async verificationSession(payload: VerificationSessionRequest): Promise<any> {\n console.log('apiKey in verificationSession', payload.apiKey);\n try {\n\n\n // /api/v1/verification/api/kyc/sessions/{session_id}/steps/{step}/\n const { session_id, step, data, templateId, action, apiKey } = payload;\n\n const token = apiKey ? undefined : await authentification();\n // const session_id = \"kyc-8b4e069258d8\";\n const payloadData = {\n action: action,\n data: {\n step,\n templateId,\n ...(action === \"location_permission\" ? { permissionGranted: true, } : {}),\n ...data,\n },\n ...({ session_id: session_id }),\n timestamp: new Date().toISOString()\n }\n const url = `${KYCConfig.getBackendUrl()}/verification/api/kyc/sessions/${session_id}/steps/${step}/`;\n\n\n const logPayload = truncateFields({ payloadData, session_id, step });\n logger.log('verificationSession payload',\n JSON.stringify(truncateFields({ logPayload, token: token ?? \"-\", path: url, apiKey }),\n null, 2))\n\n const res = await axios.post<SessionResponse>(url,\n payloadData,\n {\n headers: {\n 'Content-Type': 'application/json',\n ...(apiKey ? { 'Authorization': `ApiKey ${apiKey}` } : { 'Authorization': `Bearer ${token}` })\n }\n });\n logger.log('verificationSession res', JSON.stringify(truncateFields(res.data), null, 2));\n return res.data;\n\n\n } catch (error) {\n logger.error('Error validating component:', JSON.stringify(error, null, 2));\n throw new Error(errorMessage(error));\n }\n }\n // reultat de la verification\n async getVerificationResult(session_id: string): Promise<VerificationResult> {\n try {\n const token = await authentification();\n const url = `${KYCConfig.getBackendUrl()}/verification/api/kyc/result/?session_id=${session_id}`;\n const res = await axios.get<VerificationResult>(url,\n { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` } });\n logger.log('getVerificationResult res', JSON.stringify(truncateFields(res.data), null, 2));\n return res.data;\n } catch (error) {\n logger.error('Error getting verification result:', JSON.stringify(errorMessage(error), null, 2));\n throw error;\n }\n }\n}\n\n\nconst kycService = new KYCService(\"\", \"\");\nexport default kycService;\n\n\n// Pour éviter d'afficher des champs trop longs, on tronque les valeurs longues dans le log\nexport function truncateFields(obj: any, maxLength = 420): any {\n if (typeof obj !== 'object' || obj === null) return obj;\n if (Array.isArray(obj)) return obj.map(item => truncateFields(item, maxLength));\n const truncated: any = {};\n for (const key in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;\n const value = obj[key];\n if (typeof value === 'string' && value.length > maxLength) {\n truncated[key] = value.slice(0, maxLength) + '... [truncated]';\n } else if (typeof value === 'object' && value !== null) {\n truncated[key] = truncateFields(value, maxLength);\n } else {\n truncated[key] = value;\n }\n }\n return truncated;\n}\nexport const authentification = async () => {\n try {\n logger.log('authentification params', 'kyc_frontend', 'ZCW4mGaJXWR0UuI40lM1pHNQmYLw2xvX');\n const params = new URLSearchParams();\n params.append('client_id', 'kyc_frontend');\n params.append('client_secret', 'ZCW4mGaJXWR0UuI40lM1pHNQmYLw2xvX');\n params.append('grant_type', 'client_credentials');\n const res = await axios.post(`https://keycloak.transfergratis.net/realms/kyc/protocol/openid-connect/token`,\n params,\n {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n }\n );\n logger.log('authentification res', JSON.stringify(truncateFields(res.data)));\n return res.data.access_token;\n } catch (error: any) {\n logger.error('Error authentifying:', {\n message: error.message,\n status: error.response?.status,\n statusText: error.response?.statusText,\n data: error.response?.data,\n url: error.config?.url,\n method: error.config?.method\n });\n\n // Extract backend error message if available\n const backendMessage = errorMessage(error);\n\n if (backendMessage) {\n logger.error('Backend authentication error:', JSON.stringify(truncateFields(backendMessage), null, 2));\n throw new Error(`Authentication failed: ${JSON.stringify(truncateFields(backendMessage))}`);\n }\n\n throw error;\n }\n}\n\n\n\nexport const errorMessage = (error: any) => {\n return error.response?.data?.message ||\n error.response?.data?.detail ||\n error.response?.data?.error ||\n error.response?.data;\n}"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { SelfieVideoResponse } from "./KYCService";
|
|
2
|
+
import { KycEnvironment } from "../../types/env.types";
|
|
3
|
+
declare const selfieVerification: (selfieImage: string, env?: KycEnvironment) => Promise<SelfieVideoResponse[]>;
|
|
2
4
|
export default selfieVerification;
|
|
3
5
|
//# sourceMappingURL=SelfieVerification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieVerification.d.ts","sourceRoot":"","sources":["../../../src/modules/api/SelfieVerification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelfieVerification.d.ts","sourceRoot":"","sources":["../../../src/modules/api/SelfieVerification.ts"],"names":[],"mappings":"AAAA,OAAmB,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,kBAAkB,GAAU,aAAa,MAAM,EAAE,MAAK,cAA6B,KAAG,OAAO,CAAC,mBAAmB,EAAE,CAuBxH,CAAA;AAKD,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import kycService, { authentification } from "./KYCService";
|
|
2
|
-
const selfieVerification = async (selfieImage) => {
|
|
2
|
+
const selfieVerification = async (selfieImage, env = 'PRODUCTION') => {
|
|
3
|
+
// In SANDBOX mode, skip AI verification and return a mock success response
|
|
4
|
+
if (env === 'SANDBOX') {
|
|
5
|
+
console.log("SANDBOX mode: Skipping AI verification for selfie");
|
|
6
|
+
// Return a mock response that simulates successful verification
|
|
7
|
+
// This allows the flow to continue without actual AI processing
|
|
8
|
+
const mockResponse = [{
|
|
9
|
+
orientation_direction: "center",
|
|
10
|
+
turn_score: 1.0,
|
|
11
|
+
bbox: [0, 0, 100, 100],
|
|
12
|
+
capture: true,
|
|
13
|
+
instruction: "SANDBOX: AI verification skipped",
|
|
14
|
+
error: ""
|
|
15
|
+
}];
|
|
16
|
+
return mockResponse;
|
|
17
|
+
}
|
|
18
|
+
// PRODUCTION mode: perform actual AI verification
|
|
3
19
|
const token = await authentification();
|
|
4
20
|
const response = await kycService.processSelfieOrientationPicture(selfieImage, token);
|
|
5
21
|
console.log("selfieVerification response", JSON.stringify(response, null, 2));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieVerification.js","sourceRoot":"","sources":["../../../src/modules/api/SelfieVerification.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SelfieVerification.js","sourceRoot":"","sources":["../../../src/modules/api/SelfieVerification.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC;AAIjF,MAAM,kBAAkB,GAAG,KAAK,EAAE,WAAmB,EAAE,MAAsB,YAAY,EAAkC,EAAE;IACzH,2EAA2E;IAC3E,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACjE,gEAAgE;QAChE,gEAAgE;QAEhE,MAAM,YAAY,GAA0B,CAAC;gBACzC,qBAAqB,EAAE,QAAQ;gBAC/B,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC;gBACtB,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,kCAAkC;gBAC/C,KAAK,EAAE,EAAE;aACZ,CAAC,CAAC;QACH,OAAO,YAAY,CAAC;IACxB,CAAC;IAED,kDAAkD;IAClD,MAAM,KAAK,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,+BAA+B,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAA;AAKD,eAAe,kBAAkB,CAAC","sourcesContent":["import kycService, { authentification, SelfieVideoResponse } from \"./KYCService\";\n\nimport { KycEnvironment } from \"../../types/env.types\";\n\nconst selfieVerification = async (selfieImage: string, env: KycEnvironment = 'PRODUCTION'): Promise<SelfieVideoResponse[]> => {\n // In SANDBOX mode, skip AI verification and return a mock success response\n if (env === 'SANDBOX') {\n console.log(\"SANDBOX mode: Skipping AI verification for selfie\");\n // Return a mock response that simulates successful verification\n // This allows the flow to continue without actual AI processing\n \n const mockResponse: SelfieVideoResponse[] = [{\n orientation_direction: \"center\",\n turn_score: 1.0,\n bbox: [0, 0, 100, 100],\n capture: true,\n instruction: \"SANDBOX: AI verification skipped\",\n error: \"\"\n }];\n return mockResponse;\n }\n\n // PRODUCTION mode: perform actual AI verification\n const token = await authentification();\n const response = await kycService.processSelfieOrientationPicture(selfieImage, token);\n console.log(\"selfieVerification response\", JSON.stringify(response, null, 2));\n return response;\n}\n\n\n\n\nexport default selfieVerification;"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BackendKYCTemplate } from '../../types/KYC.types';
|
|
2
|
+
export declare class TemplateServiceClass {
|
|
3
|
+
private cache;
|
|
4
|
+
private cacheTimeout;
|
|
5
|
+
/**
|
|
6
|
+
* Get headers for API requests
|
|
7
|
+
*/
|
|
8
|
+
private getHeaders;
|
|
9
|
+
/**
|
|
10
|
+
* Fetch a template from the backend API
|
|
11
|
+
* @param templateId - The ID of the template to fetch
|
|
12
|
+
* @param apiKey - Optional API key for authentication
|
|
13
|
+
* @param token - Optional Bearer token for authentication
|
|
14
|
+
* @param useCache - Whether to use cached version if available (default: true)
|
|
15
|
+
* @returns The backend template
|
|
16
|
+
*/
|
|
17
|
+
fetchTemplate(templateId: string, apiKey?: string, token?: string, useCache?: boolean): Promise<BackendKYCTemplate>;
|
|
18
|
+
/**
|
|
19
|
+
* Clear the template cache
|
|
20
|
+
* @param templateId - Optional template ID to clear. If not provided, clears all cache.
|
|
21
|
+
*/
|
|
22
|
+
clearCache(templateId?: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get cached template if available
|
|
25
|
+
* @param templateId - The template ID
|
|
26
|
+
* @returns The cached template or null if not found/expired
|
|
27
|
+
*/
|
|
28
|
+
getCachedTemplate(templateId: string): BackendKYCTemplate | null;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch list of available templates (optional feature)
|
|
31
|
+
* @param apiKey - Optional API key for authentication
|
|
32
|
+
* @param token - Optional Bearer token for authentication
|
|
33
|
+
* @returns Array of template metadata
|
|
34
|
+
*/
|
|
35
|
+
fetchTemplateList(apiKey?: string, token?: string): Promise<Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
name: Record<string, string>;
|
|
38
|
+
version?: string;
|
|
39
|
+
status?: string;
|
|
40
|
+
}>>;
|
|
41
|
+
}
|
|
42
|
+
declare const templateService: TemplateServiceClass;
|
|
43
|
+
export default templateService;
|
|
44
|
+
//# sourceMappingURL=TemplateService.d.ts.map
|