hl-core 0.0.9-beta.51 → 0.0.9-beta.53

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.
@@ -51,7 +51,7 @@ export const useDataStore = defineStore('data', {
51
51
  isGons: state => state.product === 'gons',
52
52
  isKazyna: state => state.product === 'halykkazyna',
53
53
  isDas: state => state.product === 'daskamkorlyk',
54
- isPension: state => state.product === 'pensionannuity',
54
+ isPension: state => state.product === 'pensionannuitynew',
55
55
  isAmulet: state => state.product === 'amuletlife',
56
56
  isGns: state => state.product === 'gns',
57
57
  isCalculator: state => state.product === 'calculator',
@@ -256,6 +256,12 @@ export const useDataStore = defineStore('data', {
256
256
  isAdjuster() {
257
257
  return this.isRole(constants.roles.Adjuster);
258
258
  },
259
+ isDsoDirector() {
260
+ return this.isRole(constants.roles.DsoDirector);
261
+ },
262
+ isAccountantDirector() {
263
+ return this.isRole(constants.roles.AccountantDirector);
264
+ },
259
265
  isProcessEditable(statusCode?: keyof typeof Statuses) {
260
266
  const getEditibleStatuses = () => {
261
267
  const defaultStatuses = constants.editableStatuses;
@@ -983,7 +989,7 @@ export const useDataStore = defineStore('data', {
983
989
  delete data.id;
984
990
  }
985
991
  }
986
- data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : member.isDisability.nameRu == 'Да';
992
+ data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : !!member.isDisability;
987
993
  data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
988
994
  data.profession = member.job;
989
995
  data.position = member.jobPosition;
@@ -1035,11 +1041,11 @@ export const useDataStore = defineStore('data', {
1035
1041
  }
1036
1042
  }
1037
1043
  },
1038
- async setApplication(calculate: boolean = false) {
1044
+ async setApplication(applicationData: object, calculate: boolean = false) {
1039
1045
  try {
1040
1046
  this.isLoading = true;
1041
1047
  this.isButtonsLoading = true;
1042
- await this.api.setApplication(this.formStore.applicationData.pensionApp);
1048
+ await this.api.setApplication(applicationData);
1043
1049
  if (calculate) {
1044
1050
  await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
1045
1051
  this.showToaster('success', this.t('toaster.successSaved'), 2000);
@@ -1437,7 +1443,7 @@ export const useDataStore = defineStore('data', {
1437
1443
  if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
1438
1444
  },
1439
1445
  async getInsuranceCompanies() {
1440
- if (this.isPension) return await this.getFromApi('insuranceCompanies', 'getInsuranceCompanies');
1446
+ if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
1441
1447
  },
1442
1448
  async getProcessIndexRate() {
1443
1449
  if (this.processCode) {
@@ -1526,6 +1532,7 @@ export const useDataStore = defineStore('data', {
1526
1532
  this.getInsuranceCompanies(),
1527
1533
  this.getEconomicActivityType(),
1528
1534
  this.getAuthorityBasis(),
1535
+ this.getDisabilityGroups(),
1529
1536
  ]);
1530
1537
  },
1531
1538
  async getQuestionList(
@@ -1617,8 +1624,8 @@ export const useDataStore = defineStore('data', {
1617
1624
  delete query.processCodes;
1618
1625
  query.processCode = byOneProcess;
1619
1626
  }
1620
- if (byOneProcess === 1) {
1621
- query.processCodes = [1, 2, 4];
1627
+ if (byOneProcess === 19) {
1628
+ query.processCodes = [19, 2, 4];
1622
1629
  delete query.processCode;
1623
1630
  }
1624
1631
  const taskList = await this.api.getTaskList(
@@ -2286,7 +2293,7 @@ export const useDataStore = defineStore('data', {
2286
2293
  });
2287
2294
  this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
2288
2295
  }
2289
- if (this.isPension && this.formStore.policyholderForm.bankInfo) {
2296
+ if (this.isPension && this.formStore.policyholderForm.bankInfo && this.formStore.policyholderForm.bankInfo.bik) {
2290
2297
  this.formStore.insuredForm[0].bankInfo = this.formStore.policyholderForm.bankInfo;
2291
2298
  }
2292
2299
  } catch (err) {
@@ -2438,16 +2445,20 @@ export const useDataStore = defineStore('data', {
2438
2445
  if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
2439
2446
  if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
2440
2447
  if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
2448
+ if (typeof this.formStore.applicationData[whichMember].isDisability === 'boolean')
2449
+ this.formStore[whichForm].isDisability = this.formStore.applicationData[whichMember].isDisability;
2450
+ if (!!this.formStore.applicationData[whichMember].disabilityGroupId) {
2451
+ const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
2452
+ this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2453
+ }
2441
2454
  if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
2442
2455
  this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
2443
2456
  this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
2444
2457
  const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
2445
- if (bank) {
2446
- this.formStore[whichForm].bankInfo.bankName = bank;
2447
- this.formStore[whichForm].bankInfo.bin = bank.ids as string;
2448
- } else {
2449
- this.formStore[whichForm].bankInfo.bankName = new Value();
2450
- }
2458
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.applicationData.pensionApp.transferContractCompany);
2459
+ this.formStore[whichForm].bankInfo.bankName = bank ? bank : new Value();
2460
+ this.formStore[whichForm].bankInfo.bin = bank ? String(bank.ids) : '';
2461
+ this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2451
2462
  }
2452
2463
  },
2453
2464
  setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
@@ -2470,6 +2481,13 @@ export const useDataStore = defineStore('data', {
2470
2481
  if ('jobPlace' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].jobName) {
2471
2482
  this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
2472
2483
  }
2484
+ if (typeof this.formStore.applicationData[whichMember][index].isDisability === 'boolean') {
2485
+ this.formStore[whichForm][index].isDisability = this.formStore.applicationData[whichMember][index].isDisability;
2486
+ }
2487
+ if (!!this.formStore.applicationData[whichMember][index].disabilityGroupId) {
2488
+ const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember][index].disabilityGroupId);
2489
+ this.formStore[whichForm][index].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2490
+ }
2473
2491
  },
2474
2492
  async signDocument(type: string = 'electronic') {
2475
2493
  try {
@@ -2499,25 +2517,21 @@ export const useDataStore = defineStore('data', {
2499
2517
  return [
2500
2518
  {
2501
2519
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
2502
- name: this.processCode == 1 ? 'PA_Statement' : 'PA_RefundStatement',
2520
+ name: this.processCode == 19 ? 'PA_Statement' : 'PA_RefundStatement',
2521
+ format: 'pdf',
2522
+ },
2523
+ {
2524
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2525
+ name: 'Agreement',
2503
2526
  format: 'pdf',
2504
2527
  },
2505
2528
  ];
2506
2529
  }
2507
-
2508
2530
  case 'ContractSignedByAuthorizedPerson':
2509
2531
  return [
2510
2532
  {
2511
2533
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
2512
- name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
2513
- format: 'pdf',
2514
- },
2515
- ];
2516
- case 'ContractSignedByAuthorizedPerson':
2517
- return [
2518
- {
2519
- processInstanceId: String(this.formStore.applicationData.processInstanceId),
2520
- name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
2534
+ name: 'PA_Contract',
2521
2535
  format: 'pdf',
2522
2536
  },
2523
2537
  ];
@@ -2550,31 +2564,62 @@ export const useDataStore = defineStore('data', {
2550
2564
  await ncaLayerClient.connect();
2551
2565
  activeTokens = await ncaLayerClient.getActiveTokens();
2552
2566
  const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
2553
- const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
2554
- const wnd = window.open('about:blank', '', '_blank');
2555
- wnd?.document.write(agreementXml as any);
2556
- const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
2557
- const document = {
2558
- processInstanceId: String(this.formStore.applicationData.processInstanceId),
2559
- name: 'PAEnpf_Agreement',
2560
- format: 'xml',
2561
- };
2562
- const signData = await this.api.signXml([document]);
2563
- let data = new FormData();
2564
- data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2565
- data.append('xmlData', signedAgreement);
2566
- data.append('name', 'PAEnpf_Agreement');
2567
- data.append('format', 'xml');
2568
- data.append('EdsXmlId', signData.data);
2569
- await this.api.uploadXml(data);
2570
- await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2571
- this.showToaster('success', this.t('pension.consentGiven'), 3000);
2567
+ if (this.formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson') {
2568
+ const document = await this.generatePDFDocument('PAEnpf_Agreement', '40', 'pdf');
2569
+ const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2570
+ const formData = new FormData();
2571
+ formData.append('base64EncodedSignature', base64EncodedSignature);
2572
+ formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2573
+ formData.append('name', 'PAEnpf_Agreement');
2574
+ formData.append('format', 'pdf');
2575
+ try {
2576
+ await this.api.uploadDigitalCertifijcate(formData);
2577
+ await this.handleTask('accept', String(this.formStore.applicationTaskId));
2578
+ } catch (e) {
2579
+ this.showToaster('error', String(e));
2580
+ return;
2581
+ }
2582
+ } else if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
2583
+ const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
2584
+ const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2585
+ const formData = new FormData();
2586
+ formData.append('base64EncodedSignature', base64EncodedSignature);
2587
+ formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2588
+ formData.append('name', 'PA_Contract');
2589
+ formData.append('format', 'pdf');
2590
+ try {
2591
+ await this.api.uploadDigitalCertifijcate(formData);
2592
+ await this.handleTask('accept', String(this.formStore.applicationTaskId));
2593
+ } catch (e) {
2594
+ this.showToaster('error', String(e));
2595
+ return;
2596
+ }
2597
+ } else {
2598
+ const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
2599
+ const wnd = window.open('about:blank', '', '_blank');
2600
+ wnd?.document.write(agreementXml as any);
2601
+ const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
2602
+ const document = {
2603
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2604
+ name: 'PAEnpf_Agreement',
2605
+ format: 'xml',
2606
+ };
2607
+ const signData = await this.api.signXml([document]);
2608
+ const data = new FormData();
2609
+ data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2610
+ data.append('xmlData', signedAgreement);
2611
+ data.append('name', 'PAEnpf_Agreement');
2612
+ data.append('format', 'xml');
2613
+ data.append('EdsXmlId', signData.data);
2614
+ await this.api.uploadXml(data);
2615
+ await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2616
+ }
2572
2617
  } catch (error) {
2573
2618
  this.showToaster('error', String(error));
2574
2619
  return;
2575
2620
  }
2576
2621
  } else {
2577
- if (this.processCode === 1 || this.processCode === 2 || this.processCode === 3) {
2622
+ if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
2578
2623
  const result = await this.api.signBts(data);
2579
2624
  if (result.code === 0) this.formStore.signUrls = result.data;
2580
2625
  } else {
@@ -2608,7 +2653,7 @@ export const useDataStore = defineStore('data', {
2608
2653
  link.setAttribute('download', 'Договор страхования.pdf');
2609
2654
  break;
2610
2655
  case constants.documentTypes.application1:
2611
- link.setAttribute('download', 'Приложение №1.xls');
2656
+ link.setAttribute('download', 'Приложение №1.pdf');
2612
2657
  break;
2613
2658
  case constants.documentTypes.questionnaireInsured:
2614
2659
  link.setAttribute('download', 'Анкета Застрахованного.docx');
@@ -3349,7 +3394,6 @@ export const useDataStore = defineStore('data', {
3349
3394
  },
3350
3395
  async startApplicationV2(data: PolicyholderClass) {
3351
3396
  const policyholder = JSON.parse(JSON.stringify(data)) as any;
3352
- if (!policyholder.clientData.iin) return false;
3353
3397
  this.preparePersonData(policyholder);
3354
3398
  keyDeleter(policyholder as PolicyholderClass, [
3355
3399
  'clientData.beneficalOwnerQuest',
@@ -3426,7 +3470,7 @@ export const useDataStore = defineStore('data', {
3426
3470
  this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
3427
3471
  this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
3428
3472
  this.formStore.lfb.clientId = clientId;
3429
- this.formStore.lfb.policyholder.clientData.authorityDetails.date = reformatDate(clientData.authorityDetails.date);
3473
+ this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date);
3430
3474
  this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
3431
3475
  this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
3432
3476
  this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
@@ -3459,8 +3503,8 @@ export const useDataStore = defineStore('data', {
3459
3503
  if (accidentIncidents && accidentIncidents.length) {
3460
3504
  this.formStore.lfb.accidentIncidents = accidentIncidents;
3461
3505
  this.formStore.lfb.accidentIncidents.forEach(incident => {
3462
- incident.amount = incident.amount === 0 ? null : incident.amount;
3463
- incident.count = incident.count === 0 ? null : incident.count;
3506
+ incident.amount = incident.amount === 0 ? '' : incident.amount;
3507
+ incident.count = incident.count === 0 ? '' : incident.count;
3464
3508
  });
3465
3509
  }
3466
3510
 
@@ -3487,7 +3531,12 @@ export const useDataStore = defineStore('data', {
3487
3531
  },
3488
3532
  async saveAccidentIncidents(data: AccidentIncidents[]) {
3489
3533
  try {
3490
- const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, data);
3534
+ const dataCopy = JSON.parse(JSON.stringify(data));
3535
+ for (const incident of dataCopy) {
3536
+ incident.count = !!incident.count ? incident.count : 0;
3537
+ incident.amount = incident.amount ? incident.amount : 0;
3538
+ }
3539
+ const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, dataCopy);
3491
3540
  return response;
3492
3541
  } catch (err) {
3493
3542
  return ErrorHandler(err);
@@ -3576,6 +3625,7 @@ export const useDataStore = defineStore('data', {
3576
3625
  iin: reformatIin(client.iin),
3577
3626
  insSum: client.insuredPolicyData.insSum,
3578
3627
  premium: client.insuredPolicyData.premium,
3628
+ premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
3579
3629
  hasAttachedFile: client.hasAttachedFile,
3580
3630
  };
3581
3631
  });
@@ -3829,7 +3879,9 @@ export const useDataStore = defineStore('data', {
3829
3879
  this.isBranchDirector() ||
3830
3880
  this.isUSNSACCINS() ||
3831
3881
  this.isDsuio() ||
3832
- this.isAdjuster(),
3882
+ this.isAdjuster() ||
3883
+ this.isDsoDirector() ||
3884
+ this.isAccountantDirector(),
3833
3885
  };
3834
3886
  },
3835
3887
  },
package/store/rules.ts CHANGED
@@ -240,19 +240,15 @@ export const rules = {
240
240
  checkDate: [
241
241
  (v: any) => {
242
242
  const today = new Date();
243
- const yesterday = new Date();
244
- yesterday.setDate(today.getDate() - 1);
245
243
  const yourDate = new Date(formatDate(v)!);
246
-
247
244
  if (yourDate.toDateString() === today.toDateString()) {
248
245
  return true;
249
- } else if (yourDate.toDateString() === yesterday.toDateString()) {
250
- return true;
251
246
  } else {
252
247
  return t('rules.checkDate');
253
248
  }
254
249
  },
255
250
  ],
251
+ fileRequired: [(v: any) => !!v || t('rules.fileRequired'), (v: any) => (v && v.length > 0) || t('rules.fileRequired')],
256
252
  guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
257
253
  if (Number(v) > Number(termAnnuityPayments)) {
258
254
  return t('rules.guaranteedPeriodLimit');
package/types/enum.ts CHANGED
@@ -95,6 +95,8 @@ export enum Roles {
95
95
  USNSACCINS = 'USNSACCINS',
96
96
  Dsuio = 'Dsuio',
97
97
  Adjuster = 'Adjuster',
98
+ DsoDirector = 'DsoDirector',
99
+ AccountantDirector = 'AccountantDirector',
98
100
  }
99
101
 
100
102
  export enum Statuses {
package/types/index.ts CHANGED
@@ -25,7 +25,7 @@ declare global {
25
25
  | 'daskamkorlyk'
26
26
  | 'amuletlife'
27
27
  | 'gns'
28
- | 'pensionannuity'
28
+ | 'pensionannuitynew'
29
29
  | 'dso'
30
30
  | 'uu'
31
31
  | 'auletti'
@@ -291,6 +291,7 @@ declare global {
291
291
  birthDate: string;
292
292
  insSum: number;
293
293
  premium?: number;
294
+ premiumWithLoad?: number;
294
295
  position?: string;
295
296
  lifeMultiply?: number;
296
297
  lifeAdditive?: number;
@@ -354,7 +355,7 @@ declare global {
354
355
 
355
356
  type SignDataType = {
356
357
  processInstanceId: string;
357
- name: 'Statement' | 'Agreement' | 'Contract' | 'PA_Contract' | 'PA_Statement' | 'PA_RefundStatement' | 'PA_RefundAgreement' | 'PAEnpf_Agreement';
358
+ name: 'Statement' | 'Agreement' | 'Contract' | 'PA_Contract' | 'PA_Statement' | 'PA_RefundStatement' | 'PA_RefundAgreement' | 'PAEnpf_Agreement' | 'InvoicePayment';
358
359
  format: 'pdf' | 'xml';
359
360
  };
360
361
 
@@ -715,8 +716,8 @@ declare global {
715
716
  coverTypeId: string | null;
716
717
  coverTypeName: string | null;
717
718
  coverTypeCode: number | null;
718
- count: number | null;
719
- amount: number | null;
719
+ count: number | string;
720
+ amount: number | string;
720
721
  shortDescription: string | null;
721
722
  };
722
723