Exemple #1
0
        public override void SendRequest()
        {
            StringBuilder buf = new StringBuilder();

            Globals.AddParameter(buf, "attach", "TenpayAssure");
            Globals.AddParameter(buf, "chnid", this.Seller);
            Globals.AddParameter(buf, "cmdno", "12");
            Globals.AddParameter(buf, "encode_type", "2");
            Globals.AddParameter(buf, "mch_desc", this.mch_desc);
            Globals.AddParameter(buf, "mch_name", this.mch_name);
            Globals.AddParameter(buf, "mch_price", this.mch_price);
            Globals.AddParameter(buf, "mch_returl", this.mch_returl);
            Globals.AddParameter(buf, "mch_type", "1");
            Globals.AddParameter(buf, "mch_vno", this.mch_vno);
            Globals.AddParameter(buf, "need_buyerinfo", "2");
            Globals.AddParameter(buf, "seller", this.Seller);
            Globals.AddParameter(buf, "show_url", this.show_url);
            Globals.AddParameter(buf, "transport_desc", "");
            Globals.AddParameter(buf, "transport_fee", "0");
            Globals.AddParameter(buf, "version", "2");
            Globals.AddParameter(buf, "key", this.Key);
            string str = Globals.GetMD5(buf.ToString());
            string url = "https://www.tenpay.com/cgi-bin/med/show_opentrans.cgi?attach=TenpayAssure&chnid=" + this.Seller + "&cmdno=12&encode_type=2&mch_desc=" + this.mch_desc + "&mch_name=" + this.mch_name + "&mch_price=" + this.mch_price + "&mch_returl=" + this.mch_returl + "&mch_type=1&mch_vno=" + this.mch_vno + "&need_buyerinfo=2&seller=" + this.Seller + "&show_url=" + this.show_url + "&transport_desc=&transport_fee=0&version=2&sign=" + str;

            this.RedirectToGateway(url);
        }
Exemple #2
0
        public override void VerifyNotify(int timeout, string configXml)
        {
            string parameterValue = this.parameters["version"];
            string str2           = this.parameters["cmdno"];
            string str3           = this.parameters["retcode"];
            string str4           = this.parameters["status"];
            string str5           = this.parameters["seller"];
            string str6           = this.parameters["total_fee"];
            string str7           = this.parameters["trade_price"];
            string str8           = this.parameters["transport_fee"];
            string str9           = this.parameters["buyer_id"];
            string str10          = this.parameters["chnid"];
            string str11          = this.parameters["cft_tid"];
            string str12          = this.parameters["mch_vno"];
            string str13          = this.parameters["attach"];
            string str14          = this.parameters["sign"];

            if (!str3.Equals("0"))
            {
                this.OnNotifyVerifyFaild();
            }
            else
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(configXml);
                StringBuilder buf = new StringBuilder();
                Globals.AddParameter(buf, "attach", str13);
                Globals.AddParameter(buf, "buyer_id", str9);
                Globals.AddParameter(buf, "cft_tid", str11);
                Globals.AddParameter(buf, "chnid", str10);
                Globals.AddParameter(buf, "cmdno", str2);
                Globals.AddParameter(buf, "mch_vno", str12);
                Globals.AddParameter(buf, "retcode", str3);
                Globals.AddParameter(buf, "seller", str5);
                Globals.AddParameter(buf, "status", str4);
                Globals.AddParameter(buf, "total_fee", str6);
                Globals.AddParameter(buf, "trade_price", str7);
                Globals.AddParameter(buf, "transport_fee", str8);
                Globals.AddParameter(buf, "version", parameterValue);
                Globals.AddParameter(buf, "key", document.FirstChild.SelectSingleNode("Key").InnerText);
                if (!str14.Equals(Globals.GetMD5(buf.ToString())))
                {
                    this.OnNotifyVerifyFaild();
                }
                else
                {
                    string str15 = str4;
                    if (str15 != null)
                    {
                        if (!(str15 == "3"))
                        {
                            if (str15 == "5")
                            {
                                this.OnFinished(true);
                            }
                        }
                        else
                        {
                            this.OnPayment();
                        }
                    }
                }
            }
        }