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); }
public static GetLoanRequest MapSsnToGetRequest(string ssn, int maxEntities) { _log.Debug("START MapSsnToGetRequest"); GetLoanRequest request = new GetLoanRequest(); CriteriaLoan_Ssn c = new CriteriaLoan_Ssn(); c.MaxEntities = maxEntities; c.CriterionSSN = new ASA.Web.Services.LoanService.Proxy.LoanManagement.CriterionSSNType(); c.CriterionSSN.SSN = ssn; c.CriterionSSN.LogicalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.LogicalOperatorType.AND; c.CriterionSSN.RelationalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.RelationalOperatorType.EQUALS; c.CriterionRoleId = new ASA.Web.Services.LoanService.Proxy.LoanManagement.CriterionRoleIdType(); c.CriterionRoleId.RoleId = "BORR"; c.CriterionRoleId.LogicalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.LogicalOperatorType.AND; c.CriterionRoleId.RelationalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.RelationalOperatorType.EQUALS; c.CriterionIsArchived = new ASA.Web.Services.LoanService.Proxy.LoanManagement.CriterionIsArchivedType(); c.CriterionIsArchived.IsArchived = ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.N; c.CriterionIsArchived.LogicalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.LogicalOperatorType.AND; c.CriterionIsArchived.RelationalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.RelationalOperatorType.EQUALS; c.CriterionInputSourceId = new ASA.Web.Services.LoanService.Proxy.LoanManagement.CriterionInputSourceIDType(); c.CriterionInputSourceId.InputSourceId = "DER"; c.CriterionInputSourceId.LogicalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.LogicalOperatorType.AND; c.CriterionInputSourceId.RelationalOperator = ASA.Web.Services.LoanService.Proxy.LoanManagement.RelationalOperatorType.CONTAINS; c.ListReturnTypes = new ASA.Web.Services.LoanService.Proxy.LoanManagement.ReturnListType(); c.ListReturnTypes.LoanTier2Type = ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.Y; c.ListReturnTypes.LoanTier2OrganizationArray = ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.Y; c.ListReturnTypes.LoanTier2PersonArray = ASA.Web.Services.LoanService.Proxy.LoanManagement.YNFlagType.Y; //set sort values. This will help (but not gaurantee) that the newer IsArchived=N, InputSourceId %DER% // are more likely to be in the list of loans returned. SortFields sortFields = new SortFields(); sortFields.IsArchived = SortOperatorType.DESC; sortFields.InputSourceId = SortOperatorType.ASC; c.SortFields = sortFields; request.Criteria = c as LoanServiceCriteriaType; _log.Debug("END MapSsnToGetRequest"); return(request); }
public override Loan Get(string id) { Known.TryGetValue(id, out var returned); if (returned == null) { var result = new GetLoanRequest(id).Execute(Api.Client); if (result.Status == 200) { returned = new Loan(); returned.UpdateFromRequest(Utils.DictionaryOfJsonFields(result.Data.Loan)); Known.Add(returned.Id, returned); } } return(returned); }
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); }
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); }