private void GenerateAndSendWcmCustomDisclosures(WCMDisclosurePackage package) { var waitDialog = new PleaseWaitDialog(); new TaskFactory().StartNew(() => { waitDialog.Progress.Report($"Generating Disclosures for {package.PackageType} Package."); try { GenerateWcmDisclosurePackage(package); var packageResponses = SendWCMDisclosurePackage(package, waitDialog); EncompassApplication.CurrentLoan.Commit(); waitDialog.PleaseWaitForm.Close(); MessageBox.Show($"Disclosure Package Sent Successfully."); } catch (WCMException ex) { UIHelper.DisplayWCMException(ex); } catch (Exception ex) { Macro.Alert($"Unhandled Exception ERROR: {ex.ToString()}"); } }).ContinueWith((x) => { waitDialog.PleaseWaitForm.Close(); }); return; }
private DisclosureRequest PopulateDisclosureRequest(Attachment disclosure, WCMDisclosurePackage package) { return(new DisclosureRequest() { DisclosureName = disclosure.Title, DeliveryType = MapDisclosureDeliveryType(package) }); }
private void GenerateWcmDisclosurePackage(WCMDisclosurePackage package) { string eFolderThatContainsPackage = package.EfolderNameThatContainsDisclosures; EncompassHelper.RemoveCurrentAttachmentsInEfolderPlaceholder(this.Loan, eFolderThatContainsPackage); Loan.Fields["CX.KM.PRINTSCENARIO"].Value = eFolderThatContainsPackage; if (package.PackageType == WCMPackageTypeEnum.PriorityPurchase) { _cdoDisclosuresUtility.GeneratePpBorrowersAuthorization(); } }
private WCMDisclosure PopulateWCMDisclosures(Attachment attachment, WCMDisclosurePackage package) { // SP - EncompassFormType for CDO Packages are all custom return (new WCMDisclosure() { DocumentRequest = PopulatePostDocumentRequest(attachment, package), DisclosureRequest = PopulateDisclosureRequest(attachment, package), EncompassFormType = "Custom Form", Name = attachment.Title, FileBytes = attachment.DataOriginal //EfolderAttachment = attachment }); }
private void DisplayEncompassDocEngineDialog(WCMDisclosurePackage package) { switch (package.PackageType) { case WCMPackageTypeEnum.ClosingDisclosureWithAcknowledgement: case WCMPackageTypeEnum.ChangeOfCircumstanceCD: Macro.ExecSignature("_EPASS_SIGNATURE;ENCOMPASSDOCS;AUDIT"); break; default: Macro.ExecSignature("_EPASS_SIGNATURE;ENCOMPASSDOCS;EDISCLOSURES2"); break; } }
private void RunGenerateDisclosuresValidation(WCMDisclosurePackage package) { string loanOfficerId = this.Loan.LoanOfficerID; var loUser = this.Loan.Session.Users.GetUser(loanOfficerId); // SP - if state license is missing, go fill it out if (this.Loan.Fields["3629"].IsEmpty()) { if (this.Loan.Fields["14"].IsEmpty()) { throw new WCMException("Property State (field 14) is empty and required."); } string propertyState = this.Loan.Fields["14"].Value.ToString(); var propertyStateLicense = loUser.StateLicenses[propertyState]; if (propertyStateLicense == null || propertyStateLicense.Enabled == false) { throw new WCMException( $"LO '{loUser.FullName}' is NOT licensed for '{propertyState}' Property State."); } this.Loan.Fields["3629"].Value = propertyStateLicense.LicenseNumber; } var cdSentDateField = this.Loan.Fields["3977"]; switch (package.PackageType) { case WCMPackageTypeEnum.OneCallClose: case WCMPackageTypeEnum.FullPackage: case WCMPackageTypeEnum.ChangeOfCircumstanceLE: if (cdSentDateField.IsEmpty() == false) { throw new WCMException( $"A CD was sent to borrower on {cdSentDateField.ToDate().ToShortDateString()}. " + $"{Environment.NewLine + Environment.NewLine}An LE cannot be sent after a CD has been delivered; " + $"this will cause major issues. DO NOT ATTEMPT TO GENERATE AN LE."); } break; default: break; } }
public List <WCMDisclosure> GetDisclosuresFromTrackedDocument(WCMDisclosurePackage packageSelected, TrackedDocument efolder) { var result = new List <WCMDisclosure>(); AttachmentList attachments = efolder.GetAttachments(); foreach (Attachment attachment in attachments) { // SP - 03/21 - Doc Conversion Turned on // attachments are NOT available until after they are fully converted // while loop below allows us to check if doc is fully converted 20 times // thread.sleep in between each try let's doc finish converting int attemptDisclosureCount = 0; while (attemptDisclosureCount < 10) { attemptDisclosureCount++; try { result.Add(PopulateWCMDisclosures(attachment, packageSelected)); break; } catch (Exception ex) { // SP - aftr trying x times, throw ex if (attemptDisclosureCount >= 10) { throw new WCMException($"Unable to retrieve attachment from efolder " + $"'{efolder.Title}. '{ex.ToString()}'"); } Thread.Sleep(5000); } } } return(result); }
private List <PostPackageResponse> SendWCMDisclosurePackage(WCMDisclosurePackage package, PleaseWaitDialog waitDialog) { var trackedDoc = _cdoDisclosuresUtility.GetDisclosuresTrackedDoc(package.EfolderNameThatContainsDisclosures, package); var wcmDisclosures = _cdoDisclosuresUtility.GetDisclosuresFromTrackedDocument(package, trackedDoc); var disclosuresService = new DisclosuresManger(DisclosuresHelper.PopulateDisclosuresUtilityConfig(), new DisclosuresUtilityRequest() { EfolderContainingDisclosures = trackedDoc, DisclosurePackage = package, Disclosures = wcmDisclosures, Loan = EncompassApplication.CurrentLoan, Progress = waitDialog.Progress }); var packageResponse = disclosuresService.SendDisclosurePackageToBorrower(); waitDialog.Progress.Report($"Disclosures sent successfully. {Environment.NewLine + Environment.NewLine}Saving Loan..."); return(packageResponse); }
public void RunDisclosuresProcess(WCMDisclosurePackage package) { SetGenerateDisclosureFields(); RunGenerateDisclosuresValidation(package); // SP - doc generation on EM engine must be done on the main UI Thread!!! if (package.DocumentGenerateType == DocumentGenerateTypeEnum.EncompassDocEngine) { DisplayEncompassDocEngineDialog(package); } else if (package.DocumentGenerateType == DocumentGenerateTypeEnum.WCMCustomGenerate) { GenerateAndSendWcmCustomDisclosures(package); } else { throw new WCMException( $"Unable to proceed with document generation type '{package.DocumentGenerateType}'."); } return; }
private WCMDisclosure PopulateWcmDisclosure(EllieMae.EMLite.LoanServices.BamObjects.PdfDocument disclosure, WCMDisclosurePackage package) { return(new WCMDisclosure() { DisclosureRequest = PopulateDisclosureRequest(disclosure, package.DeliveryType), DocumentRequest = PopulatePostDocumentRequest(disclosure, package.DeliveryType), EncompassFormType = disclosure.Type, Name = GetDisclosureName(disclosure), FilePath = disclosure.Path }); }
private List <WCMDisclosure> GetDisclosures(PdfDocumentList encompassDisclosuresList, WCMDisclosurePackage package) { var result = new List <WCMDisclosure>(); for (int i = 0; i < encompassDisclosuresList.Count; i++) { result.Add(PopulateWcmDisclosure(encompassDisclosuresList[i], package)); } return(result); }
public TrackedDocument GetDisclosuresTrackedDoc(string eFolderNameThatContainsPackage, WCMDisclosurePackage package) { LogEntryList docList = Loan.Log.TrackedDocuments.GetDocumentsByTitle(eFolderNameThatContainsPackage); if (docList.Count == 0) { throw new WCMException( $"No placeholder was found '{eFolderNameThatContainsPackage}'. " + $"Please re-generate disclosure package"); } else if (docList.Count > 1) { // which placeholder do we choose? try to remove empty ones first EncompassUtilities.RemoveEmptyDuplicatePlaceholder(docList, this.Loan); } //after removing empty placeholders, if still more than 1, fail docList = Loan.Log.TrackedDocuments.GetDocumentsByTitle(eFolderNameThatContainsPackage); if (docList.Count > 1) { throw new WCMException( $"More than one '{eFolderNameThatContainsPackage}' placeholder with attachments. " + $"Please contact tech support."); } // now grab attachments and save them to CDO return((TrackedDocument)docList[0]); //AddDisclosuresToCdoResponse addDisclosuresToCdoResult = AddDisclosuresToCustomDataObject(this.Loan, eFolderPlaceholderContainingDisclosures, package.PackageType); //if (addDisclosuresToCdoResult.WasSuccessful == false) //{ // throw new WCMException( // $"Error adding disclosures to CDO. {addDisclosuresToCdoResult.ErrorMessage}."); //} //EncompassUtilities.DeleteAttachmentsFromEfolder(this.Loan, eFolderPlaceholderContainingDisclosures); //return addDisclosuresToCdoResult.OrderToBeSent; }
// SP - Default to view only If we actually want the borrower to sign a document // We will set this in the disclosures manager when looking at the disclosure config file private DocumentDeliveryTypeEnum MapDocDeliveryType(WCMDisclosurePackage package) { return(DocumentDeliveryTypeEnum.ViewImmediately); }
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 DisclosureDeliveryTypeEnum MapDisclosureDeliveryType(WCMDisclosurePackage package) { return(DisclosureDeliveryTypeEnum.Review); }