gemcap-be-common 1.4.127 → 1.4.129

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.127",
3
+ "version": "1.4.129",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -479,9 +479,9 @@ class PdfService {
479
479
  }
480
480
  const bankAccounts = {
481
481
  'Black Feather': [
482
- [{ text: 'Bank name' }, { text: 'Chase' }],
483
- [{ text: 'ABA' }, { text: '322271627' }],
484
- [{ text: 'Account' }, { text: '80009785264' }],
482
+ [{ text: 'Bank name' }, { text: 'BMO N.A' }],
483
+ [{ text: 'ABA' }, { text: '071000288' }],
484
+ [{ text: 'Account' }, { text: '1841261' }],
485
485
  ],
486
486
  'GemCap': [
487
487
  [{ text: 'Bank name' }, { text: 'CIBC Bank USA' }],
@@ -493,7 +493,7 @@ class PdfService {
493
493
  const paymentInstruction = [
494
494
  [{ text: 'Please remit payment to', fillColor: '#44464b', color: 'white' }, { text: '', fillColor: '#44464b' }],
495
495
  ...bankAccounts[organization.name],
496
- [{ text: 'Account name' }, { text: `${this.config.title} Solutions Master Concentration` }],
496
+ [{ text: 'Account name' }, { text: `${this.config.title} Funding AssetCo LLC Collection Account` }],
497
497
  [{ text: 'Reference' }, { text: `${borrower.code} - STATEMENT PAYMENT` }],
498
498
  [{ text: 'The reference is required to ensure timely settlement of your account.', color: 'red' }, {}],
499
499
  ];
@@ -569,9 +569,9 @@ export class PdfService {
569
569
 
570
570
  const bankAccounts = {
571
571
  'Black Feather': [
572
- [{ text: 'Bank name' }, { text: 'Chase' }],
573
- [{ text: 'ABA' }, { text: '322271627' }],
574
- [{ text: 'Account' }, { text: '80009785264' }],
572
+ [{ text: 'Bank name' }, { text: 'BMO N.A' }],
573
+ [{ text: 'ABA' }, { text: '071000288' }],
574
+ [{ text: 'Account' }, { text: '1841261' }],
575
575
  ],
576
576
  'GemCap': [
577
577
  [{ text: 'Bank name' }, { text: 'CIBC Bank USA' }],
@@ -584,7 +584,7 @@ export class PdfService {
584
584
  const paymentInstruction = [
585
585
  [{ text: 'Please remit payment to', fillColor: '#44464b', color: 'white' }, { text: '', fillColor: '#44464b' }],
586
586
  ...bankAccounts[organization.name],
587
- [{ text: 'Account name' }, { text: `${this.config.title} Solutions Master Concentration` }],
587
+ [{ text: 'Account name' }, { text: `${this.config.title} Funding AssetCo LLC Collection Account` }],
588
588
  [{ text: 'Reference' }, { text: `${borrower.code} - STATEMENT PAYMENT` }],
589
589
  [{ text: 'The reference is required to ensure timely settlement of your account.', color: 'red' }, {}],
590
590
  ];
@@ -15,6 +15,7 @@ const Borrower_model_1 = require("../models/Borrower.model");
15
15
  const TermLoan_model_1 = require("../models/TermLoan.model");
16
16
  const reports_db_1 = require("../db/reports.db");
17
17
  const QuickbooksAccount_model_1 = require("../models/QuickbooksAccount.model");
18
+ const Company_model_1 = require("../models/Company.model");
18
19
  const headersIIF = [
19
20
  {
20
21
  service: '!TRNS',
@@ -300,6 +301,10 @@ class QuickbooksService {
300
301
  if (reportErrorsSet.size > 0) {
301
302
  return { reportData: [], reportErrors: Array.from(reportErrorsSet) };
302
303
  }
304
+ const assetCompany = await Company_model_1.Company.findOne({ name: 'AssetCo' }).lean();
305
+ if (!assetCompany) {
306
+ return { reportData: [], reportErrors: ['AssetCo company not found'] };
307
+ }
303
308
  const { reportType, productIds, chargeTypes, reportDate } = params;
304
309
  const reportDateFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
305
310
  const reportDateTrFormatted = (0, dayjs_1.default)(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
@@ -351,8 +356,8 @@ class QuickbooksService {
351
356
  }
352
357
  let totalAmount = product.isParticipant ? -totalAmountValue : totalAmountValue;
353
358
  totalAmount = isAccrual ? totalAmount : -totalAmount;
354
- const quickbooksAccountBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: charge.code }).lean();
355
- const quickbooksAccountPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: PLCode }).lean();
359
+ const quickbooksAccountBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: charge.code, companyId: assetCompany._id.toString() }).lean();
360
+ const quickbooksAccountPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: PLCode, companyId: assetCompany._id.toString() }).lean();
356
361
  if (!quickbooksAccountBS || !quickbooksAccountPL) {
357
362
  if (!quickbooksAccountBS) {
358
363
  reportErrorsSet.add(charge.code);
@@ -431,8 +436,8 @@ class QuickbooksService {
431
436
  settlementCode = revolverProduct.code;
432
437
  }
433
438
  }
434
- const quickbooksAccountPaymentBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: product.code }).lean();
435
- const quickbooksAccountPaymentPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: settlementCode }).lean();
439
+ const quickbooksAccountPaymentBS = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: product.code, companyId: assetCompany._id.toString() }).lean();
440
+ const quickbooksAccountPaymentPL = await QuickbooksAccount_model_1.QuickbooksAccount.findOne({ accountCode: settlementCode, companyId: assetCompany._id.toString() }).lean();
436
441
  if (!quickbooksAccountPaymentBS || !quickbooksAccountPaymentPL) {
437
442
  if (!quickbooksAccountPaymentBS) {
438
443
  reportErrorsSet.add(product.code);
@@ -23,6 +23,7 @@ import { CashAllocationService } from './cash-allocation.service';
23
23
  import { CompaniesService } from './companies.service';
24
24
  import { LoanChargesService } from './loan-charges.service';
25
25
  import { LoanPaymentsService } from './loan-payments.service';
26
+ import { Company } from '../models/Company.model';
26
27
 
27
28
  export type QuickBookReportType = 'accrual' | 'payment' | 'cash';
28
29
 
@@ -355,6 +356,11 @@ export class QuickbooksService {
355
356
  return { reportData: [], reportErrors: Array.from(reportErrorsSet) };
356
357
  }
357
358
 
359
+ const assetCompany = await Company.findOne({ name: 'AssetCo' }).lean();
360
+ if (!assetCompany) {
361
+ return { reportData: [], reportErrors: ['AssetCo company not found'] };
362
+ }
363
+
358
364
  const { reportType, productIds, chargeTypes, reportDate } = params;
359
365
  const reportDateFormatted = dayjs(reportDate).utcOffset(0).format('MM/DD/YYYY').toUpperCase();
360
366
  const reportDateTrFormatted = dayjs(reportDate).utcOffset(0).format(transactionsDateFormat).toUpperCase();
@@ -412,8 +418,8 @@ export class QuickbooksService {
412
418
  }
413
419
  let totalAmount = product.isParticipant ? -totalAmountValue : totalAmountValue;
414
420
  totalAmount = isAccrual ? totalAmount : -totalAmount;
415
- const quickbooksAccountBS = await QuickbooksAccount.findOne({ accountCode: charge.code }).lean();
416
- const quickbooksAccountPL = await QuickbooksAccount.findOne({ accountCode: PLCode }).lean();
421
+ const quickbooksAccountBS = await QuickbooksAccount.findOne({ accountCode: charge.code, companyId: assetCompany._id.toString() }).lean();
422
+ const quickbooksAccountPL = await QuickbooksAccount.findOne({ accountCode: PLCode, companyId: assetCompany._id.toString() }).lean();
417
423
  if (!quickbooksAccountBS || !quickbooksAccountPL) {
418
424
  if (!quickbooksAccountBS) {
419
425
  reportErrorsSet.add(charge.code);
@@ -506,8 +512,8 @@ export class QuickbooksService {
506
512
  }
507
513
  }
508
514
 
509
- const quickbooksAccountPaymentBS = await QuickbooksAccount.findOne({ accountCode: product.code }).lean();
510
- const quickbooksAccountPaymentPL = await QuickbooksAccount.findOne({ accountCode: settlementCode }).lean();
515
+ const quickbooksAccountPaymentBS = await QuickbooksAccount.findOne({ accountCode: product.code, companyId: assetCompany._id.toString() }).lean();
516
+ const quickbooksAccountPaymentPL = await QuickbooksAccount.findOne({ accountCode: settlementCode, companyId: assetCompany._id.toString() }).lean();
511
517
  if (!quickbooksAccountPaymentBS || !quickbooksAccountPaymentPL) {
512
518
  if (!quickbooksAccountPaymentBS) {
513
519
  reportErrorsSet.add(product.code);