using Business.Authentication; using Business.Mobile; using Business.MobileV2; using Common; using Common.Model; using Common.Model.MobileV2; using JsonRx.AuthFilter; using log4net; using Newtonsoft.Json; using System; using System.Web; using System.Web.Http; namespace JsonRx.ApiV3 { [RoutePrefix("api/v5")] public class MobileV3Controller : ApiController { private readonly IMobileV2Business _requestServicesV2; private readonly IAuthenticationBusiness _authenticationBusiness; private static readonly ILog Log = LogManager.GetLogger(typeof(MobileV3Controller)); public MobileV3Controller() { } /// /// /// /// public MobileV3Controller(IMobileV2Business requestServicesV2, IAuthenticationBusiness authenticationBusiness) { _requestServicesV2 = requestServicesV2; _authenticationBusiness = authenticationBusiness; } [HttpPost] [TokenAuthentication] [Route("mobile/{customer}/receiverinfo/{countryId?}")] public IHttpActionResult GetReceiverInformationV2(DateFilterParams search, string customer, string countryId = "0") { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetReceiverInformationV2"; var customerId = customer; Log.Debug("GetReceiverInformationV2 | REQUEST : Customer: " + customer + "countryId: " + countryId + " " + JsonConvert.SerializeObject(search)); var kycResponse = _requestServicesV2.GetReceiverInformationV2(search, customerId, countryId); return Ok(kycResponse); } /// /// /// /// [HttpPost] [TokenAuthentication] [Route("mobile/DashBoardV2")] public IHttpActionResult RefreshDashboardInformationV2(UserModel user) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = user.UserId; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RefreshDashboardInformationV2"; Log.Debug("RefreshDashboardInformationV2 | REQUEST : " + JsonConvert.SerializeObject(user)); JsonRxResponse custResponse = new JsonRxResponse(); if (user == null) { user = new UserModel(); } if (string.IsNullOrEmpty(user.UserId)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserId is missing."; return Ok(custResponse); } custResponse = _requestServicesV2.RefreshDashboardInformationV2(user); return Ok(custResponse); } /// /// /// /// [HttpPost] [TokenAuthentication] [Route("mobile/{customer}/UpdateCustomerProfile")] public IHttpActionResult UpdateCustomerProfileV2(string customer) { CustomerProfileV2 request = new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer }; LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "UpdateCustomerProfileV2"; Log.Debug("RefreshDashboardInformationV2 | REQUEST : " + (request)); JsonRxResponse custResponse = new JsonRxResponse(); if (string.IsNullOrEmpty(request.UserId)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserId is missing."; return Ok(custResponse); } custResponse = _requestServicesV2.CustomerProfile(request); return Ok(custResponse); } [HttpPost] [TokenAuthentication] [Route("mobile/GetKycSettings")] public IHttpActionResult GetKycSettings(KycRequest kycRequest) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = kycRequest.UserId; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetKycSettings"; Log.Debug("GetKycSettings | REQUEST : " + JsonConvert.SerializeObject(kycRequest)); JsonRxResponse custResponse = new JsonRxResponse(); if (string.IsNullOrEmpty(kycRequest.UserId)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserId is missing."; return Ok(custResponse); } custResponse = _requestServicesV2.GetKycSettings(kycRequest); return Ok(custResponse); } [HttpPost] [TokenAuthentication] [Route("mobile/SaveKycSettings")] public IHttpActionResult SaveKycSettings(KycOption kycOption) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = kycOption.UserId; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "SaveKycSettings"; Log.Debug("SaveKycSettings | REQUEST : " + JsonConvert.SerializeObject(kycOption)); JsonRxResponse custResponse = new JsonRxResponse(); if (string.IsNullOrEmpty(kycOption.UserId)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserId is missing."; return Ok(custResponse); } custResponse = _requestServicesV2.SaveKycSettings(kycOption); return Ok(custResponse); } /// /// /// /// [HttpGet] [TokenAuthentication] [Route("mobile/{customer}/GetCustomerProfile")] public IHttpActionResult GetCustomerProfile(string customer) { //= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer }; LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetCustomerProfile"; Log.Debug("GetCustomerProfile | REQUEST : " + (customer)); JsonRxResponse custResponse = new JsonRxResponse() { ErrorCode = "0" }; if (string.IsNullOrEmpty(customer)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserEmail is missing."; return Ok(custResponse); } custResponse.Data = _requestServicesV2.GetCustomerProfile(customer); return Ok(custResponse); } /// /// /// /// [HttpPost] [TokenAuthentication] [Route("mobile/SaveCustomerProfile")] public IHttpActionResult SaveCustomerProfile(CustomerDetailV2 request) { //= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer }; LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = request.Username; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "SaveCustomerProfile"; Log.Debug("UpdateCustomerDetail | REQUEST : " + JsonConvert.SerializeObject(request)); JsonRxResponse custResponse = new JsonRxResponse(); if (string.IsNullOrEmpty(request.UserId)) { custResponse.ErrorCode = "1"; custResponse.Msg = "UserId is missing."; return Ok(custResponse); } custResponse = _requestServicesV2.UpdateCustomerProfile(request); return Ok(custResponse); } /// /// /// /// /// [HttpPost] [TokenAuthentication] [Route("mobile/DownLoadStatement/{userId}")] public IHttpActionResult DownLoadStatement(DateFilterParams search, string userId) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = userId; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "DownLoadStatement"; Log.Debug("DownLoadStatement | REQUEST : " + userId + "|" + JsonConvert.SerializeObject(search)); JsonRxResponse walletStatement = new JsonRxResponse(); if (string.IsNullOrEmpty(userId)) { walletStatement.ErrorCode = "1"; walletStatement.Msg = "UserId is Missing"; return Ok(walletStatement); } walletStatement = _requestServicesV2.DownLoadStatement(search, userId); return Ok(walletStatement); } } }