Пример #1
0
        /// <summary>
        /// 订单支付表单HTML字符串生成
        /// </summary>
        /// <param name="context">请求上下文对象</param>
        /// <param name="para">订单相关参数</param>
        /// <returns></returns>
        public string LinePaySendRequestWriter(LineRequestPara para)
        {
            string key = string.Empty;
            string keyValue = string.Empty;
            string signValue = string.Empty;
            string sign = string.Empty;
            RSAOperate Rdaop = new RSAOperate();

            Dictionary<string, string> dic = new Dictionary<string, string>() { 
             {"outOrderId",para.outOrderId},
             {"totalAmount",para.totalAmount.ToString()},
             {"goodsName",para.goodsName},
             {"goodsExplain",para.goodsExplain},
             {"merUrl",para.merUrl},
             {"noticeUrl",para.noticeUrl},
             {"bankCardType",para.bankCardType},
             {"bankCode",para.bankCode},
             {"orderCreateTime",para.orderCreateTime},
             {"lastPayTime",para.lastPayTime}
            };


            signValue = Rdaop.GetUrlParamString(CreateRquestUrlPara(para), RSASign.GetPayRSAParamSort());
            //提交参数加密
            sign = RSASign.GetMD5RSA(signValue + ProperConst.Key);

            var paraSort = RSASign.GetPayParamSort().ToList();


            StringBuilder writer = new StringBuilder();
            writer.Append(" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ");
            writer.Append(" <html xmlns=\"http://www.w3.org/1999/xhtml\" > ");
            writer.Append(" <head runat=\"server\"><title>中联信通支付</title> ");
            writer.Append(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/> ");
            writer.Append(" </head><body> ");
            writer.AppendFormat(" <form id=\"formpay\" method=\"post\" action=\"{0}\"> ", ProperConst.payUrl);

            paraSort.ForEach(k =>
            {
                key = k;
                if (key == "merchantCode")
                    keyValue = ProperConst.merchantCode;
                else
                    keyValue = dic[key];

                writer.AppendFormat(" <input type=\"text\" name=\"{0}\" style=\"display:none;\" value=\"{1}\"/> ",
                    key, keyValue);
            });

            writer.AppendFormat(" <input type=\"text\" name=\"sign\"  style=\"display:none;\" value=\"{0}\"/> ", sign);
            writer.Append(" </form> ");
            writer.Append(" <script type=\"text/javascript\"> document.getElementById(\"formpay\").submit();</script> ");

            return writer.ToString();
        }
Пример #2
0
        /// <summary>
        /// 订单支付表单HTML字符串生成
        /// </summary>
        /// <param name="context">请求上下文对象</param>
        /// <param name="para">订单相关参数</param>
        /// <returns></returns>
        public string LinePaySendRequestWriter(LineRequestPara para)
        {
            string     key       = string.Empty;
            string     keyValue  = string.Empty;
            string     signValue = string.Empty;
            string     sign      = string.Empty;
            RSAOperate Rdaop     = new RSAOperate();

            Dictionary <string, string> dic = new Dictionary <string, string>()
            {
                { "outOrderId", para.outOrderId },
                { "totalAmount", para.totalAmount.ToString() },
                { "goodsName", para.goodsName },
                { "goodsExplain", para.goodsExplain },
                { "merUrl", para.merUrl },
                { "noticeUrl", para.noticeUrl },
                { "bankCardType", para.bankCardType },
                { "bankCode", para.bankCode },
                { "orderCreateTime", para.orderCreateTime },
                { "lastPayTime", para.lastPayTime }
            };


            signValue = Rdaop.GetUrlParamString(CreateRquestUrlPara(para), RSASign.GetPayRSAParamSort());
            //提交参数加密
            sign = RSASign.GetMD5RSA(signValue + ProperConst.Key);

            var paraSort = RSASign.GetPayParamSort().ToList();


            StringBuilder writer = new StringBuilder();

            writer.Append(" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ");
            writer.Append(" <html xmlns=\"http://www.w3.org/1999/xhtml\" > ");
            writer.Append(" <head runat=\"server\"><title>中联信通支付</title> ");
            writer.Append(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/> ");
            writer.Append(" </head><body> ");
            writer.AppendFormat(" <form id=\"formpay\" method=\"post\" action=\"{0}\"> ", ProperConst.payUrl);

            paraSort.ForEach(k =>
            {
                key = k;
                if (key == "merchantCode")
                {
                    keyValue = ProperConst.merchantCode;
                }
                else
                {
                    keyValue = dic[key];
                }

                writer.AppendFormat(" <input type=\"text\" name=\"{0}\" style=\"display:none;\" value=\"{1}\"/> ",
                                    key, keyValue);
            });

            writer.AppendFormat(" <input type=\"text\" name=\"sign\"  style=\"display:none;\" value=\"{0}\"/> ", sign);
            writer.Append(" </form> ");
            writer.Append(" <script type=\"text/javascript\"> document.getElementById(\"formpay\").submit();</script> ");

            return(writer.ToString());
        }
Пример #3
0
 /// <summary>
 /// 生成中联信通 from 提交JSON参数
 /// </summary>
 /// <param name="para"></param>
 /// <returns></returns>
 private string CreateRquestUrlPara(LineRequestPara para)
 {
     return(para.DocumentsToJson());
 }
Пример #4
0
 /// <summary>
 /// 生成中联信通 from 提交JSON参数
 /// </summary>
 /// <param name="para"></param>
 /// <returns></returns>
 private string CreateRquestUrlPara(LineRequestPara para)
 {
     return para.DocumentsToJson();
 }