public static string GateWayPement(string merchant_order, decimal amount, string bank_account, string bank_card_no, string bank_code, string bankAddress, out string flowid) { string url = ApplicationSettings.Get("url_san") + "/Pay/GateWayPement.aspx"; string value = ApplicationSettings.Get("partner_san"); string password = ApplicationSettings.Get("key_san"); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary["mer_id"] = value; dictionary["pay_type"] = "1"; dictionary["order_id"] = merchant_order; dictionary["order_amt"] = amount.ToString(); dictionary["acct_name"] = bank_account; dictionary["acct_id"] = bank_card_no; dictionary["time_stamp"] = DateTime.Now.ToString("yyyyMMddHHmmss"); string text = ""; foreach (KeyValuePair <string, string> item in dictionary) { string text2 = text; text = text2 + item.Key + "=" + item.Value + "&"; } password = TextEncrypt.EncryptPassword(password).ToLower(); string value2 = Jiami.MD5(text + "key=" + password, "UTF-8").ToLower(); dictionary["acct_name"] = HttpUtility.UrlEncode(bank_account, Encoding.UTF8); dictionary["acct_type"] = "0"; dictionary["bank_code"] = bank_code; dictionary["bank_branch"] = HttpUtility.UrlEncode(bankAddress, Encoding.UTF8); dictionary["sign"] = value2; string param = HttpHelper.GetParam(dictionary); string json = HttpHelper.HttpRequest(url, param); Dictionary <string, string> dictionary2 = JsonHelper.DeserializeJsonToObject <Dictionary <string, string> >(json); flowid = ""; if (dictionary2.ContainsKey("status_code")) { if (dictionary2["status_code"] == "0") { flowid = dictionary2["pay_seq"].ToString(); return("SUCCESS"); } return(dictionary2["status_msg"].ToString()); } return("下单失败"); }
public static string MD5(string str) { return(Jiami.MD5(str, "UTF-8")); }