Exemple #1
0
        /// <summary>
        /// 生成NativeURL
        /// </summary>
        /// <param name="pProductid">商品标识</param>
        /// <returns></returns>
        public string GenerateNativeUrl(string pProductid)
        {
            if (Channel == null)
            {
                throw new WeiXinPayException("Channel未设置");
            }
            var temp = Paras.Where(t => t.Key.ToLower() == "appid" || t.Key.ToLower() == "noncestr" ||
                                   t.Key.ToLower() == "timestamp" || t.Key.ToLower() == "productid").Select(t => t);
            var dic = new Dictionary <string, object> {
            };

            foreach (var item in temp)
            {
                dic[item.Key.ToLower()] = item.Value;
            }
            dic["appkey"]    = Channel.PaySignKey;
            dic["productid"] = pProductid;
            var nosign = CommonUtil.GetParametersStr(dic);

            dic["sign"] = FormsAuthentication.HashPasswordForStoringInConfigFile(nosign, "SHA1").ToLower();
            temp        = dic.Where(t => t.Key != "appkey").Select(t => t);
            return(string.Format("weixin://wxpay/bizpayurl?", CommonUtil.GetParametersStr(temp)));
        }