using Business.Authentication; using Business.KFTCBusiness; using Business.Mobile; using Common; using Common.Helper; using Common.Model; using JsonRx.AuthFilter; using JsonRx.Helper; using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web; using System.Web.Http; namespace JsonRx.ApiV3 { [RoutePrefix("api/v4")] public class MobileV2Controller : ApiController { private readonly IMobileServices _requestServices; private readonly IAuthenticationBusiness _authenticationBusiness; private readonly KftcProcessBusiness _business; private static readonly ILog Log = LogManager.GetLogger(typeof(MobileV2Controller)); /// /// public MobileV2Controller() { } /// /// /// /// public MobileV2Controller(IMobileServices requestServices, IAuthenticationBusiness authenticationBusiness, KftcProcessBusiness business) { _requestServices = requestServices; _authenticationBusiness = authenticationBusiness; _business = business; } /// /// /// /// [HttpGet] [ApplicationLevelAuthentication] [Route("mobile/loadForm/{customer}/{type}")] public IHttpActionResult LoadFormStaticData(string type, string customer) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "LoadFormStaticData"; Log.Debug("LoadFormStaticData | REQUEST : Type: " + type + " | Customer: " + customer); var staticDataResponse = _requestServices.LoadFormStaticData_V3(type, customer); return Ok(staticDataResponse); } /// /// /// [HttpPost] [ApplicationLevelAuthentication] [Route("mobile/RegisterKyc")] public IHttpActionResult RegisterKyc() { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RegisterKyc"; LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = HttpContext.Current.Request["userId"]; LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RegisterKyc"; CustomerKYC_V4 customerKYC_V4 = new CustomerKYC_V4(); Log.Debug("user trying to register the kyc v4."); var kycResponse = _requestServices.RegisterKYC_V4(); return Ok(kycResponse); } /// /// /// /// [HttpGet] [ApplicationLevelAuthentication] [Route("GetKftcParameters/{user}")] public IHttpActionResult GetKftcParameters(string user) { JsonRxResponse resp = new JsonRxResponse(); LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetKftcParameters"; Log.Debug("Log1 : GetKftcParameters started : header : " + Request); if (user == null) { resp.ErrorCode = "1"; resp.Msg = "Invalid Parameters."; resp.Data = new { }; return Ok(resp); } if (!user.ToLower().Equals(user.ToLower())) { resp.ErrorCode = "1"; resp.Msg = "Invalid Parameters."; resp.Data = new { }; return Ok(resp); } var kftcLangauge = Request.Headers.GetValues("lang"); var l = "en"; if (kftcLangauge != null) { var ll = kftcLangauge.ToList(); if (ll.Count > 0) { l = ll[0] == null ? "en" : ll[0].ToString(); } } var kftcClientId = ApplicationConfig.ReadWebConfig("client_id", ""); Log.Debug("key:Kftc-GetKftcParameters process started"); resp = _business.RegistrationKFTC_V4(user, l, kftcClientId); Log.Debug(resp); return Ok(resp); } } }