gemcap-be-common 1.5.58 → 1.5.59

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/db/reports.db.js CHANGED
@@ -207,7 +207,7 @@ const getLedgerData = async (params, options = defaultReportLedgerOptions) => {
207
207
  };
208
208
  }))
209
209
  : statementTransactions.slice();
210
- const isParticipant = group.product.masterLoanProductId !== undefined;
210
+ const isParticipant = group.product.masterLoanProductId != null;
211
211
  const groupedMappedStatementTransactions = await Promise.all(statementTransactionsWithBalance.map(async (statement) => {
212
212
  const transactions = [];
213
213
  if (statement.amountPaid > 0) {
package/db/reports.db.ts CHANGED
@@ -285,7 +285,7 @@ const getLedgerData = async (params: ReportLedgerParams, options = defaultReport
285
285
  }))
286
286
  : statementTransactions.slice();
287
287
 
288
- const isParticipant = group.product.masterLoanProductId !== undefined;
288
+ const isParticipant = group.product.masterLoanProductId != null;
289
289
  const groupedMappedStatementTransactions = await Promise.all(statementTransactionsWithBalance.map(async (statement) => {
290
290
 
291
291
  const transactions = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.58",
3
+ "version": "1.5.59",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -357,7 +357,7 @@ class QuickbooksService {
357
357
  if (totalAmountValue === 0) {
358
358
  return;
359
359
  }
360
- let totalAmount = product.masterLoanProductId !== undefined ? -totalAmountValue : totalAmountValue;
360
+ let totalAmount = product.masterLoanProductId != null ? -totalAmountValue : totalAmountValue;
361
361
  totalAmount = isAccrual ? totalAmount : -totalAmount;
362
362
  const quickbooksAccountBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: charge.code, ...companyFilter }).lean();
363
363
  const quickbooksAccountPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: PLCode, ...companyFilter }).lean();
@@ -374,7 +374,7 @@ class QuickbooksService {
374
374
  ...trTemplate,
375
375
  productId,
376
376
  class: borrower.code,
377
- memo: `${borrower.code} ${product.masterLoanProductId !== undefined ? 'PARTICIPANT' : ''} ${reports_db_1.EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
377
+ memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} ${reports_db_1.EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
378
378
  };
379
379
  tr.account = quickbooksAccountBS.fullName;
380
380
  tr.amount = totalAmount;
@@ -429,8 +429,8 @@ class QuickbooksService {
429
429
  ...trTemplate,
430
430
  productId,
431
431
  class: borrower.code,
432
- amount: product.masterLoanProductId !== undefined ? +amount : -+amount,
433
- memo: `${borrower.code} ${product.masterLoanProductId !== undefined ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
432
+ amount: product.masterLoanProductId != null ? +amount : -+amount,
433
+ memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
434
434
  };
435
435
  if (settlementCode === 'null') {
436
436
  const products = await this.loanChargesService.getLoanProducts(borrower._id.toString());
@@ -416,7 +416,7 @@ export class QuickbooksService {
416
416
  if (totalAmountValue === 0) {
417
417
  return;
418
418
  }
419
- let totalAmount = product.masterLoanProductId !== undefined ? -totalAmountValue : totalAmountValue;
419
+ let totalAmount = product.masterLoanProductId != null ? -totalAmountValue : totalAmountValue;
420
420
  totalAmount = isAccrual ? totalAmount : -totalAmount;
421
421
  const quickbooksAccountBS = await QuickbooksAccount.findOne({ accountCode: charge.code, ...companyFilter }).lean();
422
422
  const quickbooksAccountPL = await QuickbooksAccount.findOne({ accountCode: PLCode, ...companyFilter }).lean();
@@ -433,7 +433,7 @@ export class QuickbooksService {
433
433
  ...trTemplate,
434
434
  productId,
435
435
  class: borrower.code,
436
- memo: `${borrower.code} ${product.masterLoanProductId !== undefined ? 'PARTICIPANT' : ''} ${EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
436
+ memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} ${EChargeType[charge.chargeType].toUpperCase()} ${product.type.toUpperCase()} - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
437
437
  };
438
438
 
439
439
  tr.account = quickbooksAccountBS.fullName;
@@ -500,8 +500,8 @@ export class QuickbooksService {
500
500
  ...trTemplate,
501
501
  productId,
502
502
  class: borrower.code,
503
- amount: product.masterLoanProductId !== undefined ? +amount : -+amount,
504
- memo: `${borrower.code} ${product.masterLoanProductId !== undefined ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
503
+ amount: product.masterLoanProductId != null ? +amount : -+amount,
504
+ memo: `${borrower.code} ${product.masterLoanProductId != null ? 'PARTICIPANT' : ''} PRINCIPAL PAID TERM - TRANS: ${reportDateTrFormatted} - POST: ${currentDateTrFormatted}`,
505
505
  };
506
506
 
507
507
  if (settlementCode === 'null') {
@@ -76,7 +76,7 @@ class InvestorSummaryService {
76
76
  await Promise.all(borrowerIds.map(async (borrowerId) => {
77
77
  const borrower = await Borrower_model_1.BorrowerModel.findById(borrowerId).lean();
78
78
  const borrowerProducts = await this.loanChargesService.getLoanProducts(borrowerId);
79
- await Promise.all(borrowerProducts.filter((product) => product.masterLoanProductId === undefined).map(async (product) => {
79
+ await Promise.all(borrowerProducts.filter((product) => product.masterLoanProductId == null).map(async (product) => {
80
80
  const productId = product._id.toString();
81
81
  const isRevolver = product.type === loan_types_enum_1.ELoanTypes.REVOLVER;
82
82
  const { balance: balanceEnd } = await this.loanChargesService.getLoanProductBalance(productId, end);
@@ -100,7 +100,7 @@ export class InvestorSummaryService {
100
100
  await Promise.all(borrowerIds.map(async (borrowerId) => {
101
101
  const borrower = await BorrowerModel.findById(borrowerId).lean();
102
102
  const borrowerProducts = await this.loanChargesService.getLoanProducts(borrowerId);
103
- await Promise.all(borrowerProducts.filter((product) => product.masterLoanProductId === undefined).map(async (product) => {
103
+ await Promise.all(borrowerProducts.filter((product) => product.masterLoanProductId == null).map(async (product) => {
104
104
  const productId = product._id.toString();
105
105
  const isRevolver = product.type === ELoanTypes.REVOLVER;
106
106
  const { balance: balanceEnd } = await this.loanChargesService.getLoanProductBalance(productId, end);
@@ -323,7 +323,7 @@ class ReportsService {
323
323
  const hasTermProduct = products.some((product) => product.type === loan_types_enum_1.ELoanTypes.TERM);
324
324
  const manyTermProduct = products.filter((product) => product.type === loan_types_enum_1.ELoanTypes.TERM).length > 1;
325
325
  return await Promise.all(products.map(async (product) => {
326
- if (product.masterLoanProductId !== undefined) {
326
+ if (product.masterLoanProductId != null) {
327
327
  return null;
328
328
  }
329
329
  if ((0, dayjs_1.default)(product.deactivationDate).isBefore((0, dayjs_1.default)(date))) {
@@ -426,7 +426,7 @@ export class ReportsService {
426
426
  const manyTermProduct = products.filter((product) => product.type === ELoanTypes.TERM).length > 1;
427
427
 
428
428
  return await Promise.all(products.map(async (product) => {
429
- if (product.masterLoanProductId !== undefined) {
429
+ if (product.masterLoanProductId != null) {
430
430
  return null as IBankReportData;
431
431
  }
432
432
  if (dayjs(product.deactivationDate).isBefore(dayjs(date))) {