@transfergratis/react-native-sdk 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -617
- package/android/build.gradle +1 -1
- package/build/components/KYCElements/IDCardCapture.js +3 -3
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.js +3 -3
- package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -1
- package/build/components/TemplateKYCExample.d.ts +1 -1
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +5 -8
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +7 -2
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +3 -2
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/index.d.ts +1 -31
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -41
- package/build/index.js.map +1 -1
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +15 -9
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/types.d.ts +1 -0
- package/build/modules/api/types.d.ts.map +1 -1
- package/build/modules/api/types.js.map +1 -1
- package/build/utils/cropByObb.js +3 -3
- package/build/utils/cropByObb.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KYCElements/IDCardCapture.tsx +8 -8
- package/src/components/KYCElements/VerificationProgressTemplate.tsx +10 -10
- package/src/components/TemplateKYCExample.tsx +7 -9
- package/src/components/TemplateKYCFlowRefactored.tsx +10 -3
- package/src/hooks/useTemplateKYCFlow.tsx +4 -3
- package/src/index.ts +2 -66
- package/src/modules/api/KYCService.ts +17 -11
- package/src/modules/api/types.ts +1 -0
- package/src/utils/cropByObb.ts +3 -3
|
@@ -226,9 +226,9 @@ export class KYCService {
|
|
|
226
226
|
const rnFile: any = { uri: fileUri, type: 'image/jpeg', name: 'id_card_front.jpg' };
|
|
227
227
|
formData.append('file', rnFile);
|
|
228
228
|
const docTypeShorted = GovernmentDocumentTypeShorted[docType as GovernmentDocumentType];
|
|
229
|
-
logger.log('checkTemplateType params', this.mrzServiceURL, JSON.stringify({ fileUri, docTypeShorted, docRegion, token, postfix }, null, 2));
|
|
230
229
|
const url = `${this.mrzServiceURL}/get_template_version/?doc_type=${encodeURIComponent(docTypeShorted)}&doc_region=${encodeURIComponent(docRegion)}&postfix=${postfix}`;
|
|
231
230
|
|
|
231
|
+
logger.log('checkTemplateType params', this.mrzServiceURL, JSON.stringify({ fileUri, docTypeShorted, docRegion, token, postfix, url }, null, 2));
|
|
232
232
|
try {
|
|
233
233
|
const res = await axios.post<CheckTemplateTypeResponse>(url, formData, {
|
|
234
234
|
headers: { 'Content-Type': 'multipart/form-data', 'Authorization': `Bearer ${token}`, },
|
|
@@ -396,10 +396,11 @@ export class KYCService {
|
|
|
396
396
|
|
|
397
397
|
try {
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
|
|
401
400
|
// /api/v1/verification/api/kyc/sessions/{session_id}/steps/{step}/
|
|
402
|
-
const { session_id, step, data, templateId, action } = payload;
|
|
401
|
+
const { session_id, step, data, templateId, action, apiKey } = payload;
|
|
402
|
+
|
|
403
|
+
const token = apiKey ? undefined : await authentification();
|
|
403
404
|
// const session_id = "kyc-8b4e069258d8";
|
|
404
405
|
const payloadData = {
|
|
405
406
|
action: action,
|
|
@@ -423,7 +424,7 @@ export class KYCService {
|
|
|
423
424
|
const res = await axios.post<SessionResponse>(url,
|
|
424
425
|
payloadData,
|
|
425
426
|
{
|
|
426
|
-
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }
|
|
427
|
+
headers: { 'Content-Type': 'application/json', ...(this.apiKey ? { 'Authorization': `ApiKey ${this.apiKey}` } : { 'Authorization': `Bearer ${token}` }) }
|
|
427
428
|
});
|
|
428
429
|
logger.log('verificationSession res', JSON.stringify(truncateFields(res.data), null, 2));
|
|
429
430
|
return res.data;
|
|
@@ -436,12 +437,17 @@ export class KYCService {
|
|
|
436
437
|
}
|
|
437
438
|
// reultat de la verification
|
|
438
439
|
async getVerificationResult(session_id: string): Promise<VerificationResult> {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
440
|
+
try {
|
|
441
|
+
const token = await authentification();
|
|
442
|
+
const url = `${this.backendServiceURL}/verification/api/kyc/result/?session_id=${session_id}`;
|
|
443
|
+
const res = await axios.get<VerificationResult>(url,
|
|
444
|
+
{ headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` } });
|
|
445
|
+
logger.log('getVerificationResult res', JSON.stringify(truncateFields(res.data), null, 2));
|
|
446
|
+
return res.data;
|
|
447
|
+
} catch (error) {
|
|
448
|
+
logger.error('Error getting verification result:', JSON.stringify(errorMessage(error), null, 2));
|
|
449
|
+
throw error;
|
|
450
|
+
}
|
|
445
451
|
}
|
|
446
452
|
}
|
|
447
453
|
|
package/src/modules/api/types.ts
CHANGED
package/src/utils/cropByObb.ts
CHANGED
|
@@ -82,9 +82,9 @@ export async function cropImageWithBBox(uri: string, bbox: any) {
|
|
|
82
82
|
// 3️⃣ Convertir le bbox à la taille réelle scale 0.10 = 10%
|
|
83
83
|
const crop = {
|
|
84
84
|
originX: bbox.minX ,
|
|
85
|
-
originY: bbox.minY
|
|
86
|
-
width: bbox.width
|
|
87
|
-
height: bbox.height
|
|
85
|
+
originY: bbox.minY ,
|
|
86
|
+
width: bbox.width ,
|
|
87
|
+
height: bbox.height,
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// 4️⃣ Appliquer le crop
|