/// <summary> /// 在收到VersionResult之后调用,会检测是否只有一次 /// </summary> public static void CheckAndInitAlipay() { var privateKey = AlipayUtil.Restore(ClientInfoHolder.Instance.AliPkey); AlipayPlugin.Init(ClientInfoHolder.Instance.AliPid, ClientInfoHolder.Instance.AliSid, privateKey); _hasInittedAlipay = true; }
public ActionResult Notify() { if (AlipayUtil.Verify(Request.Form)) { ViewBag.Message = "Success"; } else { ViewBag.Message = "Fail"; } return(View()); }
/// <summary> /// 获取支付宝POST过来通知消息,并以“参数名=参数值”的形式组成数组 /// request回来的信息组成的数组 /// </summary> /// <returns></returns> public Dictionary <string, string> GetRequestPost() { int i = 0; IDictionary <string, string> sArray = new Dictionary <string, string>(); NameValueCollection coll; coll = Request.Form; String[] requestItem = coll.AllKeys; string log = "\n=========================================" + DateTime.Now.ToString() + " 支付宝异步返回" + "=================================================\n"; for (i = 0; i < requestItem.Length; i++) { sArray.Add(requestItem[i], Request.Form[requestItem[i]]); log += requestItem[i] + ":" + Request.Form[requestItem[i]] + " \n"; } AlipayUtil.WriteLog(log); return((Dictionary <string, string>)sArray); }
/// <summary> /// 同步验签(App正常支付,支付宝服务端同步返回的报文需要上传到这进行验签,使用服务端sdk里的RSACheckContent()方法) /// ps:如果客户端同步通知只做个提示,此方法可不用,以异步通知为准 /// </summary> /// <returns></returns> public string getSynYanQian() { return(AlipayUtil.GetSynYanQian(true) + ""); }
public string GetAsynchronousYanQian() { return(AlipayUtil.AsynchronousYanQian(GetRequestPost())); }
public string GetRSASignedOrder(string body, string subject, string out_trade_no, string timeout_express, string total_amount) { return(AlipayUtil.CreateRSASignedOrderString(body, subject, out_trade_no, timeout_express, total_amount)); }
public ActionResult Alipay(decimal amount) { AlipayUtil.Request(DateTime.Now.ToString("yyyyMMddHHmmss"), amount); return(View()); }