Exemplo n.º 1
0
        // return a borrower that has registered and accepted the primary offer
        public static LoanApplicationAgentStateObject GetPrimaryOffer(RegisterBorrower.Request borrower, Guid applicationGuid, string borrowerGuid = null)
        {
            var loanApplicationOffersClient = new LoanApplicationOffersClient();
            var offerJson = new GetOffers.GenerateRequest();

            offerJson.LoanAmount = borrower.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 LoanApplicationAgentStateObject();

            stateObject.Borrower = borrower;

            if (borrowerGuid != null)
            {
                stateObject.BorrowerGuid = new Guid(borrowerGuid);
            }

            stateObject.OfferGuid           = new Guid(offerGuid);
            stateObject.LoanApplicationGuid = applicationGuid;
            return(stateObject);
        }
Exemplo n.º 2
0
        public static LoanApplicationAgentStateObject GetBorrowerToQuoting(RegisterBorrower.Request borrower, Guid applicationGuid)
        {
            var loanApplicationOffersClient = new LoanApplicationOffersClient();
            var offerJson = new GetOffers.GenerateRequest();

            offerJson.LoanAmount = borrower.RequestedLoanAmount;

            var result      = loanApplicationOffersClient.GenerateOffers(offerJson, applicationGuid.ToString());
            var stateObject = new LoanApplicationAgentStateObject();

            stateObject.Borrower            = borrower;
            stateObject.LoanApplicationGuid = applicationGuid;
            return(stateObject);
        }
Exemplo n.º 3
0
        public static LoanApplicationAgentStateObject RegisteredBorrower(RegisterBorrower.Request borrower)
        {
            // check email availability
            var Client           = new BorrowersClient();
            var registerResponse = Client.RegisterBorrower(borrower);
            var result           = new LoanApplicationAgentStateObject();

            if (registerResponse.statusCode != HttpStatusCode.Created || registerResponse.content == null)
            {
                log.Info($"Borrower Registration Failed.");
                return(null);
            }

            result.Borrower            = borrower;
            result.BorrowerGuid        = (Guid)registerResponse.content.BorrowerGuid;
            result.LoanApplicationGuid = (Guid)registerResponse.content.LoanApplicationGuid;

            return(result);
        }