You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

130 lines
4.6 KiB

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));
/// <summary>
/// </summary>
public MobileV2Controller() { }
/// <summary>
/// </summary>
/// <param name="requestServices"></param>
/// <param name="authenticationBusiness"></param>
public MobileV2Controller(IMobileServices requestServices, IAuthenticationBusiness authenticationBusiness, KftcProcessBusiness business)
{
_requestServices = requestServices;
_authenticationBusiness = authenticationBusiness;
_business = business;
}
/// <summary>
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[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);
}
/// <summary>
/// </summary>
/// <returns></returns>
[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);
}
/// <summary>
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[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);
}
}
}