Exemplo n.º 1
0
        /// <summary>
        /// 创建虚拟交易
        /// </summary>
        /// <param name="gatewayUrl">提交支付宝的地址</param>
        /// <param name="digitalGoods">交易参数</param>
        /// <param name="page">Page对象</param>
        public void CreateDigitalTrade(string gatewayUrl, DigitalGoods digitalGoods, Page page)
        {
            HttpResponse Response = page.Response;
            string       t        = gatewayUrl + "?" + Md5SignParam(digitalGoods);
            string       url      = string.Format("<script language='javascript'>window.open(\"{0}\") </script>", t);

            Response.Write(url);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取Md5sign后的参数
        /// </summary>
        /// <param name="digitalGoods"></param>
        /// <returns></returns>
        private string Md5SignParam(DigitalGoods digitalGoods)
        {
            if (digitalGoods.Sign_Type.ToLower() != "md5")
            {
                throw new CommonAliPayBaseException("Sign_Type不支持MD5", 100);
            }

            SortedList <string, string> goods = GetParam(digitalGoods);

            string param       = GetUrlParam(goods, false) + digitalGoods.Sign;
            string encodeParam = GetUrlParam(goods, true) + "&";
            string sign        = GetMd5Sign(digitalGoods._Input_Charset, param);

            return(encodeParam + string.Format("sign={0}&sign_type={1}", HttpUtility.HtmlEncode(sign),
                                               HttpUtility.HtmlEncode(digitalGoods.Sign_Type)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// ��ȡMd5sign��IJ���
        /// </summary>
        /// <param name="digitalGoods"></param>
        /// <returns></returns>
        private string Md5SignParam(DigitalGoods digitalGoods)
        {
            if (digitalGoods.Sign_Type.ToLower() != "md5")
            {
                throw new CommonAliPayBaseException("Sign_Type��֧��MD5", 100);
            }

            SortedList<string, string> goods = GetParam(digitalGoods);

            string param = GetUrlParam(goods, false) + digitalGoods.Sign;
            string encodeParam = GetUrlParam(goods, true) + "&";
            string sign = GetMd5Sign(digitalGoods._Input_Charset, param);
            return encodeParam + string.Format("sign={0}&sign_type={1}", HttpUtility.HtmlEncode(sign),
                HttpUtility.HtmlEncode(digitalGoods.Sign_Type));
        }
Exemplo n.º 4
0
 /// <summary>
 /// �������⽻��
 /// </summary>
 /// <param name="gatewayUrl">�ύ֧�����ĵ�ַ</param>
 /// <param name="digitalGoods">���ײ���</param>
 /// <param name="page">Page����</param>
 public void CreateDigitalTrade(string gatewayUrl, DigitalGoods digitalGoods, Page page)
 {
     HttpResponse Response = page.Response;
     string t = gatewayUrl + "?" + Md5SignParam(digitalGoods);
     string url = string.Format("<script language='javascript'>window.open(\"{0}\") </script>", t);
     Response.Write(url);
 }