コード例 #1
0
        /// <summary>
        /// 功能描述:再创参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="encstring">加密字段</param>
        /// <returns></returns>
        public string ProcessingZCselect(Dictionary <string, string> parameter, string encstring)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();



            //得到所有的值
            string keys = "";

            foreach (string item in parameter.Keys)
            {
                if (item != "notify_url")
                {
                    keys += parameter[item];
                }
            }
            keys += encstring;



            string pram = PayBehavior.EncryptionMd5(keys, "x2");

            parameter.Add("sign", pram);


            string reust = PayBehavior.AsciiDesc(parameter).TrimEnd('&');

            return(reust);
        }
コード例 #2
0
        /// <summary>
        /// 功能描述:QJ的参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="encstring">加密字段</param>
        /// <param name="outamunt">内扣金额</param>
        /// <returns></returns>
        public string ProcessingQJ(Dictionary <string, string> parameter, string encstring, decimal outamunt)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            parameter["order_amount"] = (decimal.Parse(parameter["order_amount"].ToString()) + outamunt).ToString();
            string returnjson = "{transdata:'',sign:'',signtype:''}";
            string newdict    = PayBehavior.AsciiDesc(parameter);

            newdict += "key=" + encstring;
            string md5string = PayBehavior.EncryptionMd5(newdict);


            string jsonpar = JsonHelper.SerializeObject(parameter);

            //转换成JSON
            //JArray array = JArray.Parse("[" + jsonpar + "]");

            JToken jToken = JToken.Parse(returnjson);



            jToken["sign"]      = HttpUtility.UrlEncode(md5string, Encoding.GetEncoding("utf-8"));
            jToken["transdata"] = HttpUtility.UrlEncode(jsonpar, Encoding.GetEncoding("utf-8"));
            jToken["signtype"]  = "MD5";
            return(jToken.ToString());
        }
コード例 #3
0
        /// <summary>
        /// 功能描述:Y的参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <returns></returns>
        public string ProcessingY(Dictionary <string, string> parameter, string key)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();
            string          ascdict     = PayBehavior.AsciiDesc(parameter);

            ascdict = ascdict + "md5key=" + key;
            string jsonpar = PayBehavior.EncryptionMd5(ascdict, "x2");

            parameter.Add("sign", jsonpar);
            string retuntext = PayBehavior.AsciiDesc(parameter).TrimEnd('&');

            return(retuntext);
        }
コード例 #4
0
        /// <summary>
        /// 功能描述:支付线程
        /// </summary>
        /// <param name="MerchantId">商户ID</param>
        /// <param name="order_no">订单号</param>
        /// <param name="order_amount">金额</param>
        /// <param name="order_time">订单创建时间</param>
        /// <param name="pay_type">支付方式</param>
        /// <param name="product_name">商品描述</param>
        /// <param name="fldNotice">异步通知地址</param>
        /// <param name="key">商户key值</param>

        public static void myThread(string MerchantId, string order_no, string order_amount, string order_time, string pay_type, string product_name, string fldNotice, string key)
        {
            TimerExampleState s = new TimerExampleState();

            s.fldNotice = fldNotice;

            AsynParameterPay asyn = new AsynParameterPay();

            asyn.MerchantId  = MerchantId;
            asyn.OrderID     = order_no;
            asyn.Amount      = order_amount;
            asyn.OrderTime   = order_time;
            asyn.Paytype     = pay_type;
            asyn.ProductName = product_name;
            asyn.Paystate    = "支付成功";

            string getpram = JsonHelper.SerializeObject(asyn);
            //json 转换成Dictionary
            Dictionary <string, string> valuePairs = JsonHelper.DeserializeStringToDictionary <string, string>(getpram);
            //排序
            RulePayBehavior behavior = new RulePayBehavior();
            string          sign     = behavior.AsciiDesc(valuePairs);

            //添加key值
            sign += "key=" + key;
            //md5加密
            string signkey = behavior.EncryptionMd5(sign);

            asyn.Sign = signkey;

            //装换成json
            s.pram = JsonHelper.SerializeObject(asyn);

            //创建代理对象TimerCallback,该代理将被定时调用
            TimerCallback timerDelegate = new TimerCallback(Request);
            //创建一个时间间隔为5m的定时器
            Timer timer = new Timer(timerDelegate, s, 5 * 60 * 1000, 5 * 60 * 1000);

            s.tmr = timer;
            //主线程停下来等待Timer对象的终止
            while (s.tmr != null)
            {
                Thread.Sleep(1000);
            }
        }
コード例 #5
0
        /// <summary>
        /// 功能描述:无名参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="encstring">加密字段</param>
        /// <returns></returns>
        public string ProcessingWM(Dictionary <string, string> parameter, string encstring)
        {
            string          reust       = "";
            RulePayBehavior PayBehavior = new RulePayBehavior();

            string ascdict = PayBehavior.AsciiDesc(parameter).TrimEnd('&');

            ascdict += encstring;

            reust = PayBehavior.EncryptionMd5(ascdict, "x2");

            parameter.Add("sign", reust);


            reust = PayBehavior.AsciiDesc(parameter).TrimEnd('&');

            return(reust);
        }
コード例 #6
0
        /// <summary>
        /// 功能描述:亿点的代付参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <returns></returns>
        public string ProcessingYDSub(Dictionary <string, string> parameter, string key)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //得到一个字符串


            parameter["transferMoney"] = (decimal.Parse(parameter["transferMoney"]) * 100).ToString("F0");

            string[] listkey = new string[] { "version", "merchantNum", "nonce_str", "merMark", "user_ip", "method", "transferId", "transferMoney", "bankCard", "bankllh" };

            string ascdict = "";

            foreach (string item in listkey)
            {
                ascdict += item + "=" + parameter[item] + "&";
            }



            //添加key
            ascdict = ascdict + "key=" + key;

            //md5加密

            string sign = PayBehavior.EncryptionMd5(ascdict);


            parameter.Add("sign", sign);


            string jsontext = PayBehavior.GetParamsStr(parameter);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }
コード例 #7
0
        /// <summary>
        /// 功能描述:亿动的参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <returns></returns>
        public string ProcessingYD(Dictionary <string, string> parameter, string key)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //得到一个字符串


            parameter["amount"] = (decimal.Parse(parameter["amount"]) * 100).ToString("F0");

            string[] listkey = new string[] { "version", "merchantNum", "nonce_str", "merMark", "client_ip", "payType", "orderNum", "amount", "body" };

            string ascdict = "";

            foreach (string item in listkey)
            {
                ascdict += item + "=" + parameter[item] + "&";
            }



            //添加key
            ascdict = ascdict + "key=" + key;

            //md5加密

            string sign = PayBehavior.EncryptionMd5(ascdict);

            parameter.Add("signType", "MD5");
            parameter.Add("sign", sign);


            string jsontext = PayBehavior.GetParamsStr(parameter);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }
コード例 #8
0
        /// <summary>
        /// 功能描述:海付查询参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="encstring">加密字段</param>
        /// <returns></returns>
        public string ProcessingHFselect(Dictionary <string, string> parameter, string encstring)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //参与签名的字段
            string[] listkey = new string[] { "userid" };

            //签名的字典表
            Dictionary <string, string> singdict = new Dictionary <string, string>();
            string ascdict = "";

            foreach (string item in listkey)
            {
                singdict.Add(item, parameter[item].ToString());
            }
            //排序得到字符

            ascdict = PayBehavior.AsciiDesc(singdict);


            //添加key
            ascdict = ascdict + "key=" + encstring;

            //md5加密

            string sign = PayBehavior.EncryptionMd5(ascdict, "x2");

            parameter.Add("sign", sign);


            string jsontext = PayBehavior.GetParamsStr(parameter);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }
コード例 #9
0
        /// <summary>
        /// 功能描述:海付的代付参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <returns></returns>
        public string ProcessingHFSub(Dictionary <string, string> parameter, string key)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //参与签名的字段
            string[] listkey = new string[] { "userid", "amount", "bankCode", "cardName", "cardNo", "mobile", "customerType", "accountTypeCode", "province", "city", "issueBankName", "notifyUrl" };

            //签名的字典表
            Dictionary <string, string> singdict = new Dictionary <string, string>();
            string ascdict = "";

            foreach (string item in listkey)
            {
                singdict.Add(item, parameter[item].ToString());
            }
            //排序得到字符

            ascdict = PayBehavior.AsciiDesc(singdict);


            //添加key
            ascdict = ascdict + "key=" + key;

            //md5加密

            string sign = PayBehavior.EncryptionMd5(ascdict, "x2");

            parameter.Add("sign", sign);


            string jsontext = PayBehavior.GetParamsStr(parameter);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }
コード例 #10
0
        /// <summary>
        /// 功能描述:亿点的查询参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <returns></returns>
        public string ProcessingYDSelect(Dictionary <string, string> parameter, string key)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //得到一个字符串



            string[] listkey = new string[] { "method", "transferId", "merchantNum", "nonce_str" };

            string ascdict = "";

            foreach (string item in listkey)
            {
                ascdict += item + "=" + parameter[item] + "&";
            }



            //添加key
            ascdict = ascdict + "key=" + key;

            //md5加密

            string sign = PayBehavior.EncryptionMd5(ascdict);


            parameter.Add("sign", sign);


            string jsontext = PayBehavior.GetParamsStr(parameter);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }
コード例 #11
0
        /// <summary>
        /// 功能描述:判断请求是否合法
        /// 创建  人:周文卿
        /// 创建时间:2018-11-15
        /// </summary>
        /// <param name="payparameter"></param>
        /// <returns></returns>
        public rerurnpram Islegitimate(payparameter payparameter)
        {
            string pramkey = "";

            try
            {
                Dictionary <object, object> dict2 = new Dictionary <object, object>();
                dict2 = PayBehavior.GetPropertiesboj <payparameter>(payparameter);
                rerurnpram rerurnpram = new rerurnpram();
                //日志实体类
                SysLogMsg sysLogMsg = new SysLogMsg();
                string    Retunr    = "";

                //判断是否有null的参数
                rerurnpram = PayBehavior.IsParmNull(dict2);
                if (rerurnpram.message != "" && rerurnpram.message != null)
                {
                    return(rerurnpram);
                }

                Dictionary <string, string> dict = new Dictionary <string, string>();
                dict = PayBehavior.GetProperties <payparameter>(payparameter);
                //判断金额
                if (!PayBehavior.tryint(payparameter.Amount))
                {
                    rerurnpram.statecode    = "40005";
                    rerurnpram.message      = "金额不正确!";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "金额不正确:{'Amount':'" + payparameter.Amount + "'}";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);
                }



                int    outint    = 0;
                string SecretKey = "";
                string rateName  = "";
                DDYZ.Ensis.Rule.DataRule.RuletblOrdertable ordertable = new DDYZ.Ensis.Rule.DataRule.RuletblOrdertable();
                List <newtblSubroute> subroutes = ordertable.IsRule(out outint, payparameter.MerchantId, decimal.Parse(payparameter.Amount), payparameter.OrderID, payparameter.PayType, out SecretKey, out rateName);
                switch (outint)
                {
                case 40001:
                    rerurnpram.statecode    = "40001";
                    rerurnpram.message      = "未开户的商户!";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "未开户的商户:{'MerchantId':'" + payparameter.MerchantId + "'}";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);

                case 40008:
                    rerurnpram.statecode    = "40008";
                    rerurnpram.message      = "订单号已存在!";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "订单号已存在:{'OrderID':'" + payparameter.OrderID + "'}";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);

                case 40003:
                    rerurnpram.statecode    = "40003";
                    rerurnpram.message      = "路由未配置,请联系管理员!";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "路由未配置,请联系管理员!";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);

                case 40012:
                    rerurnpram.statecode    = "40012";
                    rerurnpram.message      = "费率未配置!";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "费率未配置!";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);
                }
                #region 判断Key值
                //排序得到一个新的Dictionary
                string newdict = PayBehavior.AsciiDesc(dict);
                newdict += "key=" + SecretKey;
                //加密
                string md5string = PayBehavior.EncryptionMd5(newdict);
                pramkey = newdict;
                if (md5string != payparameter.Sign)
                {
                    rerurnpram.statecode    = "40002";
                    rerurnpram.message      = "验签失败";
                    rerurnpram.data         = "";
                    sysLogMsg.OperationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sysLogMsg.MerchantId    = payparameter.MerchantId;
                    sysLogMsg.MethodName    = "LB_PayH5";
                    sysLogMsg.Parameter     = JsonHelper.SerializeObject(payparameter);
                    sysLogMsg.Content       = "验签失败:{'mysign':" + md5string + ",'sign':" + payparameter.Sign + "}";
                    Retunr = LogHelp.logMessage(sysLogMsg);
                    LogHelp.warn(Retunr);
                    return(rerurnpram);
                }
                #endregion

                List <newtblSubroute> newList = PayBehavior.GetRandomList(subroutes, 1);



                string sign    = "";
                string orderid = "";
                string url     = "";
                //处理参数
                Dictionary <string, string> directory = PayBehavior.HandleParm(newList, dict, ref sign, ref orderid, ref url);
                //按照Ascii从小到大排序 得到一个字符串
                string ascdict = PayBehavior.AsciiDesc(directory);


                RuleCommon common = new RuleCommon();
                DataTable  dt     = common.GetQueryDate("", "tblChannelinformation", "1=1");

                string fldRequestUrl        = "";
                string fldUpstreamSecretKey = "";
                string fldType = "";
                string fldUpstreamMerchantID = "";
                string channel = "";
                //加上Key值
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (newList[0].fldPayType == dt.Rows[i]["fldPayType"].ToString() && newList[0].fldGatewaynumber == dt.Rows[i]["fldNum"].ToString())
                    {
                        fldRequestUrl        = dt.Rows[i]["fldRequestUrl"].ToString();
                        fldUpstreamSecretKey = dt.Rows[i]["fldUpstreamSecretKey"].ToString();
                        fldType = dt.Rows[i]["fldType"].ToString();
                        fldUpstreamMerchantID = dt.Rows[i]["fldUpstreamMerchantID"].ToString();
                        channel = dt.Rows[i]["fldNum"].ToString();
                    }
                }
                rerurnpram.message = fldUpstreamSecretKey;
                ascdict            = ascdict + "key=" + fldUpstreamSecretKey;
                //加密后的字符串
                string encstring = "";
                //判断加密方式
                switch (newList[0].fldEncryptionWay)
                {
                case "md5":
                    encstring = PayBehavior.EncryptionMd5(ascdict);
                    break;

                case "shal":
                    encstring = PayBehavior.Sha1Signature(ascdict);
                    break;
                }

                Processingparameter processingparameter = new Processingparameter();

                string  por     = "";
                CheckIP checkIP = new CheckIP();
                string  ip      = checkIP.GetIP();

                decimal amount = decimal.Parse(payparameter.Amount);

                string transactionnum = PayBehavior.ram(1000000000);



                RuleOldOrdertable ordertables = new RuleOldOrdertable();
                #region 根据各个通道 处理请求参数
                switch (newList[0].fldGatewaynumber)
                {
                case "QJ_004":
                    por = processingparameter.ProcessingQJ(directory, fldUpstreamSecretKey, 0);
                    break;

                case "YD_010":
                    por = processingparameter.ProcessingYD(directory, fldUpstreamSecretKey);
                    break;

                case "Y_007":
                    por = processingparameter.ProcessingY(directory, fldUpstreamSecretKey);
                    break;

                case "RUI_005":
                    por = processingparameter.ProcessingRUI(directory, fldUpstreamSecretKey);
                    break;

                case "HT_006":
                    por = processingparameter.ProcessingHT(directory, fldUpstreamSecretKey, "0");
                    break;

                case "ZC_008":
                    por = processingparameter.ProcessingZC(directory, fldUpstreamSecretKey);
                    break;

                case "WM_009":
                    por = processingparameter.ProcessingWM(directory, fldUpstreamSecretKey);
                    break;

                case "HF_011":
                    por = processingparameter.ProcessingHF(directory, fldUpstreamSecretKey);
                    break;

                case "XF_012":
                    por = processingparameter.ProcessingXF(directory, fldUpstreamSecretKey);
                    break;

                default:
                    directory.Add(sign, encstring);
                    por = processingparameter.Processing(directory);
                    break;
                }

                #endregion
                RulePayRequest rulePayRequest = new RulePayRequest();
                ////请求
                switch (newList[0].fldGatewaynumber)
                {
                case "RUI_005":
                case "HT_006":
                case "Y_007":
                case "ZC_008":
                case "WM_009":
                case "YD_010":
                case "HF_011":
                    //case "XF_012":
                    rerurnpram = rulePayRequest.HttpPost(fldRequestUrl, por, channel, payparameter.PayType, transactionnum, payparameter.OrderID);
                    break;

                case "XF_012":

                    rerurnpram = rulePayRequest.trt(fldRequestUrl, por, channel, payparameter.PayType, transactionnum, payparameter.OrderID);
                    break;

                default:

                    rerurnpram = rulePayRequest.PostUrl(fldRequestUrl, por, payparameter.PayType, channel, transactionnum, payparameter.OrderID);
                    break;
                }

                if (rerurnpram.message == "支付中")
                {
                    rerurnpram.message   = "支付中";
                    rerurnpram.statecode = "200";

                    rerurnpram.data = url + "?OrderID=" + payparameter.OrderID + "&tid=" + transactionnum;
                }
                else
                {
                    rerurnpram.message   = "支付失败";
                    rerurnpram.urlcode   = "";
                    rerurnpram.statecode = "500";
                }

                DDYZ.Ensis.Presistence.DataEntity.tblOrdertable tbl = new DDYZ.Ensis.Presistence.DataEntity.tblOrdertable();
                tbl.fldCreatetime      = DateTime.Now;
                tbl.fldtransactionnum  = transactionnum;
                tbl.fldChannelnum      = orderid;
                tbl.fldOrdernum        = payparameter.OrderID;
                tbl.fldOrderAmount     = amount;
                tbl.fldRtefundAmount   = amount;
                tbl.fldMerchID         = payparameter.MerchantId;
                tbl.fldOrederdetailed  = payparameter.ProductName;
                tbl.fldRateCode        = payparameter.PayType;
                tbl.fldRateName        = rateName;
                tbl.fldChannelType     = fldType;
                tbl.fldChannelID       = fldUpstreamMerchantID;
                tbl.fldOrderInvalid    = DateTime.Now;
                tbl.fldNotice          = payparameter.Notifyurl;
                tbl.fldLaunchIP        = ip;
                tbl.fldStaute          = rerurnpram.message;
                tbl.fldchangstautetime = DateTime.Now;
                tbl.fldtransactiontime = DateTime.Now;
                tbl.fldSettlement      = amount;
                tbl.fldServiceCharge   = 0;
                int index = ordertables.Insert(tbl);

                if (index > 0)
                {
                }
                else
                {
                    rerurnpram.message   = "支付失败";
                    rerurnpram.urlcode   = "";
                    rerurnpram.statecode = "500";
                }



                return(rerurnpram);
            }
            catch (Exception e)
            {
                throw new InsertException(e.Message, "RulePayMethod", "Islegitimate", pramkey);
            }
        }
コード例 #12
0
        /// <summary>
        /// 功能描述:汇通参数
        /// </summary>
        /// <param name="parameter">参数</param>
        /// <param name="key">加密字段</param>
        /// <param name="type">类型</param>
        /// <returns></returns>
        public string ProcessingHT(Dictionary <string, string> parameter, string key, string type)
        {
            RulePayBehavior PayBehavior = new RulePayBehavior();

            //得到加密方式
            string SignMethod = parameter["SignMethod"].ToString();
            string Amount     = "";

            if (type == "0")
            {
                Amount = "Amount";
            }
            else
            {
                Amount = "Payment_amt";
            }
            //金额乘以100
            if (parameter.ContainsKey(Amount))
            {
                parameter[Amount] = (decimal.Parse(parameter[Amount]) * 100).ToString("F0");
            }


            //删除异步地址和同步地址 进行签名
            parameter.Remove("SignMethod");



            //排序
            string paixu = PayBehavior.AsciiDesc(parameter).TrimEnd('&');

            //排序后的字符串加上key
            paixu = paixu + key;
            //加密字符串
            string sign = PayBehavior.EncryptionMd5(paixu, "x2");

            //添加 加密方式和sign


            parameter.Add("SignMethod", SignMethod);

            parameter.Add("Signature", sign);


            //对特殊参数先进行Base64编码然后把其中的”+”替换为“%2b”
            String[] base64Keys = new String[] { "CodeUrl", "ImgUrl", "Token_Id", "PayInfo", "sPayUrl", "PayUrl", "NotifyUrl", "ReturnUrl" };

            Dictionary <string, string> keyValuePairs = PayBehavior.stringtobase64(parameter, base64Keys);

            ////对所有的值进行encode
            string[] arrKeynew = keyValuePairs.Keys.ToArray();
            for (int i = 0; i < arrKeynew.Length; i++)
            {
                keyValuePairs[arrKeynew[i].ToString()] = HttpUtility.UrlEncode(keyValuePairs[arrKeynew[i].ToString()], System.Text.Encoding.UTF8);
            }

            //string jsontext = PayBehavior.GetParamsStr(keyValuePairs);
            string jsontext = PayBehavior.GetParamsStr(keyValuePairs);

            //string jsontext = JsonHelper.SerializeObject(parameter);

            return(jsontext);
        }