public string SuccessNotification(PaySuccessModel model) { if (model != null) { } return("true"); }
public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext) { string requestContent = actionContext.Request.Content.ReadAsStringAsync().Result; PaySuccessModel model = new PaySuccessModel(); model = JsonConvert.DeserializeObject <PaySuccessModel>(requestContent); string result = BaseBiz.ValidationSignature(model); if (!string.IsNullOrEmpty(result)) { var media = new JsonMediaTypeFormatter(); ObjectContent content = new ObjectContent(typeof(JsonResult <string>), new JsonResult <string> { ErrorCode = "0001", Message = result, Data = string.Empty }, media); actionContext.Response = new HttpResponseMessage() { Content = content }; } }
public ActionResult Index(PaymentModel payMod) { returnedURL = HttpContext.Request.Url.Scheme + "://" + HttpContext.Request.Url.Authority + HttpContext.Request.ApplicationPath + returnedURLReceiptPage; WebProxy webProxy = new WebProxy("192.9.200.10", 3128); webProxy.BypassProxyOnLocal = false; name = payMod.name; email = payMod.email; phone = payMod.phone; totalAmount = "150"; long milliseconds = DateTime.Now.Ticks; order_Id = milliseconds.ToString(); string hash_string = merchant_id + serviceType_id + order_Id + totalAmount + returnedURL + apiKey; string hashed = SHA512(hash_string); string jsondata = ""; string json = "{\"merchantId\":\"" + merchant_id + "\",\"serviceTypeId\":\"" + serviceType_id + "\",\"totalAmount\":\"" + totalAmount + "\",\"hash\":\"" + hashed + "\",\"orderId\":\"" + order_Id + "\",\"responseurl\":\"" + returnedURL + "\",\"payerName\":\"" + name + "\",\"payerEmail\":\"" + email + "\",\"payerPhone\":\"" + phone + "\",\"lineItems\":[ {\"lineItemsId\":\"881004944703\",\"beneficiaryName\":\"Department of Software Development\",\"beneficiaryAccount\":\"0230084841038\",\"bankCode\":\"000\",\"beneficiaryAmount\":\"150\",\"deductFeeFrom\":\"1\"}]}"; using (var client = new WebClient()) { client.Headers[HttpRequestHeader.Accept] = "application/json"; client.Headers[HttpRequestHeader.ContentType] = "application/json"; //Setup the WebClient to route packets through the proxy instead of directly client.Proxy = webProxy; try { jsondata = client.UploadString(gatewayURL, "POST", json); } catch (Exception ex) { throw ex; } } jsondata = jsondata.Replace("jsonp(", ""); jsondata = jsondata.Replace(")", ""); SplitResponseVO result = JsonConvert.DeserializeObject <SplitResponseVO>(jsondata); if (result != null) { status = result.status; remitaRetrivalReference = result.RRR.Trim(); statuscode = result.statuscode; var model = new PaySuccessModel { status = status, remitaRetrivalReference = remitaRetrivalReference, statuscode = statuscode }; return(View("PaymentSuccess", model)); } if (statuscode != null && statuscode.Equals("025")) { var model = new PayFailModel { merchantId = merchant_id, returnedURL = returnedURL, remitaRetrivalReference = remitaRetrivalReference, rrrPaymenthash_string = merchant_id + remitaRetrivalReference + apiKey //rrrPaymentSHA = SHA512(rrrPaymenthash_string), // rrr = rrrPaymentSHA //form1.Action = rrrGatewayPaymentURL; }; return(View("PaymentFail", model)); } return(View()); }