gemcap-be-common 1.4.104 → 1.4.106
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/package.json
CHANGED
|
@@ -28,7 +28,6 @@ class LoanStatementStatusService {
|
|
|
28
28
|
let currentDate = (0, dayjs_1.default)(product.startDate).utcOffset(0).startOf('month');
|
|
29
29
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
30
30
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
31
|
-
console.log('initStatementStatuses');
|
|
32
31
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
33
32
|
currentDate = currentDate.add(1, 'month');
|
|
34
33
|
}
|
|
@@ -73,7 +72,6 @@ class LoanStatementStatusService {
|
|
|
73
72
|
return [{ start: startOfMonth, end: endOfMonth }];
|
|
74
73
|
}
|
|
75
74
|
async toggleStatementLock(productId, statementDate) {
|
|
76
|
-
console.log('toggleStatementLock');
|
|
77
75
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
78
76
|
if (statementStatus) {
|
|
79
77
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -81,7 +79,6 @@ class LoanStatementStatusService {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
async updateStatementStatus(productId, statementDate, actual) {
|
|
84
|
-
console.log('updateStatementStatus', { statementDate, actual });
|
|
85
82
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
86
83
|
if (statementStatus && !statementStatus.locked) {
|
|
87
84
|
statementStatus.actual = actual;
|
|
@@ -106,7 +103,6 @@ class LoanStatementStatusService {
|
|
|
106
103
|
}
|
|
107
104
|
async getStatementStatus(productId, date) {
|
|
108
105
|
const statementDate = this.getStatementDateForDate(date);
|
|
109
|
-
console.log('getStatementStatus');
|
|
110
106
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
111
107
|
}
|
|
112
108
|
async getCreateStatementStatus(productId, statementDate) {
|
|
@@ -159,14 +155,13 @@ class LoanStatementStatusService {
|
|
|
159
155
|
const loanChargesService = this.getLoanChargesService();
|
|
160
156
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
161
157
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
162
|
-
console.log('getBorrowerMonthStatus');
|
|
163
158
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
164
159
|
}));
|
|
165
160
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|
|
166
161
|
}
|
|
167
162
|
async recalculateStatementQueued(productMap) {
|
|
168
163
|
this.mainQueueService.sendTaskToQueue({
|
|
169
|
-
data: {
|
|
164
|
+
data: { productMap },
|
|
170
165
|
pattern: event_map_1.EventMap.recalc.STATEMENT_STATUS,
|
|
171
166
|
}, queue_map_1.QueueMap.main).catch(console.error);
|
|
172
167
|
}
|
|
@@ -34,7 +34,6 @@ export class LoanStatementStatusService {
|
|
|
34
34
|
let currentDate = dayjs(product.startDate).utcOffset(0).startOf('month');
|
|
35
35
|
while (currentDate.diff(endDate, 'month') <= 0) {
|
|
36
36
|
const statementDate = this.getStatementDateForDate(currentDate.toDate());
|
|
37
|
-
console.log('initStatementStatuses');
|
|
38
37
|
await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
39
38
|
currentDate = currentDate.add(1, 'month');
|
|
40
39
|
}
|
|
@@ -87,7 +86,6 @@ export class LoanStatementStatusService {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
async toggleStatementLock(productId: string, statementDate: ISelectedMonth) {
|
|
90
|
-
console.log('toggleStatementLock');
|
|
91
89
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
92
90
|
if (statementStatus) {
|
|
93
91
|
statementStatus.locked = !statementStatus.locked;
|
|
@@ -96,7 +94,6 @@ export class LoanStatementStatusService {
|
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
async updateStatementStatus(productId: string, statementDate: ISelectedMonth, actual: boolean) {
|
|
99
|
-
console.log('updateStatementStatus', { statementDate, actual });
|
|
100
97
|
const statementStatus = await this.getCreateStatementStatus(productId, statementDate);
|
|
101
98
|
if (statementStatus && !statementStatus.locked) {
|
|
102
99
|
statementStatus.actual = actual;
|
|
@@ -123,7 +120,6 @@ export class LoanStatementStatusService {
|
|
|
123
120
|
|
|
124
121
|
async getStatementStatus(productId: string, date: Date) {
|
|
125
122
|
const statementDate = this.getStatementDateForDate(date);
|
|
126
|
-
console.log('getStatementStatus');
|
|
127
123
|
return this.getCreateStatementStatus(productId, statementDate);
|
|
128
124
|
}
|
|
129
125
|
|
|
@@ -177,7 +173,6 @@ export class LoanStatementStatusService {
|
|
|
177
173
|
const loanChargesService = this.getLoanChargesService();
|
|
178
174
|
const products = await loanChargesService.getLoanProducts(borrowerId);
|
|
179
175
|
const lastResults = await Promise.all(products.map(async (product) => {
|
|
180
|
-
console.log('getBorrowerMonthStatus');
|
|
181
176
|
return await this.getCreateStatementStatus(product._id.toString(), statementDate);
|
|
182
177
|
}));
|
|
183
178
|
return lastResults.reduce((acc, res) => res.actual && acc, true);
|
|
@@ -185,7 +180,7 @@ export class LoanStatementStatusService {
|
|
|
185
180
|
|
|
186
181
|
async recalculateStatementQueued(productMap: Record<string, string>) {
|
|
187
182
|
this.mainQueueService.sendTaskToQueue({
|
|
188
|
-
data: {
|
|
183
|
+
data: { productMap },
|
|
189
184
|
pattern: EventMap.recalc.STATEMENT_STATUS,
|
|
190
185
|
}, QueueMap.main).catch(console.error);
|
|
191
186
|
}
|