Exemplo n.º 1
0
        public override string getRequestURL()
        {
            string xml = "<?xml version=\"1.0\" encoding=\"GB2312\" ?><root>";

            ArrayList akeys = new ArrayList(parameters.Keys);

            foreach (string k in akeys)
            {
                string v = (string)parameters[k];
                xml += "<" + k + ">" + v + "</" + k + ">";
            }

            xml += "</root>";

            string content = EncodeBase64(xml, this.getCharset());

            string md5Res1 = MD5Util.GetMD5(content, this.getCharset()).ToLower();
            string md5Src2 = md5Res1 + this.getKey();

            string abstractStr = MD5Util.GetMD5(md5Src2, this.getCharset()).ToLower();

            this.setDebugInfo(xml + "=>" + content + "=>" + md5Src2 + " => sign:" + abstractStr);

            string requestURL = this.getGateUrl() + "?" + "content=" + TenpayUtil.UrlEncode(content, getCharset()) + "&abstract=" + TenpayUtil.UrlEncode(abstractStr, getCharset());

            return(requestURL);
        }
Exemplo n.º 2
0
        /** 获取带参数的请求URL  @return String */
        public virtual string getRequestURL()
        {
            this.createSign();

            StringBuilder sb    = new StringBuilder();
            ArrayList     akeys = new ArrayList(parameters.Keys);

            akeys.Sort();
            foreach (string k in akeys)
            {
                string v = (string)parameters[k];
                if (null != v && "key".CompareTo(k) != 0)
                {
                    sb.Append(k + "=" + TenpayUtil.UrlEncode(v, getCharset()) + "&");
                }
            }

            //去掉最后一个&
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }

            return(this.getGateUrl() + "?" + sb.ToString());
        }