Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string str = ApplicationSettings.Get("key_ymf");

            System.Collections.Generic.Dictionary <string, string> requestPost = this.GetRequestPost();
            string str2 = string.Format("apiName={0}&notifyTime={1}&tradeAmt={2}&merchNo={3}&merchParam={4}&orderNo={5}&tradeDate={6}&accNo={7}&accDate={8}&orderStatus={9}", new object[]
            {
                requestPost["apiName"],
                requestPost["notifyTime"],
                requestPost["tradeAmt"],
                requestPost["merchNo"],
                requestPost["merchParam"],
                requestPost["orderNo"],
                requestPost["tradeDate"],
                requestPost["accNo"],
                requestPost["accDate"],
                requestPost["orderStatus"]
            });
            string b = Jiami.MD5(str2 + str).ToLower();

            if (!(requestPost["signMsg"].ToLower() == b))
            {
                Log.Write("签名错误:" + JsonHelper.SerializeObject(requestPost));
                base.Response.Write("签名错误");
            }
            else
            {
                ShareDetialInfo shareDetialInfo = new ShareDetialInfo();
                shareDetialInfo.OrderID   = requestPost["orderNo"];
                shareDetialInfo.IPAddress = Utility.UserIP;
                shareDetialInfo.PayAmount = System.Convert.ToDecimal(requestPost["tradeAmt"]);
                Message message = FacadeManage.aideTreasureFacade.FilliedOnline(shareDetialInfo, 0);
                if (message.Success)
                {
                    base.Response.Write("SUCCESS");
                }
                else
                {
                    Log.Write(message.Content + ":" + JsonHelper.SerializeObject(requestPost));
                }
            }
        }
Пример #2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!base.IsPostBack)
     {
         NameValueCollection form = System.Web.HttpContext.Current.Request.Form;
         foreach (string text in form)
         {
             if (text != "sign")
             {
                 this.dic.Add(text, form[text]);
             }
         }
         string str   = PayHelper.PrepareSign(this.dic) + "&key=" + this.key;
         string text2 = Jiami.MD5(str).ToUpper();
         if (text2.Equals(form["sign"]))
         {
             ShareDetialInfo shareDetialInfo = new ShareDetialInfo();
             shareDetialInfo.OrderID   = form["out_trade_no"];
             shareDetialInfo.IPAddress = Utility.UserIP;
             shareDetialInfo.PayAmount = System.Convert.ToDecimal(form["total_fee"]);
             Message message = FacadeManage.aideTreasureFacade.FilliedOnline(shareDetialInfo, 0);
             if (message.Success)
             {
                 base.Response.Write("success");
             }
             else
             {
                 Log.Write(message.Content);
             }
         }
         else
         {
             Log.Write(JsonHelper.SerializeObject(this.dic));
             base.Response.Write("Signature verification failed");
         }
     }
 }
Пример #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string value  = base.Request["merchant_code"];
            string value2 = base.Request["notify_type"];
            string text   = base.Request["sign"];
            string text2  = base.Request["order_no"];
            string value3 = base.Request["order_amount"];
            string value4 = base.Request["order_time"];
            string value5 = base.Request["return_params"];
            string value6 = base.Request["trade_no"];
            string value7 = base.Request["trade_time"];
            string text3  = base.Request["trade_status"];
            string str    = ApplicationSettings.Get("key_41");
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            sortedDictionary.Add("merchant_code", value);
            sortedDictionary.Add("notify_type", value2);
            sortedDictionary.Add("order_no", text2);
            sortedDictionary.Add("order_amount", value3);
            sortedDictionary.Add("order_time", value4);
            sortedDictionary.Add("return_params", value5);
            sortedDictionary.Add("trade_no", value6);
            sortedDictionary.Add("trade_time", value7);
            sortedDictionary.Add("trade_status", text3);
            string text4 = "";

            foreach (System.Collections.Generic.KeyValuePair <string, string> current in sortedDictionary)
            {
                if (current.Value != "")
                {
                    string text5 = text4;
                    text4 = string.Concat(new string[]
                    {
                        text5,
                        current.Key,
                        "=",
                        current.Value,
                        "&"
                    });
                }
            }
            string text6 = text4 + "key=" + str;

            text4 = Jiami.MD5(text6, "UTF-8");
            if (!(text4 == text))
            {
                Log.Write(string.Concat(new string[]
                {
                    "签名错误—加密前:",
                    text6,
                    "—加密后:",
                    text4,
                    "—sign:",
                    text
                }));
                base.Response.Write("不合法数据");
            }
            else
            {
                if (!("success" == text3))
                {
                    Log.Write("支付失败");
                    base.Response.Write("支付失败");
                }
                else
                {
                    ShareDetialInfo shareDetialInfo = new ShareDetialInfo();
                    shareDetialInfo.OrderID   = text2;
                    shareDetialInfo.IPAddress = Utility.UserIP;
                    shareDetialInfo.PayAmount = System.Convert.ToDecimal(value3);
                    Message message = FacadeManage.aideTreasureFacade.FilliedOnline(shareDetialInfo, 0);
                    if (message.Success)
                    {
                        Log.Write("充值成功");
                        base.Response.Write("success");
                    }
                    else
                    {
                        Log.Write(message.Content);
                    }
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("dd");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text4 = text;

            switch (text4)
            {
            case "alipay":
                text = "010008";
                onLineOrder.ShareID = 2;
                goto IL_289;

            case "weixin":
                text = "010007";
                onLineOrder.ShareID = 3;
                goto IL_289;

            case "alipay-scan":
                text                = "010002";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_289;

            case "weixin-scan":
                text                = "010001";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_289;

            case "qq":
                text = "7";
                onLineOrder.ShareID = 6;
                goto IL_289;

            case "kuaijie":
                text = "010010";
                onLineOrder.ShareID = 7;
                goto IL_289;

            case "qq-scan":
                text                = "010000";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_289;

            case "jd":
                text = "6";
                onLineOrder.ShareID = 9;
                goto IL_289;

            case "baidu":
                text = "5";
                onLineOrder.ShareID = 10;
                goto IL_289;
            }
            text = "4";
            onLineOrder.ShareID = 1;
IL_289:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string url   = ApplicationSettings.Get("url_dd");
            string value = ApplicationSettings.Get("parter_dd");
            string str   = ApplicationSettings.Get("key_dd");
            string text2 = ApplicationSettings.Get("pay_url");

            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string orderID = onLineOrder.OrderID;
            string value2  = text2 + "/pay/diandian/notify_url.aspx";
            string str2    = "{\"mch_app_id\":\"http://www.qp137.com\",\"device_info\":\"AND_WAP\",\"ua\":\"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36\",\"mch_app_name\":\"支付测试\",\"cashier_desk\":\"1\"}";
            string s       = System.Web.HttpUtility.UrlEncode(str2);

            byte[] bytes  = System.Text.Encoding.UTF8.GetBytes(s);
            string value3 = System.Convert.ToBase64String(bytes);

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["version"]      = "1.0";
            dictionary["charset"]      = "utf-8";
            dictionary["merchant_id"]  = value;
            dictionary["out_trade_no"] = orderID;
            dictionary["user_ip"]      = GameRequest.GetUserIP();
            dictionary["subject"]      = "支付测试";
            dictionary["body"]         = "支付测试";
            dictionary["user_id"]      = formString;
            dictionary["total_fee"]    = formInt.ToString("#0.00");
            dictionary["notify_url"]   = value2;
            dictionary["return_url"]   = value2;
            dictionary["nonce_str"]    = TextUtility.CreateAuthStr(20, false);
            dictionary["biz_content"]  = value3;
            dictionary["trade_type"]   = text;
            dictionary = (
                from p in dictionary
                orderby p.Key
                select p).ToDictionary((System.Collections.Generic.KeyValuePair <string, string> p) => p.Key, (System.Collections.Generic.KeyValuePair <string, string> o) => o.Value);
            string str3 = PayHelper.PrepareSign(dictionary) + "&key=" + str;

            dictionary["sign"] = Jiami.MD5(str3).ToUpper();
            string param = PayHelper.ToXml(dictionary);
            string text3 = HttpHelper.HttpRequest(url, param, "post", "utf-8", "text/xml");

            System.Collections.Generic.Dictionary <string, string> dictionary2 = PayHelper.XmlToDic(text3);
            if (!dictionary2.ContainsKey("status"))
            {
                base.Response.Write(text3);
                base.Response.End();
            }
            else
            {
                string a = dictionary2["status"];
                if (a == "0")
                {
                    this.order_no     = orderID;
                    this.order_amount = formInt.ToString();
                    this.qrcode       = dictionary2["pay_info"];
                    base.Response.Redirect(this.qrcode);
                }
                else
                {
                    base.Response.Write(dictionary2["message"]);
                    base.Response.End();
                }
            }
        }
Пример #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 20)
            {
                base.Response.Write("充值金额不能低于20");
                base.Response.End();
            }
            string text = base.Request["type"];

            if (string.IsNullOrEmpty(text))
            {
                base.Response.Write("请选择支付方式");
                base.Response.End();
            }
            double num = System.Convert.ToDouble(base.Request["money"]);

            if (num < 0.0)
            {
                base.Response.Write("充值金额不能低于0元");
                base.Response.End();
            }
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("th");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string a;

            if ((a = text) != null)
            {
                if (!(a == "alipay-wap"))
                {
                    if (!(a == "weixin-wap"))
                    {
                        if (!(a == "alipay"))
                        {
                            if (a == "weixin")
                            {
                                text = "WEIXIN";
                                onLineOrder.ShareID = 5;
                            }
                        }
                        else
                        {
                            text = "ZHIFUBAO";
                            onLineOrder.ShareID = 4;
                        }
                    }
                    else
                    {
                        text = "WEIXIN_H5";
                        onLineOrder.ShareID = 3;
                    }
                }
                else
                {
                    text = "ZHIFUBAO_H5";
                    onLineOrder.ShareID = 2;
                }
            }
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string value     = ApplicationSettings.Get("partner_41");
            string str       = ApplicationSettings.Get("key_41");
            string actionUrl = ApplicationSettings.Get("url_41");
            string str2      = ApplicationSettings.Get("pay_url");
            string value2    = str2 + "/pay/41/notify_url.aspx";
            string value3    = str2 + "/pay/41/return_url.aspx";
            string value4    = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            SortedDictionary <string, string> sortedDictionary = new SortedDictionary <string, string>();

            sortedDictionary.Add("input_charset", "UTF-8");
            sortedDictionary.Add("notify_url", value2);
            sortedDictionary.Add("return_url", value3);
            sortedDictionary.Add("pay_type", "1");
            sortedDictionary.Add("bank_code", text);
            sortedDictionary.Add("merchant_code", value);
            sortedDictionary.Add("order_no", onLineOrder.OrderID);
            sortedDictionary.Add("order_amount", num.ToString());
            sortedDictionary.Add("order_time", value4);
            sortedDictionary.Add("product_name", "");
            sortedDictionary.Add("product_num", "");
            sortedDictionary.Add("req_referer", "");
            sortedDictionary.Add("customer_ip", "");
            sortedDictionary.Add("customer_phone", "");
            sortedDictionary.Add("receive_address", "");
            sortedDictionary.Add("return_params", "");
            string text2 = "";

            foreach (System.Collections.Generic.KeyValuePair <string, string> current in sortedDictionary)
            {
                if (current.Value != "")
                {
                    string text3 = text2;
                    text2 = string.Concat(new string[]
                    {
                        text3,
                        current.Key,
                        "=",
                        current.Value,
                        "&"
                    });
                }
            }
            text2 = text2 + "key=" + str;
            sortedDictionary.Add("sign", Jiami.MD5(text2, "UTF-8"));
            base.Response.Write(HttpHelper.CreatFormHtml(actionUrl, sortedDictionary, "post"));
        }
Пример #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string formString = GameRequest.GetFormString("account");

            if (formString == "")
            {
                base.Response.Write("充值账号错误");
                base.Response.End();
            }
            int formInt = GameRequest.GetFormInt("amount", 0);

            if (formInt < 6)
            {
                base.Response.Write("充值金额不能低于6元");
                base.Response.End();
            }
            string      text        = GameRequest.GetFormString("type");
            OnLineOrder onLineOrder = new OnLineOrder();

            onLineOrder.OrderID = PayHelper.GetOrderIDByPrefix("ymf");
            if (Fetch.GetUserCookie() == null)
            {
                onLineOrder.OperUserID = 0;
            }
            else
            {
                onLineOrder.OperUserID = Fetch.GetUserCookie().UserID;
            }
            onLineOrder.Accounts    = formString;
            onLineOrder.OrderAmount = formInt;
            onLineOrder.IPAddress   = GameRequest.GetUserIP();
            string text3 = text;

            switch (text3)
            {
            case "alipay":
                text = "9";
                onLineOrder.ShareID = 2;
                goto IL_283;

            case "weixin":
                text = "13";
                onLineOrder.ShareID = 3;
                goto IL_283;

            case "alipay-scan":
                text                = "4";
                this.paytype        = "支付宝";
                onLineOrder.ShareID = 4;
                goto IL_283;

            case "weixin-scan":
                text                = "5";
                this.paytype        = "微信";
                onLineOrder.ShareID = 5;
                goto IL_283;

            case "qq":
                text = "15";
                onLineOrder.ShareID = 6;
                goto IL_283;

            case "qq-scan":
                text                = "6";
                this.paytype        = "QQ";
                onLineOrder.ShareID = 8;
                goto IL_283;

            case "jd":
                text = "21";
                onLineOrder.ShareID = 9;
                goto IL_283;

            case "jd-scan":
                text = "8";
                onLineOrder.ShareID = 13;
                goto IL_283;

            case "kuaijie":
                text = "1";
                onLineOrder.ShareID = 7;
                goto IL_283;
            }
            onLineOrder.ShareID = 1;
IL_283:
            Message message = FacadeManage.aideTreasureFacade.RequestOrder(onLineOrder);

            if (!message.Success)
            {
                base.Response.Write(message.Content);
                base.Response.End();
            }
            string value   = ApplicationSettings.Get("parter_ymf");
            string key2    = ApplicationSettings.Get("key_ymf");
            string text2   = ApplicationSettings.Get("pay_url");
            string gateway = ApplicationSettings.Get("url_ymf");

            if (text2 == "")
            {
                text2 = "http://" + base.Request.Url.Host;
            }
            string value2 = text2 + "/pay/youmifu/notify_url.aspx";

            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary["apiName"] = "WAP_PAY_B2C";
            if (text == "wangyin")
            {
                dictionary["apiName"] = "WEB_PAY_B2C";
            }
            dictionary["apiVersion"]   = "1.0.0.1";
            dictionary["platformID"]   = value;
            dictionary["merchNo"]      = value;
            dictionary["orderNo"]      = onLineOrder.OrderID;
            dictionary["tradeDate"]    = System.DateTime.Now.ToString("yyyyMMdd");
            dictionary["amt"]          = formInt.ToString() + ".00";
            dictionary["merchUrl"]     = value2;
            dictionary["merchParam"]   = TextUtility.CreateAuthStr(20, false);
            dictionary["tradeSummary"] = "shop";
            dictionary["customerIP"]   = GameRequest.GetUserIP();
            string sourceData = PayHelper.PrepareSign(dictionary);
            string value3     = Jiami.sign(sourceData, key2);

            dictionary["signMsg"]       = value3;
            dictionary["choosePayType"] = text;
            if (text == "wangyin")
            {
                dictionary["choosePayType"] = "1";
            }
            dictionary["bankCode"] = "";
            base.Response.Write(PayHelper.BuildForm(dictionary, gateway));
            base.Response.End();
        }