hl-core 0.0.9-beta.42 → 0.0.9-beta.42-test

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
@@ -767,7 +767,7 @@ export class ApiClass {
767
767
  }
768
768
 
769
769
  async saveBeneficialOwner(processInstanceId: string | number, benificiaryId: string | null, data: any) {
770
- return await this.axiosCall({
770
+ return await this.axiosCall<string>({
771
771
  method: Methods.POST,
772
772
  url: `/${this.productUrl}/api/Application/saveBeneficialOwner/?processInstanceId=${processInstanceId}&benificiaryId=${benificiaryId}`,
773
773
  data: data,
@@ -783,7 +783,7 @@ export class ApiClass {
783
783
  }
784
784
 
785
785
  async saveInsured(processInstanceId: string | number, insuredId: string | null, data: any) {
786
- return await this.axiosCall({
786
+ return await this.axiosCall<string>({
787
787
  method: Methods.POST,
788
788
  url: `/${this.productUrl}/api/Application/saveInsured/?processInstanceId=${processInstanceId}&insuredId=${insuredId}`,
789
789
  data: data,
@@ -905,7 +905,7 @@ export default defineComponent({
905
905
  }
906
906
  };
907
907
  const pickTermValue = async (item: Value) => {
908
- if (!panelCodeList.includes(item.code as string) && whichProduct.value === 'lifebusiness') {
908
+ if (!panelCodeList.includes(item.code as string)) {
909
909
  dataStore.rightPanel.open = false;
910
910
  isTermsPanelOpen.value = false;
911
911
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.42",
3
+ "version": "0.0.9-beta.42-test",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -3118,18 +3118,48 @@ export const useDataStore = defineStore('data', {
3118
3118
  const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
3119
3119
  if (economySectorCode) member.economySectorCode = economySectorCode;
3120
3120
  },
3121
+ preparePersonData(data: any) {
3122
+ if (data) {
3123
+ Object.keys(data).forEach(key => {
3124
+ const dataKeys = key as keyof typeof data;
3125
+ if (data[dataKeys] === Object(data[dataKeys])) {
3126
+ if (!!data[dataKeys]) {
3127
+ this.preparePersonData(data[dataKeys]);
3128
+ }
3129
+ } else {
3130
+ if (data[dataKeys] !== null) {
3131
+ if (dataKeys === 'iin' || dataKeys === 'bin') {
3132
+ //@ts-ignore
3133
+ data[dataKeys] = data[dataKeys].replace(/-/g, '');
3134
+ }
3135
+ if (dataKeys === 'phoneNumber') data[dataKeys] = formatPhone(data[dataKeys]);
3136
+ if (dataKeys === 'issuedOn' || dataKeys === 'validUntil' || dataKeys === 'birthDate') data[dataKeys] = formatDate(data[dataKeys])?.toISOString() ?? '';
3137
+ //@ts-ignore
3138
+ if (dataKeys === 'nameRu' && data['ids']) data['id'] = data['ids'];
3139
+ }
3140
+ }
3141
+ });
3142
+ }
3143
+ },
3121
3144
  async startApplicationV2(data: PolicyholderClass) {
3122
- const policyholder = data.clientData;
3123
- if (!policyholder.iin) return false;
3124
- try {
3125
- const response = await this.api.startApplication(data);
3145
+ const policyholder = JSON.parse(JSON.stringify(data)) as any;
3146
+ this.preparePersonData(policyholder);
3147
+ delete policyholder.clientData.beneficalOwnerQuest;
3148
+ delete policyholder.clientData.identityDocument;
3149
+ delete policyholder.clientData.authoritedPerson.identityDocument;
3150
+ delete policyholder.clientData.activityTypes;
3151
+ if (!policyholder.clientData.iin) return false;
3152
+ try {
3153
+ const response = await this.api.startApplication(policyholder);
3126
3154
  this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
3127
3155
  return response.processInstanceId;
3128
3156
  } catch (err) {
3129
3157
  return ErrorHandler(err);
3130
3158
  }
3131
3159
  },
3132
- async saveClient(policyholder: PolicyholderClass) {
3160
+ async saveClient(data: PolicyholderClass) {
3161
+ const policyholder = JSON.parse(JSON.stringify(data)) as any;
3162
+ this.preparePersonData(policyholder);
3133
3163
  try {
3134
3164
  await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
3135
3165
  } catch (err) {
@@ -3212,8 +3242,6 @@ export const useDataStore = defineStore('data', {
3212
3242
  );
3213
3243
  const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
3214
3244
  this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
3215
- // const processTariff = this.processTariff.find(item => item.id == applicationData.policyAppDto.tariffId);
3216
- // this.formStore.productConditionsForm.processTariff = processTariff ? processTariff : new Value();
3217
3245
  const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
3218
3246
  this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
3219
3247
  } catch (err) {
@@ -3242,7 +3270,25 @@ export const useDataStore = defineStore('data', {
3242
3270
  return ErrorHandler(err);
3243
3271
  }
3244
3272
  },
3245
- async saveBeneficialOwnerList(beneficialOwnerList: BeneficialOwner[]) {
3273
+ async saveBeneficialOwnerList(data: BeneficialOwner[]) {
3274
+ const beneficialOwnerList = JSON.parse(JSON.stringify(data)) as any;
3275
+ for (const item of beneficialOwnerList) {
3276
+ delete item.beneficialOwnerData.identityDocument.issuedOn;
3277
+ delete item.beneficialOwnerData.activityTypes;
3278
+ delete item.beneficialOwnerData.actualAddress;
3279
+ delete item.beneficialOwnerData.addTaxResidency;
3280
+ delete item.beneficialOwnerData.authoritedPerson;
3281
+ delete item.beneficialOwnerData.authorityDetails;
3282
+ delete item.beneficialOwnerData.bankInfo;
3283
+ delete item.beneficialOwnerData.economySectorCode;
3284
+ delete item.beneficialOwnerData.legalAddress;
3285
+ delete item.beneficialOwnerData.placeOfBirth;
3286
+ delete item.beneficialOwnerData.resident;
3287
+ delete item.beneficialOwnerData.taxResidentCountry;
3288
+ delete item.beneficialOwnerData.typeOfEconomicActivity;
3289
+ item.processInstanceId = this.formStore.applicationData.processInstanceId;
3290
+ this.preparePersonData(item.beneficialOwnerData);
3291
+ }
3246
3292
  try {
3247
3293
  const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
3248
3294
  return response;
@@ -3250,7 +3296,10 @@ export const useDataStore = defineStore('data', {
3250
3296
  return ErrorHandler(err);
3251
3297
  }
3252
3298
  },
3253
- async saveBeneficialOwner(beneficialOwner: BeneficialOwner) {
3299
+ async saveBeneficialOwner(data: BeneficialOwner) {
3300
+ const beneficialOwner = JSON.parse(JSON.stringify(data)) as any;
3301
+ delete beneficialOwner.beneficialOwnerData.identityDocument.issuedOn;
3302
+ this.preparePersonData(beneficialOwner.beneficialOwnerData);
3254
3303
  try {
3255
3304
  const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, String(beneficialOwner.id), beneficialOwner);
3256
3305
  return response;