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.
 
 
 

748 lines
32 KiB

using Business.SendMoney;
using Common;
using Common.Model;
using log4net;
using Newtonsoft.Json;
using System;
using System.Web.Http;
using System.Web.Http.ModelBinding;
using System.Web.Routing;
using System.Linq;
using JsonRx.AuthFilter;
using JsonRx.Helper;
using Common.Model.SendMoney;
using System.Threading.Tasks;
using PushNotification;
using Common.Language;
using Common.Helper;
using Common.Model.Notification;
using Business;
using Common.Model.Config;
using System.Collections.Generic;
using System.Runtime.Remoting.Messaging;
using System.Configuration;
using Newtonsoft.Json.Linq;
namespace JsonRx.Api
{
/// <summary>
/// </summary>
[RoutePrefix("api/v1")]
//[EnableCors("*", "*", "*")]
public class SendMoneyController : ApiController
{
private readonly ISendMoneyBusiness _bussiness;
private static string AccessCode = "";
private static readonly ILog Log = LogManager.GetLogger(typeof(SendMoneyController));
/// <summary>
/// </summary>
public SendMoneyController() { }
/// <summary>
/// </summary>
/// <param name="business"></param>
public SendMoneyController(ISendMoneyBusiness business)
{
_bussiness = business;
//AccessCode = JsonRxStatic.GetAccessToken();
}
/// <summary>
/// </summary>
/// <param name="country"></param>
/// <param name="receiver"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/load/{country}")]
public IHttpActionResult LoadCountryServiceDetail(string country, [FromUri] string receiver)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "LoadCountryServiceDetail";
Log.Debug("LoadCountryServiceDetail | REQUEST : " + country + "Receiver : " + receiver);
var customerId = Util.GetCustomerId(Request);
CountryServiceModel request = new CountryServiceModel()
{
Country = country,
ReceiverId = receiver,
CustomerId = customerId
};
JsonRxResponse res = _bussiness.LoadCountryServiceDetail(request);
return Ok(res);
}
/// <summary>
/// </summary>
/// <param name="country"></param>
/// <param name="bank"></param>
/// <param name="search"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/load/branch/{country}/{bank}")]
public IHttpActionResult LoadCountryBankServiceDetail(string country, string bank, [FromUri] string search)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "LoadCountryBankServiceDetail";
Log.Debug("LoadCountryBankServiceDetail | REQUEST : " + country + "Bank : " + bank);
JsonRxResponse res = _bussiness.LoadBankBranch(country, bank, search);
return Ok(res);
}
/// <summary>
/// method is used to check whether provided bank account is valid or not through partner API
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
//[HttpPost]
//[TokenAuthentication]
//[Route("mobile/sendmoney/validation/account")]
//public IHttpActionResult AccountValidation(AccountValidationRequest request)
//{
// var pId = Guid.NewGuid();
// request.ProcessId = pId.ToString();
// LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = pId;
// LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = request.IdNumber;
// LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "AccountValidation";
// Log.Debug("account validation request " + JsonConvert.SerializeObject(request));
// if (ModelState.IsValid)
// {
// var res = _bussiness.AccountValidation(request);
// return Ok(res);
// }
// return ModelValidationError(ModelState);
//}
/// <summary>
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/calculate")]
public IHttpActionResult Calculate(ExRateCalculateRequest model)
{
//var lang = "NP";
string enumString = string.Empty;
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
var pId = Guid.NewGuid();
model.processId = pId.ToString();
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = pId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "calculate";
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = model.userId;
model.DeviceType= Util.GetDeviceType(Request);
Log.Debug("Calculate | REQUEST : " + JsonConvert.SerializeObject(model));
if (ModelState.IsValid)
{
//model.senderId = Util.GetCustomerId(Request);
var res = _bussiness.Calculate(model);
res.FootNoteMessage = res.ErrorCode.Equals("0") ? Utilities.GetLanguageMapping(ConfigurationManager.AppSettings["footNote_calculateSendMoney"].ToString(), lang).Message : "";
if (res.ErrorCode.Equals("0"))
{
var d = JObject.Parse(res.Data.ToString());
if (d != null && d["schemeAppliedMsg"] != null)
{
res.FootNoteMessage = $"{ res.FootNoteMessage}. {d["schemeAppliedMsg"].ToString()}";
}
}
return Ok(new JsonRxResponse { ErrorCode = res.ErrorCode.Equals("0") ? "0" : "1", Msg = res.Msg, Data = res.Data, FootNoteMessage = res.FootNoteMessage });
//return Ok(res);
}
return ModelValidationError(ModelState);
}
/// <summary>
/// Method is used for Send Transaction through Mobile
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/dotransaction")]
public IHttpActionResult Send(MobileRemitRequest model)
{
string enumString = string.Empty;
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
model.ProcessId = model.FOREX_SESSION_ID.Replace("-", "") + ":" + model.PayOutPartner + ":sendTxn";
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = model.ProcessId;
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = model.User;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "dotransaction";
LogicalThreadContext.Properties[LoggerProperty.PAYOUTPARTNERID] = model.PayOutPartner;
Log.Debug("DOTRANSACTION | REQUEST : " + JsonConvert.SerializeObject(model));
JsonRxResponse res = new JsonRxResponse();
//res.SetResponse("0", "Transaction send succcessfully", null);
if (ModelState.IsValid)
{
//model.SenderId = Util.GetCustomerId(Request);
//model.TxnPassword = StringExtension.ToVirtualKeyDecryptString(model.TxnPassword);
model.TxnPassword = model.TxnPassword;
DbResult _dbRes = new DbResult()
{
ResponseCode = "0",
Msg = "Success!"
};
if (model.DeliveryMethodId == "2" && (model.PAgent == null || model.PAgent == "" || model.PAgent == "0"))
{
res.SetResponse("100", "Bank Id Is Required !");
return Ok(res);
}
if (!string.IsNullOrEmpty(model.PurposeOfRemittance) &&
model.PurposeOfRemittance.Equals("11345") | model.PurposeOfRemittance.Equals("Payment of Import Good"))
{
if (string.IsNullOrEmpty(model.GoodsOrigin))
{
res.SetResponse("100", "GoodsOrigin is required!");
return Ok(res);
}
if (string.IsNullOrEmpty(model.GoodsType))
{
res.SetResponse("100", "GoodsType is required!");
return Ok(res);
}
if (string.IsNullOrEmpty(model.PortOfShipment))
{
res.SetResponse("100", "PortOfShipment is required!");
return Ok(res);
}
}
string type = "";
// Log.Debug("DOTRANSACTION.isBiometricUsed : " + Convert.ToString(model.isUseBiometric));
type = (model.isUseBiometric) ? "wallet" : model.PaymentType;
//_dbRes = _bussiness.CheckLoginPIN(model.User, model.TxnPassword, type, model.SenderId);
//Log.Debug("CheckLoginPIN | DB RESPONSE : " + JsonConvert.SerializeObject(_dbRes));
if (_dbRes.ResponseCode == "0")
{
res = _bussiness.SendTransaction(model);
Log.Debug("DOTRANSACTION | RESPONSE : " + JsonConvert.SerializeObject(res));
if (res.ErrorCode == "0")
{
// var fcmid = Util.getJWTTokenClaim(Request.GetJWTToken(), "ClientFcmId");
//var lang = Util.getJWTTokenClaim(Request.GetJWTToken(), "language");
//Task.Run(() => FcmNotifier.Notify(fcmid, Languages.GetMessage("transaction_success", lang), Languages.GetTitle("transaction", lang)));
LogicalThreadContext.Properties[LoggerProperty.CONTROLNO] = res.Extra;
//SendNotificationRequest temp = new SendNotificationRequest();
//NotificationDTO rvm = new NotificationDTO();
//if (res.Extra3 != null && res.Extra3.ToString() == "N")
//{
// temp.Template = Common.Model.Enum.NotifyTemplate.TF_NO_BALANCE;
// rvm.ClickActivity = "OPEN_ACTIVITY_NOTIFICATION";
// SendNotificationRequest request = new SendNotificationRequest()
// {
// IsBulkNotification = false,
// UserName = model.User,
// ProcessId = model.ProcessId,
// ProviderId = "dotransaction",
// Template = temp.Template,
// // Template = Common.Model.Enum.NotifyTemplate.TRANSACTION_SUCCESS,
// Recipients = new List<RecipientViewModel>()
// {
// new RecipientViewModel() { Address= Util.GetClientFCMId(Request) ,NotificationContent = new NotificationDTO() { ClickActivity = rvm.ClickActivity} }
// },
// Language = Util.getJWTTokenClaim(Request.GetJWTToken(), "language")
// };
// var devicetype = Util.GetDeviceType(Request);
// if (devicetype != null && devicetype.Equals("IOS"))
// {
// Task.Run(() => NotifierV2.SendNotification(request, NOTIFICATION_TYPE.PUSH_NOTIFICATION));
// }
//}
}
if (res.ErrorCode.Equals("0"))
{
if (res.Extra3 != null && res.Extra3.ToString() == "N")
enumString = RESPONSE_MSG.SEND_TRANSACTION_SUCCESS.ToString();
else
enumString = "Please proceed to complete your payment.";
}
else if (res.ErrorCode.Equals("1"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_1.ToString();
}
else if (res.ErrorCode.Equals("2"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_2.ToString();
}
else if (res.ErrorCode.Equals("3"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_3.ToString();
}
else if (res.ErrorCode.Equals("4"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_4.ToString();
}
else if (res.ErrorCode.Equals("5"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_5.ToString();
}
else if (res.ErrorCode.Equals("6"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_6.ToString();
}
else if (res.ErrorCode.Equals("7"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_7.ToString();
}
else if (res.ErrorCode.Equals("8"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_8.ToString();
}
else if (res.ErrorCode.Equals("9"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_9.ToString();
}
else if (res.ErrorCode.Equals("10"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_10.ToString();
}
else if (res.ErrorCode.Equals("11"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_11.ToString();
}
else if (res.ErrorCode.Equals("12"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_12.ToString();
}
else if (res.ErrorCode.Equals("13"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_13.ToString();
}
else if (res.ErrorCode.Equals("14"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_14.ToString();
}
else if (res.ErrorCode.Equals("15"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_15.ToString();
}
else if (res.ErrorCode.Equals("16"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_16.ToString();
}
else if (res.ErrorCode.Equals("17"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_17.ToString();
}
else if (res.ErrorCode.Equals("19"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_19.ToString();
}
else if (res.ErrorCode.Equals("22"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_22.ToString();
}
//else if (res.ErrorCode.Equals("21"))
//{
// enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_21.ToString();
//}
var map = Utilities.GetLanguageMapping(enumString, lang);
return Ok(new JsonRxResponse { ErrorCode = res.ErrorCode.Equals("0") ? "0" : "1",
Msg = res.ErrorCode.Equals("21") | res.ErrorCode.Equals("1") ? res.Msg : map.Message, Id = res.Id, Extra = res.Extra, Data= res.Data, FootNoteMessage = "" });
// return Ok(res);
}
else
{
// changes for return messages
// res.SetResponse("1", _dbRes.Msg, null);
//var res = _dao.ParseDbResult(sql);
if (_dbRes.ResponseCode.Equals("18"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_18.ToString();
}
else if (_dbRes.ResponseCode.Equals("20"))
{
enumString = RESPONSE_MSG.SEND_TRANSACTION_FAIL_20.ToString();
}
var map = Utilities.GetLanguageMapping(enumString, lang);
// var res = new JsonRxResponse { ErrorCode = _dbRes.ResponseCode.Equals("0") ? "0" : "1", Msg = map.Message };
return Ok(new JsonRxResponse { ErrorCode = _dbRes.ResponseCode.Equals("0") ? "0" : "1", Msg = map.Message, FootNoteMessage = "" });
}
}
else
{
res.SetResponse("1", "Invalid request.", null);
return Ok(res);
}
}
/// <summary>
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/tracktransaction")]
public IHttpActionResult TrackTransaction(TrackTransactionParam param)
{
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "TrackTransaction";
Log.Debug("TrackTransaction | REQUEST : " + JsonConvert.SerializeObject(param));
JsonRxResponse res = new JsonRxResponse();
if (param == null)
{
param = new TrackTransactionParam();
}
if (string.IsNullOrEmpty(param.ControlNo))
{
res.ErrorCode = "1";
res.Msg = "Control No is missing.";
return Ok(res);
}
var payStatusResponse = _bussiness.TrackTransaction(param);
return Ok(payStatusResponse);
}
/// <summary>
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/amendtransaction")]
public IHttpActionResult AmendTransaction(TrackTransactionParam param)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "AmendTransaction";
Log.Debug("AmendTransaction | REQUEST : " + JsonConvert.SerializeObject(param));
JsonRxResponse res = new JsonRxResponse();
string enumString = string.Empty;
if (param == null)
{
param = new TrackTransactionParam();
}
if (string.IsNullOrEmpty(param.ControlNo))
{
//res.ErrorCode = "1";
//res.Msg = "Control No is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_1.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.TranId))
{
//res.ErrorCode = "1";
//res.Msg = "TransactionId is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_2.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.Body))
{
//res.ErrorCode = "1";
//res.Msg = "Body is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_3.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.UserId))
{
//res.ErrorCode = "1";
//res.Msg = "Requested from Invalid User";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_4.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
res = _bussiness.AmendTransaction(param);
return Ok(res);
}
/// <summary>
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/canceltransaction")]
public IHttpActionResult CancelTransaction(TrackTransactionParam param)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "CancelTransaction";
Log.Debug("CancelTransaction | REQUEST : " + JsonConvert.SerializeObject(param));
JsonRxResponse res = new JsonRxResponse();
string enumString = string.Empty;
if (param == null)
{
param = new TrackTransactionParam();
}
if (string.IsNullOrEmpty(param.ControlNo))
{
//res.ErrorCode = "1";
//res.Msg = "Control No is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_3.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.TranId))
{
//res.ErrorCode = "1";
//res.Msg = "TransactionId is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_4.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.Body))
{
//res.ErrorCode = "1";
//res.Msg = "Body is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_5.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.UserId))
{
//res.ErrorCode = "1";
//res.Msg = "Requested from Invalid User";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_6.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
res = _bussiness.CancelTransaction(param);
return Ok(res);
}
/// <summary>
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/rejecttransaction")]
public IHttpActionResult RejectTransaction(RejectTransactionParam param)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
param.ProcessId = Guid.NewGuid().ToString().Replace("-", "");
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = param.ProcessId;
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RejectTransaction";
Log.Debug("RejectTransaction | REQUEST : " + JsonConvert.SerializeObject(param));
JsonRxResponse res = new JsonRxResponse();
string enumString = string.Empty;
if (param == null)
{
param = new RejectTransactionParam();
}
//if (string.IsNullOrEmpty(param.ControlNo))
//{
// //res.ErrorCode = "1";
// //res.Msg = "Control No is missing.";
// //return Ok(res);
// enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_3.ToString();
// var map = Utilities.GetLanguageMapping(enumString, lang);
// res.SetResponse("1", map.Message);
// return Ok(res);
//}
if (string.IsNullOrEmpty(param.TranId))
{
//res.ErrorCode = "1";
//res.Msg = "TransactionId is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_4.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.Body))
{
//res.ErrorCode = "1";
//res.Msg = "Body is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_5.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
if (string.IsNullOrEmpty(param.UserId))
{
//res.ErrorCode = "1";
//res.Msg = "Requested from Invalid User";
//return Ok(res);
enumString = RESPONSE_MSG.CANCEL_TRANSACTION_FAIL_6.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
res = _bussiness.RejectTransaction(param);
return Ok(res);
}
/// <summary>
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/AmendTransactionV2")]
public IHttpActionResult AmendTransactionV2(AmendTransactionParam param)
{
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserId;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "AmendTransactionV2";
Log.Debug("AmendTransactionV2 | REQUEST : " + JsonConvert.SerializeObject(param));
JsonRxResponse res = new JsonRxResponse();
string enumString = string.Empty;
if (param == null)
{
param = new AmendTransactionParam();
}
if (string.IsNullOrEmpty(param.ControlNo))
{
//res.ErrorCode = "1";
//res.Msg = "Control No is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_1.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
else if (string.IsNullOrEmpty(param.TranId))
{
//res.ErrorCode = "1";
//res.Msg = "TransactionId is missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_2.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
else if (param.ChangeParams.Count < 0)
{
//res.ErrorCode = "1";
//res.Msg = "Amendment request(s) are missing.";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_3.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
else if (string.IsNullOrEmpty(param.UserId))
{
//res.ErrorCode = "1";
//res.Msg = "Requested from Invalid User";
//return Ok(res);
enumString = RESPONSE_MSG.AMEND_TRANSACTION_FAIL_4.ToString();
var map = Utilities.GetLanguageMapping(enumString, lang);
res.SetResponse("1", map.Message);
return Ok(res);
}
var referenceMaps = Utilities.GetReferenceMaps(Common.Model.Config.MappingType.MODIFICATION_REQUEST);
var modificationsFields = referenceMaps.SelectMany(b => b.Mappings.Where(x => x.subItems != null).SelectMany(c => c.subItems
.Select(d => d.field))).ToList();
var output = modificationsFields.Where(x => param.ChangeParams.Any(z => x.Contains(z.Key)));
if (!output.Any())
{
res.ErrorCode = "1";
res.Msg = "ChangeParameter(s) are Invalid.";
Log.Info("AmendTransactionV2 | RESPONSE : " + JsonConvert.SerializeObject(res));
return Ok(res);
}
res.ErrorCode = "0";
res.Msg = "Amemdment request is completed.";
res = _bussiness.AmendTransactionV2(param); //create similar as of core
return Ok(res);
}
[HttpPost]
[TokenAuthentication]
[Route("mobile/sendmoney/AccountValidation")]
public IHttpActionResult AccountValidation(AccountValidationModel model)
{
model.ProcessId = Guid.NewGuid().ToString();
var lang = Convert.ToString(CallContext.GetData(Constants.Language));
LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = model.ProcessId;
LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = model.UserName;
LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "AccountValidation";
LogicalThreadContext.Properties[LoggerProperty.CONTROLNO] = model.ControlNo;
Log.Debug("VerifyAccount Request: " + JsonConvert.SerializeObject(model));
var response = _bussiness.AccountValidation(model);
Log.Debug("VerifyAccount Response: " + JsonConvert.SerializeObject(response));
return Json(response);
}
#region modelstate validation
protected IHttpActionResult ModelValidationError(ModelStateDictionary modelState)
{
var modelErrors = modelState.Select(x => x.Value.Errors)
.Where(y => y.Count > 0)
.First()[0].ErrorMessage;
JsonRxResponse jsonRx = new JsonRxResponse()
{
ErrorCode = "1",
Msg = string.IsNullOrEmpty(modelErrors) ? "It seems like incorrect Json input(s)." : modelErrors,
Data = ""
};
return Ok(jsonRx);
}
#endregion modelstate validation
}
}