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.
 
 
 

145 lines
5.2 KiB

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
{
/// <summary>
/// Api endpoint for the Penny testing module
/// </summary>
[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));
/// <summary>
/// DEfault Constructor
/// </summary>
public InboundController() { }
/// <summary>
/// Constructor that injects the IPennyBussiness
/// </summary>
/// <param name="pennyBusiness"></param>
public InboundController(IInboundPennyTestBusiness pennyBusiness, IUtilityBusiness utilityBusiness, IInboundBusiness inboundBusiness)
{
_pennyBusiness = pennyBusiness;
_utilityBusiness = utilityBusiness;
_inboundBusiness = inboundBusiness;
}
/// <summary>
/// This methods is used to start the penny testing FOR CUSTOMER BANK ACCOUNT VERIFICATION
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[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);
}
/// <summary>
/// This methods verifies and certified the customer penny certificate.
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[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);
}
}
}