using Business.Inbound; using Business.PennyTest; using Business.Utility; using Common; using Common.InboundModel; using Common.Model; using Common.Model.PennyTest; using JsonRx.AuthFilter; using JsonRx.Helper; using log4net; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; namespace JsonRx.InboundApi { /// /// Api endpoint for the Penny testing module /// [RoutePrefix("api/v1/inbound")] public class InboundController : ApiController { private readonly IInboundPennyTestBusiness _pennyBusiness; private readonly IUtilityBusiness _utilityBusiness; private readonly IInboundBusiness _inboundBusiness; private static readonly ILog Log = LogManager.GetLogger(typeof(InboundController)); /// /// DEfault Constructor /// public InboundController() { } /// /// Constructor that injects the IPennyBussiness /// /// public InboundController(IInboundPennyTestBusiness pennyBusiness, IUtilityBusiness utilityBusiness, IInboundBusiness inboundBusiness) { _pennyBusiness = pennyBusiness; _utilityBusiness = utilityBusiness; _inboundBusiness = inboundBusiness; } /// /// This methods is used to start the penny testing FOR CUSTOMER BANK ACCOUNT VERIFICATION /// /// /// [HttpPost] [TokenAuthentication] [Route("mobile/pennytest/start/{user}")] public IHttpActionResult StartPennyTesting(string user, PennyTestRequestParam param, [FromUri] string reSendCode) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "InboundStartPennyTesting"; Log.Debug("Starting Penny testing."); //var senderId = Util.GetCustomerId(Request); JsonRxResponse resp = new JsonRxResponse(); resp = _pennyBusiness.StartInbound(user, param, reSendCode); return Ok(resp); } /// /// This methods verifies and certified the customer penny certificate. /// /// /// [HttpPost] //[ApplicationLevelAuthentication] [Route("mobile/pennytest/getcertified")] public IHttpActionResult VerifyCertificate(PennyCertVerifyRequestModel model) { LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid(); LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "InboundVerifyCertificate"; //CallContext.SetData(Constants.FcmId,""); Log.Debug("Starting Penny testing verification" + JsonConvert.SerializeObject(model)); JsonRxResponse resp = new JsonRxResponse(); if (model == null) { resp.ErrorCode = "1"; resp.Msg = "Invalid parameters."; resp.Data = new { Message = resp.Msg }; return Ok(resp); } //model.CustomerId = Util.GetCustomerId(Request); resp = _pennyBusiness.VerifyCertificate(model); return Ok(resp); } [HttpPost] [TokenAuthentication] [Route("mobile/koreanBanks")] public IHttpActionResult GetKoreanBanks() { //var senderId = Util.GetCustomerId(Request); var res = this._utilityBusiness.GetKoreanBanks(); return Ok(res); } [HttpPost] [TokenAuthentication] [Route("mobile/bankaccounts/{userId}")] public IHttpActionResult BankAccounts(string userId) { //var senderId = Util.GetCustomerId(Request); var res = this._inboundBusiness.BankAccounts(userId); return Ok(res); } [HttpPost] [TokenAuthentication] [Route("mobile/tranHistory/{userId}")] public IHttpActionResult TranactionHistory(DateFilterParams search, string userId) { //var senderId = Util.GetCustomerId(Request); var res = this._inboundBusiness.TranactionHistory(search, userId); return Ok(res); } [HttpPost] [TokenAuthentication] [Route("mobile/tranHistory/{userId}/{tranId}")] public IHttpActionResult TranactionHistory(string userId, string tranId) { //var senderId = Util.GetCustomerId(Request); var res = this._inboundBusiness.TranactionDetail(tranId, userId); return Ok(res); } [HttpPost] [TokenAuthentication] [Route("mobile/deleteInboundAccount/{userId}/{account}")] public IHttpActionResult DeleteInboundAccount(string userId, string account) { //var senderId = Util.GetCustomerId(Request); var res = this._inboundBusiness.DeleteInboundAccount(account, userId); return Ok(res); } } }