public CT_SearchResult TestGetData() { var user = InitializeUser(); var retrievedata = new CallCreditGetData(user); CT_SearchResult apiresult = retrievedata.GetSearch07a(); /* ParseCallCreditTest testsave = new ParseCallCreditTest(apiresult, 1); * testsave.Execute();*/ return(null); }
public void makeCall() { CallcreditBsbAndCreditReport apiProxy = InitializeApiProxy(); UserInfo user = InitializeUser(); CT_SearchDefinition apiSD = InitializeApiRequest(user); CT_SearchResult apiresult = new CT_SearchResult(); apiresult = apiProxy.Search07a(apiSD); apiProxy.Dispose(); }
public CT_SearchResult GetSearch07a() { CT_SearchResult apiresult = new CT_SearchResult(); apiresult = apiProxy.Search07a(apiSD); return(apiresult); //XmlSerializer serializer = new XmlSerializer(typeof(CT_SearchResult)); //TextWriter writer = new StreamWriter(@"C:\temp1\Xml.xml"); //serializer.Serialize(writer, apiresult); //CallCreditModelBuilder modelbuilder = new CallCreditModelBuilder(); //CallCredit BaseData = modelbuilder.Build(apiresult); //BaseData.Apiresult = apiresult; //return BaseData; }
public static void Main() { try { CallcreditBsbAndCreditReport apiProxy = InitializeApiProxy(); UserInfo user = InitializeUser(); CT_SearchDefinition apiSD = InitializeApiRequest(user); CT_SearchResult apiresult = new CT_SearchResult(); apiresult = apiProxy.Search07a(apiSD); var builder = new CallCreditModelBuilder(); builder.Build(apiresult); Console.WriteLine("====" + apiresult.creditrequest.applicant.Length); Console.WriteLine("====" + apiresult.creditrequest.applicant[0].dob); } catch (Exception e) { Console.WriteLine(e); //throw; } /*apiProxy.Dispose();*/ } // Main
} //GetServiceOutput private void GetCallCreditData(InputLocationDetailsUKLocation ukLocation, string firstName, string surname, DateTime?birthDate, string postcode, int customerId, int?directorId) { if (!CurrentValues.Instance.CallCreditEnabled) { Log.InfoFormat( "Not retrieving CallCredit data for customer {0} director {1}: CallCredit is disabled.", customerId, directorId ); return; } // if try { Log.InfoFormat("Retrieving CallCredit data for customer {0} director {1}", customerId, directorId); var searchRequest = new CT_searchapplicant { dob = birthDate ?? DateTime.UtcNow, dobSpecified = birthDate.HasValue, name = new[] { new CT_inputname { forename = firstName, surname = surname, } }, address = new[] { new CT_inputaddress { postcode = ukLocation.Postcode, street1 = ukLocation.Street, street2 = ukLocation.Street2, startdateSpecified = false, enddateSpecified = false, buildingname = ukLocation.HouseName, buildingno = ukLocation.HouseNumber, posttown = ukLocation.PostTown, } }, tpoptout = 0, tpoptoutSpecified = true }; CallCreditLib.CallCreditGetData callCreditGetData = new CallCreditGetData(searchRequest); CT_SearchResult searchResponse = callCreditGetData.GetSearch07a(); Log.InfoFormat( "Saving to ServiceLog CallCredit data fro customer {0} director {1}", customerId, directorId ); Utils.WriteLog( searchRequest, searchResponse, ExperianServiceType.CallCredit, customerId, directorId, firstName, surname, birthDate, postcode ); } catch (Exception ex) { Log.Error("Failed retrieve from data CallCredit", ex); } //try } //GetCallCreditData
public CallCredit Build(CT_SearchResult response, int?customerId, int?directorId, DateTime?insertDate, long serviceLogId) { /*Console.WriteLine(response.token); * return null;*/ var result = new CallCredit { ApplicantData = new List <CallCreditData>(), Amendments = new List <CallCreditAmendments>(), ApplicantAddresses = new List <CallCreditApplicantAddresses>(), ApplicantNames = new List <CallCreditApplicantNames>(), Email = new List <CallCreditEmail>(), Telephone = new List <CallCreditTelephone>(), MP_ServiceLogId = serviceLogId, CustomerId = customerId, DirectorId = directorId, InsertDate = insertDate ?? DateTime.UtcNow }; if (response == null || response.creditreport == null) { result.HasCallCreditError = true; result.Error = "Creditreport is null"; return(result); } //report attributes TryRead(() => result.LinkType = response.creditreport.linktype, "report link type", false); TryRead(() => result.ReportSearchID = response.creditreport.searchid, "report search ID", false); //response set TryRead(() => result.PayLoadData = XSerializer.Serialize(response.payload), "Client's own data", false); TryRead(() => result.YourReference = response.yourreference, "User reference as part of search definition", false); TryRead(() => result.Token = response.token, "Client's own data", false); //request details as part of response TryRead(() => result.SchemaVersionCR = response.creditrequest.schemaversion, "The version of the schema for credit request", false); TryRead(() => result.DataSetsCR = (int)response.creditrequest.datasets, "Search datasets required for credit request, values 0 to 511", false); TryRead(() => result.Score = Convert.ToBoolean(response.creditrequest.score), "Score request check"); TryRead(() => result.Purpose = response.creditrequest.purpose, "Credit request search purpose"); TryRead(() => result.CreditType = response.creditrequest.credittype, "Credit type"); TryRead(() => result.BalorLim = (int)response.creditrequest.balorlim, "Balance or credit limit applied for", false); TryRead(() => result.Term = response.creditrequest.term, "Term of loan applied for", false); TryRead(() => result.Transient = Convert.ToBoolean(response.creditrequest.transient), "financial (transient) association check", false); TryRead(() => result.AutoSearch = Convert.ToBoolean(response.creditrequest.autosearch), "auto-searching of undeclared addresses check", false); TryRead(() => result.AutoSearchMaximum = (int)response.creditrequest.autosearchmaximum, "Maximum number of addresses to auto-search", false); //jobdetails TryRead(() => result.UniqueSearchID = response.jobdetails.searchid, "Unique identifier for Credit Reports", false); TryRead(() => result.CastInfo = response.jobdetails.cast, "CastInfo - Callcredit System Specific Information", false); TryRead(() => result.PSTV = response.jobdetails.pstv, "PSTV - Callcredit System Specific Information", false); TryRead(() => result.LS = response.jobdetails.ls, "LS - Callcredit System Specific Information", false); result.SearchDate = TryReadDate(() => response.jobdetails.searchdate, "Date and time that Search was carried out ", false); //linkrequest TryRead(() => result.SchemaVersionLR = response.linkrequest.schemaversion, "The version of the schema for link request", false); TryRead(() => result.DataSetsLR = (int)response.linkrequest.datasets, "Search datasets required for link request, values 0 to 511", false); TryRead(() => result.OrigSrchLRID = response.linkrequest.origsrchid, "Original report searchid", false); TryRead(() => result.NavLinkID = response.linkrequest.navlinkid, "Link navigation identifier of the link to be followed (either Address or Associate Link)", false); //subsequent equest TryRead(() => result.SchemaVersionSR = response.secondaryrequest.schemaversion, "The version of the schema for subsequent request", false); TryRead(() => result.DataSetsLR = (int)response.secondaryrequest.datasets, "Search datasets required for subsequent request, values 0 to 511", false); TryRead(() => result.OrigSrchSRID = response.secondaryrequest.origsrchid, "Original report searchid", false); //request applicant details as part of response result.Dob = TryReadDate(() => response.creditrequest.applicant[0].dob, "Applicant's date Of birth"); TryRead(() => result.Hho = Convert.ToBoolean(response.creditrequest.applicant[0].hho), "Household override check", false); TryRead(() => result.TpOptOut = Convert.ToBoolean(response.creditrequest.applicant[0].tpoptout), "Third party data opt out check"); //applicant demographics //person TryRead(() => result.CustomerStatus = response.creditrequest.applicant[0].applicantdemographics.person.customerstatus, "Customer Applicant Status Code ", false); TryRead(() => result.MaritalStatus = response.creditrequest.applicant[0].applicantdemographics.person.maritalstatus, "Applicant's Marital Status Code", false); TryRead(() => result.TotalDependents = (int)response.creditrequest.applicant[0].applicantdemographics.person.totaldependents, "Total number of dependent children", false); TryRead(() => result.LanguageVerbal = response.creditrequest.applicant[0].applicantdemographics.person.language, "Language Code", false); //Identity TryRead(() => result.Type1 = response.creditrequest.applicant[0].applicantdemographics.person.identity[0].type, "Identity Type Code 1", false); TryRead(() => result.Type2 = response.creditrequest.applicant[0].applicantdemographics.person.identity[1].type, "Identity Type Code 2", false); TryRead(() => result.Type3 = response.creditrequest.applicant[0].applicantdemographics.person.identity[2].type, "Identity Type Code 3", false); TryRead(() => result.Type4 = response.creditrequest.applicant[0].applicantdemographics.person.identity[3].type, "Identity Type Code 4", false); //Accommodation TryRead(() => result.AccommodationType = response.creditrequest.applicant[0].applicantdemographics.accommodation.type, "Accommodation Type Code", false); TryRead(() => result.PropertyValue = (int)response.creditrequest.applicant[0].applicantdemographics.accommodation.propertyvalue, "Estimate of how much the property is worth", false); TryRead(() => result.MortgageBalance = (int)response.creditrequest.applicant[0].applicantdemographics.accommodation.mortgagebalance, "The total amount of the mortgage still to be repaid", false); TryRead(() => result.MonthlyRental = (int)response.creditrequest.applicant[0].applicantdemographics.accommodation.monthlyrental, "The price that the applicant pays the home's owner for using the home", false); TryRead(() => result.ResidentialStatus = response.creditrequest.applicant[0].applicantdemographics.accommodation.residentialstatus, "Residential Status Code", false); //employment TryRead(() => result.Occupation = response.creditrequest.applicant[0].applicantdemographics.employment.occupation, "Occupation Code", false); TryRead(() => result.EmploymentStatus = response.creditrequest.applicant[0].applicantdemographics.employment.employmentstatus, "Employment Status Code", false); result.ExpiryDate = TryReadDate(() => response.creditrequest.applicant[0].applicantdemographics.employment.expirydate, "Employment Expiry Data - dependent on the Employment Status Code", false); TryRead(() => result.EmploymentRecency = response.creditrequest.applicant[0].applicantdemographics.employment.employmentrecency, "Employment Recency Code", false); TryRead(() => result.EmployerCategory = response.creditrequest.applicant[0].applicantdemographics.employment.employercategory, "Employer Category Code", false); TryRead(() => result.TimeAtCurrentEmployer = response.creditrequest.applicant[0].applicantdemographics.employment.timeatcurrentemployer, "Total number of months with the current employer", false); //account TryRead(() => result.SortCode = response.creditrequest.applicant[0].applicantdemographics.account.sortcode, "Bank sort code of main banking relationship", false); TryRead(() => result.AccountNumber = response.creditrequest.applicant[0].applicantdemographics.account.accountnumber, "Account number of main banking relationship", false); TryRead(() => result.TimeAtBank = response.creditrequest.applicant[0].applicantdemographics.account.timeatbank, "Total number of months with the current bank", false); TryRead(() => result.PaymentMethod = response.creditrequest.applicant[0].applicantdemographics.account.paymentmethod, "Account's Payment Method Code", false); TryRead(() => result.FinanceType = response.creditrequest.applicant[0].applicantdemographics.account.financetype, "Finance/Non Finance Type Code", false); //expenditure TryRead(() => result.TotalDebitCards = (int)response.creditrequest.applicant[0].applicantdemographics.expenditure.totaldebitcards, "Total number of cheque of debit cards linked directly to the customer's bank account", false); TryRead(() => result.TotalCreditCards = (int)response.creditrequest.applicant[0].applicantdemographics.expenditure.totalcreditcards, "Total number of credit or charge cards used to purchase goods and services on credit", false); TryRead(() => result.MonthlyUnsecuredAmount = (int)response.creditrequest.applicant[0].applicantdemographics.expenditure.monthlyunsecuredamount, "Monthly unsecured financial obligation owed to creditors", false); //main incom details TryRead(() => result.AmountPr = (int)response.creditrequest.applicant[0].applicantdemographics.income.primary.amount, "Amount of main income received according to frequency", false); TryRead(() => result.TypePr = response.creditrequest.applicant[0].applicantdemographics.income.primary.type, "Main income Type Code", false); TryRead(() => result.PaymentMethodPr = response.creditrequest.applicant[0].applicantdemographics.income.primary.paymentmethod, "Main income Payment Method Code", false); TryRead(() => result.FrequencyPr = response.creditrequest.applicant[0].applicantdemographics.income.primary.frequency, "Main income Frequency Code", false); //any additional incom details TryRead(() => result.AmountAd = (int)response.creditrequest.applicant[0].applicantdemographics.income.additional.amount, "Amount of additional income received according to frequency", false); TryRead(() => result.TypeAd = response.creditrequest.applicant[0].applicantdemographics.income.additional.type, "Additional income Type Code", false); TryRead(() => result.PaymentMethodAd = response.creditrequest.applicant[0].applicantdemographics.income.additional.paymentmethod, "Additional income Payment Method Code", false); TryRead(() => result.FrequencyAd = response.creditrequest.applicant[0].applicantdemographics.income.additional.frequency, "Additional income Frequency Code", false); CT_creditreport creditreport = response.creditreport; result.ApplicantData = BuildData(creditreport); result.Amendments = GetAmendments(response.secondaryrequest); result.ApplicantAddresses = GetApplicantAddresses(response.creditrequest); result.ApplicantNames = GetApplicantNames(response.creditrequest); result.Email = GetEmail(response.creditrequest.applicant[0].applicantdemographics); result.Telephone = GetTelephone(response.creditrequest.applicant[0].applicantdemographics); result.ApplicantData[0].Tpd = GetTpd(creditreport.applicant[0].tpd); const int maxErrorLength = 4000; result.Error = (!string.IsNullOrEmpty(Errors) && Errors.Length > maxErrorLength) ? Errors.Substring(0, maxErrorLength) : Errors; result.HasParsingError = HasParsingError; return(result); //Object with searchdata }