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.

115 lines
4.5 KiB

1 year ago
  1. using Business.SendMoney;
  2. using Common;
  3. using Common.Model;
  4. using Common.Model.External;
  5. using JsonRx.AuthFilter;
  6. using log4net;
  7. using Newtonsoft.Json;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Net;
  12. using System.Net.Http;
  13. using System.Web.Http;
  14. namespace JsonRx.Api
  15. {
  16. [RoutePrefix("api/v4")]
  17. public class ExternalController : ApiController
  18. {
  19. private readonly ISendMoneyBusiness _bussiness;
  20. private static string AccessCode = "";
  21. private static readonly ILog Log = LogManager.GetLogger(typeof(ExternalController));
  22. [HttpPost]
  23. //[ApplicationLevelAuthentication]
  24. [Route("External/AdditionalInformationCallbackv1")]
  25. public IHttpActionResult AdditionalInformationCallback(BracBankStatusCallbackParam param)
  26. {
  27. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  28. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserName;
  29. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "AdditionalInformationCallback";
  30. Log.Debug("TransactionStatusCallback | REQUEST : " + JsonConvert.SerializeObject(param));
  31. CallbackTpResponse res = new CallbackTpResponse();
  32. //JsonRxResponse res = new JsonRxResponse();
  33. if (param == null)
  34. {
  35. param = new BracBankStatusCallbackParam();
  36. }
  37. if (string.IsNullOrEmpty(param.TTReferenceNo))
  38. {
  39. res.StatusCode = "0";
  40. res.MessageType = "Control No is missing.";
  41. // res.StatusDescription
  42. return Ok(res);
  43. }
  44. var resp = _bussiness.TransactionStatusCallback(param);
  45. return Ok(resp);
  46. }
  47. [HttpPost]
  48. [ApplicationLevelAuthentication]
  49. [Route("External/transactionStatusCallbackv1")]
  50. public IHttpActionResult TransactionStatusCallback(BracBankStatusCallbackParam param)
  51. {
  52. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  53. LogicalThreadContext.Properties[LoggerProperty.CREATEDBY] = param.UserName;
  54. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "TransactionStatusCallback";
  55. Log.Debug("TransactionStatusCallback | REQUEST : " + JsonConvert.SerializeObject(param));
  56. CallbackTpResponse res = new CallbackTpResponse();
  57. //JsonRxResponse res = new JsonRxResponse();
  58. if (param == null)
  59. {
  60. param = new BracBankStatusCallbackParam();
  61. }
  62. if (string.IsNullOrEmpty(param.TTReferenceNo))
  63. {
  64. res.StatusCode = "0";
  65. res.MessageType = "Control No is missing.";
  66. // res.StatusDescription
  67. return Ok(res);
  68. }
  69. var resp = _bussiness.TransactionStatusCallback(param);
  70. return Ok(resp);
  71. }
  72. [HttpPost]
  73. //[ApplicationLevelAuthentication]
  74. [Route("External/AdditionalInformationCallback")]
  75. public HttpResponseMessage AdditionalInformationCallback(string param)
  76. {
  77. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  78. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "TransactionStatusCallback";
  79. Log.Debug("AdditionalInformationCallback | REQUEST : " + JsonConvert.SerializeObject(param));
  80. string result = "Hello world! Time is: " + DateTime.Now;
  81. var resp = new HttpResponseMessage(HttpStatusCode.OK);
  82. resp.Content = new StringContent(result, System.Text.Encoding.UTF8, "text/plain");
  83. return resp;
  84. }
  85. [HttpPost]
  86. //[ApplicationLevelAuthentication]
  87. [Route("External/transactionStatusCallback")]
  88. public HttpResponseMessage TransactionStatusCallback(string param)
  89. {
  90. LogicalThreadContext.Properties[LoggerProperty.PROCESSID] = Guid.NewGuid();
  91. LogicalThreadContext.Properties[LoggerProperty.METHODNAME] = "TransactionStatusCallback";
  92. Log.Debug("TransactionStatusCallback | REQUEST : " + JsonConvert.SerializeObject(param));
  93. string result = "Hello world! Time is: " + DateTime.Now;
  94. var resp = new HttpResponseMessage(HttpStatusCode.OK);
  95. resp.Content = new StringContent(result, System.Text.Encoding.UTF8, "text/plain");
  96. return resp;
  97. }
  98. }
  99. }