creditu-common-library 1.3.4 → 1.3.5

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.
@@ -150,7 +150,7 @@ var OfferService = /** @class */ (function () {
150
150
  var debtGuaranteeViv = this.maximumLocal.debtGuaranteeViv(propertyValue, maximumPropertyLTV, k1Fin, k2Fin);
151
151
  var approvedAmountLoanToValue = this.maximumLocal.debtGuarantee(debtGuaranteeViv, debtGuaranteeCr);
152
152
  var approvedAmount = this.getApprovedAmount(approvedAmountFinanceCharge, maximumLocalIncomeDividend, approvedAmountLoanToValue);
153
- var credituAmount = this.credituAmount(downPayment, subsidy, propertyValue, creditInsuranceFactor, creditInsuranceFinancing, operationalExpensesWeightedSum, operationalExpensesFinancing, creditTaxRate, creditTaxRatePercentage, amountRequestedByClient);
153
+ var credituAmount = this.math.round(this.credituAmount(downPayment, subsidy, propertyValue, creditInsuranceFactor, creditInsuranceFinancing, operationalExpensesWeightedSum, operationalExpensesFinancing, creditTaxRate, creditTaxRatePercentage, amountRequestedByClient), 0);
154
154
  var creditAmount = this.getCreditAmountToOffer(approvedAmount, credituAmount, creditMinAmount, creditMaxAmount);
155
155
  var financingAmount = this.financingAmount(creditAmount, k1Fin, k2Fin);
156
156
  var installment = this.installment.getMonthlyPayment(baseMonthlyPayment, creditAmount);
@@ -314,7 +314,7 @@ var OfferService = /** @class */ (function () {
314
314
  // eslint-disable-next-line class-methods-use-this
315
315
  OfferService.prototype.getCreditAmountToOffer = function (approvedAmount, credituAmount, creditMinAmount, creditMaxAmount) {
316
316
  models_1.Guarder.defined(creditMinAmount, 'CreditMinAmount');
317
- var minApprovedAmount = Math.round(Math.min(approvedAmount, credituAmount));
317
+ var minApprovedAmount = Math.min(approvedAmount, credituAmount);
318
318
  if (minApprovedAmount > creditMaxAmount.value())
319
319
  return creditMaxAmount.value();
320
320
  if (minApprovedAmount < creditMinAmount.value())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "creditu-common-library",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -132,25 +132,25 @@ describe('offerService', () => {
132
132
  creditInsuranceFee: 0,
133
133
  gf: 0,
134
134
  gp: 32499.999999999996,
135
- lifeInsuranceFee: 95.00399000000002,
135
+ lifeInsuranceFee: 95.00401058569999,
136
136
  propertyInsuranceFee: 19.5,
137
137
  unemploymentInsuranceFee: 0,
138
- creditAmount: 558847,
138
+ creditAmount: 558847.1210925741,
139
139
  credituAmount: 582660,
140
140
  approvedAmount: 558847.1210925741,
141
141
  approvedAmountFinanceCharge: 718916.7501636882,
142
- creditInsurancePremium: 41396.074072915,
143
- installment: 7707.9943192239,
142
+ creditInsurancePremium: 41396.0830427353,
143
+ installment: 7707.9959894143,
144
144
  unitInstallment: 0.0137926737,
145
145
  approvedAmountIncomeDividend: 558847.1210925741,
146
- backEndRatio: 0.3499999244,
146
+ backEndRatio: 0.35,
147
147
  approvedAmountLoanToValue: 584997.6600163799,
148
- financingAmount: 517450.9259114373,
149
- frontEndRatio: 0.3499999244,
150
- loanToValueCredit: 0.8597646154,
151
- loanToValueHome: 0.7960783476,
152
- totalFee: 7822.4983092239,
153
- creditFee: 7822.4983092239,
148
+ financingAmount: 517451.03803419106,
149
+ frontEndRatio: 0.35,
150
+ loanToValueCredit: 0.8597648017,
151
+ loanToValueHome: 0.7960785201,
152
+ totalFee: 7822.500000000001,
153
+ creditFee: 7822.500000000001,
154
154
  propertyValue: 650000,
155
155
  monthlyInterestRate: 0.0110148959202348,
156
156
  amountRequestedByClient: 539500,
@@ -158,7 +158,7 @@ describe('offerService', () => {
158
158
  percentageOperationalExpensesFinanced: 0,
159
159
  operationalExpenses: 34435.539999999986,
160
160
  creditInsuranceFactor: 0.08,
161
- financingRatio: 0.9591305392
161
+ financingRatio: 0.9591307470999999
162
162
  };
163
163
 
164
164
  const params: OfferParams = {
@@ -240,28 +240,28 @@ describe('offerService', () => {
240
240
  Kgop2: 0,
241
241
  Kscr: 0.0066666667,
242
242
  adjustmentFactorGraceMonths: 1,
243
- creditInsuranceFee: 2914.0333479035,
243
+ creditInsuranceFee: 2914.0306328198,
244
244
  gf: 0,
245
245
  gp: 32499.999999999996,
246
- lifeInsuranceFee: 74.30785,
246
+ lifeInsuranceFee: 74.3077807654,
247
247
  propertyInsuranceFee: 19.5,
248
248
  unemploymentInsuranceFee: 0,
249
- creditAmount: 437105,
249
+ creditAmount: 437104.5927374448,
250
250
  credituAmount: 585000,
251
251
  approvedAmount: 437104.5927374448,
252
252
  approvedAmountFinanceCharge: 562303.7167625874,
253
- creditInsurancePremium: 34968.4,
254
- installment: 4814.6660723694995,
253
+ creditInsurancePremium: 34968.3674189956,
254
+ installment: 4814.6615864149,
255
255
  unitInstallment: 0.0110148959202348,
256
256
  approvedAmountIncomeDividend: 437104.5927374448,
257
- backEndRatio: 0.35000032529999997,
257
+ backEndRatio: 0.35,
258
258
  approvedAmountLoanToValue: 585000,
259
- financingAmount: 437105,
259
+ financingAmount: 437104.5927374448,
260
260
  frontEndRatio: 0.35,
261
- loanToValueCredit: 0.6724692308,
262
- loanToValueHome: 0.6724692308,
263
- totalFee: 7822.5072702729985,
264
- creditFee: 7822.5072702729985,
261
+ loanToValueCredit: 0.6724686042,
262
+ loanToValueHome: 0.6724686042,
263
+ totalFee: 7822.5000000001,
264
+ creditFee: 7822.5000000001,
265
265
  propertyValue: 650000,
266
266
  monthlyInterestRate: 0.0110148959202348,
267
267
  amountRequestedByClient: 585000,
@@ -269,7 +269,7 @@ describe('offerService', () => {
269
269
  percentageOperationalExpensesFinanced: 0,
270
270
  operationalExpenses: 34435.539999999986,
271
271
  creditInsuranceFactor: 0.08,
272
- financingRatio: 0.7471880341999999
272
+ financingRatio: 0.7471873379999999
273
273
  };
274
274
 
275
275
  const params: OfferParams = {
@@ -353,28 +353,28 @@ describe('offerService', () => {
353
353
  Kgop2: 0,
354
354
  Kscr: 0.0066666667,
355
355
  adjustmentFactorGraceMonths: 1,
356
- creditInsuranceFee: 2521.6533459416,
356
+ creditInsuranceFee: 2521.6511653518,
357
357
  gf: 0,
358
358
  gp: 32499.999999999996,
359
- lifeInsuranceFee: 64.30216,
359
+ lifeInsuranceFee: 64.302104395,
360
360
  propertyInsuranceFee: 19.5,
361
361
  unemploymentInsuranceFee: 0,
362
- creditAmount: 378248,
362
+ creditAmount: 378247.6729115391,
363
363
  credituAmount: 585000,
364
364
  approvedAmount: 378247.6729115391,
365
365
  approvedAmountFinanceCharge: 486588.50963552855,
366
- creditInsurancePremium: 30259.84,
367
- installment: 5217.0512416776,
366
+ creditInsurancePremium: 30259.813832923104,
367
+ installment: 5217.046730253201,
368
368
  unitInstallment: 0.0137926737,
369
369
  approvedAmountIncomeDividend: 378247.6729115391,
370
- backEndRatio: 0.35000030190000003,
370
+ backEndRatio: 0.35,
371
371
  approvedAmountLoanToValue: 585000,
372
- financingAmount: 378248,
372
+ financingAmount: 378247.6729115391,
373
373
  frontEndRatio: 0.35,
374
- loanToValueCredit: 0.58192,
375
- loanToValueHome: 0.58192,
376
- totalFee: 7822.5067476192,
377
- creditFee: 7822.5067476192,
374
+ loanToValueCredit: 0.5819194968,
375
+ loanToValueHome: 0.5819194968,
376
+ totalFee: 7822.500000000001,
377
+ creditFee: 7822.500000000001,
378
378
  propertyValue: 650000,
379
379
  monthlyInterestRate: 0.0110148959202348,
380
380
  amountRequestedByClient: 585000,
@@ -382,7 +382,7 @@ describe('offerService', () => {
382
382
  percentageOperationalExpensesFinanced: 0,
383
383
  operationalExpenses: 34435.539999999986,
384
384
  creditInsuranceFactor: 0.08,
385
- financingRatio: 0.6465777778
385
+ financingRatio: 0.6465772187
386
386
  };
387
387
 
388
388
  const params: OfferParams = {
@@ -466,28 +466,28 @@ describe('offerService', () => {
466
466
  Kgop2: 0,
467
467
  Kscr: 0.0029032,
468
468
  adjustmentFactorGraceMonths: 1,
469
- creditInsuranceFee: 1552.3412969457,
469
+ creditInsuranceFee: 1552.3416905968,
470
470
  gf: 0,
471
471
  gp: 32499.999999999996,
472
- lifeInsuranceFee: 95.00416,
472
+ lifeInsuranceFee: 95.0041840917,
473
473
  propertyInsuranceFee: 19.5,
474
474
  unemploymentInsuranceFee: 0,
475
- creditAmount: 558848,
476
- credituAmount: 584999.9410752,
475
+ creditAmount: 558848.1417156955,
476
+ credituAmount: 585000,
477
477
  approvedAmount: 558848.1417156955,
478
478
  approvedAmountFinanceCharge: 718918.0631221518,
479
- creditInsurancePremium: 42776.0070803456,
480
- installment: 6155.6525439232,
479
+ creditInsurancePremium: 42776.0179277166,
480
+ installment: 6155.6541049068,
481
481
  unitInstallment: 0.0110148959202348,
482
482
  approvedAmountIncomeDividend: 558848.1417156955,
483
- backEndRatio: 0.34999991059999996,
483
+ backEndRatio: 0.3499999991,
484
484
  approvedAmountLoanToValue: 585000,
485
- financingAmount: 534700.08850432,
486
- frontEndRatio: 0.34999991059999996,
487
- loanToValueCredit: 0.8597661539,
488
- loanToValueHome: 0.8226155207999999,
489
- totalFee: 7822.4980008689,
490
- creditFee: 7822.4980008689,
485
+ financingAmount: 534700.2240964576,
486
+ frontEndRatio: 0.3499999991,
487
+ loanToValueCredit: 0.8597663719,
488
+ loanToValueHome: 0.8226157294,
489
+ totalFee: 7822.4999795953,
490
+ creditFee: 7822.4999795953,
491
491
  propertyValue: 650000,
492
492
  monthlyInterestRate: 0.0110148959202348,
493
493
  amountRequestedByClient: 559722,
@@ -495,7 +495,7 @@ describe('offerService', () => {
495
495
  percentageOperationalExpensesFinanced: 0,
496
496
  operationalExpenses: 34435.539999999986,
497
497
  creditInsuranceFactor: 0.08,
498
- financingRatio: 0.9552958227999999
498
+ financingRatio: 0.9552960650000001
499
499
  };
500
500
 
501
501
  const params: OfferParams = {
@@ -586,7 +586,7 @@ describe('offerService', () => {
586
586
  propertyInsuranceFee: 19.5,
587
587
  unemploymentInsuranceFee: 0,
588
588
  creditAmount: 519999,
589
- credituAmount: 519999.48,
589
+ credituAmount: 519999,
590
590
  approvedAmount: 519999.99999999994,
591
591
  approvedAmountFinanceCharge: 880329.7165416365,
592
592
  creditInsurancePremium: 38518.4444433659,
@@ -699,7 +699,7 @@ describe('offerService', () => {
699
699
  propertyInsuranceFee: 13.5,
700
700
  unemploymentInsuranceFee: 0,
701
701
  creditAmount: 360000,
702
- credituAmount: 359999.64,
702
+ credituAmount: 360000,
703
703
  approvedAmount: 360000,
704
704
  approvedAmountFinanceCharge: 717899.3819035813,
705
705
  creditInsurancePremium: 26666.666665920002,
@@ -921,25 +921,25 @@ describe('offerService', () => {
921
921
  creditInsuranceFee: 0,
922
922
  gf: 0,
923
923
  gp: 32499.999999999996,
924
- lifeInsuranceFee: 84.3644,
924
+ lifeInsuranceFee: 84.3644109052,
925
925
  propertyInsuranceFee: 0,
926
926
  unemploymentInsuranceFee: 0,
927
- creditAmount: 421822,
928
- credituAmount: 519999.9999999999,
927
+ creditAmount: 421822.0545259302,
928
+ credituAmount: 520000,
929
929
  approvedAmount: 421822.0545259302,
930
930
  approvedAmountFinanceCharge: 421822.0545259302,
931
931
  creditInsurancePremium: 0,
932
- installment: 4738.1349766298,
932
+ installment: 4738.1355890948,
933
933
  unitInstallment: 0.0112325459,
934
934
  approvedAmountIncomeDividend: 586483.5408183229,
935
- backEndRatio: 0.3499999721,
935
+ backEndRatio: 0.35,
936
936
  approvedAmountLoanToValue: 519999.9999999999,
937
- financingAmount: 421822,
938
- frontEndRatio: 0.21577178419999998,
939
- loanToValueCredit: 0.6489569231,
940
- loanToValueHome: 0.6489569231,
941
- totalFee: 7822.4993766298,
942
- creditFee: 4822.4993766298,
937
+ financingAmount: 421822.0545259302,
938
+ frontEndRatio: 0.2157718121,
939
+ loanToValueCredit: 0.648957007,
940
+ loanToValueHome: 0.648957007,
941
+ totalFee: 7822.500000000001,
942
+ creditFee: 4822.5,
943
943
  propertyValue: 650000,
944
944
  monthlyInterestRate: 0.0110148959202348,
945
945
  amountRequestedByClient: 519999.99999999994,
@@ -947,7 +947,7 @@ describe('offerService', () => {
947
947
  percentageOperationalExpensesFinanced: 0,
948
948
  operationalExpenses: 34435.539999999986,
949
949
  creditInsuranceFactor: 0,
950
- financingRatio: 0.8111961538
950
+ financingRatio: 0.8111962587
951
951
  };
952
952
 
953
953
  const params: OfferParams = {
@@ -1038,7 +1038,7 @@ describe('offerService', () => {
1038
1038
  propertyInsuranceFee: 0.4004,
1039
1039
  unemploymentInsuranceFee: 0,
1040
1040
  creditAmount: 1773,
1041
- credituAmount: 1773.221098,
1041
+ credituAmount: 1773,
1042
1042
  approvedAmount: 1980,
1043
1043
  approvedAmountFinanceCharge: 4207.7629943957,
1044
1044
  creditInsurancePremium: 116.8363636381,
@@ -1150,7 +1150,7 @@ describe('offerService', () => {
1150
1150
  propertyInsuranceFee: 0.3458,
1151
1151
  unemploymentInsuranceFee: 0,
1152
1152
  creditAmount: 0,
1153
- credituAmount: 1526.745,
1153
+ credituAmount: 1527,
1154
1154
  approvedAmount: -1083.2554644041,
1155
1155
  approvedAmountFinanceCharge: -1083.2554644041,
1156
1156
  creditInsurancePremium: 0,
@@ -1263,7 +1263,7 @@ describe('offerService', () => {
1263
1263
  propertyInsuranceFee: 0.4368,
1264
1264
  unemploymentInsuranceFee: 0,
1265
1265
  creditAmount: 2007,
1266
- credituAmount: 2006.7322000000001,
1266
+ credituAmount: 2007,
1267
1267
  approvedAmount: 2070.5411139114003,
1268
1268
  approvedAmountFinanceCharge: 3302.1569962424,
1269
1269
  creditInsurancePremium: 133.7500466699,
@@ -1375,7 +1375,7 @@ describe('offerService', () => {
1375
1375
  propertyInsuranceFee: 0.4004,
1376
1376
  unemploymentInsuranceFee: 0,
1377
1377
  creditAmount: 1977,
1378
- credituAmount: 1976.7330000000002,
1378
+ credituAmount: 1977,
1379
1379
  approvedAmount: 1980,
1380
1380
  approvedAmountFinanceCharge: 2733.0574039923,
1381
1381
  creditInsurancePremium: 131.7507933565,
@@ -1483,33 +1483,33 @@ describe('offerService', () => {
1483
1483
  creditInsuranceFee: 0,
1484
1484
  gf: 19.8,
1485
1485
  gp: 11,
1486
- lifeInsuranceFee: 0.68952,
1486
+ lifeInsuranceFee: 0.6894459,
1487
1487
  propertyInsuranceFee: 0.4004,
1488
1488
  unemploymentInsuranceFee: 0,
1489
- creditAmount: 1768,
1490
- credituAmount: 1976.7330000000002,
1489
+ creditAmount: 1767.8099999734,
1490
+ credituAmount: 1977,
1491
1491
  approvedAmount: 1767.8099999734,
1492
1492
  approvedAmountFinanceCharge: 2611.0147948526,
1493
- creditInsurancePremium: 117.82266193939999,
1494
- installment: 9.5290003848,
1493
+ creditInsurancePremium: 117.81,
1494
+ installment: 9.5279763405,
1495
1495
  unitInstallment: 0.0053897061,
1496
1496
  approvedAmountIncomeDividend: 3047.3668578061,
1497
- backEndRatio: 0.40123158870000003,
1497
+ backEndRatio: 0.4011980591,
1498
1498
  approvedAmountLoanToValue: 1767.8099999734,
1499
- financingAmount: 1650.1773380872,
1500
- frontEndRatio: 0.32422771699999997,
1501
- loanToValueCredit: 0.8036363636,
1499
+ financingAmount: 1650.0000000000002,
1500
+ frontEndRatio: 0.3241941873,
1501
+ loanToValueCredit: 0.80355,
1502
1502
  loanToValueHome: 0.75,
1503
- totalFee: 13.140907064799999,
1504
- creditFee: 10.618920384800001,
1503
+ totalFee: 13.139808920499998,
1504
+ creditFee: 10.617822240499999,
1505
1505
  propertyValue: 2200,
1506
1506
  monthlyInterestRate: 0.003962491754522,
1507
1507
  amountRequestedByClient: 1845,
1508
1508
  operationalExpensesFee: 0,
1509
1509
  percentageOperationalExpensesFinanced: 19.8,
1510
- operationalExpenses: 26.337999999999997,
1510
+ operationalExpenses: 26.3376199999,
1511
1511
  creditInsuranceFactor: 0.0714,
1512
- financingRatio: 0.8944050613000001
1512
+ financingRatio: 0.8943089431
1513
1513
  };
1514
1514
  const params: OfferParams = {
1515
1515
  maximumBackendRatio: 0.55, // Máximo de CF (L alpha)
@@ -1595,33 +1595,33 @@ describe('offerService', () => {
1595
1595
  creditInsuranceFee: 0,
1596
1596
  gf: 18.8,
1597
1597
  gp: 10,
1598
- lifeInsuranceFee: 0.313365,
1598
+ lifeInsuranceFee: 0.3133845,
1599
1599
  propertyInsuranceFee: 0.364,
1600
1600
  unemploymentInsuranceFee: 0,
1601
- creditAmount: 1607,
1602
- credituAmount: 1762.4530000000002,
1601
+ creditAmount: 1607.0999999758,
1602
+ credituAmount: 1762,
1603
1603
  approvedAmount: 1607.0999999758,
1604
1604
  approvedAmountFinanceCharge: 1608.3313023417,
1605
- creditInsurancePremium: 107.0933358239,
1606
- installment: 7.9655014282,
1605
+ creditInsurancePremium: 107.10000000000001,
1606
+ installment: 7.965997103299999,
1607
1607
  unitInstallment: 0.0049567526,
1608
1608
  approvedAmountIncomeDividend: 1608.3313023417,
1609
- backEndRatio: 0.549563894,
1609
+ backEndRatio: 0.5495966518000001,
1610
1610
  approvedAmountLoanToValue: 1607.0999999758,
1611
- financingAmount: 1499.9066642003,
1612
- frontEndRatio: 0.549563894,
1613
- loanToValueCredit: 0.8035,
1614
- loanToValueHome: 0.7499533321,
1615
- totalFee: 8.6428664282,
1616
- creditFee: 8.6428664282,
1611
+ financingAmount: 1500,
1612
+ frontEndRatio: 0.5495966518000001,
1613
+ loanToValueCredit: 0.80355,
1614
+ loanToValueHome: 0.75,
1615
+ totalFee: 8.643381603299998,
1616
+ creditFee: 8.643381603299998,
1617
1617
  propertyValue: 2000,
1618
1618
  monthlyInterestRate: 0.0035947364096048,
1619
1619
  amountRequestedByClient: 1645,
1620
1620
  operationalExpensesFee: 0,
1621
1621
  percentageOperationalExpensesFinanced: 18.8,
1622
- operationalExpenses: 25.016,
1622
+ operationalExpenses: 25.016199999999998,
1623
1623
  creditInsuranceFactor: 0.0714,
1624
- financingRatio: 0.9117973643
1624
+ financingRatio: 0.9118541032999999
1625
1625
  };
1626
1626
  const params: OfferParams = {
1627
1627
  maximumBackendRatio: 0.55, // Máximo de CF (L alpha)
@@ -1707,25 +1707,25 @@ describe('offerService', () => {
1707
1707
  creditInsuranceFee: 0,
1708
1708
  gf: 1495,
1709
1709
  gp: 0,
1710
- lifeInsuranceFee: 175.02,
1710
+ lifeInsuranceFee: 175.01982498,
1711
1711
  propertyInsuranceFee: 30.555525,
1712
1712
  unemploymentInsuranceFee: 0,
1713
- creditAmount: 200000,
1713
+ creditAmount: 199999.80000000002,
1714
1714
  credituAmount: closeTo(200000.00000000003, 6) as any, // 200000.00000000003
1715
1715
  approvedAmount: 199999.80000000002,
1716
1716
  approvedAmountFinanceCharge: 221752.09972869532, // 259219.6004185969
1717
1717
  creditInsurancePremium: 0,
1718
- installment: 1826.7148000000002,
1718
+ installment: 1826.7129732852002,
1719
1719
  unitInstallment: 0.009133574,
1720
1720
  approvedAmountIncomeDividend: 271708.7673152308, // 299184.9344878252
1721
- backEndRatio: 0.506458065,
1721
+ backEndRatio: 0.5064576647, // 0.4422342406
1722
1722
  approvedAmountLoanToValue: 199999.80000000002,
1723
- financingAmount: 200000.00000000006,
1724
- frontEndRatio: 0.406458065,
1725
- loanToValueCredit: 0.9000008999999999,
1723
+ financingAmount: 199999.80000000002,
1724
+ frontEndRatio: 0.4064576647, // 0.3695069679
1725
+ loanToValueCredit: 0.9,
1726
1726
  loanToValueHome: 0.9,
1727
- totalFee: 2532.290325,
1728
- creditFee: 2032.290325,
1727
+ totalFee: 2532.2883232652, // 2432.2883232652
1728
+ creditFee: 2032.2883232652,
1729
1729
  propertyValue: 222222,
1730
1730
  monthlyInterestRate: 0.008734593820043001,
1731
1731
  amountRequestedByClient: closeTo(200000.00000000003, 6) as any, // 200000.00000000003
@@ -1733,7 +1733,7 @@ describe('offerService', () => {
1733
1733
  percentageOperationalExpensesFinanced: 1495,
1734
1734
  operationalExpenses: 1495,
1735
1735
  creditInsuranceFactor: 0,
1736
- financingRatio: 1
1736
+ financingRatio: 0.999999
1737
1737
  };
1738
1738
  const params: OfferParams = {
1739
1739
  maximumBackendRatio: 0.55, // Máximo de CF (L alpha)