Esempio n. 1
0
        /// <summary>
        /// 获取待签名字符串(调试用)
        /// </summary>
        /// <param name="inputPara">通知返回参数数组</param>
        /// <returns>待签名字符串</returns>
        private string GetPreSignStr(SortedDictionary <string, string> inputPara)
        {
            Dictionary <string, string> sPara = new Dictionary <string, string>();

            //过滤空值、sign与sign_type参数
            sPara = AlipayCore.FilterPara(inputPara);

            //获取待签名字符串
            string preSignStr = AlipayCore.CreateLinkString(sPara);

            return(preSignStr);
        }
Esempio n. 2
0
        /// <summary>
        /// 生成要请求给支付宝的参数数组
        /// </summary>
        /// <param name="sParaTemp">请求前的参数数组</param>
        /// <param name="code">字符编码</param>
        /// <returns>要请求的参数数组字符串</returns>
        private static string BuildRequestParaToString(SortedDictionary <string, string> sParaTemp, Encoding code)
        {
            //待签名请求参数数组
            Dictionary <string, string> sPara = new Dictionary <string, string>();

            sPara = BuildRequestPara(sParaTemp);

            //把参数组中所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对参数值做urlencode
            string strRequestData = AlipayCore.CreateLinkStringUrlencode(sPara, code);

            return(strRequestData);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取返回回来的待签名数组签名后结果
        /// </summary>
        /// <param name="inputPara">通知返回参数数组</param>
        /// <returns>签名结果字符串</returns>
        private string GetResponseMysign(SortedDictionary <string, string> inputPara)
        {
            Dictionary <string, string> sPara = new Dictionary <string, string>();

            //过滤空值、sign与sign_type参数
            sPara = AlipayCore.FilterPara(inputPara);

            //获得签名结果
            string mysign = AlipayCore.BuildMysign(sPara, _key, _sign_type, _input_charset);

            return(mysign);
        }
Esempio n. 4
0
        /// <summary>
        /// 生成要请求给支付宝的参数数组
        /// </summary>
        /// <param name="sParaTemp">请求前的参数数组</param>
        /// <returns>要请求的参数数组</returns>
        private static Dictionary <string, string> BuildRequestPara(SortedDictionary <string, string> sParaTemp)
        {
            //待签名请求参数数组
            Dictionary <string, string> sPara = new Dictionary <string, string>();
            //签名结果
            string mysign = "";

            //过滤签名参数数组
            sPara = AlipayCore.FilterPara(sParaTemp);

            //获得签名结果
            mysign = AlipayCore.BuildMysign(sPara, _key, _sign_type, _input_charset);

            //签名结果与签名方式加入请求提交参数组中
            sPara.Add("sign", mysign);
            sPara.Add("sign_type", _sign_type);

            return(sPara);
        }