public void NewAppNeedInitialToInReviewNeedUwDecision()
        {
            LoanApplicationCoreStateObject loanApplicationInfo         = TransitionToReviewingState(borrowerRegistration);
            ResponseObject <GetLoanApplicationStatusResponse> response = coreLoanApplicationStatusClient
                                                                         .GetStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());

            if (response.content == null ||
                response.content.LoanApplicationState != LoanApplicationState.Reviewing ||
                response.content.LoanApplicationStatus != LoanApplicationStatus.NewAppNeedInitialReview)
            {
                var message = response.content == null ? "No response was returned, null content object." : $"State = {response.content.LoanApplicationState.ToString()}, Status = {response.content.LoanApplicationStatus.ToString()}";
                log.Error("Failing test due to invalid setup state for our loan application...");
                Assert.Fail($"Loan Application State or Status not in the valid state or status; unable to continue - {message}");
            }

            AssignAgentToLoanApplication((Guid)loanApplicationInfo.LoanApplicationGuid, AgentRole.UW, "clpuw");
            var coreLoanAppClient = new LoanApplicationClient();
            var workflowResponse  = coreLoanAppClient.WorkflowAction(loanApplicationInfo.LoanApplicationGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);

            Assert.That(workflowResponse.statusCode == HttpStatusCode.OK, $"Invalid status code returned when attempting workflow transition:  {workflowResponse.statusCode}");
            log.Info("Checking the actual status of our loan application after transitioning to SendToUW");

            var statusResponse = coreLoanApplicationStatusClient.GetStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());

            log.Info("transitioning the status...");

            coreLoanApplicationStatusClient
            .UpdateStatusByLoanApplication(loanApplicationInfo.LoanApplicationGuid.ToString());
            Assert.That(statusResponse.statusCode == HttpStatusCode.OK, $"We received an invalid status code from our core loanapplication status request:  {statusResponse.statusCode}.");
            Assert.NotNull(statusResponse.content, "We have a response but the response content is null for our status request");
            ValidateApplicationState(statusResponse.content, LoanApplicationState.Reviewing, LoanApplicationStatus.InReviewNeedDecision);
            log.Info("We have successfully transitioned our loan application into the Reviewing/InReviewNeedDecision.  Now we must check to see if we have an Agent assigned.");
        }
 public StateTransitionTests(string environment) : base(environment)
 {
     env = environment;
     borrowerRegistration            = CoreModelConstructors.CreateRegisterBorrowerRequest();
     loanApplicationClient           = new LoanApplicationClient();
     bcdClient                       = new LoanApplicationBcdClient();
     coreLoanApplicationStatusClient = new LoanApplicationStatusClient();
     loanApplicationStateClient      = new LoanApplicationStateClient();
 }
        public void PipelineLoanStateCoreTransitionToDecline()
        {
            var borrowerState = TransitionToReviewingState(borrowerRegistration);
            var stateClient   = new LoanApplicationClient();
            var noContent     = new ResponseObject <EmptyResult>();

            noContent = stateClient.ChangeStateToDecline(borrowerState.LoanApplicationGuid.ToString());
            Assert.That(noContent.statusCode == HttpStatusCode.OK);

            List <string> emails = GetAdverseActionsEmails(emailAddress);

            Assert.That(emails.Count > 0);
        }
        public void PipelineLoanStateCoreTransitionToAccepting()
        {
            var borrowerState = TransitionToReviewingState(borrowerRegistration);
            int emailCount    = GetEmails(emailAddress).Count;
            var stateClient   = new LoanApplicationClient();
            var noContent     = new ResponseObject <EmptyResult>();

            noContent = loanApplicationClient.SetLoanAppToAccept(borrowerState.LoanApplicationGuid.ToString());
            Assert.That(noContent.statusCode == HttpStatusCode.OK);

            var stateResult = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());

            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Accepting);

            List <string> emails = GetEmails(emailAddress);

            Assert.That(emails.Count > emailCount);
        }
예제 #5
0
        public static LoanApplicationCoreStateObject SubmitLoanApplication(string applicationGuid, RegisterBorrowerRequest borrower)
        {
            var loanApplicationClient = new LoanApplicationClient();
            var devinfo = new DeviceInfo();

            devinfo.BlackBoxId = "BlackBoxId".GetAppSetting();
            devinfo.IpAddress  = "127.0.0.1";
            SignAllPreLoanAppSubmitDocs(applicationGuid);
            var request = CoreModelConstructors.CreateLoanApplicationSubmitRequest(devinfo, 1, 1, 1, 1, borrower.Borrower.LastName);
            LoanApplicationCoreStateObject result = new LoanApplicationCoreStateObject();

            loanApplicationClient.SubmitLoanApplication(applicationGuid, request);
            result.ApplicaiontStatus   = LoanApplicationStatus.NewAppNeedInitialReview;
            result.ApplicationState    = LoanApplicationState.Reviewing;
            result.Borrower            = borrower;
            result.LoanApplicationGuid = new Guid(applicationGuid);
            return(result);
        }
예제 #6
0
        public static LoanApplicationCoreStateObject TransitionToReviewingState(RegisterBorrowerRequest borrowerRegistration)
        {
            var loanApplicationClient = new LoanApplicationClient();
            var statusUpdateClient    = new LoanApplicationStatusClient();
            var borrowerState         = GetBorrowerWithAllStipsButEmailAndBankverification(borrowerRegistration);
            var stateResult           = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());

            EmailVerification(borrowerState.LoanApplicationGuid.ToString(), borrowerRegistration.Borrower.EmailAddress);

            var statusUpdateResponse = statusUpdateClient.UpdateStatusJob();

            stateResult = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());

            var request = CoreModelConstructors.CreateCoreLinkBankAccountRequest("wells", (Guid)borrowerState.LoanApplicationGuid, "plaid_test", "plaid_good", PIEPER_JONES.Common.Enums.BankProvider.Plaid);

            BankLinking(borrowerState.LoanApplicationGuid.ToString(), (Guid)borrowerState.BorrowerGuid, borrowerRegistration, request);
            statusUpdateResponse = statusUpdateClient.UpdateStatusJob();
            stateResult          = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());
            borrowerState        = SubmitLoanApplication(borrowerState.LoanApplicationGuid.ToString(), borrowerRegistration);
            stateResult          = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());
            return(borrowerState);
        }
예제 #7
0
        public static ResponseObject <GetOffersResponse> UpdateLoanApplicationPassStips(string loanApplicationGuid)
        {
            var loanAppClient      = new LoanApplicationClient();
            var loanApp            = loanAppClient.GetLoanApplication(loanApplicationGuid);
            var saveLoanAppRequest = new UpdateLoanApplicationRequest();

            saveLoanAppRequest.LoanApplication = loanApp.content;

            saveLoanAppRequest.LoanApplicationVerificationFlags = new LoanApplicationVerificationFlags();
            saveLoanAppRequest.LoanApplicationVerificationFlags.AccountHolderVerified      = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.AccountNumberVerified      = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.AddressVerified            = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.DobVerified                = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.EmailVerified              = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.EmployerNameVerified       = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.EmploymentStatusVerified   = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.NameVerified               = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.OtherContactNumberVerified = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.OwnRentVerified            = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.PrimaryPhoneNumberVerified = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.SsnVerified                = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.WorkAddressVerified        = true;
            saveLoanAppRequest.LoanApplicationVerificationFlags.WorkPhoneNumberVerified    = true;
            saveLoanAppRequest.VerifiedBorrowerIncome = loanApp.content.LoanFile.Borrowers[0].AnnualIncome;
            saveLoanAppRequest.VerifiedBorrowerDebt   = loanApp.content.LoanFile.Debt[0].Amount;
            //saveLoanAppRequest.VerifiedBorrowerIncome
            //Dispositions for uploaded files
            var docGuids = GetFileUploadGuids(loanApplicationGuid);

            foreach (string dg in docGuids)
            {
                ResponseObject <EmptyResult> disposition = new UploadedDocumentsClient().DocumentDisposition(dg, "Pass");
            }

            var findAlertsRequest = new SearchAlertFlagsRequest();

            findAlertsRequest.LoanApplicationGuid = new Guid(loanApplicationGuid);
            var alertsClient = new AlertFlagClient();
            var alerts       = alertsClient.AlertFlagSearch(findAlertsRequest);
            var agentGuid    = (Guid)GetAgentByUserName("uw").agentGuid;
            var agent        = GetAgentByUserName("uw");

            if (ClearAlerts(alerts.content, agent) == false)
            {
                Assert.Fail("Cannot continue because alerts could not be cleared.");
            }

            var findDataObjectsRequest = new SearchDataObjectRequest();

            findDataObjectsRequest.LoanApplicationGuid = new Guid(loanApplicationGuid);
            var dataObjectClient = new DataObjectClient();
            var dataObjects      = dataObjectClient.DataObjectSearch(findDataObjectsRequest);

            if (DispositionDataObjects(dataObjects.content, agent, Disposition.FalsePositive) == false)
            {
                Assert.Fail("Cannot continue because data object could not be dispositioned.");
            }

            var response         = loanAppClient.SaveLoanApplicationUW(saveLoanAppRequest);
            var hardPullResponse = new LoanApplicationThirdPartyClient().RunHardPull(loanApplicationGuid);
            var reprice          = new LoanApplicationOffersClient().Reprice(loanApplicationGuid);

            return(reprice);
        }
        public static bool ReviewStatusTransitions(Guid?loanAppInfoGuid, LoanApplicationStatus targetStatus)
        {
            var client = new LoanApplicationClient();

            switch (targetStatus)
            {
            case (LoanApplicationStatus.InReviewNeedDecision):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.EscalatedNeedFAReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToFA);
                break;

            case (LoanApplicationStatus.EscalatedNeedFAManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToFA);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FAM, "clpfam");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.EscalatedNeedUWManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UWM, "clpuwm");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.EditRequestNeedUWReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString(), "Approve");
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.ReturnedfromVerbalNeedUWReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Escalate);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                break;

            case (LoanApplicationStatus.ReturnedfromFundingNeedUWManagerReview):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UWM, "clpuwm");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                VerbalVerification(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.PassVerbal);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.ReturnToUW);
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.EscalateToManager);
                break;

            case (LoanApplicationStatus.ApprovedPendingNote):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Approve);
                break;

            case (LoanApplicationStatus.NoteSignedNeedVerbal):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                SignLoanPacket(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                break;

            case (LoanApplicationStatus.VerbalVerifiedNeedFunding):
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.UW, "clpuw");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FA, "clpfa");
                AssignAgentToLoanApplication((Guid)loanAppInfoGuid, AgentRole.FAM, "clpfam");
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.SendToUW);
                UpdateLoanApplicationPassStips(loanAppInfoGuid.ToString());
                DispositionOfUploadedFiles(loanAppInfoGuid.ToString());
                SignPromissoryAndFTIL(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.Counter);
                SignLoanPacket(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.VerbalQueue);
                VerbalVerification(loanAppInfoGuid.ToString());
                client.WorkflowAction(loanAppInfoGuid.ToString(), LoanApplicationWorkflowAction.PassVerbal);
                break;

            default:
                log.Error($"Functionality for LoanApplicationStatus {targetStatus.ToString()} is Not Available for this method");
                return(false);
            }

            var statusClient = new LoanApplicationStatusClient();

            statusClient.UpdateStatusByLoanApplication(loanAppInfoGuid.ToString());
            var statusResponse = statusClient.GetStatusByLoanApplication(loanAppInfoGuid.ToString());

            if (statusResponse.statusCode != HttpStatusCode.OK || statusResponse.content == null)
            {
                log.Error($"Error in checking the response of our status request (null content or invalid statuscode).");
                return(false);
            }
            else
            {
                if (statusResponse.content.LoanApplicationStatus == targetStatus)
                {
                    return(true);
                }
                else
                {
                    log.Error($"Wrong status generated for our request to transition to {targetStatus.ToString()} we received {statusResponse.content.LoanApplicationStatus.ToString()}.");
                    return(false);
                }
            }
        }