Example #1
0
        public GetLoanResponse GetLoan(GetLoanRequest getRequest)
        {
            //TODO: Populate fake GetLoanResponse object here...
            GetLoanResponse response = new GetLoanResponse();

            response.LoanCanonical    = new LoanCanonicalType[4];
            response.LoanCanonical[0] = GetNewLoanCanonicalType(7, new DateTime(2006, 5, 28), 4000.00M, 400.00M, "School of Good Times", "Fake Money Lender");
            response.LoanCanonical[1] = GetNewLoanCanonicalType(8, new DateTime(2006, 6, 13), 3000.00M, 300.00M, "Univ of Rock n'Roll", "Bags O' Cash Lending");
            response.LoanCanonical[2] = GetNewLoanCanonicalType(9, new DateTime(2008, 9, 10), 2225.99M, 19.95M, "The Mock School of Test Data", "Bank of Fake Currency");
            response.LoanCanonical[3] = GetNewLoanCanonicalType(10, new DateTime(2009, 9, 6), 1000.00M, 19.95M, "Graduate School of Basket Weavers", "Bank of Dad's Wallet");
            return(response);
        }
Example #2
0
        public SelfReportedLoanListModel GetLoans(string ssn, ASAMemberModel member)
        {
            _log.Debug("START GetLoans");
            SelfReportedLoanListModel srlList = null;

            if (member != null) //TODO: Mehdi && member.Source != SourceType.SELF_REGISTERED_NO_MATCH)
            {
                ////the following hardcoded values are only for when you're being lazy and dont want to find a person to test GetPerson, MatchingPersonFound, and GetLoan
                //member.FirstName = "Dwayne";
                //member.LastName = "Baker";
                //member.DOB = new DateTime(1976,1,30);
                //member.IndividualId = "967A954B-AB09-4713-9B6E-2067B8C3F992";
                //ssn = "803450294";

                // See if person is in ODS for this SSN
                GetPersonRequest  getPersonRequest  = TranslateLoanModel.MapSSNToGetPersonRequest(ssn);
                GetPersonResponse getPersonResponse = _proxyPerson.GetPerson(getPersonRequest);

                // if person was retrieved, do they match the FName, LName, and DOB from context?
                bool personMatchFound = MatchingPersonFound(member, getPersonResponse);

                if (personMatchFound)
                {
                    _log.Debug("personMatchFound.");
                    // save this person's SSN from ODS to Avectra
                    bool ssnSaved = SaveSSNToAvectra(member, ssn);

                    if (ssnSaved)
                    {
                        // go get this person's Loans from ODS
                        GetLoanRequest  getRequest = TranslateLoanModel.MapSsnToGetRequest(ssn, Config.LoanServiceMaxEntities);
                        GetLoanResponse response   = _proxyLoan.GetLoan(getRequest);
                        srlList = TranslateLoanModel.MapGetResponseToModel(response, member.IndividualId);
                    }
                }
                else
                {
                    _log.Debug("NOT personMatchFound.");
                }
            }

            _log.Debug("END GetLoans");
            return(srlList);
        }
Example #3
0
        public GetLoanResponse GetLoan(GetLoanRequest getRequest)
        {
            _log.Debug("InvokeLoanManagementService.GetLoan() starting ...");
            LoanManagementClient client = null;

            GetLoanResponse response = null;

            try
            {
                client = new LoanManagementClient();
                _log.Debug("client created successfully");
                ILoanManagement lm = (ILoanManagement)client;
                response = lm.GetLoan(getRequest);
                _log.Debug("response was received from ODS LoanManagement service");
            }
            catch (TimeoutException timeout)
            {
                _log.Error("InvokeLoanManagementService.GetLoan() Timeout Exception:" + timeout.Message);
                ProxyHelper.HandleServiceException(client);
            }
            catch (CommunicationException comm)
            {
                _log.Error("InvokeLoanManagementService.GetLoan() Communication Exception:" + comm.Message);
                ProxyHelper.HandleServiceException(client);
            }
            catch (Exception e)
            {
                _log.Error("InvokeLoanManagementService.GetLoan() Exception:" + e.Message);
            }
            finally
            {
                if (client != null && client.State != CommunicationState.Closed)
                {
                    ProxyHelper.CloseChannel(client);
                }
            }

            _log.Debug("InvokeLoanManagementService.GetLoan() ending ...");
            return(response);
        }
Example #4
0
        public static SelfReportedLoanListModel MapGetResponseToModel(GetLoanResponse response, string individualId)
        {
            _log.Debug("START MapGetResponseToModel");
            SelfReportedLoanListModel loanList = new SelfReportedLoanListModel();

            if (response != null)
            {
                if (response.LoanCanonical != null && response.LoanCanonical.Length > 0)
                {
                    for (int i = 0; i < response.LoanCanonical.Length; i++)
                    {
                        _log.Debug("mapping info for ODS Loan with LoanId = " + response.LoanCanonical[i].LoanTier2.LoanInfoType.LoanId);
                        LoanTier2Type tier2 = response.LoanCanonical[i].LoanTier2;
                        //QC 3926: Should only be showing the users loans where "IsArchived" = 'N', and InputSourceId like '%DER%'.
                        if (tier2.LoanInfoType.IsArchived == ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.N &&
                            tier2.LoanInfoType.InputSourceId != null &&
                            tier2.LoanInfoType.InputSourceId.ToUpper().Contains("DER")
                            )
                        {
                            SelfReportedLoanModel srModel = new SelfReportedLoanModel();
                            srModel.IndividualId    = individualId;
                            srModel.AccountNickname = ""; // "Imported Loan " + i;     // INFO NOT AVAILALBE ON LOAN. Can be provided by borrower in UI.
                            srModel.HolderName      = GetDepartmentName(tier2.OrganizationArray, "HOLD");
                            //QC 3922:  Interest rate is a fraction of 1 in ODS, and needs to display as a whole number in SALT.
                            //  Hence, we've added the multiply by 100 here.
                            if (tier2.LoanInfoType.InterestRate != null)
                            {
                                srModel.InterestRate = Math.Round((double)(tier2.LoanInfoType.InterestRate * 100), 3, MidpointRounding.AwayFromZero);
                            }
                            srModel.OriginalLoanAmount                = tier2.LoanInfoType.ApprovedLoanAmount; //TODO: is this correct mapping?
                            srModel.IsActive                          = true;
                            srModel.LoanSelfReportedEntryId           = "";                                    //note: cant give it a PK here... must treat all of these as if they are unsaved SRLE's.
                            srModel.LoanStatusId                      = tier2.LoanInfoType.LoanStatusId;
                            srModel.LoanTypeId                        = tier2.LoanInfoType.LoanTypeId;
                            srModel.NextPaymentDueAmount              = tier2.RepaymentInfoType.NextPaymentDueAmount;
                            srModel.NextPaymentDueDate                = tier2.RepaymentInfoType.NextPaymentDueDate;
                            srModel.PaymentDueAmount                  = tier2.RepaymentInfoType.NextPaymentDueAmount;
                            srModel.PrincipalBalanceOutstandingAmount = tier2.LoanInfoType.OutstandingPrincipalBalance;
                            srModel.SchoolName                        = GetDepartmentName(tier2.OrganizationArray, "SCHL");
                            srModel.ServicerName                      = GetDepartmentName(tier2.OrganizationArray, "SERV");
                            srModel.ServicerWebAddress                = ""; //is there something I don't know about that can provide this info??
                            srModel.LoanTerm                          = 10; //defaulting to 10 for now.  Will likely get more requirements for future releases.

                            loanList.Loans.Add(srModel);
                        }
                    }
                }
                else if (response.ResponseMessageList != null && response.ResponseMessageList.Count > 0)
                {
                    for (int i = 0; i < response.ResponseMessageList.Count; i++)
                    {
                        _log.Info("ResponseMessageList[" + i + "].MessageDetails = " + response.ResponseMessageList[i].MessageDetails);
                        ErrorModel error = new ErrorModel(response.ResponseMessageList[i].MessageDetails, "Web Loan Service", response.ResponseMessageList[i].ResponseCode);
                        loanList.ErrorList.Add(error);
                    }
                }
                else
                {
                    _log.Warn("An error occured in MapGetResponseToModel when trying to retrieve loan information. Canonical not found.");
                    ErrorModel error = new ErrorModel("An error occured when trying to retrieve loan information", "Web Loan Service");
                    loanList.ErrorList.Add(error);
                }
            }
            else
            {
                ErrorModel error = new ErrorModel("No valid response was received from the Loan Management service", "Web Loan Service");
                loanList.ErrorList.Add(error);
            }
            _log.Debug("END MapGetResponseToModel");
            return(loanList);
        }