public void GoToDoTasksPortalInBlend()
 {
     if (PortalExistsForHQNumber() == false)
     {
         Macro.Alert("A portal has not been created for this loan. Please create a portal and try again.");
     }
     else
     {
         string portalId = BlendUtility.GetPortalId(this.Loan);
         System.Diagnostics.Process.Start($"{WcmSettings.BlendSettings.BlendPortalUri}/#/loans/{portalId}/followUps");
     }
 }
        private PostDocumentRequest PopulatePostDocumentRequest(Attachment attachment, WCMDisclosurePackage package)
        {
            var loan   = this.Loan;
            var result = new PostDocumentRequest()
            {
                PortalId              = loan.Fields["CX.BLEND.LOANID"].ToString(),
                BorrowerPartyId       = BlendUtility.GetCurrentBorrowerPairBorrowerBlendId(loan),
                CoBorrowerPartyId     = BlendUtility.GetCurrentBorrowerPairCoBorrowerBlendId(loan),
                LosLoanNumber         = loan.LoanNumber,
                FileName              = attachment.Title,
                DisplayNameAndLosType = attachment.Title,
                DocumentDeliveryType  = MapDocDeliveryType(package)
            };

            return(result);
        }
        private async void Button_CreateAppraisalCreditCardTask_Click(object sender, EventArgs e)
        {
            GenericIsLoanEligibleForTask loanReadyForAppraisalTaskCheck = _passFailUtility.IsLoanReadyForAppraisalTaskCheck();

            if (loanReadyForAppraisalTaskCheck.IsLoanEligible == false)
            {
                Macro.Alert($"{string.Join(Environment.NewLine, loanReadyForAppraisalTaskCheck.ReasonsWhyLoanIsNotEliglbe)}");
                return;
            }

            var pleaseWaitForm = new PleaseWaitDialog();


            PostAppraisalTaskResponse postCcTask = null;

            await new TaskFactory().StartNew(() =>
            {
                pleaseWaitForm.Progress.Report("Generating payment link, appraisal doc, and task in borrower portal...");
                postCcTask = BlendUtility.CreateAppraisalCreditCardCaptureTaskToBorrowerPortal(EncompassApplication.CurrentLoan, WcmSettings.BlendSettings.CreateOrderAppraisalTaskUri);
            }).ContinueWith((x) =>
            {
                pleaseWaitForm.PleaseWaitForm.Close();

                if (postCcTask.WasSuccessful == false)
                {
                    Macro.Alert($"Error creating Appraisal Credit Card Payment Task: '{postCcTask.ErrorMessage}'");
                }
                else if (postCcTask.DidAppraisalTaskPost == false)
                {
                    Macro.Alert($"Appraisal task did not post: '{postCcTask.ReasonTaskDidNotPost}'");
                }
                else
                {
                    if (postCcTask.DidAppraisalTaskPost)
                    {
                        Macro.Alert($"Order Appraisal Task Posted Succesfully!");
                    }
                    else
                    {
                        Macro.Alert($"Hit unintended else statemnt. Pleae send screenshot to dev team. " +
                                    $"DidAppraisalTaskPost '{postCcTask.DidAppraisalTaskPost}'..WasSuccessful '{postCcTask.WasSuccessful}'. " +
                                    $"ErrorMessage' {postCcTask.ErrorMessage}'");
                    }
                }
            });
        }
        private PostDocumentRequest PopulatePostDocumentRequest(
            EllieMae.EMLite.LoanServices.BamObjects.PdfDocument disclosure,
            DeliveryTypeEnum packageDeliveryType)
        {
            var loan   = EncompassApplication.CurrentLoan;
            var result = new PostDocumentRequest()
            {
                PortalId              = loan.Fields["CX.BLEND.LOANID"].ToString(),
                BorrowerPartyId       = BlendUtility.GetCurrentBorrowerPairBorrowerBlendId(loan),
                CoBorrowerPartyId     = BlendUtility.GetCurrentBorrowerPairCoBorrowerBlendId(loan),
                LosLoanNumber         = loan.LoanNumber,
                FileName              = disclosure.Title,
                DisplayNameAndLosType = disclosure.Title,
                DocumentDeliveryType  = MapDocDeliveryType(disclosure.SignatureType, packageDeliveryType)
            };

            return(result);
        }
        // we want to disable name, email fields when a portal has already been created so a user doesn't change them
        private void DisableThirdPartyFieldsForPortalsAlreadyCreated()
        {
            // get a count of the title only portal ids created
            var topIds = BlendUtility.GetTitleOnlyBlendPartyPortalIds(this.Loan);

            //get a list of all controls that contain title only fields
            var controls = this.Form.GetAllFieldControls();
            var titleOnlyPersonControls = controls.Where(x => x.Field.FieldID.ToUpper().Contains("CX.BLEND.TPO")).ToList();

            for (int i = 1; i <= topIds.Count; i++)
            {
                // title only fields have a number at the end (i.e. cx.blend.tpo.firstname1)
                // go through and disable controls where field ID contains tpo naming convention AND the number
                var controlsThatAreForThisTitleOnlyParty = titleOnlyPersonControls.Where(x => x.Field.FieldID.Contains(i.ToString()));
                foreach (var controlToDisable in controlsThatAreForThisTitleOnlyParty)
                {
                    EncompassHelper.EnableDisableControl(controlToDisable.ControlID, this.Form, false);
                }
            }
        }
Ejemplo n.º 6
0
        private bool MapDocumentToEfolder(Loan loan, BlendDocReturned document, TrackedDocument eFolder)
        {
            string docId = document.Id;

            try
            {
                var url = WcmSettings.GetDocumentFromBlendUri;


                GetDocumentResponse docResponse = BlendUtility.GetDocumentFromBlendPortal(docId, url);

                var data = new EllieMae.Encompass.BusinessObjects.DataObject(docResponse.DocumentData);
                EllieMae.Encompass.BusinessObjects.Loans.Attachment attachment = loan.Attachments.AddObject(data, ".pdf");
                attachment.Title = $"{document.Name}";

                eFolder.Attach(attachment);

                // once attached go update the export status

                var uri           = WcmSettings.UpdateDocExportStatusBlendUri;
                var updateRequest = new UpdateDocumentExportStatusRequest()
                {
                    BlendDocumentId       = docId,
                    UtcDocumentExportTime = DateTime.UtcNow.ToShortDateString()
                };
                var requestTest    = Newtonsoft.Json.JsonConvert.SerializeObject(updateRequest);
                var updateResponse = BlendUtility.PostDocumentExportStatusUpdate(updateRequest, uri);
            }
            catch (Exception ex)
            {
                Macro.Alert($"Error mapping {document.Name} to eFolder. Please submit a Help Desk Ticket." + Environment.NewLine + $"Error Message: {ex.Message}");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 7
0
        private void FormWrapper_FormOpened(object sender, FormOpenedArgs e)
        {
            var form = e.OpenForm;

            if (!form.Name.Equals("UnderwritingDetailsDialog", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var pnlStatus = form.Controls.Find("pageStatus", true);

            if (pnlStatus != null && pnlStatus.Count() > 0)
            {
                Panel uwStatusPanel = (Panel)pnlStatus[0];
                if (uwStatusPanel.Controls != null && uwStatusPanel.Controls.Count > 0)
                {
                    string borrowerName = "";
                    // populate borrower checkboxes that let you select who to send tasks to
                    BorrowerPair currentPair = EncompassApplication.CurrentLoan.BorrowerPairs.Current;

                    string borrowerBlendId = BlendUtility.GetCurrentBorrowerPairBorrowerBlendId(EncompassApplication.CurrentLoan);
                    if (string.IsNullOrEmpty(borrowerBlendId))
                    {
                        return;
                    }

                    borrowerName = $"{currentPair.Borrower.FirstName} {currentPair.Borrower.LastName}";


                    //if (currentPair.CoBorrower != null)
                    //{
                    //    string coborrowerBlendId = BlendUtility.GetCurrentBorrowerPairCoBorrowerBlendId(theLoan);
                    //    if (string.IsNullOrEmpty(coborrowerBlendId) == false)
                    //    {
                    //        CoBorrowePortalId = coborrowerBlendId;
                    //        checkBox_CoBorrower.Text = $"{currentPair.CoBorrower.FirstName} {currentPair.CoBorrower.LastName}";
                    //        checkBox_CoBorrower.Visible = true;
                    //    }
                    //}

                    //has this condition already been posted
                    // if y, show updates control
                    // if n, show post control

                    var conditionManager = new BlendConditionManagerPost_Control(borrowerName);
                    conditionManager.Location = new Point(100, 70);

                    conditionManager.Visible = true;
                    conditionManager.BringToFront();
                    uwStatusPanel.Controls.Add((Control)conditionManager);
                    uwStatusPanel.Refresh();

                    //var SendDisclosures = new Button();
                    //SendDisclosures.Name = "WcmDisclosures";
                    //SendDisclosures.Text = "WCM TESTING";
                    //SendDisclosures.Size = new Size(70, 22);
                    //// Back.Image = (Image)Resources.Back;
                    //SendDisclosures.Click += new EventHandler(SendDisclosuresButton_Click);
                    //SendDisclosures.Location = new Point(75, 22);
                    //SendDisclosures.Visible = true;
                    //SendDisclosures.Enabled = true;
                    //SendDisclosures.BringToFront();
                    //ButtonsPanel.Controls.Add((Control)SendDisclosures);
                    //ButtonsPanel.Refresh();
                }
            }
        }
Ejemplo n.º 8
0
        private bool DownloadAndMapBlendApplicationDocuments(Loan loan)
        {
            TrackedDocument         eFolder          = null;
            string                  blendLoanId      = loan.Fields["CX.BLEND.LOANID"].ToString();
            List <BlendDocReturned> eFolderDocuments = new List <BlendDocReturned>();

            string url = WcmSettings.GetAllPortalDocumentsUri;
            GetAllPortalDocumentsResponse getAllDocsResponse = BlendUtility.GetAllBlendPortalDocuments(blendLoanId, url);

            var responseTest = Newtonsoft.Json.JsonConvert.SerializeObject(getAllDocsResponse);

            try
            {
                foreach (var doc in getAllDocsResponse.Documents)
                {
                    var docType = doc.Type;
                    switch (docType)
                    {
                    case "CREDIT_REPORT":

                        eFolder = loan.Log.TrackedDocuments.Add("Credit Report", "Started");
                        var creditReportMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (creditReportMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }

                        break;

                    case "BLEND_INCOME_VERIFICATION":
                        //case "VERIFICATION_OF_INCOME":
                        eFolder = loan.Log.TrackedDocuments.Add("Income - Written VOE", "Started");
                        var voiMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (voiMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }
                        break;

                    case "PAY_STUB":
                    case "IRSW2":
                        eFolder = loan.Log.TrackedDocuments.Add("Income- Paystubs/W-2s", "Started");
                        var payMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (payMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }
                        break;

                    case "4506t":
                    case "4506c":
                        eFolder = loan.Log.TrackedDocuments.Add("Income-4506C", "Started");
                        var taxReturnMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (taxReturnMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }
                        break;

                    case "IRS1040":
                        eFolder = loan.Log.TrackedDocuments.Add("Income- Pers Tax Returns w/Scheds", "Started");
                        var irsMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (irsMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }
                        break;

                    case "PRE_APPROVAL_LETTER":
                    case "PRE_QUALIFICATION_LETTER":
                        eFolder = loan.Log.TrackedDocuments.Add("Preapproval - Blend", "Started");
                        if (MapDocumentToEfolder(loan, doc, eFolder))
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                            loan.Fields["CX.BLEND.PREAPP.SENT"].Value = "Y";
                        }
                        break;

                    case "GENERATED_ASSET_STATEMENT":
                        var assetPlaceholder = loan.Log.TrackedDocuments.GetDocumentsByTitle("Asset - Bank Statements - Chk/Svgs");
                        if (assetPlaceholder.Count > 0)
                        {
                            foreach (TrackedDocument assetDoc in assetPlaceholder)
                            {
                                eFolder = assetDoc;
                                break;
                            }
                        }
                        else
                        {
                            eFolder = loan.Log.TrackedDocuments.Add("Asset - Bank Statements - Chk/Svgs", "Started");
                        }

                        var assetsMapped = MapDocumentToEfolder(loan, doc, eFolder);
                        if (assetsMapped)
                        {
                            DeleteAttachmentFromFileManager(loan, doc);
                        }

                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Macro.Alert($"Error mapping Blend Documents to the eFolder. Please submit a helpdesk Ticket." + Environment.NewLine + $"Error Message: {e.Message}");
                return(false);
            }

            //once mapped set the date field
            loan.Fields["CX.BLEND.APP.DOCS.IMPORTED"].Value = DateTime.Now;
            return(true);
        }
 public void GoToCoPilotInBlend()
 {
     BlendUtility.GoToCoPilotInBlend(this.Loan, WcmSettings.BlendSettings.BlendPortalUri);
 }
 public bool PortalExistsForHQNumber()
 {
     return(BlendUtility.PortalAccountExistsForThisLoan(this.Loan));
 }
        public AddTitleOnlyPartyResponse CreateTitleOnlyPartyPortal(int tpoIndex)
        {
            var loan = this.Loan;
            var titleOnlyPartyIdField = loan.Fields[$"CX.BLEND.TPO.ID{tpoIndex}"];

            if (titleOnlyPartyIdField.IsEmpty() == false)
            {
                Macro.Alert("ERROR: A Blend Portal has already been created for this Title Only Party. Please try to create one on a different line.");
                return(null);
            }

            AddTitleOnlyPartyResponse response = new AddTitleOnlyPartyResponse();

            List <string> fieldIdsThatMustBeFilledOut = new List <string>()
            {
                $"CX.BLEND.TPO.FIRSTNAME{tpoIndex}",
                $"CX.BLEND.TPO.LASTNAME{tpoIndex}",
                $"CX.BLEND.TPO.EMAIL{tpoIndex}",
                $"CX.BLEND.TPO.SIGNERTYPE{tpoIndex}"
            };

            List <LoanField> emptyFields = new List <LoanField>();

            foreach (var item in fieldIdsThatMustBeFilledOut)
            {
                var field = loan.Fields[item];
                if (field.IsEmpty())
                {
                    emptyFields.Add(field);
                }
            }

            if (emptyFields.Any())
            {
                var fieldIds = emptyFields.Select(x => x.ID).ToList();
                EncompassUtilities.HighlightEmptyFields(fieldIds, this.Form, loan);

                string fieldDescriptions = string.Join(", ", emptyFields.Select(x => x.Descriptor).ToList());
                Macro.Alert($"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}Required fields are empty: {fieldDescriptions}.");

                return(null);
            }


            string tpoFirstName = loan.Fields[$"CX.BLEND.TPO.FIRSTNAME{tpoIndex}"].Value.ToString();
            string tpoLastName  = loan.Fields[$"CX.BLEND.TPO.LASTNAME{tpoIndex}"].Value.ToString();
            string email        = loan.Fields[$"CX.BLEND.TPO.EMAIL{tpoIndex}"].Value.ToString();
            string vestingType  = loan.Fields[$"CX.BLEND.TPO.SIGNERTYPE{tpoIndex}"].Value.ToString();


            // get blend parties before creating tpo
            var getPartiesResponse = BlendUtility.GetPartiesOnLoan(BlendUtility.GetPortalId(loan), WcmSettings.BlendSettings.GetAllLoanPartiesUri);

            if (getPartiesResponse.WasSuccessful == false)
            {
                response.ErrorMessage  = $"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}Error retreiving loan parties. '{getPartiesResponse.ErrorMessage}'.";
                response.WasSuccessful = false;
                return(response);
            }

            List <LoanParty> loanPartiesBeforeCommit = getPartiesResponse.LoanParties;
            //  Macro.Alert(loanPartiesBeforeCommit.Count + " Parties Before Commit");

            // need to map WCM 'vesting type' value to Ellie Mae's values

            Dictionary <string, string> vestingDictionary = new Dictionary <string, string>();

            // WCM field value, encompass value
            vestingDictionary.Add("OTHER", "");
            vestingDictionary.Add("SETTLOR", "Title Only Settlor Trustee");
            vestingDictionary.Add("SPOUSE", "Non Title Spouse");
            vestingDictionary.Add("TITLE_HOLDER", "Title only");
            vestingDictionary.Add("TITLE_HOLDER_TRUSTEE", "Title Only Trustee");

            var thisVesting = vestingDictionary.Where(x => x.Key.Equals(vestingType)).FirstOrDefault();

            if (string.IsNullOrEmpty(thisVesting.Value))
            {
                Macro.Alert($"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}ERROR: Unable to map vesting party '{vestingType}' for Blend.");
                return(null);
            }
            //check for entry in borrower Information - Vesting screen prior to mapping to file contacts and remove if entry is same as third Party being created
            bool   doesVestingEntryExist = false;
            int    vestingIndex          = loan.AdditionalVestingParties.Count;
            string tpoName = tpoFirstName + " " + tpoLastName;

            if (loan.Fields[$"TR0{vestingIndex}01"].ToString().Equals(tpoName, StringComparison.OrdinalIgnoreCase))
            {
                doesVestingEntryExist = true;
            }
            // grab SSN and DOB before deleting to include in FileContact/ newly created Vesting
            string ssnVestedParty = loan.Fields[$"TR0{vestingIndex}03"].GetStringValueBlankIfNull();
            string dobVestedParty = loan.Fields[$"TR0{vestingIndex}12"].GetStringValueBlankIfNull();

            if (doesVestingEntryExist)
            {
                loan.AdditionalVestingParties.RemoveAt(vestingIndex);
            }

            // create non-borrowering owner contact programatically
            int contactIndex = loan.NBOContacts.Add();

            loan.Fields[$"NBOC0{contactIndex}01"].Value = tpoFirstName;
            loan.Fields[$"NBOC0{contactIndex}03"].Value = tpoLastName;
            loan.Fields[$"NBOC0{contactIndex}11"].Value = email;
            loan.Fields[$"NBOC0{contactIndex}09"].Value = thisVesting.Value;
            loan.Fields[$"NBOC0{contactIndex}16"].Value = dobVestedParty;

            List <LoanParty> loanPartiesAfterCommit = new List <LoanParty>();

            // when 'commit' is called, KM's bridge plugin will create title only party in Blend
            // there is a chance that the creating the Title only party, commiting, and getting parties again from blend
            // happens so fast, we won't get new party created. Creating a loop to try this sequence 3 times and wait a few seconds between each one
            for (int i = 0; i < 4; i++)
            {
                loan.Commit();
                loan.Fields[$"TR0{vestingIndex}03"].Value = ssnVestedParty;


                // get blend parties after creating tpo and we should have 1 more....
                getPartiesResponse = BlendUtility.GetPartiesOnLoan(BlendUtility.GetPortalId(loan), WcmSettings.BlendSettings.GetAllLoanPartiesUri);
                if (getPartiesResponse.WasSuccessful == false)
                {
                    string msg = $"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}{loan.LoanNumber}Error retreiving loan parties. '{getPartiesResponse.ErrorMessage}'.";
                    response.WasSuccessful = false;
                    response.ErrorMessage  = msg;
                    Macro.Alert(msg);
                    return(response);
                }

                loanPartiesAfterCommit = getPartiesResponse.LoanParties;

                //Macro.Alert(loanPartiesAfterCommit.Count + " Parties");
                if (loanPartiesBeforeCommit.Count != loanPartiesAfterCommit.Count)
                {
                    // sucess! This means titl only party was created, so continue
                    break;
                }
                if (loanPartiesAfterCommit.Count == loanPartiesAfterCommit.Count)
                {
                    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(3));
                }
            }

            if (loanPartiesAfterCommit.Count == loanPartiesBeforeCommit.Count)
            {
                response.WasSuccessful = false;
                string msg = $"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}{loan.LoanNumber}. The number of loan parties in Blend is the same as after trying to create Title Only Party. This is a big issue. Please submit a tech request.";
                response.ErrorMessage = msg;
                Macro.Alert(msg);
                return(response);
            }


            // find new loan party
            foreach (var party in loanPartiesBeforeCommit)
            {
                var borrower = loanPartiesAfterCommit.Where(x => x.id.Equals(party.id, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                if (borrower != null)
                {
                    loanPartiesAfterCommit.Remove(borrower);
                }
            }

            if (loanPartiesAfterCommit.Count != 1)
            {
                response.WasSuccessful = false;
                string msg = $"Error Creating Third Party Portal{Environment.NewLine + Environment.NewLine}{loan.LoanNumber}. There are '{loanPartiesAfterCommit}' new loan parties. We should only have 1. This is a problem. Please submit a tech request.";
                response.ErrorMessage = msg;
                Macro.Alert(msg);
                return(response);
            }


            // this is our new loan party
            var titleOnlyParty = loanPartiesAfterCommit[0];

            titleOnlyPartyIdField.Value = titleOnlyParty.id;
            Macro.Alert($"True. {Environment.NewLine + Environment.NewLine}Third Party Portal Created Succesfully. Party ID: {titleOnlyParty.id}.");


            return(response);
        }
 public void GoToBorrowerPortalInBlend()
 {
     BlendUtility.GoToBorrowerPortalInBrowser(this.Loan, WcmSettings.BlendSettings.BlendPortalUri);
 }