using System;
using System.Collections.Generic;
using System.Linq;
namespace EShang.Common
{
public class PayHelper
{
///
/// 支付获取签名
///
///
///
///
public static string getSign(Dictionary dic, string key)
{
var list = dic.OrderBy(s => s.Key);
string str = "";
foreach (var ss in list)
{
str += ss.Key + "=" + ss.Value + "&";
}
str += "key=" + key;
str = MD5Util.GetMD5(str , "UTF-8").ToUpper();
return str;
}
///
/// Dictionary 对象转换字符串
///
///
///
public static string paramsToString(Dictionary dic)
{
string str = String.Empty;
foreach (var e in dic)
{
str += e.Key + "=" + e.Value + "&";
}
str = str.TrimEnd('&');
return str;
}
}
}