@dynamatix/gb-schemas 2.3.279 → 2.3.281

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.
@@ -1 +1 @@
1
- {"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAorBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"applicant-welcome-call.model.d.ts","sourceRoot":"","sources":["../../applicants/applicant-welcome-call.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAsrBhC,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4D,CAAC;AAEnF,eAAe,gBAAgB,CAAC"}
@@ -556,10 +556,18 @@ welcomeCallSchema.virtual('initialRatePercentage').get(function () {
556
556
  // Virtual property for finance summary HTML
557
557
  welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
558
558
  console.log('financeSummaryHtml virtual field called');
559
- console.log('Current applicationId:', this.applicationId);
560
- // Get application data
561
- if (this.applicationId && typeof this.applicationId === 'object') {
562
- const application = this.applicationId;
559
+ let application = null;
560
+ if (this.applicantId && typeof this.applicantId === 'object' && !(typeof this.applicantId.toHexString === 'function') && this.applicantId.applicationId) {
561
+ application = this.applicantId.applicationId;
562
+ }
563
+ else if (this.applicationId && typeof this.applicationId === 'object') {
564
+ application = this.applicationId;
565
+ }
566
+ else {
567
+ console.log('No application found');
568
+ return 'N/A';
569
+ }
570
+ if (application) {
563
571
  console.log('Application data:', JSON.stringify(application, null, 2));
564
572
  // Initialize summary data
565
573
  let product = 'N/A';
@@ -569,34 +577,31 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
569
577
  let occupancy = 'N/A';
570
578
  // Get product information (first 3 characters)
571
579
  if (application.selectedProduct && typeof application.selectedProduct === 'string') {
572
- product = application.selectedProduct.substring(0, 3);
580
+ product = application.selectedProduct;
573
581
  console.log('Product from selectedProduct:', product);
574
582
  }
575
583
  else if (application.productId && typeof application.productId === 'object' && application.productId.selectedProduct) {
576
- product = application.productId.selectedProduct.substring(0, 3);
584
+ product = application.productId.selectedProduct;
577
585
  console.log('Product from productId:', product);
578
586
  }
579
- // Get finance term from product features - check if productFeatures is populated
580
- if (application.productFeatures && typeof application.productFeatures === 'object') {
581
- const productFeatures = application.productFeatures;
582
- console.log('Product features:', JSON.stringify(productFeatures, null, 2));
583
- // Get fixed term
584
- if (productFeatures.fixedTerm) {
585
- financeTerm = `${productFeatures.fixedTerm} year finance term`;
586
- console.log('Finance term:', financeTerm);
587
- }
588
- // Get monthly finance from repayment
589
- if (productFeatures.repayment) {
590
- monthlyFinance = `£${productFeatures.repayment}`;
591
- console.log('Monthly finance:', monthlyFinance);
587
+ // Get finance term from productId if available
588
+ if (application.productId && typeof application.productId === 'object') {
589
+ if (application.productId.numberOfYearsToRepay) {
590
+ financeTerm = `${application.productId.numberOfYearsToRepay} year finance term`;
591
+ console.log('Finance term from productId:', financeTerm);
592
592
  }
593
593
  }
594
594
  else {
595
- console.log('No productFeatures found or not populated');
595
+ console.log('No productId found or not populated');
596
596
  }
597
- // Get rental income from mortgage
597
+ // Note: productFeatures is a separate collection that needs to be populated in form configuration
598
+ // If you need productFeatures data, it should be populated separately in the form config
599
+ // Get rental income from mortgage - mortgageId is at application level
600
+ let mortgage = null;
598
601
  if (application.mortgageId && typeof application.mortgageId === 'object') {
599
- const mortgage = application.mortgageId;
602
+ mortgage = application.mortgageId;
603
+ }
604
+ if (mortgage) {
600
605
  console.log('Mortgage data:', JSON.stringify(mortgage, null, 2));
601
606
  if (mortgage.monthlyRentalIncome) {
602
607
  // Format the rental income value
@@ -606,13 +611,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
606
611
  rentalIncome = `£${rentalValue}`;
607
612
  console.log('Rental income:', rentalIncome);
608
613
  }
609
- }
610
- else {
611
- console.log('No mortgageId found or not populated');
612
- }
613
- // Get occupancy information from mortgage
614
- if (application.mortgageId && typeof application.mortgageId === 'object') {
615
- const mortgage = application.mortgageId;
614
+ // Get occupancy information from mortgage
616
615
  if (mortgage.proposedTenantsLids && Array.isArray(mortgage.proposedTenantsLids)) {
617
616
  // Get the first proposed tenant type
618
617
  const firstTenant = mortgage.proposedTenantsLids[0];
@@ -622,6 +621,9 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
622
621
  }
623
622
  }
624
623
  }
624
+ else {
625
+ console.log('No mortgageId found or not populated');
626
+ }
625
627
  // Create HTML content
626
628
  const summaryContent = `
627
629
  <div><p class="text-bold">Product:</p> <span>${product}</span></div>
@@ -633,7 +635,7 @@ welcomeCallSchema.virtual('financeSummaryHtml').get(function () {
633
635
  console.log('Final summary content:', summaryContent);
634
636
  return summaryContent;
635
637
  }
636
- console.log('No applicationId found or not populated');
638
+ console.log('No application found');
637
639
  return 'N/A';
638
640
  });
639
641
  applyAuditMiddleware(welcomeCallSchema, "ApplicantWelcomeCall");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamatix/gb-schemas",
3
- "version": "2.3.279",
3
+ "version": "2.3.281",
4
4
  "description": "All the schemas for gatehouse bank back-end",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",