hl-core 0.0.9-beta.49 → 0.0.9-beta.50

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/api/base.api.ts CHANGED
@@ -920,4 +920,16 @@ export class ApiClass {
920
920
  },
921
921
  });
922
922
  }
923
+
924
+ async generateShortLink(data: { link: string; priority: string }) {
925
+ return await this.axiosCall<{
926
+ id: string;
927
+ link: string;
928
+ }>({
929
+ url: '/notification/shorteners',
930
+ baseURL: getStrValuePerEnv('gatewayApiUrl'),
931
+ method: Methods.POST,
932
+ data: data,
933
+ });
934
+ }
923
935
  }
@@ -9,26 +9,18 @@ export default function (axios: AxiosInstance) {
9
9
  }
10
10
  if (request.url && request.baseURL) {
11
11
  const host = window.location.hostname;
12
- if (host.startsWith('bpmsrv02')) {
13
- if (request.baseURL === 'https://products.halyklife.kz/api/v1/insis') {
14
- request.baseURL = 'http://bpmsrv02.halyklife.nb';
12
+ if (host.startsWith('bpmsrv02') || host.startsWith('vega')) {
13
+ if (request.baseURL === getStrValuePerEnv('baseApi')) {
14
+ request.baseURL = getStrValuePerEnv('baseApiLocal');
15
15
  }
16
- if (request.baseURL === 'https://products.halyklife.kz/efo/api') {
17
- request.baseURL = 'http://efo-prod.halyklife.nb/api';
16
+ if (request.baseURL === getStrValuePerEnv('efoBaseApi')) {
17
+ request.baseURL = getStrValuePerEnv('efoBaseApiLocal');
18
18
  }
19
- if (request.baseURL === 'https://products.halyklife.kz/aml/api') {
20
- request.baseURL = 'http://aml-prod.halyklife.nb/api';
19
+ if (request.baseURL === getStrValuePerEnv('amlBaseApi')) {
20
+ request.baseURL = getStrValuePerEnv('amlBaseApiLocal');
21
21
  }
22
- }
23
- if (host.startsWith('vega')) {
24
- if (request.baseURL === 'https://products.halyklife.kz/api/v1/test/insis') {
25
- request.baseURL = 'http://vega:84';
26
- }
27
- if (request.baseURL === 'https://products.halyklife.kz/test/efo/api') {
28
- request.baseURL = 'http://efo-dev.halyklife.nb/api';
29
- }
30
- if (request.baseURL === 'https://products.halyklife.kz/test/aml/api') {
31
- request.baseURL = 'http://aml-dev.halyklife.nb/api';
22
+ if (request.baseURL === getStrValuePerEnv('gatewayApiUrl')) {
23
+ request.baseURL = getStrValuePerEnv('gatewayApiUrlLocal');
32
24
  }
33
25
  }
34
26
  if (import.meta.env.VITE_ON_NEW_API === 'true') {
@@ -1010,10 +1010,28 @@ export default {
1010
1010
  isButtonLoading.value = true;
1011
1011
  const parsedDocument = await callDocumentReader(imageDataList.value);
1012
1012
  if (typeof parsedDocument === 'object') {
1013
+ if (
1014
+ member.value.iin &&
1015
+ parsedDocument.iin &&
1016
+ reformatIin(parsedDocument.iin) &&
1017
+ member.value.iin.length === useMask().iin.length &&
1018
+ reformatIin(parsedDocument.iin).length === useMask().iin.length &&
1019
+ member.value.iin !== reformatIin(parsedDocument.iin)
1020
+ ) {
1021
+ dataStore.showToaster('error', 'Не совпадают ИИН');
1022
+ isButtonLoading.value = false;
1023
+ return;
1024
+ }
1013
1025
  formatDateProperty(parsedDocument, 'front');
1014
1026
  member.value.parsedDocument = parsedDocument;
1015
1027
  if (parsedDocument.age) member.value.age = parsedDocument.age;
1016
1028
  if (parsedDocument.iin) member.value.iin = reformatIin(parsedDocument.iin);
1029
+ if (parsedDocument.gender) {
1030
+ if (parsedDocument.gender === 'M' || parsedDocument.gender === 'F') {
1031
+ const gender = dataStore.gender.find((i: Value) => i.id === (parsedDocument.gender === 'M' ? 1 : 2));
1032
+ if (gender) member.value.gender = gender;
1033
+ }
1034
+ }
1017
1035
  if (parsedDocument.birthDate) member.value.birthDate = parsedDocument.birthDate;
1018
1036
  if (parsedDocument.documentIssueDate) member.value.documentDate = parsedDocument.documentIssueDate;
1019
1037
  if (parsedDocument.documentExpireDate) member.value.documentExpire = parsedDocument.documentExpireDate;
@@ -1022,8 +1040,17 @@ export default {
1022
1040
  if (parsedDocument.firstName) member.value.firstName = parsedDocument.firstName;
1023
1041
  if (parsedDocument.middleName) member.value.middleName = parsedDocument.middleName;
1024
1042
  if (parsedDocument.fullName) member.value.longName = parsedDocument.fullName;
1043
+ if (parsedDocument.documentName && parsedDocument.documentName.startsWith('Kazakhstan - Id Card')) {
1044
+ const documentType = dataStore.documentTypes.find((i: Value) => i.ids === '1UDL');
1045
+ if (documentType) member.value.documentType = documentType;
1046
+ }
1025
1047
  if (!!parsedDocument.documentIssuer) {
1026
- if (parsedDocument.documentIssuer === 'МИНИСТЕРСТВО ВНУТРЕННИХ ДЕЛ РК' || parsedDocument.documentIssuer === 'ҚР ІШКІ ІСТЕР МИНИСТРЛІГІ') {
1048
+ if (
1049
+ parsedDocument.documentIssuer === 'МИНИСТЕРСТВО ВНУТРЕННИХ ДЕЛ РК' ||
1050
+ parsedDocument.documentIssuer === 'ҚР ІШКІ ІСТЕР МИНИСТРЛІГІ' ||
1051
+ /ҚАЗАҚСТАН/gi.test(parsedDocument.documentIssuer) ||
1052
+ /КАЗАХСТАН/gi.test(parsedDocument.documentIssuer)
1053
+ ) {
1027
1054
  const documentIssuer = dataStore.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
1028
1055
  if (documentIssuer) member.value.documentIssuers = documentIssuer;
1029
1056
  } else {
@@ -544,9 +544,10 @@ export default defineComponent({
544
544
  await dataStore.generateDocument();
545
545
  };
546
546
 
547
- const convertQr = (url: string | null) => {
547
+ const convertQr = async (url: string | null) => {
548
548
  if (url) {
549
- qrUrl.value = url;
549
+ const shortedUrl = await dataStore.generateShortLink(url);
550
+ qrUrl.value = typeof shortedUrl === 'string' && !!shortedUrl ? shortedUrl : url;
550
551
  isQrDialog.value = true;
551
552
  } else {
552
553
  dataStore.showToaster('error', dataStore.t('toaster.noUrl'));
@@ -2,7 +2,7 @@ import { useDisplay } from 'vuetify';
2
2
  import jwt_decode from 'jwt-decode';
3
3
  import { XMLParser } from 'fast-xml-parser';
4
4
  import { AxiosError } from 'axios';
5
- import { DocumentReaderApi, Scenario, TextFieldType } from '@regulaforensics/document-reader-webclient';
5
+ import { DocumentReaderApi, Scenario, TextFieldType, LCID } from '@regulaforensics/document-reader-webclient';
6
6
  import { PolicyholderClass } from '../composables/classes';
7
7
 
8
8
  export const getBaseCredentials = () => {
@@ -335,7 +335,7 @@ export const getLastDayOfMonth = (year: number, month: number) => {
335
335
  return new Date(year, month + 1, 0, (date.getTimezoneOffset() / 60) * -1).toISOString();
336
336
  };
337
337
 
338
- type WhichValuePerEnv = 'qrGenUrl';
338
+ type WhichValuePerEnv = 'qrGenUrl' | 'gatewayApiUrl' | 'gatewayApiUrlLocal' | 'baseApi' | 'baseApiLocal' | 'efoBaseApi' | 'efoBaseApiLocal' | 'amlBaseApi' | 'amlBaseApiLocal';
339
339
 
340
340
  export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
341
341
  const valuesPerEnv: {
@@ -348,8 +348,48 @@ export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
348
348
  development: 'mobileSign:https://test-sign.halyklife.kz/EgovQrCms',
349
349
  test: 'mobileSign:https://test-sign.halyklife.kz/EgovQrCms',
350
350
  },
351
+ gatewayApiUrl: {
352
+ production: 'https://products.halyklife.kz/gateway',
353
+ development: 'https://products.halyklife.kz/test/gateway',
354
+ test: 'https://products.halyklife.kz/test/gateway',
355
+ },
356
+ gatewayApiUrlLocal: {
357
+ production: 'http://products.halyklife.nb/gateway',
358
+ development: 'http://products.halyklife.nb/test/gateway',
359
+ test: 'http://products.halyklife.nb/test/gateway',
360
+ },
361
+ baseApi: {
362
+ production: 'https://products.halyklife.kz/api/v1/insis',
363
+ development: 'https://products.halyklife.kz/api/v1/test/insis',
364
+ test: 'https://products.halyklife.kz/api/v1/test/insis',
365
+ },
366
+ baseApiLocal: {
367
+ production: 'http://bpmsrv02.halyklife.nb',
368
+ development: 'http://vega:84',
369
+ test: 'http://vega:84',
370
+ },
371
+ efoBaseApi: {
372
+ production: 'https://products.halyklife.kz/efo/api',
373
+ development: 'https://products.halyklife.kz/test/efo/api',
374
+ test: 'https://products.halyklife.kz/test/efo/api',
375
+ },
376
+ efoBaseApiLocal: {
377
+ production: 'http://efo-prod.halyklife.nb/api',
378
+ development: 'http://efo-dev.halyklife.nb/api',
379
+ test: 'http://efo-dev.halyklife.nb/api',
380
+ },
381
+ amlBaseApi: {
382
+ production: 'https://products.halyklife.kz/aml/api',
383
+ development: 'https://products.halyklife.kz/test/aml/api',
384
+ test: 'https://products.halyklife.kz/test/aml/api',
385
+ },
386
+ amlBaseApiLocal: {
387
+ production: 'http://aml-prod.halyklife.nb/api',
388
+ development: 'http://aml-dev.halyklife.nb/api',
389
+ test: 'http://aml-dev.halyklife.nb/api',
390
+ },
351
391
  };
352
- return valuesPerEnv[which][useEnv().envMode];
392
+ return valuesPerEnv[which][import.meta.env.VITE_MODE];
353
393
  };
354
394
 
355
395
  export const getMainPageRoute = () => {
@@ -413,19 +453,30 @@ export const callDocumentReader = async (imageBase64: string | string[]) => {
413
453
  if (!imageBase64) return false;
414
454
  const dataStore = useDataStore();
415
455
  try {
416
- const api = new DocumentReaderApi({ basePath: 'http://10.176.49.47:8080' });
456
+ const api = new DocumentReaderApi({
457
+ basePath: `${getStrValuePerEnv('gatewayApiUrl')}/regulaforensics`,
458
+ baseOptions: { headers: { Authorization: `Bearer ${dataStore.accessToken}` } },
459
+ });
417
460
  const result = await api.process({
418
461
  images: Array.isArray(imageBase64) ? imageBase64 : [imageBase64],
419
462
  processParam: { scenario: Scenario.FULL_PROCESS, doublePageSpread: true, measureSystem: 0 },
420
463
  });
464
+ const documentName = ref<string | undefined>(undefined);
465
+ if (result.rawResponse && result.rawResponse.ContainerList) {
466
+ const dType = result.rawResponse.ContainerList.List.find(i => i.result_type === 9);
467
+ if (dType && 'OneCandidate' in dType && dType.OneCandidate && dType.OneCandidate.DocumentName) {
468
+ documentName.value = dType.OneCandidate.DocumentName;
469
+ }
470
+ }
421
471
  if (result.text) {
422
472
  const iin = result.text.getField(TextFieldType.PERSONAL_NUMBER);
423
- const lastName = result.text.getField(TextFieldType.SURNAME);
424
- const firstName = result.text.getField(TextFieldType.GIVEN_NAMES_RUS) ?? result.text.getField(TextFieldType.GIVEN_NAMES);
425
- const middleName = result.text.getField(TextFieldType.FATHERS_NAME_RUS) ?? result.text.getField(TextFieldType.FATHERS_NAME);
426
- const fullName = result.text.getField(TextFieldType.SURNAME_AND_GIVEN_NAMES);
473
+ const lastName = result.text.getField(TextFieldType.SURNAME, LCID.KAZAKH);
474
+ const firstName = result.text.getField(TextFieldType.GIVEN_NAMES_RUS, LCID.KAZAKH) ?? result.text.getField(TextFieldType.GIVEN_NAMES, LCID.KAZAKH);
475
+ const middleName = result.text.getField(TextFieldType.FATHERS_NAME_RUS, LCID.KAZAKH) ?? result.text.getField(TextFieldType.FATHERS_NAME, LCID.KAZAKH);
476
+ const fullName = result.text.getField(TextFieldType.SURNAME_AND_GIVEN_NAMES, LCID.KAZAKH);
427
477
  const birthDate = result.text.getField(TextFieldType.DATE_OF_BIRTH);
428
478
  const age = result.text.getField(TextFieldType.AGE);
479
+ const gender = result.text.getField(TextFieldType.SEX);
429
480
  const documentNumber = result.text.getField(TextFieldType.DOCUMENT_NUMBER);
430
481
  const documentIssuer = result.text.getField(TextFieldType.AUTHORITY_RUS) ?? result.text.getField(TextFieldType.AUTHORITY);
431
482
  const documentIssueDate = result.text.getField(TextFieldType.DATE_OF_ISSUE);
@@ -438,6 +489,8 @@ export const callDocumentReader = async (imageBase64: string | string[]) => {
438
489
  fullName: fullName?.value,
439
490
  birthDate: birthDate?.value,
440
491
  age: age?.value,
492
+ gender: gender?.value,
493
+ documentName: documentName.value,
441
494
  documentNumber: documentNumber?.value,
442
495
  documentIssuer: documentIssuer?.value,
443
496
  documentIssueDate: documentIssueDate?.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.49",
3
+ "version": "0.0.9-beta.50",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -3508,6 +3508,17 @@ export const useDataStore = defineStore('data', {
3508
3508
  return ErrorHandler(err);
3509
3509
  }
3510
3510
  },
3511
+ async generateShortLink(url: string) {
3512
+ try {
3513
+ const response = await this.api.generateShortLink({
3514
+ link: url,
3515
+ priority: 'low',
3516
+ });
3517
+ return response.link;
3518
+ } catch (err) {
3519
+ return ErrorHandler(err);
3520
+ }
3521
+ },
3511
3522
  hasJobSection(whichForm: keyof typeof StoreMembers) {
3512
3523
  if (this.isLifetrip) return false;
3513
3524
  switch (whichForm) {