Ejemplo n.º 1
0
        public static LoanApplicationCoreStateObject GetBorrowerWithAllStipsButIDVerification(RegisterBorrowerRequest borrower, string employerAddress1, string employerAddress2, string employerCity, string employerState, string employerZipCode,
                                                                                              string currentEmployer, int lengthYears, string phoneNumber, string phoneExtension, string jobTitle, DateTime startDate, EmploymentStatus status)
        {
            var statusClient  = new LoanApplicationStatusClient();
            var filePath      = AppDomain.CurrentDomain.BaseDirectory.ToString() + "Resources\\";
            var fileName      = "logo.jpg";
            var borrowerState = RegisterBorrower(borrower);

            borrowerState = GetPrimaryOffer(borrowerState.Borrower, (Guid)borrowerState.LoanApplicationGuid, borrowerState.BorrowerGuid.ToString());
            var employmentUpdate = CoreModelConstructors.CreateUpdateEmploymentRequestAuto();

            EmploymentInformation(employmentUpdate, (Guid)borrowerState.BorrowerGuid);
            borrowerState.LoanApplicationStipsCompleted++;
            var statusNoContent = statusClient.UpdateStatusJob();

            //ID
            EmailVerification(borrowerState.BorrowerGuid.ToString(), borrowerState.Borrower.Borrower.EmailAddress);
            var request = CoreModelConstructors.CreateCoreLinkBankAccountRequest("wells", (Guid)borrowerState.LoanApplicationGuid, "plaid_test", "plaid_good", PIEPER_JONES.Common.Enums.BankProvider.Plaid);

            statusNoContent = statusClient.UpdateStatusJob();
            IncomeVerification(borrowerState.LoanApplicationGuid.ToString(), filePath, fileName, null);
            borrowerState.LoanApplicationStipsCompleted++;
            statusNoContent = statusClient.UpdateStatusJob();
            BankStatementVerification(borrowerState.LoanApplicationGuid.ToString(), filePath, fileName, null);
            borrowerState.LoanApplicationStipsCompleted++;
            statusNoContent = statusClient.UpdateStatusJob();
            UpdateHomePayment(1700, GetRandomEnumValue <OccupancyStatus>(), borrowerState.BorrowerGuid.ToString());
            borrowerState.LoanApplicationStipsCompleted++;
            //Get all of these updated via the "batch job"
            statusNoContent = statusClient.UpdateStatusJob();
            return(borrowerState);
        }
Ejemplo n.º 2
0
        public static LoanApplicationCoreStateObject GetBorrowerWithAllStipsButEmailAndBankverificationAuto(RegisterBorrowerRequest borrower, string address1, string address2, string city, string state, string zipCode, string currentEmployer, int lengthYears, string phoneNumber, string extension, string jobTitle, DateTime startDate, EmploymentStatus status)
        {
            var statusClient  = new LoanApplicationStatusClient();
            var filePath      = AppDomain.CurrentDomain.BaseDirectory.ToString() + "Resources\\";
            var borrowerState = RegisterBorrower(borrower);

            borrowerState = GetPrimaryOffer(borrowerState.Borrower, (Guid)borrowerState.LoanApplicationGuid, borrowerState.BorrowerGuid.ToString());
            var employmentUpdate = CoreModelConstructors.CreateUpdateEmploymentRequestAuto();

            EmploymentInformation(employmentUpdate, (Guid)borrowerState.BorrowerGuid);
            borrowerState.LoanApplicationStipsCompleted++;
            var statusNoContent = statusClient.UpdateStatusJob();

            IdentityVerification(borrowerState.LoanApplicationGuid.ToString(), filePath, "PhotoID.pdf", null);
            borrowerState.LoanApplicationStipsCompleted++;
            statusNoContent = statusClient.UpdateStatusJob();
            IncomeVerification(borrowerState.LoanApplicationGuid.ToString(), filePath, "W2.pdf", null);
            borrowerState.LoanApplicationStipsCompleted++;
            statusNoContent = statusClient.UpdateStatusJob();
            BankStatementVerification(borrowerState.LoanApplicationGuid.ToString(), filePath, "BankStatement.pdf", null);
            borrowerState.LoanApplicationStipsCompleted++;
            statusNoContent = statusClient.UpdateStatusJob();
            UpdateHomePayment(1700, GetRandomEnumValue <OccupancyStatus>(), borrowerState.BorrowerGuid.ToString());
            borrowerState.LoanApplicationStipsCompleted++;
            //Get all of these updated via the "batch job"
            statusNoContent = statusClient.UpdateStatusJob();
            return(borrowerState);
        }
Ejemplo n.º 3
0
 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 PipelineLoanStateAllStipsButEmailVerificationAndBankLinking()
        {
            var statusUpdateClient = new LoanApplicationStatusClient();
            var borrowerState      = GetBorrowerWithAllStipsButEmailAndBankverification(borrowerRegistration);

            //All Stips are completed now besides Email and BankLinking...now fill out bank linking...
            var stateResult = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());

            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Applying);
            Assert.That(stateResult.content.LoanApplicationStatus == LoanApplicationStatus.AppStipsPending);

            //Link Bank Account
            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);
            //All Stips but EmailVerification let's verifyEmail
            var statusUpdateResponse = statusUpdateClient.UpdateStatusJob();

            stateResult = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());
            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Applying);

            //Now that we are down to one REAL stip, we check for EmailOnlyPending
            Assert.That(stateResult.content.LoanApplicationStatus == LoanApplicationStatus.EmailOnlyPending);

            //Verify The Email Address and check status again
            EmailVerification(borrowerState.LoanApplicationGuid.ToString(), borrowerRegistration.Borrower.EmailAddress);

            //We should now be ready for the AppSubmitPending status
            statusUpdateResponse = statusUpdateClient.UpdateStatusJob();
            stateResult          = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());
            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Applying);
            Assert.That(stateResult.content.LoanApplicationStatus == LoanApplicationStatus.AppSubmitPending);

            //Ready to Submit the LoanApplication now
            SubmitLoanApplication(borrowerState.LoanApplicationGuid.ToString(), borrowerRegistration);
            stateResult          = loanApplicationClient.Status(borrowerState.LoanApplicationGuid.ToString());
            statusUpdateResponse = statusUpdateClient.UpdateStatusJob();

            //Now to move to Review
            Assert.That(stateResult.content.LoanApplicationState == LoanApplicationState.Reviewing);
            Assert.That(stateResult.content.LoanApplicationStatus == LoanApplicationStatus.NewAppNeedInitialReview, $"Did not successfully transition to status NewAppNeedInitialReview, status is {stateResult.content.LoanApplicationStatus}.");
        }
Ejemplo n.º 5
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);
        }
        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);
                }
            }
        }