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.

255 lines
9.6 KiB

1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
  1. using Business.Authentication;
  2. using Business.Mobile;
  3. using Business.MobileV2;
  4. using Common;
  5. using Common.Model;
  6. using Common.Model.MobileV2;
  7. using JsonRx.AuthFilter;
  8. using log4net;
  9. using Newtonsoft.Json;
  10. using System;
  11. using System.Web;
  12. using System.Web.Http;
  13. namespace JsonRx.ApiV3
  14. {
  15. [RoutePrefix("api/v5")]
  16. public class MobileV3Controller : ApiController
  17. {
  18. private readonly IMobileV2Business _requestServicesV2;
  19. private readonly IAuthenticationBusiness _authenticationBusiness;
  20. private static readonly ILog Log = LogManager.GetLogger(typeof(MobileV3Controller));
  21. public MobileV3Controller() { }
  22. /// <summary>
  23. /// </summary>
  24. /// <param name="requestServices"></param>
  25. /// <param name="authenticationBusiness"></param>
  26. public MobileV3Controller(IMobileV2Business requestServicesV2, IAuthenticationBusiness authenticationBusiness)
  27. {
  28. _requestServicesV2 = requestServicesV2;
  29. _authenticationBusiness = authenticationBusiness;
  30. }
  31. [HttpPost]
  32. [TokenAuthentication]
  33. [Route("mobile/{customer}/receiverinfo/{countryId?}")]
  34. public IHttpActionResult GetReceiverInformationV2(DateFilterParams search, string customer, string countryId = "0")
  35. {
  36. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  37. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer;
  38. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetReceiverInformationV2";
  39. var customerId = customer;
  40. Log.Debug("GetReceiverInformationV2 | REQUEST : Customer: " + customer + "countryId: " + countryId + " " + JsonConvert.SerializeObject(search));
  41. var kycResponse = _requestServicesV2.GetReceiverInformationV2(search, customerId, countryId);
  42. return Ok(kycResponse);
  43. }
  44. /// <summary>
  45. /// </summary>
  46. /// <param name="user"></param>
  47. /// <returns></returns>
  48. [HttpPost]
  49. [TokenAuthentication]
  50. [Route("mobile/DashBoardV2")]
  51. public IHttpActionResult RefreshDashboardInformationV2(UserModel user)
  52. {
  53. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  54. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = user.UserId;
  55. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "RefreshDashboardInformationV2";
  56. Log.Debug("RefreshDashboardInformationV2 | REQUEST : " + JsonConvert.SerializeObject(user));
  57. JsonRxResponse custResponse = new JsonRxResponse();
  58. if (user == null)
  59. {
  60. user = new UserModel();
  61. }
  62. if (string.IsNullOrEmpty(user.UserId))
  63. {
  64. custResponse.ErrorCode = "1";
  65. custResponse.Msg = "UserId is missing.";
  66. return Ok(custResponse);
  67. }
  68. custResponse = _requestServicesV2.RefreshDashboardInformationV2(user);
  69. return Ok(custResponse);
  70. }
  71. /// <summary>
  72. /// </summary>
  73. /// <param name="user"></param>
  74. /// <returns></returns>
  75. [HttpPost]
  76. [TokenAuthentication]
  77. [Route("mobile/{customer}/UpdateCustomerProfile")]
  78. public IHttpActionResult UpdateCustomerProfileV2(string customer)
  79. {
  80. CustomerProfileV2 request = new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer };
  81. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  82. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer;
  83. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "UpdateCustomerProfileV2";
  84. Log.Debug("RefreshDashboardInformationV2 | REQUEST : " + (request));
  85. JsonRxResponse custResponse = new JsonRxResponse();
  86. if (string.IsNullOrEmpty(request.UserId))
  87. {
  88. custResponse.ErrorCode = "1";
  89. custResponse.Msg = "UserId is missing.";
  90. return Ok(custResponse);
  91. }
  92. custResponse = _requestServicesV2.CustomerProfile(request);
  93. return Ok(custResponse);
  94. }
  95. [HttpPost]
  96. [TokenAuthentication]
  97. [Route("mobile/GetKycSettings")]
  98. public IHttpActionResult GetKycSettings(KycRequest kycRequest)
  99. {
  100. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  101. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = kycRequest.UserId;
  102. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetKycSettings";
  103. Log.Debug("GetKycSettings | REQUEST : " + JsonConvert.SerializeObject(kycRequest));
  104. JsonRxResponse custResponse = new JsonRxResponse();
  105. if (string.IsNullOrEmpty(kycRequest.UserId))
  106. {
  107. custResponse.ErrorCode = "1";
  108. custResponse.Msg = "UserId is missing.";
  109. return Ok(custResponse);
  110. }
  111. custResponse = _requestServicesV2.GetKycSettings(kycRequest);
  112. return Ok(custResponse);
  113. }
  114. [HttpPost]
  115. [TokenAuthentication]
  116. [Route("mobile/SaveKycSettings")]
  117. public IHttpActionResult SaveKycSettings(KycOption kycOption)
  118. {
  119. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  120. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = kycOption.UserId;
  121. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "SaveKycSettings";
  122. Log.Debug("SaveKycSettings | REQUEST : " + JsonConvert.SerializeObject(kycOption));
  123. JsonRxResponse custResponse = new JsonRxResponse();
  124. if (string.IsNullOrEmpty(kycOption.UserId))
  125. {
  126. custResponse.ErrorCode = "1";
  127. custResponse.Msg = "UserId is missing.";
  128. return Ok(custResponse);
  129. }
  130. custResponse = _requestServicesV2.SaveKycSettings(kycOption);
  131. return Ok(custResponse);
  132. }
  133. /// <summary>
  134. /// </summary>
  135. /// <param name="user"></param>
  136. /// <returns></returns>
  137. [HttpGet]
  138. [TokenAuthentication]
  139. [Route("mobile/{customer}/GetCustomerProfile")]
  140. public IHttpActionResult GetCustomerProfile(string customer)
  141. {
  142. //= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer };
  143. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  144. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = customer;
  145. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "GetCustomerProfile";
  146. Log.Debug("GetCustomerProfile | REQUEST : " + (customer));
  147. JsonRxResponse custResponse = new JsonRxResponse() { ErrorCode = "0" };
  148. if (string.IsNullOrEmpty(customer))
  149. {
  150. custResponse.ErrorCode = "1";
  151. custResponse.Msg = "UserEmail is missing.";
  152. return Ok(custResponse);
  153. }
  154. custResponse.Data = _requestServicesV2.GetCustomerProfile(customer);
  155. return Ok(custResponse);
  156. }
  157. /// <summary>
  158. /// </summary>
  159. /// <param name="user"></param>
  160. /// <returns></returns>
  161. [HttpPost]
  162. [TokenAuthentication]
  163. [Route("mobile/SaveCustomerProfile")]
  164. public IHttpActionResult SaveCustomerProfile(CustomerDetailV2 request)
  165. {
  166. //= new CustomerProfileV2() { Username = HttpContext.Current.Request["userId"], UserId = customer };
  167. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  168. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = request.Username;
  169. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "SaveCustomerProfile";
  170. Log.Debug("UpdateCustomerDetail | REQUEST : " + JsonConvert.SerializeObject(request));
  171. JsonRxResponse custResponse = new JsonRxResponse();
  172. if (string.IsNullOrEmpty(request.UserId))
  173. {
  174. custResponse.ErrorCode = "1";
  175. custResponse.Msg = "UserId is missing.";
  176. return Ok(custResponse);
  177. }
  178. custResponse = _requestServicesV2.UpdateCustomerProfile(request);
  179. return Ok(custResponse);
  180. }
  181. /// <summary>
  182. /// </summary>
  183. /// <param name="search"></param>
  184. /// <param name="userId"></param>
  185. /// <returns></returns>
  186. [HttpPost]
  187. [TokenAuthentication]
  188. [Route("mobile/DownLoadStatement/{userId}")]
  189. public IHttpActionResult DownLoadStatement(DateFilterParams search, string userId)
  190. {
  191. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  192. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = userId;
  193. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "DownLoadStatement";
  194. Log.Debug("DownLoadStatement | REQUEST : " + userId + "|" + JsonConvert.SerializeObject(search));
  195. JsonRxResponse walletStatement = new JsonRxResponse();
  196. if (string.IsNullOrEmpty(userId))
  197. {
  198. walletStatement.ErrorCode = "1";
  199. walletStatement.Msg = "UserId is Missing";
  200. return Ok(walletStatement);
  201. }
  202. walletStatement = _requestServicesV2.DownLoadStatement(search, userId);
  203. return Ok(walletStatement);
  204. }
  205. }
  206. }