public async Task <bool> GetConsumerProfile(TransunionRequest.RequestTrans01 Request, string UserID, int ProductID) { startDate = DateTime.Now; log = new Logger(); try { var config = new MapperConfiguration( cfg => { cfg.CreateMap <RequestTrans01, BureauEnquiry13>() .ForMember(x => x.ul_long_score, y => y.MapFrom(z => z.LongScore)) .ForMember(x => x.ul_medium_score, y => y.MapFrom(z => z.MediumScore)) .ForMember(x => x.ul_short_score, y => y.MapFrom(z => z.ShortScore)) .ForMember(x => x.ul_average_score, y => y.MapFrom(z => z.AverageScore)); } ); var mapper = config.CreateMapper(); var enquiry13 = mapper.Map <BureauEnquiry13>(Request); enquiry13.SecurityCode = securityCode; enquiry13.SubscriberCode = subNo; enquiry13.EnquirerContactName = "Prelen Nair"; enquiry13.EnquirerContactPhoneNo = "083225398"; var response = await client.ProcessRequestTrans13Async(enquiry13); result = response.ErrorCode == null ? true : false; if (!result) { log.LogError(UserID, "DataSolutions.Web", "TransUnionConsumer.GetConsumerProfile", response.ErrorCode + " " + response.ErrorMessage); } //log transaction endDate = DateTime.Now; transData = new TransactionModel.TransactionData { EndDate = endDate, IsSuccessful = result, Message = response.ErrorMessage, ProductID = ProductID, StartDate = startDate, UserID = Convert.ToInt32(UserID) }; SaveTransaction(transData); } catch (Exception ex) { log.LogError(UserID, "DataSolutions.Web", "TransUnionConsumer.GetConsumerProfile", ex.Message); } return(result); }
public async Task <bool> ProcessRequestTrans41Async(TransunionRequest.RequestTrans01 Request, string UserID, int ProductID) { startDate = DateTime.Now; log = new Logger(); try { var config = new MapperConfiguration( cfg => { cfg.CreateMap <RequestTrans01, BureauEnquiry41>() .ForMember(x => x.ul_long_score, y => y.MapFrom(z => z.LongScore)) .ForMember(x => x.ul_medium_score, y => y.MapFrom(z => z.MediumScore)) .ForMember(x => x.ul_short_score, y => y.MapFrom(z => z.ShortScore)) .ForMember(x => x.ul_average_score, y => y.MapFrom(z => z.AverageScore)); } ); var mapper = config.CreateMapper(); var enquiry41 = mapper.Map <BureauEnquiry41>(Request); enquiry41.SecurityCode = securityCode; enquiry41.SubscriberCode = subNo; enquiry41.EnquirerContactName = "Prelen Nair"; enquiry41.EnquirerContactPhoneNo = "0832253698"; destination = environment == "Test" ? Destination.Test : Destination.Live; /* Begin Proxy code*/ //BasicHttpBinding binding = new BasicHttpBinding("ConsumerSoap"); //binding.Security.Mode = BasicHttpSecurityMode.Transport; //binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; //binding.UseDefaultWebProxy = false; //binding.ProxyAddress = new Uri("http://proxy.ntcweb.co.za:8080"); //EndpointAddress endpoint = new EndpointAddress("https://securetest.transunion.co.za/TUBureau118/Consumer.asmx"); //ConsumerSoapClient soap = new ConsumerSoapClient(binding, endpoint); //soap.ClientCredentials.UserName.UserName = "******"; //soap.ClientCredentials.UserName.Password = "******"; //var response = await soap.ProcessRequestTrans41Async(enquiry41, destination); /*End Proxy Code*/ var response = await client.ProcessRequestTrans41Async(enquiry41, destination); result = response.ErrorCode == null ? true : false; if (result) { string ticketno = ""; if (response.TicketSuccessConfirmationFR != null) { ticketno = response.TicketSuccessConfirmationFR.TicketNumber; } if (response.TraceInformationTI != null) { ticketno = response.TraceInformationTI[0].OTicketNumber; } bool x = await new TransUnionPDFService().ConvertPDFAsync("Prelen", "*****@*****.**", ticketno, UserID); string str = await new TransUnionPDFService().GetReportLink(UserID, subNo, securityCode, ticketno); } else { log.LogError(UserID, "DataSolutions.Services", "TransunionAPIController.ProcessRequestTrans41Async", response.ErrorCode + " " + response.ErrorMessage); } // Save Transaction endDate = DateTime.Now; transData = new TransactionModel.TransactionData { EndDate = endDate, IsSuccessful = result, Message = response.ErrorMessage, ProductID = ProductID, StartDate = startDate, UserID = Convert.ToInt32(UserID) }; SaveTransaction(transData); } catch (Exception ex) { log.LogError(UserID, "DataSolutions.Services", "TransunionAPIController.ProcessRequestTrans41Async", ex.Message); } return(result); }