public static bool CheckPayment(string notifyId) { var config = GeneralConfigInfo.Current; string arg = (config.Alipaypartnerid != "") ? config.Alipaypartnerid : "2088002872555901"; string arg2 = "https://www.alipay.com/cooperate/gateway.do?service=notify_verify&"; string arg3 = "http://notify.alipay.com/trade/notify_query.do?"; string http = EPayments.GetHttp(string.Format("{0}partner={1}¬ify_id={2}", arg2, arg, notifyId)); if (http != "true") { http = EPayments.GetHttp(string.Format("{0}partner={1}¬ify_id={2}", arg3, arg, notifyId)); } if (http != "true") { return(false); } if (HttpContext.Current.Request.HttpMethod.Equals("GET")) { return(true); } string[] allKeys = HttpContext.Current.Request.Form.AllKeys; var sb = new StringBuilder(); //if (config.Usealipaycustompartnerid == 0) //{ // string url = "http://pay.newlifex.com/gateway/alipay.ashx?_type=alipay&_action=verify&_product=" + Utils.Version + "&_version=" + Utils.Version; // for (int i = 0; i < allKeys.Length; i++) // { // if (DNTRequest.GetString(allKeys[i]) != "") // { // if (stringBuilder.ToString() == "") // { // stringBuilder.Append(allKeys[i] + "=" + Utils.UrlEncode(DNTRequest.GetString(allKeys[i]))); // } // else // { // stringBuilder.Append("&" + allKeys[i] + "=" + Utils.UrlEncode(DNTRequest.GetString(allKeys[i]))); // } // } // } // return EPayments.GetHttp(url, stringBuilder.ToString()) == "true"; //} for (int j = 0; j < allKeys.Length; j++) { if (DNTRequest.GetString(allKeys[j]) != "" && allKeys[j] != "sign" && allKeys[j] != "sign_type") { if (String.IsNullOrEmpty(sb.ToString())) { sb.Append(allKeys[j] + "=" + DNTRequest.GetString(allKeys[j])); } else { sb.Append("&" + allKeys[j] + "=" + DNTRequest.GetString(allKeys[j])); } } } sb.Append(config.Alipaypartnercheckkey); return(EPayments.GetMD5(sb.ToString(), "utf-8") == DNTRequest.GetString("sign")); }
public static string GetHttp(string url) { return(EPayments.GetHttp(url, "")); }