public StateTransitionTests(string environment) : base(environment)
 {
     env = environment;
     borrowerRegistration            = CoreModelConstructors.CreateRegisterBorrowerRequest();
     loanApplicationClient           = new LoanApplicationClient();
     bcdClient                       = new LoanApplicationBcdClient();
     coreLoanApplicationStatusClient = new LoanApplicationStatusClient();
     loanApplicationStateClient      = new LoanApplicationStateClient();
 }
        public static LoanApplicationCoreStateObject NewAppToAssignBCD(RegisterBorrowerRequest borrowerRegistration, AgentRole role, string employmentAddress1, string employmentAddress2, string employmentCity, string employmentState, string employmentZipCode, int yearsEmployed, string phoneNumber, string phoneExtension)
        {
            var loanInfoObject = TransitionToReviewingState(borrowerRegistration);

            AssignAgentToLoanApplication((Guid)loanInfoObject.LoanApplicationGuid, role);
            loanInfoObject.ApplicaiontStatus = LoanApplicationStatus.NewAppNeedInitialReview;
            loanInfoObject.ApplicationState  = LoanApplicationState.Reviewing;
            return(loanInfoObject);
        }
        public static LoanApplicationCoreStateObject GetBorrowerToQuoting(RegisterBorrowerRequest borrower, Guid applicationGuid)
        {
            var loanApplicationOffersClient = new LoanApplicationOffersClient();
            var offerJson = new GenerateOffersRequest();

            offerJson.LoanAmount = borrower.LoanApplication.RequestedLoanAmount;
            var result      = loanApplicationOffersClient.GenerateOffers(offerJson, applicationGuid.ToString());
            var stateObject = new LoanApplicationCoreStateObject();

            stateObject.Borrower            = borrower;
            stateObject.LoanApplicationGuid = applicationGuid;
            return(stateObject);
        }
        public static LoanApplicationCoreStateObject LoanApplicationInApplyingState(RegisterBorrowerRequest borrower = null)
        {
            var result    = RegisterBorrower(borrower);
            var genOffers = new GenerateOffersRequest();

            genOffers.LoanAmount = result.Borrower.LoanApplication.RequestedLoanAmount == null ?
                                   (decimal?)(new Random().Next(5000, 35001)) : result.Borrower.LoanApplication.RequestedLoanAmount;
            var offers = GenerateOffers(genOffers, (Guid)result.LoanApplicationGuid);

            ChooseOffer((Guid)offers.LoanOfferGroup.LoanApplicationOffers[0].Guid);
            result.OfferGuid         = offers.LoanOfferGroup.LoanApplicationOffers[0].Guid;
            result.ApplicationState  = LoanApplicationState.Applying;
            result.ApplicaiontStatus = LoanApplicationStatus.AppStipsPending;
            return(result);
        }
        public static LoanApplicationCoreStateObject RegisterBorrower(RegisterBorrowerRequest borrower = null)
        {
            if (borrower == null)
            {
                borrower = CoreModelConstructors.CreateRegisterBorrowerRequest();
            }

            var  borrowersClient = new BorrowersClient();
            var  result          = borrowersClient.BorrowerRegistration(borrower);
            var  borrowerGuid    = (Guid)result.content.BorrowerGuid;
            Guid?applicationGuid = result.content.LoanApplicationGuid;
            var  returnObject    = new LoanApplicationCoreStateObject();

            returnObject.Borrower            = borrower;
            returnObject.BorrowerGuid        = borrowerGuid;
            returnObject.LoanApplicationGuid = applicationGuid;
            returnObject.ApplicaiontStatus   = LoanApplicationStatus.OfferSelectPending;
            returnObject.ApplicationState    = LoanApplicationState.Quoting;
            return(returnObject);
        }
        public static void BankLinking(string applicationGuid, Guid borrowerGuid, RegisterBorrowerRequest borrower, LinkBankAccount.Request request)
        {
            var req  = new LinkBankAccount.Request();
            var bank = new Bank();

            bank.Name               = "Wells Fargo Bank";
            bank.Id                 = "wells";
            bank.Provider           = BankProvider.Plaid;
            req.LoanApplicationGuid = new Guid(applicationGuid);
            req.Username            = "******";
            req.Password            = "******";
            req.Bank                = bank;
            var client   = new BankVerificationClient();
            var response = client.BankLinking(applicationGuid, req);
            var account  = response.content.Accounts[0];
            var sBank    = new SetBankAccount.Request();

            sBank.BankAccountGuid = (Guid)account.Guid;
            var bClient = new BorrowerBankAccountsClient();

            bClient.CreateBankAccount(sBank, applicationGuid);
        }
        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);
        }
        // return a borrower that has registered and accepted the primary offer
        public static LoanApplicationCoreStateObject GetPrimaryOffer(RegisterBorrowerRequest borrower, Guid applicationGuid, string borrowerGuid = null)
        {
            var loanApplicationOffersClient = new LoanApplicationOffersClient();
            var offerJson = new GenerateOffersRequest();

            offerJson.LoanAmount = borrower.LoanApplication.RequestedLoanAmount;
            var result = loanApplicationOffersClient.GenerateOffers(offerJson, applicationGuid.ToString());

            result = loanApplicationOffersClient.GetOffer(applicationGuid.ToString());
            var offerGuid    = result.content.LoanOfferGroup.LoanApplicationOffers[0].Guid.ToString();
            var offersClient = new OffersClient();
            var noResult     = offersClient.SelectOffer(offerGuid);
            var stateObject  = new LoanApplicationCoreStateObject();

            stateObject.Borrower = borrower;
            if (borrowerGuid != null)
            {
                stateObject.BorrowerGuid = new Guid(borrowerGuid);
            }
            stateObject.OfferGuid           = new Guid(offerGuid);
            stateObject.LoanApplicationGuid = applicationGuid;
            return(stateObject);
        }
 public void SetUp()
 {
     borrowerRegistration = CoreModelConstructors.CreateRegisterBorrowerRequest();
     emailAddress         = borrowerRegistration.Borrower.EmailAddress;
 }
        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);
        }
        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);
        }
        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);
        }
        public static LoanApplicationCoreStateObject GetBorrowerWithAllStipsButBankverification(RegisterBorrowerRequest borrower)
        {
            var borrowerState = GetBorrowerWithAllStipsButEmailAndBankverification(borrower);

            EmailVerification(borrowerState.LoanApplicationGuid.ToString(), borrowerState.Borrower.Borrower.EmailAddress);
            //Get all of these updated via the "30 second job"
            borrowerState.LoanApplicationStipsCompleted++;
            return(borrowerState);
        }
Beispiel #14
0
 public PipelineAgentStatusAccessTests(string environment) : base(environment)
 {
     coreAgentClient      = new AgentsClient();
     borrowerRegistration = CoreModelConstructors.CreateRegisterBorrowerRequest();
     env = environment;
 }