creditu-common-library 2.3.3 → 2.3.4
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/debt/models/dto/debt-inputs.dto.d.ts +4 -0
- package/debt/models/lates-input.dto.d.ts +1 -0
- package/debt/services/installment.service.js +2 -1
- package/debt/services/late.service.d.ts +1 -1
- package/debt/services/late.service.js +5 -4
- package/debt/services/monthly-payment.service.js +3 -1
- package/package.json +1 -1
- package/test/br/new-installment.service.specto.ts +288 -3
|
@@ -100,4 +100,8 @@ export declare class DebtInputs {
|
|
|
100
100
|
* Relevante para la transacción y futura remesa, no así en boleto
|
|
101
101
|
*/
|
|
102
102
|
codebtorLifeInsuranceProportion?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Indica si se perdonan los gastos de cobranza para la cuota
|
|
105
|
+
*/
|
|
106
|
+
isLateChargesFinePardoned?: boolean;
|
|
103
107
|
}
|
|
@@ -64,7 +64,8 @@ var InstallmentService = /** @class */ (function () {
|
|
|
64
64
|
considerNegativeInflation: inputs.considerNegativeInflation,
|
|
65
65
|
monthNominalLength: params.monthNominalLength,
|
|
66
66
|
inflationExchangeMethodYearlyToMonthly: params.inflationExchangeMethodYearlyToMonthly,
|
|
67
|
-
isGraceMonth: inputs.isGraceMonth
|
|
67
|
+
isGraceMonth: inputs.isGraceMonth,
|
|
68
|
+
isLateChargesFinePardoned: inputs.isLateChargesFinePardoned
|
|
68
69
|
}), lateDays = _d.lateDays, lateChargesFine = _d.lateChargesFine, lateInflation = _d.lateInflation, lateInflationaryCorrection = _d.lateInflationaryCorrection, lateChargesInterestRate = _d.lateChargesInterestRate, lateChargesInterest = _d.lateChargesInterest, lateInterestRate = _d.lateInterestRate, lateInterest = _d.lateInterest, lastMonthLateInflation = _d.lastMonthLateInflation, lastMonthLateChargesInterestRate = _d.lastMonthLateChargesInterestRate, lastMonthLateInterestRate = _d.lastMonthLateInterestRate, lastMonthTotalLateRate = _d.lastMonthTotalLateRate, totalLateRate = _d.totalLateRate, totalLateInterest = _d.totalLateInterest, totalLate = _d.totalLate, monthlyPaymentWithLate = _d.monthlyPaymentWithLate;
|
|
69
70
|
var totalMonthlyPayment = monthlyPaymentWithLate;
|
|
70
71
|
var response = {
|
|
@@ -26,5 +26,5 @@ export declare class LateService {
|
|
|
26
26
|
monthlyPaymentWithLate: number;
|
|
27
27
|
};
|
|
28
28
|
getTotalMonthlyPayment(dueDate: string, today: string, monthlyPaymentWithTAC: number, lateChargesFineRate: number, lateChargesInterestRate: number, interestRate: number, inflationMapLate: Record<string, number>, dailyinflationvalues: number[]): Record<string, number>;
|
|
29
|
-
getLates({ dueDate, today, totalMonthlyPaymentBeforeLate, lateChargesFineRate, lateChargesInterestRate, annualCreditInterestRate, inflationMap, considerNegativeInflation, monthNominalLength, inflationExchangeMethodYearlyToMonthly, isGraceMonth }: LatesInput): LatesOutput;
|
|
29
|
+
getLates({ dueDate, today, totalMonthlyPaymentBeforeLate, lateChargesFineRate, lateChargesInterestRate, annualCreditInterestRate, inflationMap, considerNegativeInflation, monthNominalLength, inflationExchangeMethodYearlyToMonthly, isGraceMonth, isLateChargesFinePardoned }: LatesInput): LatesOutput;
|
|
30
30
|
}
|
|
@@ -125,7 +125,7 @@ var LateService = /** @class */ (function () {
|
|
|
125
125
|
};
|
|
126
126
|
LateService.prototype.getLates = function (_a) {
|
|
127
127
|
var _this = this;
|
|
128
|
-
var dueDate = _a.dueDate, today = _a.today, totalMonthlyPaymentBeforeLate = _a.totalMonthlyPaymentBeforeLate, lateChargesFineRate = _a.lateChargesFineRate, lateChargesInterestRate = _a.lateChargesInterestRate, annualCreditInterestRate = _a.annualCreditInterestRate, inflationMap = _a.inflationMap, considerNegativeInflation = _a.considerNegativeInflation, monthNominalLength = _a.monthNominalLength, inflationExchangeMethodYearlyToMonthly = _a.inflationExchangeMethodYearlyToMonthly, isGraceMonth = _a.isGraceMonth;
|
|
128
|
+
var dueDate = _a.dueDate, today = _a.today, totalMonthlyPaymentBeforeLate = _a.totalMonthlyPaymentBeforeLate, lateChargesFineRate = _a.lateChargesFineRate, lateChargesInterestRate = _a.lateChargesInterestRate, annualCreditInterestRate = _a.annualCreditInterestRate, inflationMap = _a.inflationMap, considerNegativeInflation = _a.considerNegativeInflation, monthNominalLength = _a.monthNominalLength, inflationExchangeMethodYearlyToMonthly = _a.inflationExchangeMethodYearlyToMonthly, isGraceMonth = _a.isGraceMonth, _b = _a.isLateChargesFinePardoned, isLateChargesFinePardoned = _b === void 0 ? false : _b;
|
|
129
129
|
var lates = {
|
|
130
130
|
lateDays: 0,
|
|
131
131
|
lateChargesFine: 0,
|
|
@@ -160,7 +160,8 @@ var LateService = /** @class */ (function () {
|
|
|
160
160
|
return lates;
|
|
161
161
|
}
|
|
162
162
|
if (lateDays > 0) {
|
|
163
|
-
|
|
163
|
+
var actualLateChargesFineRate = isLateChargesFinePardoned ? 0 : lateChargesFineRate;
|
|
164
|
+
Object.assign(lates, { lateChargesFine: this.math.multiply(actualLateChargesFineRate, totalMonthlyPaymentBeforeLate) });
|
|
164
165
|
}
|
|
165
166
|
var monthlyInterestTypeFunction = {
|
|
166
167
|
COMPOUND: function (a, b, proportion) { return _this.math.subtract(_this.math.multiply(_this.math.add(1 + a), Math.pow(_this.math.add(1 + b), proportion)), 1); },
|
|
@@ -169,7 +170,7 @@ var LateService = /** @class */ (function () {
|
|
|
169
170
|
var monthlyCreditInterestRate = this.interestService.getCompoundPeriodicRate(annualCreditInterestRate, this.MONTHS_ON_YEAR);
|
|
170
171
|
// fecha de inicio de loop es la fecha más temprana entre today y dueDate
|
|
171
172
|
var whileDate = todayDateModel.isSameOrAfter(dueDateDateModel) ? dueDateDateModel : todayDateModel;
|
|
172
|
-
var
|
|
173
|
+
var _c = whileDate.toString('YYYY-MM-DD').split('-'), startingYear = _c[0], startingMonth = _c[1];
|
|
173
174
|
// fecha de fin de loop es la fecha más tardía entre today y dueDate
|
|
174
175
|
var endDate = todayDateModel.isSameOrAfter(dueDateDateModel) ? todayDateModel : dueDateDateModel;
|
|
175
176
|
var isDueDate = whileDate.daysDiff(endDate) === 0;
|
|
@@ -184,7 +185,7 @@ var LateService = /** @class */ (function () {
|
|
|
184
185
|
break;
|
|
185
186
|
}
|
|
186
187
|
var isStartingMonth = "".concat(startingYear, "-").concat(startingMonth) === whileDate.toString('YYYY-MM-DD').substring(0, 7);
|
|
187
|
-
var
|
|
188
|
+
var _d = whileDate.toString('YYYY-MM-DD').split('-'), whileYear = _d[0], whileMonth = _d[1], whileDay = _d[2];
|
|
188
189
|
var totalDaysInMonth = (new Date(Number(whileYear), Number(whileMonth), 0)).getDate(); // Deberíamos usar monthNominalLength??
|
|
189
190
|
var isLastMonthsDay = totalDaysInMonth === Number(whileDay);
|
|
190
191
|
var isLastDay = whileDate.toString('YYYY-MM-DD') === endDate.toString('YYYY-MM-DD');
|
|
@@ -33,7 +33,9 @@ var MonthlyPaymentService = /** @class */ (function () {
|
|
|
33
33
|
inflationaryUpdate: inflationaryUpdate,
|
|
34
34
|
postponedInflationaryUpdate: postponedInflationaryUpdate
|
|
35
35
|
});
|
|
36
|
-
var monthlyPayment = this.math.add(interestIUB, this.math.subtract(amortizationIUB, amortizationDiff), this.math.subtract(
|
|
36
|
+
var monthlyPayment = this.math.add(interestIUB, this.math.subtract(amortizationIUB, amortizationDiff), this.math.subtract(
|
|
37
|
+
// FIXME: Esto está mal para el caso FIXED con inflación negativa
|
|
38
|
+
inflationaryUpdate < 0 ? 0 : inflationaryUpdate, inflationaryUpdate < 0 ? 0 : postponedInflationaryUpdate));
|
|
37
39
|
return monthlyPayment;
|
|
38
40
|
};
|
|
39
41
|
/**
|
package/package.json
CHANGED
|
@@ -954,7 +954,7 @@ describe('installment-service', () => {
|
|
|
954
954
|
});
|
|
955
955
|
});
|
|
956
956
|
|
|
957
|
-
describe('Caso 4 - Gilvania Lopes da Silva Santos', () => {
|
|
957
|
+
describe('Caso 4 - Gilvania Lopes da Silva Santos - Cuota 8', () => {
|
|
958
958
|
// Parámetros de este caso
|
|
959
959
|
const isGraceMonth = false;
|
|
960
960
|
const isAmortizationPostponed = true;
|
|
@@ -1091,6 +1091,143 @@ describe('installment-service', () => {
|
|
|
1091
1091
|
});
|
|
1092
1092
|
});
|
|
1093
1093
|
|
|
1094
|
+
describe('Caso 4 - Gilvania Lopes da Silva Santos - Cuota 10', () => {
|
|
1095
|
+
// Parámetros de este caso
|
|
1096
|
+
const isGraceMonth = false;
|
|
1097
|
+
const isAmortizationPostponed = true;
|
|
1098
|
+
const numberOfMonths = new NumberOfMonths(360);
|
|
1099
|
+
const paymentNumber = new PaymentNumber(10);
|
|
1100
|
+
const amortizationMethod = AmortizationMethod.GERMAN;
|
|
1101
|
+
const previousBalance = new PreviousBalance(460677.02);
|
|
1102
|
+
const annualRate = 0.095;
|
|
1103
|
+
const inflationaryUpperBound = 0.003;
|
|
1104
|
+
const codebtorLifeInsuranceProportion = 0;
|
|
1105
|
+
const propertyAmount = 537000;
|
|
1106
|
+
const considerNegativeInflation = false;
|
|
1107
|
+
const considerTAC = true;
|
|
1108
|
+
const TACValue = 25;
|
|
1109
|
+
const monthlyCreditInsuranceExpenses = 1065;
|
|
1110
|
+
const monthlyCreditInsurancePrize = 1977.95;
|
|
1111
|
+
const monthlyCreditInsurance = monthlyCreditInsuranceExpenses + monthlyCreditInsurancePrize;
|
|
1112
|
+
// Inflation map debe tener fechas e inflaciones (desfasadas 2 meses)
|
|
1113
|
+
// desde el mes de vencimiento anterior (o fecha de firma) hasta vencimiento de cuota
|
|
1114
|
+
const inflationMap = {
|
|
1115
|
+
'2023-10-08': 0.0023,
|
|
1116
|
+
'2023-11-08': 0.0026
|
|
1117
|
+
};
|
|
1118
|
+
// inflationMapLate debe tener fechas e inflaciones (desfasadas 2 meses)
|
|
1119
|
+
// desde el vencimiento actual hasta el día de hoy (de consulta de deuda)
|
|
1120
|
+
const inflationMapLate = {
|
|
1121
|
+
'2023-11-08': 0.0026,
|
|
1122
|
+
'2023-12-01': 0.0024
|
|
1123
|
+
};
|
|
1124
|
+
// Parámetros fijos
|
|
1125
|
+
const propertyInsuranceRate = new CreditInsuranceRate(0.00003);
|
|
1126
|
+
const debtorLifeInsuranceRate = new CreditInsuranceRate(0.00017);
|
|
1127
|
+
const lateChargesFineRate = 0.02;
|
|
1128
|
+
const lateChargesInterestRate = 0.01;
|
|
1129
|
+
const upperBoundBehaviour = BehaviourCAP.FIXED;
|
|
1130
|
+
const proportionUsesSimpleInterest = true;
|
|
1131
|
+
const inflationExchangeMethodMonthlyToDaily = InterestType.SIMPLE;
|
|
1132
|
+
const insurancesStrategy = InsurancesStrategy.BALANCES;
|
|
1133
|
+
const monthNominalLength = 30;
|
|
1134
|
+
const inflationExchangeMethodYearlyToMonthly = InterestType.COMPOUND;
|
|
1135
|
+
|
|
1136
|
+
it('should yield the right results', () => {
|
|
1137
|
+
// const filePath = './test/br/Producto_LowCode-Desarrollo.xlsx';
|
|
1138
|
+
// const excelValues = new ExcelTranslator(filePath);
|
|
1139
|
+
const inputs: DebtInputs = {
|
|
1140
|
+
today: '2023-12-01',
|
|
1141
|
+
amortizationMethod,
|
|
1142
|
+
isGraceMonth,
|
|
1143
|
+
isAmortizationPostponed,
|
|
1144
|
+
paymentNumber,
|
|
1145
|
+
numberOfMonths,
|
|
1146
|
+
previousBalance,
|
|
1147
|
+
inflationaryUpperBound,
|
|
1148
|
+
propertyAmount,
|
|
1149
|
+
inflationMap,
|
|
1150
|
+
inflationMapLate,
|
|
1151
|
+
proportionUsesSimpleInterest,
|
|
1152
|
+
upperBoundBehaviour,
|
|
1153
|
+
codebtorLifeInsuranceProportion,
|
|
1154
|
+
considerNegativeInflation,
|
|
1155
|
+
considerTAC,
|
|
1156
|
+
TACValue,
|
|
1157
|
+
monthlyCreditInsurance,
|
|
1158
|
+
monthlyCreditInsuranceExpenses,
|
|
1159
|
+
monthlyCreditInsurancePrize
|
|
1160
|
+
};
|
|
1161
|
+
const params: DebtParams = {
|
|
1162
|
+
annualRate,
|
|
1163
|
+
debtorLifeInsuranceRate,
|
|
1164
|
+
propertyInsuranceRate,
|
|
1165
|
+
lateChargesFineRate,
|
|
1166
|
+
lateChargesInterestRate,
|
|
1167
|
+
monthNominalLength,
|
|
1168
|
+
inflationExchangeMethodMonthlyToDaily,
|
|
1169
|
+
insurancesStrategy,
|
|
1170
|
+
inflationExchangeMethodYearlyToMonthly
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
const expectedResult = {
|
|
1174
|
+
inflationByDates: [
|
|
1175
|
+
{}
|
|
1176
|
+
],
|
|
1177
|
+
balanceValues: {
|
|
1178
|
+
balances: [
|
|
1179
|
+
],
|
|
1180
|
+
balanceMonetaryUpdateValues: [
|
|
1181
|
+
]
|
|
1182
|
+
},
|
|
1183
|
+
balanceInflationaryUpdated: null,
|
|
1184
|
+
balanceAfter: null,
|
|
1185
|
+
inflationaryUpdate: null,
|
|
1186
|
+
interest: null, // interestIUB - interestDiff
|
|
1187
|
+
interestDiff: null, // Inflación dentro del interés 🟢
|
|
1188
|
+
interestIUB: null, // Interés corregido ✅
|
|
1189
|
+
monthlyPayment: null,
|
|
1190
|
+
monthlyPaymentWithInsurances: null,
|
|
1191
|
+
monthlyPaymentWithTAC: null,
|
|
1192
|
+
amortization: null,
|
|
1193
|
+
amortizationDiff: null,
|
|
1194
|
+
amortizationIUB: null,
|
|
1195
|
+
upperBound: null,
|
|
1196
|
+
postponedInflationaryUpdate: null,
|
|
1197
|
+
amortizationInflation: null,
|
|
1198
|
+
TACValue: null,
|
|
1199
|
+
totalLifeInsuranceFee: null,
|
|
1200
|
+
debtorLifeInsuranceFee: null,
|
|
1201
|
+
codebtorLifeInsuranceFee: null,
|
|
1202
|
+
propertyInsuranceFee: null,
|
|
1203
|
+
monthlyCreditInsurance: null,
|
|
1204
|
+
monthlyCreditInsuranceExpenses: null,
|
|
1205
|
+
monthlyCreditInsurancePrize: null,
|
|
1206
|
+
lateDays: null,
|
|
1207
|
+
lateChargesFine: null, // Multa en Excel
|
|
1208
|
+
lateChargesInterestRate: null, // Tasa de castigo diaria acumulada en Excel
|
|
1209
|
+
lateChargesInterest: null, // Pendiente de contrastar con el Excel
|
|
1210
|
+
lateInterestRate: null, // Tasa de interés diaria ac. por atraso en Excel
|
|
1211
|
+
lateInterest: null, // Pendiente de contrastar con el Excel
|
|
1212
|
+
lateInflation: null, // Tasa corrección principal en Excel
|
|
1213
|
+
lateInflationaryCorrection: null, // Pendiente de contrastar con el Excel
|
|
1214
|
+
lastMonthLateChargesInterestRate: null, // Pendiente de contrastar con el Excel
|
|
1215
|
+
lastMonthLateInflation: null, // Tasa de inflación mensual en Excel
|
|
1216
|
+
lastMonthLateInterestRate: null, // Tasa de interés mensual por atraso en Excel
|
|
1217
|
+
lastMonthTotalLateRate: null, // Pendiente de contrastar con el Excel
|
|
1218
|
+
totalLateRate: null, // Tasa de penalidad en Excel
|
|
1219
|
+
totalLateInterest: null, // Interés penal en Excel
|
|
1220
|
+
totalLate: null, // Atraso en Excel
|
|
1221
|
+
monthlyPaymentWithLate: null,
|
|
1222
|
+
totalMonthlyPayment: null,
|
|
1223
|
+
walletBalance: null
|
|
1224
|
+
};
|
|
1225
|
+
const result = service.getTotalMonthlyPayment(inputs, params);
|
|
1226
|
+
console.log(getResultForComparison(result));
|
|
1227
|
+
expect(result).toEqual(expectedResult);
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1094
1231
|
describe('Caso 5 - Ismael Oliveira Feitosa, cuota 0', () => {
|
|
1095
1232
|
// Parámetros de este caso
|
|
1096
1233
|
const isGraceMonth = true;
|
|
@@ -7867,7 +8004,7 @@ describe('installment-service', () => {
|
|
|
7867
8004
|
});
|
|
7868
8005
|
});
|
|
7869
8006
|
|
|
7870
|
-
describe
|
|
8007
|
+
describe('Caso 45 - Eneas da Silva Dias, cuota 14', () => {
|
|
7871
8008
|
// Parámetros de este caso
|
|
7872
8009
|
const isGraceMonth = false;
|
|
7873
8010
|
const isAmortizationPostponed = false;
|
|
@@ -8626,7 +8763,7 @@ describe('installment-service', () => {
|
|
|
8626
8763
|
const walletBalance = 0;
|
|
8627
8764
|
const considerWallet = false;
|
|
8628
8765
|
// Parámetros fijos
|
|
8629
|
-
const propertyInsuranceRate = new CreditInsuranceRate(0.000089);
|
|
8766
|
+
const propertyInsuranceRate = new CreditInsuranceRate(0.000089); // No es zurich
|
|
8630
8767
|
const debtorLifeInsuranceRate = new CreditInsuranceRate(0.00049);
|
|
8631
8768
|
const codebtorLifeInsuranceRate = new CreditInsuranceRate(0.00049);
|
|
8632
8769
|
const lateChargesFineRate = 0.02;
|
|
@@ -8737,4 +8874,152 @@ describe('installment-service', () => {
|
|
|
8737
8874
|
// expect(result).toEqual(expectedResult);
|
|
8738
8875
|
});
|
|
8739
8876
|
});
|
|
8877
|
+
|
|
8878
|
+
describe.only('Caso 50 - Mauricio Camporeis, cuota 4 (isLateChargesFinePardoned: true)', () => {
|
|
8879
|
+
// Parámetros de este caso
|
|
8880
|
+
const isGraceMonth = false;
|
|
8881
|
+
const isAmortizationPostponed = true;
|
|
8882
|
+
const isLateChargesFinePardoned = true;
|
|
8883
|
+
const numberOfMonths = new NumberOfMonths(241);
|
|
8884
|
+
const paymentNumber = new PaymentNumber(4);
|
|
8885
|
+
const amortizationMethod = AmortizationMethod.FRENCH;
|
|
8886
|
+
const previousBalance = new PreviousBalance(196012.51);
|
|
8887
|
+
const annualRate = 0.105;
|
|
8888
|
+
const inflationaryUpperBound = 0.003;
|
|
8889
|
+
const codebtorLifeInsuranceProportion = 0;
|
|
8890
|
+
const propertyAmount = 244000;
|
|
8891
|
+
const considerNegativeInflation = false;
|
|
8892
|
+
const considerTAC = true;
|
|
8893
|
+
const TACValue = 25;
|
|
8894
|
+
const monthlyCreditInsurancePrize = 1098;
|
|
8895
|
+
const monthlyCreditInsuranceExpenses = 366;
|
|
8896
|
+
const monthlyCreditInsurance = monthlyCreditInsuranceExpenses + monthlyCreditInsurancePrize;
|
|
8897
|
+
// Inflation map debe tener fechas e inflaciones (desfasadas 2 meses)
|
|
8898
|
+
// desde el mes de vencimiento anterior (o fecha de firma) hasta vencimiento de cuota
|
|
8899
|
+
const inflationMap = {
|
|
8900
|
+
'2023-10-08': 0.0023,
|
|
8901
|
+
'2023-11-08': 0.0026
|
|
8902
|
+
};
|
|
8903
|
+
// inflationMapLate debe tener fechas e inflaciones (desfasadas 2 meses)
|
|
8904
|
+
// desde el vencimiento actual hasta el día de hoy (de consulta de deuda)
|
|
8905
|
+
const inflationMapLate = {
|
|
8906
|
+
'2023-11-08': 0.0026,
|
|
8907
|
+
'2023-12-01': 0.0024
|
|
8908
|
+
};
|
|
8909
|
+
const upperBoundBehaviour = BehaviourCAP.FIXED;
|
|
8910
|
+
const walletBalance = 0;
|
|
8911
|
+
const considerWallet = false;
|
|
8912
|
+
// Parámetros fijos
|
|
8913
|
+
const propertyInsuranceRate = new CreditInsuranceRate(0.00003);
|
|
8914
|
+
const debtorLifeInsuranceRate = new CreditInsuranceRate(0.00017);
|
|
8915
|
+
const codebtorLifeInsuranceRate = new CreditInsuranceRate(0);
|
|
8916
|
+
const lateChargesFineRate = 0.02;
|
|
8917
|
+
const lateChargesInterestRate = 0.01;
|
|
8918
|
+
const proportionUsesSimpleInterest = true;
|
|
8919
|
+
const inflationExchangeMethodMonthlyToDaily = InterestType.SIMPLE;
|
|
8920
|
+
const insurancesStrategy = InsurancesStrategy.BALANCES;
|
|
8921
|
+
const monthNominalLength = 30;
|
|
8922
|
+
const inflationExchangeMethodYearlyToMonthly = InterestType.COMPOUND;
|
|
8923
|
+
|
|
8924
|
+
it('should yield the right results', () => {
|
|
8925
|
+
// const filePath = './test/br/Producto_LowCode-Desarrollo.xlsx';
|
|
8926
|
+
// const excelValues = new ExcelTranslator(filePath);
|
|
8927
|
+
const inputs: DebtInputs = {
|
|
8928
|
+
today: '2023-12-01',
|
|
8929
|
+
amortizationMethod,
|
|
8930
|
+
isGraceMonth,
|
|
8931
|
+
isAmortizationPostponed,
|
|
8932
|
+
paymentNumber,
|
|
8933
|
+
numberOfMonths,
|
|
8934
|
+
previousBalance,
|
|
8935
|
+
inflationaryUpperBound,
|
|
8936
|
+
propertyAmount,
|
|
8937
|
+
inflationMap,
|
|
8938
|
+
inflationMapLate,
|
|
8939
|
+
proportionUsesSimpleInterest,
|
|
8940
|
+
upperBoundBehaviour,
|
|
8941
|
+
codebtorLifeInsuranceProportion,
|
|
8942
|
+
considerNegativeInflation,
|
|
8943
|
+
considerTAC,
|
|
8944
|
+
TACValue,
|
|
8945
|
+
monthlyCreditInsurance,
|
|
8946
|
+
monthlyCreditInsuranceExpenses,
|
|
8947
|
+
monthlyCreditInsurancePrize,
|
|
8948
|
+
walletBalance,
|
|
8949
|
+
considerWallet,
|
|
8950
|
+
isLateChargesFinePardoned
|
|
8951
|
+
};
|
|
8952
|
+
const params: DebtParams = {
|
|
8953
|
+
annualRate,
|
|
8954
|
+
debtorLifeInsuranceRate,
|
|
8955
|
+
codebtorLifeInsuranceRate,
|
|
8956
|
+
propertyInsuranceRate,
|
|
8957
|
+
lateChargesFineRate,
|
|
8958
|
+
lateChargesInterestRate,
|
|
8959
|
+
monthNominalLength,
|
|
8960
|
+
inflationExchangeMethodMonthlyToDaily,
|
|
8961
|
+
insurancesStrategy,
|
|
8962
|
+
inflationExchangeMethodYearlyToMonthly
|
|
8963
|
+
};
|
|
8964
|
+
|
|
8965
|
+
const expectedResult = {
|
|
8966
|
+
inflationByDates: [
|
|
8967
|
+
{}
|
|
8968
|
+
],
|
|
8969
|
+
balanceValues: {
|
|
8970
|
+
balances: [
|
|
8971
|
+
],
|
|
8972
|
+
balanceMonetaryUpdateValues: [
|
|
8973
|
+
]
|
|
8974
|
+
},
|
|
8975
|
+
balanceInflationaryUpdated: null,
|
|
8976
|
+
balanceAfter: null,
|
|
8977
|
+
inflationaryUpdate: null,
|
|
8978
|
+
interest: null, // interestIUB - interestDiff
|
|
8979
|
+
interestDiff: null, // Inflación dentro del interés 🟢
|
|
8980
|
+
interestIUB: null, // Interés corregido ✅
|
|
8981
|
+
monthlyPayment: null,
|
|
8982
|
+
monthlyPaymentWithInsurances: null,
|
|
8983
|
+
monthlyPaymentWithTAC: null,
|
|
8984
|
+
amortization: null,
|
|
8985
|
+
amortizationDiff: null,
|
|
8986
|
+
amortizationIUB: null,
|
|
8987
|
+
upperBound: null,
|
|
8988
|
+
postponedInflationaryUpdate: null,
|
|
8989
|
+
amortizationInflation: null,
|
|
8990
|
+
TACValue: null,
|
|
8991
|
+
totalLifeInsuranceFee: null,
|
|
8992
|
+
debtorLifeInsuranceFee: null,
|
|
8993
|
+
codebtorLifeInsuranceFee: null,
|
|
8994
|
+
propertyInsuranceFee: null,
|
|
8995
|
+
monthlyCreditInsurance: null,
|
|
8996
|
+
monthlyCreditInsuranceExpenses: null,
|
|
8997
|
+
monthlyCreditInsurancePrize: null,
|
|
8998
|
+
lateDays: null,
|
|
8999
|
+
lateChargesFine: null, // Multa en Excel
|
|
9000
|
+
lateChargesInterestRate: null, // Tasa de castigo diaria acumulada en Excel
|
|
9001
|
+
lateChargesInterest: null, // Pendiente de contrastar con el Excel
|
|
9002
|
+
lateInterestRate: null, // Tasa de interés diaria ac. por atraso en Excel
|
|
9003
|
+
lateInterest: null, // Pendiente de contrastar con el Excel
|
|
9004
|
+
lateInflation: null, // Tasa corrección principal en Excel
|
|
9005
|
+
lateInflationaryCorrection: null, // Pendiente de contrastar con el Excel
|
|
9006
|
+
lastMonthLateChargesInterestRate: null, // Pendiente de contrastar con el Excel
|
|
9007
|
+
lastMonthLateInflation: null, // Tasa de inflación mensual en Excel
|
|
9008
|
+
lastMonthLateInterestRate: null, // Tasa de interés mensual por atraso en Excel
|
|
9009
|
+
lastMonthTotalLateRate: null, // Pendiente de contrastar con el Excel
|
|
9010
|
+
totalLateRate: null, // Tasa de penalidad en Excel
|
|
9011
|
+
totalLateInterest: null, // Interés penal en Excel
|
|
9012
|
+
totalLate: null, // Atraso en Excel
|
|
9013
|
+
monthlyPaymentWithLate: null,
|
|
9014
|
+
totalMonthlyPayment: null,
|
|
9015
|
+
walletBalance: null
|
|
9016
|
+
};
|
|
9017
|
+
const result = service.getTotalMonthlyPayment(inputs, params);
|
|
9018
|
+
const resultForComparison = getResultForComparison(result);
|
|
9019
|
+
// console.log(result);
|
|
9020
|
+
// console.log(JSON.stringify(getResultForComparison(result), null, 2));
|
|
9021
|
+
// console.log(Object.values(resultForComparison).join('\n'));
|
|
9022
|
+
// expect(result).toEqual(expectedResult);
|
|
9023
|
+
});
|
|
9024
|
+
});
|
|
8740
9025
|
});
|