@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.
Files changed (37) hide show
  1. package/README.md +17 -617
  2. package/android/build.gradle +1 -1
  3. package/build/components/KYCElements/IDCardCapture.js +3 -3
  4. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  5. package/build/components/KYCElements/VerificationProgressTemplate.js +3 -3
  6. package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -1
  7. package/build/components/TemplateKYCExample.d.ts +1 -1
  8. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  9. package/build/components/TemplateKYCExample.js +5 -8
  10. package/build/components/TemplateKYCExample.js.map +1 -1
  11. package/build/components/TemplateKYCFlowRefactored.js +7 -2
  12. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  13. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  14. package/build/hooks/useTemplateKYCFlow.js +3 -2
  15. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  16. package/build/index.d.ts +1 -31
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +1 -41
  19. package/build/index.js.map +1 -1
  20. package/build/modules/api/KYCService.d.ts.map +1 -1
  21. package/build/modules/api/KYCService.js +15 -9
  22. package/build/modules/api/KYCService.js.map +1 -1
  23. package/build/modules/api/types.d.ts +1 -0
  24. package/build/modules/api/types.d.ts.map +1 -1
  25. package/build/modules/api/types.js.map +1 -1
  26. package/build/utils/cropByObb.js +3 -3
  27. package/build/utils/cropByObb.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/KYCElements/IDCardCapture.tsx +8 -8
  30. package/src/components/KYCElements/VerificationProgressTemplate.tsx +10 -10
  31. package/src/components/TemplateKYCExample.tsx +7 -9
  32. package/src/components/TemplateKYCFlowRefactored.tsx +10 -3
  33. package/src/hooks/useTemplateKYCFlow.tsx +4 -3
  34. package/src/index.ts +2 -66
  35. package/src/modules/api/KYCService.ts +17 -11
  36. package/src/modules/api/types.ts +1 -0
  37. 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
- const token = await authentification();
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
- const token = await authentification();
440
- const url = `${this.backendServiceURL}/verification/api/kyc/result/?session_id=${session_id}`;
441
- const res = await axios.get<VerificationResult>(url,
442
- { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` } });
443
- logger.log('getVerificationResult res', JSON.stringify(truncateFields(res.data), null, 2));
444
- return res.data;
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
 
@@ -17,6 +17,7 @@ export interface VerificationSessionRequest {
17
17
  session_id: string;
18
18
  token: string;
19
19
  action: string
20
+ apiKey?: string;
20
21
  }
21
22
 
22
23
 
@@ -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 - 80,
86
- width: bbox.width + 100,
87
- height: bbox.height + 150,
85
+ originY: bbox.minY ,
86
+ width: bbox.width ,
87
+ height: bbox.height,
88
88
  };
89
89
 
90
90
  // 4️⃣ Appliquer le crop