コード例 #1
0
        public Order Query(Order order)
        {
            string key        = PayAndQueryKamen.key;
            string CustomerId = PayAndQueryKamen.merchantID;
            string queryUrl   = PayAndQueryKamen.queryUrl;

            CookieContainer coockie = new CookieContainer();
            string          strmd5  = "CustomerId=" + CustomerId + "CustomerOrderNo=" + order.OrderInsideID + key;
            string          sign    = Md5Helper.EncryptMd5_Kamen(strmd5);
            StringBuilder   str     = new StringBuilder();

            str.AppendFormat("CustomerId={0}", CustomerId);                //云接口商户编号
            str.AppendFormat("&CustomerOrderNo={0}", order.OrderInsideID); //客户外部系统订单号
            str.AppendFormat("&Sign={0}", sign);                           //数字签名(MerchantID+OrderID+key)


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " Kamen 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(queryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Charge,订单号:" + order.OrderInsideID + " Kamen 订单查询:" + result, LogPathFile.Recharge.ToString());

            //订单状态(未处理、处理中、可疑、成功、失败)
            string OrderStatus = Regex.Match(result, @"<OrderStatus>(.*?)</OrderStatus>").Groups[1].Value;
            string Description = Regex.Match(result, @"<Description>(.*?)</Description>").Groups[1].Value;
            string OrderNo     = Regex.Match(result, @"<OrderNo>(.*?)</OrderNo>").Groups[1].Value;

            switch (OrderStatus)
            {
            case "可疑":
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = Description + "-" + OrderNo;
                return(order);

            case "成功":
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                order.RechargeMsg    = Description + "-" + OrderNo;
                return(order);

            case "失败":
                if (Description.Contains("站点余额不足"))
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                }
                else
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                }

                order.RechargeMsg = Description + "-" + OrderNo;
                return(order);

            case "未处理":
            case "处理中":
            default:
                break;
            }

            return(order);
        }
コード例 #2
0
        public string SubmitOrder(Order order, string str = null)
        {
            try
            {
                CookieContainer coockie = new CookieContainer();

                if (string.IsNullOrEmpty(str))
                {
                    str = setPostDate(order);
                }

                WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " ShuShan 提交参数:" + str.ToString(), LogPathFile.Recharge.ToString());

                string result = PostAndGet.HttpPostString(submitUrl, str.ToString(), ref coockie);

                WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " ShuShan 提交返回:" + result, LogPathFile.Recharge.ToString());

                return(result);
            }
            catch (Exception ex)
            {
                WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " 异常:" + ex.Message, LogPathFile.Exception.ToString());
                return(null);
            }
        }
コード例 #3
0
ファイル: ManageSUP.cs プロジェクト: AnCalm/PayClient
        public string getCatalog(string catalogName)
        {
            coockie = new CookieContainer();
            string        strmd5 = merchantID + key;
            string        sign   = Md5Helper.GetMD5String_utf8(strmd5);
            StringBuilder str    = new StringBuilder();

            str.AppendFormat("MerchantI={0}", merchantID);
            str.AppendFormat("&Sign={0}", sign);  //数字签名(MerchantID+ key)

            string result = PostAndGet.HttpPostString(getCatalogUrl, str.ToString(), ref coockie);

            Regex           re = new Regex(@"<No>(.*?)</No>\s+<Name>(.*?)</Name>
", RegexOptions.None);
            MatchCollection mc = re.Matches(result);

            foreach (Match ma in mc)
            {
                if (ma.Groups[2].Value.ToString().Contains("catalogName"))
                {
                    return(ma.Groups[1].Value);
                }
            }

            return(null);
        }
コード例 #4
0
ファイル: QueryXunTong.cs プロジェクト: AnCalm/PayClient
        public Order Query(Order order)
        {
            string MerchantID = PayAndQueryXunTong.merchantID;
            string key        = PayAndQueryXunTong.key;
            string QueryUrl   = PayAndQueryXunTong.QueryUrl;


            CookieContainer coockie = new CookieContainer();

            string username  = MerchantID;          //	接入代理用户名
            string type      = "qb";                //	查询类型(固定:qb)
            string sporderid = order.OrderInsideID; //	SP订单号,商户平台的订单号,最长32位(yyyyMMddHHmmss+8)
            string buyhaoma  = order.TargetAccount; //	要进行查询的号码
            string sign      = "";                  //	MD5组合数字签名方式:MD5(username={}&type={}&sporderid={}&buyhaoma={}&key=APIkey加密串均为小写,MD5输出为32位小写


            string strmd5 = "username="******"&type=" + type + "&sporderid=" + sporderid + "&buyhaoma=" + buyhaoma + "&key=" + key;;

            sign = Md5Helper.MD5Encrypt(strmd5);

            StringBuilder str = new StringBuilder();

            str.AppendFormat("username={0}", username);
            str.AppendFormat("&type={0}", type);
            str.AppendFormat("&sporderid={0}", sporderid);
            str.AppendFormat("&buyhaoma={0}", buyhaoma);
            str.AppendFormat("&sign={0}", sign);


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " XunTong 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " XunTong 订单查询:" + result, LogPathFile.Recharge.ToString());

            // 001 充值成功 002 充值失败 003 充值处理中 004,已冲正 005,充正中 006其他情况

            if (result.Equals("001") || result.Equals("004"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.successful);
            }
            else if (result.Equals("002"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.failure);
            }
            else if (result.Equals("003") || result.Equals("005") || result.Equals("006"))
            {
                //充值中
            }
            else
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious);
            }

            return(order);
        }
コード例 #5
0
ファイル: QueryMBJ.cs プロジェクト: AnCalm/PayClient
        public Order Query(Order order)
        {
            string MerchantID = PayAndQueryMBJ.merchantID;
            string key        = PayAndQueryMBJ.key;
            string QueryUrl   = PayAndQueryMBJ.queryUrl;


            CookieContainer coockie = new CookieContainer();

            string        strmd5 = MerchantID + order.OrderInsideID + key;
            string        sign   = Md5Helper.MD5Encrypt(strmd5);
            StringBuilder str    = new StringBuilder();

            str.AppendFormat("MerchantID={0}", MerchantID);                //商家编号
            str.AppendFormat("&MerchantOrderID={0}", order.OrderInsideID); //商家订单编号
            str.AppendFormat("&Sign={0}", sign);                           //数字签名


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " MBJ 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " MBJ 订单查询:" + result, LogPathFile.Recharge.ToString());

            string state        = Regex.Match(result, @"<state>(.*?)</state>").Groups[1].Value;
            string mbjOrderId   = Regex.Match(result, @"<order-id>(.*?)</order-id>").Groups[1].Value;
            string mbjStateInfo = Regex.Match(result, @"<state-info>(.*?)</state-info>").Groups[1].Value;


            if (state.Equals("101"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                order.RechargeMsg    = mbjStateInfo + "-" + mbjOrderId;
            }
            else if (state.Equals("201") || state.Equals("202") || state.Equals("203") || state.Equals("301") || state.Equals("302") || state.Equals("304") ||
                     state.Equals("305") || state.Equals("306") || state.Equals("307") || state.Equals("401") || state.Equals("405") || state.Equals("501"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                order.RechargeMsg    = mbjStateInfo + "-" + mbjOrderId;
            }
            else if (state.Equals("601"))
            {
                int status = getOrderStatus(mbjStateInfo, "601");
                order.RechargeStatus = status;
                order.RechargeMsg    = mbjStateInfo + "-" + mbjOrderId;
            }
            else if (state.Equals("102"))
            {//充值中
            }
            else
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious) + "-" + mbjOrderId;
            }


            return(order);
        }
コード例 #6
0
        public string SubmitOrder(Order order, string str = null)
        {
            CookieContainer coockie = new CookieContainer();

            if (string.IsNullOrEmpty(str))
            {
                str = setPostDate(order);
            }

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " Xinqidian 提交参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(submitUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " Xinqidian 提交返回:" + result, LogPathFile.Recharge.ToString());

            return(result);
        }
コード例 #7
0
ファイル: PayAndQuery99vip.cs プロジェクト: AnCalm/PayClient
        public string SubmitOrder(Order order, string str = null)
        {
            CookieContainer coockie = new CookieContainer();

            if (string.IsNullOrEmpty(str))
            {
                str = setPostDate(order, "http://116.62.44.48/NotifyForm99vip.aspx", AreaValueType._99vip);
            }

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " 99vip 提交参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(submitUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:SubmitOrder,订单号:" + order.OrderInsideID + " 99vip 提交返回:" + result, LogPathFile.Recharge.ToString());

            return(result);
        }
コード例 #8
0
ファイル: ManageSUP.cs プロジェクト: AnCalm/PayClient
        public string queryOrder(Order order, string merchantOrderID, ref string msg)
        {
            int    num    = 0;
            string status = "未处理";

            while (num < 5)
            {
                coockie = new CookieContainer();
                string        strmd5 = merchantID + merchantOrderID + key;
                string        sign   = Md5Helper.GetMD5String_utf8(strmd5);
                StringBuilder str    = new StringBuilder();
                str.AppendFormat("MerchantID={0}", merchantID);
                str.AppendFormat("&OrderID={0}", merchantOrderID); //订单编号(多个订单以','分隔)
                str.AppendFormat("&Sign={0}", sign);               //数字签名(MerchantID+OrderID+key)
                str.AppendFormat("&MerchantType={0}", "0");        //商家类型(默认为0):0进货商、1供货商
                str.AppendFormat("&OrderIDType={0}", "0");         //状态(默认为0):0易约销售系统生成的订单编号、1合作商自定义的下游订单编号


                WriteLog.Write("方法:Charge,订单号:" + order.OrderInsideID + " sup 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

                string result = PostAndGet.HttpPostString("http://hphy.eyuesale.com/api/QueryOrder", str.ToString(), ref coockie);

                WriteLog.Write("方法:Charge,订单号:" + order.OrderInsideID + " sup 订单查询:" + result, LogPathFile.Recharge.ToString());

                status = Regex.Match(result, @"<Status>(.*?)</Status>").Groups[1].Value;
                msg    = Regex.Match(result, @"<DetailMsg>(.*?)</DetailMsg>").Groups[1].Value;

                if (status == "未处理")
                {
                    System.Threading.Thread.Sleep(2 * 1000);
                    num++;
                }
                if (status == "充值成功" || status == "充值失败")
                {
                    break;
                }

                if (num > 5)
                {
                    status = "可疑";
                    msg    = "查询订单结果失败";
                }
            }
            return(status);
        }
コード例 #9
0
        public Order Query(Order order)
        {
            string MerchantID = PayAndQueryRuiLian.merchantID;
            string key        = PayAndQueryRuiLian.key;
            string QueryUrl   = PayAndQueryRuiLian.QueryUrl;

            CookieContainer coockie = new CookieContainer();

            string        strmd5 = MerchantID + order.OrderInsideID + key;
            string        sign   = Md5Helper.MD5Encrypt(strmd5);
            StringBuilder str    = new StringBuilder();

            str.AppendFormat("cid={0}", MerchantID);           //商家编号
            str.AppendFormat("&oid={0}", order.OrderInsideID); //商家订单编号
            str.AppendFormat("&sign={0}", sign);               //数字签名


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " Pay1 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " Pay1 订单查询:" + result, LogPathFile.Recharge.ToString());

            string state = Regex.Match(result, @"result=(.*?)&").Groups[1].Value;
            string msg   = Regex.Match(result, @"&msg=(.*)").Groups[1].Value;


            if (state.Equals("true"))
            {
                if (msg == "1")
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.successful;
                    order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.successful);
                }
                else if (msg == "0")
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.failure);
                }
            }
            else if (state.Equals("false"))
            {
                if (msg == "参数有误" || msg == "商家帐号错误" || msg == "校验失败" || msg == "订单不存在")
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = msg;
                }
                else
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                    order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious);
                }
            }
            else
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious);
            }

            return(order);
        }
コード例 #10
0
        public Order Charge(Order order)
        {
            try
            {
                CookieContainer cookie = new CookieContainer();

                decimal totalAmount    = (decimal)order.BuyAmount;
                decimal totalAmountNum = totalAmount;
                int     isContinue     = 0;

                if (CheckStrHelper.IsChinese(order.TargetAccount))
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = "用户名不合法";
                    return(order);
                }

                order.TargetAccount = CheckChargeAccount(order.TargetAccount);

                string radPayType = "1";
                if (order.RechargeModeName.Contains("帐号直充") || order.RechargeModeName.Contains("通用点") ||
                    order.RechargeModeName.Contains("游戏点数") || order.RechargeModeName.Contains("帐号充值"))
                {
                    radPayType = "1";
                }
                else if (order.RechargeModeName.Contains("寄售点") || order.RechargeModeName.Contains("点数寄售") ||
                         order.RechargeModeName.Contains("点卡交易/寄售"))
                {
                    radPayType = "2";
                }

                while (totalAmount > 0)
                {
                    #region 提交充值
                    int chargeNum = 0;
                    int vibiNum   = 0;

                    if (isContinue > 3) //充值频繁,重试三次
                    {
                        break;
                    }

                    if (!GetChargeNum((int)totalAmount, ref chargeNum))
                    {
                        break;
                    }

                    totalAmount = totalAmount - chargeNum;
                    vibiNum     = chargeNum * 2;

                    string result = "";


                    #region 获取参数 帐号判断

                    result = PostAndGet.HttpGetString("http://www.vpay8.com/Fetch/wy/wpay.aspx", "", ref cookie);

                    string __VIEWSTATE       = Regex.Match(result, @"id=""__VIEWSTATE""\s+value=""(.*?)"" />").Groups[1].Value;
                    string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION""\s+value=""(.*?)"" />").Groups[1].Value;


                    StringBuilder checkgetDataBuilder = new StringBuilder();

                    checkgetDataBuilder.AppendFormat("__VIEWSTATE={0}", System.Web.HttpUtility.UrlEncode(__VIEWSTATE));
                    checkgetDataBuilder.AppendFormat("&__EVENTVALIDATION={0}", System.Web.HttpUtility.UrlEncode(__EVENTVALIDATION));
                    checkgetDataBuilder.AppendFormat("&DropDownList1={0}", chargeNum * 10);
                    checkgetDataBuilder.AppendFormat("&radPayType={0}", radPayType);
                    checkgetDataBuilder.AppendFormat("&qqnum={0}", order.TargetAccount);
                    checkgetDataBuilder.AppendFormat("&qqnum2={0}", order.TargetAccount);
                    checkgetDataBuilder.AppendFormat("&Button2={0}", "%E6%8F%90%E4%BA%A4%E8%AE%A2%E5%8D%95");

                    result = PostAndGet.HttpPostString("http://www.vpay8.com/Fetch/wy/wpay.aspx", checkgetDataBuilder.ToString(), ref cookie, "http://www.vpay8.com/Fetch/wy/wpay.aspx");
                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "提交参数:" + checkgetDataBuilder.ToString()
                                   + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

                    if (result.Contains("请输入正确的网易通行证账号"))
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.failure;
                        order.RechargeMsg    = "帐号不存在";
                        return(order);
                    }

                    //string href = Regex.Match(result, @"<a href=""(.*?)"">").Groups[1].Value;

                    ////http://www.vpay8.com/Fetch/wy/WSubmit.aspx?orderid=WY170313223559213118&pv=1&v=30&[email protected]&s=1788a04956cd27cc45de0d83f9ef010c

                    //result = PostAndGet.HttpGetString(System.Web.HttpUtility.UrlDecode(href, Encoding.Default), checkgetDataBuilder.ToString(), ref cookie);

                    //WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                    // + ",订单第二步提交返回:" + result, LogPathFile.Recharge);

                    #endregion

                    #region Vbi钱包充值

                    string spid      = Regex.Match(result, @"<input name='spid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string spname    = Regex.Match(result, @"<input name='spname'\s+type=""hidden""\s+value='(.*?)'> ").Groups[1].Value;
                    string spoid     = Regex.Match(result, @"<input name='spoid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string spreq     = Regex.Match(result, @"<input name='spreq'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string sprec     = Regex.Match(result, @"<input name='sprec'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string userid    = Regex.Match(result, @"<input name='userid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string userip    = Regex.Match(result, @"<input name='userip'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string spmd5     = Regex.Match(result, @"<input name='spmd5'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string spcustom  = Regex.Match(result, @"<input name='spcustom'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string spversion = Regex.Match(result, @"<input name='spversion'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string urlcode   = Regex.Match(result, @"<input name='urlcode'\s+type=hidden\s+value='(.*?)' >").Groups[1].Value;
                    string spzf      = Regex.Match(result, @"<input name='spzf'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;
                    string money     = Regex.Match(result, @"<input name='money'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value;


                    StringBuilder vnetonePostdataBuilder = new StringBuilder();
                    vnetonePostdataBuilder.AppendFormat("spid={0}", spid);
                    vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid);
                    vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&userid={0}", System.Web.HttpUtility.UrlEncode(userid, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&userip={0}", userip);
                    vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5);
                    vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion);
                    vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode);
                    vnetonePostdataBuilder.AppendFormat("&spzf={0}", spzf);
                    vnetonePostdataBuilder.AppendFormat("&money={0}", money);

                    OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi);

                    if (orderChargeAccount == null)
                    {
                        order.RechargeMsg += "未取到v币帐号||";
                        isContinue++;
                        continue;
                    }

                    result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie, vibiNum);
                    #endregion

                    #region 充值结果判断
                    if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值"))
                    {
                        order.RechargeMsg         += spoid + "充值成功||";
                        order.SuccessfulAmount    += chargeNum;
                        orderChargeAccount.Balance = orderChargeAccount.Balance - chargeNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }
                    else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询"))
                    {
                        order.RechargeMsg         += spoid + "充值成功(请五分钟后再登陆商户网站进行帐户查询)||";
                        order.SuccessfulAmount    += chargeNum;
                        orderChargeAccount.Balance = orderChargeAccount.Balance - chargeNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }
                    else if (result.Contains("操作失败"))
                    {
                        order.RechargeMsg += spoid + "操作失败||";
                        totalAmount       += chargeNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("充值过于频繁"))
                    {
                        order.RechargeMsg += "充值频繁||";
                        totalAmount       += chargeNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("验证码输入不正确"))
                    {
                        order.RechargeMsg += spoid + "验证码输入不正确||";
                        totalAmount       += chargeNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("账户余额不足"))
                    {
                        order.RechargeMsg += "账户余额不足||";
                        totalAmount       += chargeNum;;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else if (result.Contains("支付密码不正确"))
                    {
                        order.RechargeMsg += spoid + "支付密码不正确||";
                        totalAmount       += chargeNum;;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else if (result.Contains("用户不存在"))
                    {
                        order.RechargeMsg += spoid + "用户不存在||";
                        totalAmount       += chargeNum;;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else if (result.Contains("操作_Failure"))
                    {
                        order.RechargeMsg += spoid + "帐号错误||";
                        totalAmount       += chargeNum;;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else
                    {
                        order.RechargeMsg += spoid + "存疑||";
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    #endregion

                    #endregion
                }

                #region 订单状态判断
                if (order.SuccessfulAmount >= totalAmountNum)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.successful;
                }
                else if (order.SuccessfulAmount <= 0)
                {
                    if (order.RechargeMsg.Contains("帐号错误") || order.RechargeMsg.Contains("用户不存在"))
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    }
                    else
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                    }
                }
                else
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                }
                #endregion

                return(order);
            }
            catch (Exception ex)
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",充值异常信息:" + ex.Message, LogPathFile.Exception);

                return(order);
            }
        }
コード例 #11
0
ファイル: pay_hanyou_com.cs プロジェクト: AnCalm/PayClient
        bool ReCharge(Order order, int payNum, CookieContainer cookie, ref string CardNumber, ref string status, ref string msg)
        {
            #region 参数提交

            //nickname=可是地方和高科技&channelid=6&channelname=纵游一卡通&money=50&yeepay_type=ZY&v=1496835901593
            StringBuilder checkStr = new StringBuilder();
            checkStr.AppendFormat("nickname={0}", order.TargetAccount);
            checkStr.AppendFormat("&channelid={0}", "6");
            checkStr.AppendFormat("&channelname={0}", "纵游一卡通");
            checkStr.AppendFormat("&money={0}", (int)payNum);
            checkStr.AppendFormat("&yeepay_type={0}", "ZY");
            checkStr.AppendFormat("&v={0}", "1496835901593");
            string result = PostAndGet.HttpPostString_HY("http://pay.hanyou.com/pay.do", checkStr.ToString(), ref cookie, "pay.hanyou.com", "http://pay.hanyou.com/");
            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",帐号检测提交返回:" + result, LogPathFile.Recharge);

            //{"msg":"该昵称不存在","code":1,"nickName":"可是地方和高科技"}

            if (result.Contains("该昵称不存在"))
            {
                status = "失败";
                msg    = "用户不存在||";
                return(false);
            }

            if (!result.Contains("确认充值"))
            {
                status = "失败";
                msg    = "确认提交订单失败||";
                return(true);
            }


            string channelid   = Regex.Match(result, @"name=""channelid"" value=""(.*?)"" />").Groups[1].Value;
            string userid      = Regex.Match(result, @"name=""userid"" value=""(.*?)"" />").Groups[1].Value;
            string nickname    = Regex.Match(result, @"name=""nickname"" value=""(.*?)"" />").Groups[1].Value;
            string unionid     = Regex.Match(result, @"name=""unionid"" value=""(.*?)"" />").Groups[1].Value;
            string money       = Regex.Match(result, @"name=""money"" value=""(.*?)"" />").Groups[1].Value;
            string yeepay_type = Regex.Match(result, @"name=""yeepay_type"" value=""(.*?)"" />").Groups[1].Value;

            StringBuilder placeorderStr = new StringBuilder();
            placeorderStr.AppendFormat("channelid={0}", channelid);
            placeorderStr.AppendFormat("&userid={0}", userid);
            placeorderStr.AppendFormat("&nickname={0}", nickname);
            placeorderStr.AppendFormat("&unionid={0}", unionid);
            placeorderStr.AppendFormat("&money={0}", money);
            placeorderStr.AppendFormat("&yeepay_type={0}", yeepay_type);

            result = PostAndGet.HttpPostString_HY("http://pay.hanyou.com/order/placeorder.do", placeorderStr.ToString(), ref cookie, "pay.hanyou.com", "http://pay.hanyou.com/");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第一步提交返回:" + result, LogPathFile.Recharge);


            #endregion

            #region 纵游卡提交

            Cards cards = SQLCards.GetChargeCards(OrderChargeAccountType.ZYCard, (decimal)order.ProductParValue);

            if (cards == null)
            {
                status = "失败";
                msg    = "取卡失败||";
                return(true);
            }
            CardNumber = cards.CardNumber;


            string bizType         = Regex.Match(result, @"name=\\""bizType\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string merchantNo      = Regex.Match(result, @"name=\\""merchantNo\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string merchantOrderNo = Regex.Match(result, @"name=\\""merchantOrderNo\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string requestAmount   = Regex.Match(result, @"name=\\""requestAmount\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string url             = Regex.Match(result, @"name=\\""url\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string cardCode        = Regex.Match(result, @"name=\\""cardCode\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string productName     = Regex.Match(result, @"name=\\""productName\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;
            string hmac            = Regex.Match(result, @"name=\\""hmac\\"" value=\\""(.*?)\\""\/>").Groups[1].Value;

            string        yeeykUrl = "http://www.yeeyk.com/yeex-xcard-app/createOrder";
            StringBuilder yeeykStr = new StringBuilder();
            yeeykStr.AppendFormat("bizType={0}", bizType);
            yeeykStr.AppendFormat("&merchantNo={0}", merchantNo);
            yeeykStr.AppendFormat("&merchantOrderNo={0}", merchantOrderNo);
            yeeykStr.AppendFormat("&requestAmount={0}", requestAmount);
            yeeykStr.AppendFormat("&url={0}", System.Web.HttpUtility.UrlEncode(url, Encoding.Default));
            yeeykStr.AppendFormat("&cardCode={0}", cardCode);
            yeeykStr.AppendFormat("&productName={0}", System.Web.HttpUtility.UrlEncode(productName, Encoding.UTF8));
            yeeykStr.AppendFormat("&hmac={0}", hmac);
            result = PostAndGet.HttpPostString(yeeykUrl, yeeykStr.ToString(), ref cookie, "http://pay.hanyou.com/");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡收卡台提交返回:" + result, LogPathFile.Recharge);



            result = PostAndGet.HttpPostString("http://www.yeeyk.com/yeex-xcard-app/card/cardRule?cardType=ZY", "", ref cookie, "http://www.yeeyk.com/yeex-xcard-app/createOrder");

            string acquiringURL = "http://www.yeeyk.com/yeex-xcard-app/acquiring";
            //?amount=1&cardNo=703015036002529&cardType=ZY&customerNumber=10011829538&password=339745869503044&payAmount=50.00&requestId=yeeyk_201706071950562364486631
            StringBuilder acquiringStr = new StringBuilder();
            acquiringStr.AppendFormat("amount={0}", "1");
            acquiringStr.AppendFormat("&cardNo={0}", cards.CardNumber);
            acquiringStr.AppendFormat("&cardType={0}", "ZY");
            acquiringStr.AppendFormat("&customerNumber={0}", merchantNo);
            acquiringStr.AppendFormat("&password={0}", cards.CardPassWord);
            acquiringStr.AppendFormat("&payAmount={0}", payNum.ToString() + ".00");
            acquiringStr.AppendFormat("&requestId={0}", merchantOrderNo);

            result = PostAndGet.HttpPostString(acquiringURL + "?" + acquiringStr.ToString(), "", ref cookie, "http://www.yeeyk.com/yeex-xcard-app/createOrder");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交返回:" + result, LogPathFile.Recharge);

            if (!result.Contains("收单成功"))
            {
                status = "失败";
                msg    = "纵游卡提交失败||";
                return(true);
            }

            #endregion


            System.Threading.Thread.Sleep(5 * 1000);

            string orderno = merchantOrderNo.Substring(merchantOrderNo.IndexOf('_') + 1);
            #region 查询卡密结果

            string queryResultURL = "http://www.yeeyk.com/yeex-xcard-app/queryResult?" + "customerNumber=" + merchantNo + "&requestId=" + merchantOrderNo;
            //?customerNumber=10011829538&requestId=yeeyk_201706071950562364486631

            //http://www.yeeyk.com/yeex-xcard-app/queryResult?customerNumber=10011829538&requestId=yeeyk_201706122324593034531264

            result = PostAndGet.HttpPostString(queryResultURL, "", ref cookie, "http://www.yeeyk.com/yeex-xcard-app/createOrder");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交结果查询返回:" + result, LogPathFile.Recharge);

            string code = Regex.Match(result, @"""code"" : ""(.*?)""").Groups[1].Value;


            string confirmResultURL = "http://www.yeeyk.com/yeex-xcard-app/confirmResult?orderKey=" + code;
            result = PostAndGet.HttpGetString_9Y(confirmResultURL, "", ref cookie, "www.yeeyk.com", "http://www.yeeyk.com/yeex-xcard-app/createOrder");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交结果查询最终返回:" + result, LogPathFile.Recharge);


            if (result.Contains("充值成功") || result.Contains("订单支付成功"))
            {
                status = "成功";
                msg    = orderno + "充值成功||";

                cards.ReChargeStatus = (int)OrderRechargeStatus.successful;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else if (result.Contains("订单支付失败"))
            {
                status = "失败";
                msg    = orderno + "订单支付失败||";
                cards.ReChargeStatus = (int)OrderRechargeStatus.untreated;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else
            {
                status = "成功";
                msg    = orderno + "订单提交成功查询结果失败||";

                cards.ReChargeStatus = (int)OrderRechargeStatus.successful;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }

            #endregion
        }
コード例 #12
0
        public Order Charge(Order order)
        {
            try
            {
                decimal totalPrice      = (decimal)order.BuyAmount;
                decimal totalPriceFixed = totalPrice;
                int     isContinue      = 0;


                string payment = "";
                if (!Getpayment((int)order.ProductParValue, ref payment))
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = "充值面值不合法";
                    return(order);
                }

                if (CheckStrHelper.IsChinese(order.TargetAccount))
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = "充值帐号不能为中文";
                    return(order);
                }

                if (order.TargetAccount.Length < 6 || order.TargetAccount.Length > 20)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = "请输入6~20位字母和数字";
                    return(order);
                }

                CookieContainer cookie = new CookieContainer();

                while (totalPrice > 0)
                {
                    #region 提交充值
                    if (isContinue > 3) //充值频繁,重试三次
                    {
                        break;
                    }

                    totalPrice--;;

                    #region 帐号登录
                    string result = PostAndGet.HttpGetString_XY("http://my.xunyou.com/index.php/uCenter/getLoginId", "", ref cookie);
                    if (result.Contains("-1"))
                    {
                        if (!login(order, ref cookie))
                        {
                            order.RechargeMsg = "帐号登录失败";
                            totalPrice++;
                            isContinue++;
                            continue;
                        }
                    }
                    #endregion

                    #region 获取参数 订单确认
                    string        postURl  = "https://my.xunyou.com/index.php/payment/confirmPayment2014";
                    StringBuilder postData = new StringBuilder();
                    postData.AppendFormat("payment_object={0}", System.Web.HttpUtility.UrlEncode(payment, Encoding.Default));
                    postData.AppendFormat("&isconversion={0}", "2");
                    postData.AppendFormat("&product_id={0}", "2");
                    postData.AppendFormat("&payment_login={0}", order.TargetAccount);
                    postData.AppendFormat("&usernameinput={0}", order.TargetAccount);
                    postData.AppendFormat("&payment_login_confirm={0}", order.TargetAccount);
                    postData.AppendFormat("&payment_card={0}", "ICBC-NET");
                    postData.AppendFormat("&selected_product_name={0}", "%E8%BF%85%E6%B8%B8VIP");
                    postData.AppendFormat("&user_mask1={0}", "");
                    postData.AppendFormat("&user_mask2={0}", "");
                    postData.AppendFormat("&addition_product_id={0}", "");
                    postData.AppendFormat("&userid={0}", "");
                    postData.AppendFormat("&sub_product_class={0}", "");
                    postData.AppendFormat("&client={0}", "	0");
                    postData.AppendFormat("&payment_method={0}", "28");
                    postData.AppendFormat("&eid={0}", "10612");
                    postData.AppendFormat("&gameid={0}", "0");
                    postData.AppendFormat("&gid={0}", "0");
                    postData.AppendFormat("&cdkey={0}", "0");
                    postData.AppendFormat("&payment_card_account={0}", "");
                    postData.AppendFormat("&payment_card_password={0}", "");
                    postData.AppendFormat("&payment_bank={0}", "8001");
                    postData.AppendFormat("&vertifycode={0}", "");
                    postData.AppendFormat("&mobile_num={0}", "");
                    postData.AppendFormat("&packid={0}", "0");
                    postData.AppendFormat("&mac={0}", "");
                    postData.AppendFormat("&pageid={0}", "4");
                    postData.AppendFormat("&pwd={0}", "");
                    postData.AppendFormat("&spid={0}", "");
                    postData.AppendFormat("&spid2={0}", "");
                    result = PostAndGet.HttpPostString(postURl, postData.ToString(), ref cookie, "https://my.xunyou.com/pay/?eid=10612");
                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

                    if (result.Contains("用户不存在"))
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.failure;
                        order.RechargeMsg    = "用户不存在";
                        return(order);
                    }
                    if (result.Contains("请更换其他支付方式"))
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.failure;
                        order.RechargeMsg    = "帐号未设置安全工具";
                        return(order);
                    }

                    if (!result.Contains("确认订单"))
                    {
                        totalPrice++;
                        isContinue++;
                        continue;
                    }

                    #endregion

                    #region Vbi钱包充值


                    string spid             = Regex.Match(result, @"value=""(.*?)"" name=""spid""").Groups[1].Value;
                    string spname           = Regex.Match(result, @"value=""(.*?)"" name=""spname""").Groups[1].Value;
                    string spoid            = Regex.Match(result, @"value=""(.*?)"" name=""spoid""").Groups[1].Value;
                    string spreq            = Regex.Match(result, @"value=""(.*?)"" name=""spreq""").Groups[1].Value;
                    string sprec            = Regex.Match(result, @"value=""(.*?)"" name=""sprec""").Groups[1].Value;
                    string userip           = Regex.Match(result, @"value=""(.*?)"" name=""userip""").Groups[1].Value;
                    string spcustom         = Regex.Match(result, @"value=""(.*?)"" name=""spcustom""").Groups[1].Value;
                    string spversion        = Regex.Match(result, @"value=""(.*?)"" name=""spversion""").Groups[1].Value;
                    string money            = Regex.Match(result, @"value=""(.*?)"" name=""money""").Groups[1].Value;
                    string urlcode          = Regex.Match(result, @"value=""(.*?)"" name=""urlcode""").Groups[1].Value;
                    string spmd5            = Regex.Match(result, @"value=""(.*?)"" name=""spmd5""").Groups[1].Value;
                    string userid           = Regex.Match(result, @"value=""(.*?)"" name=""userid""").Groups[1].Value;
                    string payment_object   = Regex.Match(result, @"value=""(.*?)"" name=""payment_object""").Groups[1].Value;
                    string payment_orderid  = Regex.Match(result, @"value=""(.*?)"" name=""payment_orderid""").Groups[1].Value;
                    string payment_login    = Regex.Match(result, @"value=""(.*?)"" name=""payment_login""").Groups[1].Value;
                    string payment_product  = Regex.Match(result, @"value=""(.*?)"" name=""payment_product""").Groups[1].Value;
                    string payment_paymoney = Regex.Match(result, @"value=""(.*?)"" name=""payment_paymoney""").Groups[1].Value;


                    StringBuilder vnetonePostdataBuilder = new StringBuilder();
                    vnetonePostdataBuilder.AppendFormat("spid={0}", spid);
                    vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.Default));
                    vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid);
                    vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.Default));
                    vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.Default));
                    vnetonePostdataBuilder.AppendFormat("&userip={0}", userip);
                    vnetonePostdataBuilder.AppendFormat("&spcustom={0}", spcustom);
                    vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion);
                    vnetonePostdataBuilder.AppendFormat("&money={0}", money);
                    vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode);
                    vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5);
                    vnetonePostdataBuilder.AppendFormat("&userid={0}", userid);
                    vnetonePostdataBuilder.AppendFormat("&payment_object={0}", System.Web.HttpUtility.UrlEncode(payment_object, Encoding.Default));
                    vnetonePostdataBuilder.AppendFormat("&payment_orderid={0}", payment_orderid);
                    vnetonePostdataBuilder.AppendFormat("&payment_login={0}", payment_login);
                    vnetonePostdataBuilder.AppendFormat("&payment_product={0}", System.Web.HttpUtility.UrlEncode(payment_product, Encoding.Default));
                    vnetonePostdataBuilder.AppendFormat("&payment_paymoney={0}", System.Web.HttpUtility.UrlEncode(payment_paymoney, Encoding.Default));


                    OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi);

                    if (orderChargeAccount == null)
                    {
                        order.RechargeMsg += "未取到v币帐号||";
                        totalPrice++;
                        isContinue++;
                        continue;
                    }
                    result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie);

                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",V币钱包充值返回:" + result, LogPathFile.Recharge);
                    #endregion

                    #region 迅游订单查询
                    result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/index.php/payment/getOrderState/" + spoid, "", ref cookie);

                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",订单查询结果:" + result, LogPathFile.Recharge);

                    string xyOrderStatus = Regex.Match(result, @"{""state"":(.*?),").Groups[1].Value;
                    string xyfpaysuccess = Regex.Match(result, @"""fpaysuccess"":""(.*?)"",").Groups[1].Value;


                    if (xyOrderStatus == "1")
                    {
                        if (xyfpaysuccess == "1")
                        {
                            order.RechargeMsg         += spoid + "充值成功||";
                            order.SuccessfulAmount    += order.ProductParValue;
                            orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue;
                            SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        }
                        else if (xyfpaysuccess == "0")
                        {
                            order.RechargeMsg += spoid + "未支付成功||";
                            totalPrice++;
                            SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                            isContinue = isContinue + 6;
                        }
                        else
                        {
                            order.RechargeMsg += spoid + "存疑||";
                            SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        }
                    }
                    else
                    {
                        order.RechargeMsg += spoid + "存疑||";
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }

                    #endregion

                    #region VB充值结果判断
                    //if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值"))
                    //{
                    //    order.RechargeMsg += "充值成功||";
                    //    order.SuccessfulAmount += order.ProductParValue;
                    //    orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //}
                    //else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询"))
                    //{
                    //    order.RechargeMsg += "充值成功(请五分钟后再登陆商户网站进行帐户查询)||";
                    //    order.SuccessfulAmount += order.ProductParValue;
                    //    orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //}
                    //else if (result.Contains("操作失败"))
                    //{
                    //    order.RechargeMsg += "操作失败||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //    isContinue++;
                    //}
                    //else if (result.Contains("充值过于频繁"))
                    //{
                    //    order.RechargeMsg += "充值频繁||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //    isContinue++;
                    //}
                    //else if (result.Contains("验证码输入不正确"))
                    //{
                    //    order.RechargeMsg += "验证码输入不正确||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //    isContinue++;
                    //}
                    //else if (result.Contains("账户余额不足"))
                    //{
                    //    order.RechargeMsg += "账户余额不足||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                    //}
                    //else if (result.Contains("支付密码不正确"))
                    //{
                    //    order.RechargeMsg += "支付密码不正确||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                    //}
                    //else if (result.Contains("用户不存在"))
                    //{
                    //    order.RechargeMsg += "用户不存在||";
                    //    totalPrice++;
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                    //}
                    //else
                    //{
                    //    order.RechargeMsg += "存疑||";
                    //    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    //}
                    #endregion

                    #endregion
                }

                #region 订单状态判断
                if (order.SuccessfulAmount >= totalPriceFixed)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.successful;
                }
                else
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                }
                #endregion

                return(order);
            }
            catch (Exception ex)
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",充值一场信息:" + ex.Message, LogPathFile.Exception);

                return(order);
            }
        }
コード例 #13
0
        /// <summary>
        /// 通知数网订单结果
        /// </summary>
        /// <param name="merchantID">商户编号</param>
        /// <param name="key">商户密码</param>
        /// <param name="url">接口地址</param>
        /// <param name="order">订单</param>
        /// <returns></returns>
        public bool notigyOrderToSW(Order order, bool isprocessing = false)
        {
            WriteLog.Write("方法:订单开始通知数网,订单号:" + order.OrderInsideID, LogPathFile.Other.ToString());

            string sign = Md5Helper.MD5Encrypt(merchantID + order.OrderExternalID + key);

            //订单状态(充值成功:1,充值失败:0,处理中:2, 可疑订单:3)
            int    State     = 1;
            string StateInfo = "充值成功";

            if (isprocessing)
            {
                State     = 2;
                StateInfo = EnumService.GetDescription(OrderRechargeStatus.processing);
            }
            else
            {
                switch (order.RechargeStatus)
                {
                case (int)OrderRechargeStatus.successful:
                    State = 1;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.successful);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }
                    break;

                case (int)OrderRechargeStatus.failure:
                    State = 0;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.failure);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }
                    break;

                case (int)OrderRechargeStatus.processing:
                    State     = 2;
                    StateInfo = EnumService.GetDescription(OrderRechargeStatus.processing);
                    break;

                case (int)OrderRechargeStatus.untreated:
                case (int)OrderRechargeStatus.suspicious:
                    State = 3;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.suspicious);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }

                    break;
                }
            }
            string postData = string.Format("MerchantID={0}&OrderID={1}&State={2}&StateInfo={3}&Sign={4}", merchantID, order.OrderExternalID, State, System.Web.HttpUtility.UrlEncode(StateInfo, Encoding.UTF8), sign);

            //item = new HttpItem()
            //{
            //    URL = url+"?"+postData,
            //    Encoding = Encoding.UTF8,//可选项 默认类会自动识别
            //    Method = "get"    //可选项 默认为Get
            //};

            //得到HTML代码
            //result = http.GetHtml(item);

            System.Net.CookieContainer cookie = new System.Net.CookieContainer();

            //string result = PostAndGet.HttpGetString(url, postData, ref cookie);

            string result = PostAndGet.HttpPostString(notifyOrderurl, postData, ref cookie);


            WriteLog.Write("方法:订单通知数网结果,订单号:" + order.OrderInsideID + ",数网通知返回:" + result, LogPathFile.Other.ToString());

            string notifyStatus = Regex.Match(result, @"<state>(.*?)</state>").Groups[0].Value;

            if (notifyStatus.Contains("1"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #14
0
        bool ReCharge(Order order, int payNum, string payuid, CookieContainer cookie, ref string CardNumber, ref string status, ref string msg)
        {
            #region 参数提交

            string        ordercollectUrl = "http://pay.web.7k7k.com/ordercollect";
            StringBuilder ordercollectStr = new StringBuilder();
            ordercollectStr.AppendFormat("payuid={0}", payuid);
            ordercollectStr.AppendFormat("&paywhere={0}", "2");
            string result = PostAndGet.HttpPostString_HX(ordercollectUrl, ordercollectStr.ToString(), ref cookie, "pay.web.7k7k.com", "http://pay.web.7k7k.com/?qq-pf-to=pcqq.c2c");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

            string cid = Regex.Match(result, @"""cid"":""(.*?)"",").Groups[1].Value;

            Cards cards = SQLCards.GetChargeCards(OrderChargeAccountType.MMCard, payNum);
            if (cards == null)
            {
                status = "失败";
                msg    = "取卡失败||";
                return(true);
            }
            CardNumber = cards.CardNumber;


            string        payorderUrl = "http://pay.web.7k7k.com/payorder";
            StringBuilder payorderStr = new StringBuilder();

            payorderStr.AppendFormat("paywhere={0}", "2");
            payorderStr.AppendFormat("&paychannel={0}", "30");
            payorderStr.AppendFormat("&confirmusername={0}", order.TargetAccount);
            payorderStr.AppendFormat("&payuid={0}", payuid);
            payorderStr.AppendFormat("&gametext={0}", "1.%E9%80%89%E6%8B%A9%E6%B8%B8%E6%88%8F");
            payorderStr.AppendFormat("&gid={0}", "");
            payorderStr.AppendFormat("&servertext={0}", "2.%E9%80%89%E6%8B%A9%E5%8C%BA%E6%9C%8D");
            payorderStr.AppendFormat("&server_id={0}", "");
            payorderStr.AppendFormat("&cardnumber={0}", cards.CardNumber);
            payorderStr.AppendFormat("&cardpass={0}", cards.CardPassWord);
            payorderStr.AppendFormat("&kbyue={0}", "");
            payorderStr.AppendFormat("&passstatus={0}", "0");
            payorderStr.AppendFormat("&select_paytype={0}", "1");
            payorderStr.AppendFormat("&select_bank={0}", "ICBC-NET-B2C");
            payorderStr.AppendFormat("&category={0}", "1");
            payorderStr.AppendFormat("&cid={0}", cid);
            payorderStr.AppendFormat("&amt={0}", payNum);
            payorderStr.AppendFormat("&user_sta={0}", "true");

            result = PostAndGet.HttpPostString(payorderUrl, payorderStr.ToString(), ref cookie);
            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",米米卡提交返回:" + result, LogPathFile.Recharge);


            if (result.Contains("充值失败"))
            {
                status = "失败";
                msg    = "充值失败(充值失败,请确认您的卡号密码后重试)||";

                cards.ReChargeStatus = (int)OrderRechargeStatus.untreated;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else if (result.Contains("充值成功"))
            {
                status = "成功";
                msg    = cid + "充值成功||";

                cards.ReChargeStatus = (int)OrderRechargeStatus.successful;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else if (result.Contains("米米卡余额不足"))
            {
                status = "失败";
                msg    = "余额不足||";

                cards.ReChargeStatus = (int)OrderRechargeStatus.failure;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else if (result.Contains("提交失败"))
            {
                status = "失败";
                if (result.Contains("订单号重复"))
                {
                    msg = "订单号重复||";
                }
                else
                {
                    msg = "提交失败||";
                }

                cards.ReChargeStatus = (int)OrderRechargeStatus.untreated;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(true);
            }
            else
            {
                status = "可疑";
                msg    = "充值存疑";

                cards.ReChargeStatus = (int)OrderRechargeStatus.suspicious;
                cards.ReChargeMsg   += msg;
                SQLCards.UpdateCards_ByMultiple(cards);
                return(false);
            }

            #endregion
        }
コード例 #15
0
ファイル: Pay_37_com.cs プロジェクト: AnCalm/PayClient
        public Order Charge(Order order)
        {
            try
            {
                CookieContainer cookie = new CookieContainer();

                decimal totalPrice      = (decimal)(order.BuyAmount * 2);
                decimal totalPriceFixed = totalPrice;
                int     isContinue      = 0;

                if (order.BuyAmount % 5 != 0)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    order.RechargeMsg    = "购买数量不合法,请提交5的倍数";
                    return(order);
                }

                while (totalPrice > 0)
                {
                    #region 提交充值
                    int chargeVbiNum = 0;

                    if (isContinue > 3) //充值频繁,重试三次
                    {
                        break;
                    }

                    if (!GetChargeNum((int)totalPrice, ref chargeVbiNum))
                    {
                        break;
                    }

                    totalPrice = totalPrice - chargeVbiNum;

                    string result = "";


                    #region 获取参数 帐号判断
                    result = PostAndGet.HttpGetString("http://pay.37.com/", "", ref cookie);
                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",充值页面提交返回:" + result, LogPathFile.Recharge);

                    string f_token   = Regex.Match(result, @"name=\""f_token\"" id=\""confirm_f_token\"" value=\""(.*?)\""\>").Groups[1].Value;
                    string g_f_token = Regex.Match(result, @"g_f_token : '(.*?)',").Groups[1].Value;

                    StringBuilder checkgetDataBuilder = new StringBuilder();
                    checkgetDataBuilder.AppendFormat("action={0}", "check_user");
                    checkgetDataBuilder.AppendFormat("&user_name={0}", order.TargetAccount);
                    result = PostAndGet.HttpGetString("http://pay.37.com/controller/user.php", checkgetDataBuilder.ToString(), ref cookie);
                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",订单第一步提交返回:" + result, LogPathFile.Recharge);


                    string msg = Regex.Match(result, @"""msg"":""(.*?)""}").Groups[1].Value;
                    string str = "";
                    TypeCast.GetString(msg, ref str);
                    if (str.Contains("请求异常"))
                    {
                        //order.RechargeStatus = (int)OrderRechargeStatus.failure;
                        //order.RechargeMsg = "帐号不存在";
                        //return order;
                        order.RechargeMsg += "帐号不存在||";
                        totalPrice++;
                        break;
                    }
                    #endregion

                    #region 确认提交
                    StringBuilder orderPostdataBuilder = new StringBuilder();
                    orderPostdataBuilder.AppendFormat("user_name={0}", order.TargetAccount);
                    orderPostdataBuilder.AppendFormat("&game_id={0}", "100000");
                    orderPostdataBuilder.AppendFormat("&server_id={0}", "100000");;
                    orderPostdataBuilder.AppendFormat("&money={0}", chargeVbiNum);
                    orderPostdataBuilder.AppendFormat("&pay_type={0}", "17");
                    orderPostdataBuilder.AppendFormat("&pay_for={0}", "platform");
                    orderPostdataBuilder.AppendFormat("&f_token={0}", g_f_token);
                    orderPostdataBuilder.AppendFormat("&phone={0}", "");
                    orderPostdataBuilder.AppendFormat("&actor={0}", "");
                    orderPostdataBuilder.AppendFormat("&pay_bank={0}", "");
                    orderPostdataBuilder.AppendFormat("&envelope_id={0}", "");
                    orderPostdataBuilder.AppendFormat("&safe_code={0}", "");
                    orderPostdataBuilder.AppendFormat("&pay_referer={0}", "");
                    orderPostdataBuilder.AppendFormat("&action={0}", "create_order");
                    orderPostdataBuilder.AppendFormat("&ajax={0}", "0");

                    result = PostAndGet.HttpPostString("http://pay.37.com/controller/order_v2.php", orderPostdataBuilder.ToString(), ref cookie);

                    string order_id = Regex.Match(result, @"order_id=(.*?)&").Groups[1].Value;

                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",订单第二步提交返回:" + result, LogPathFile.Recharge);


                    StringBuilder payPostdataBuilder = new StringBuilder();
                    payPostdataBuilder.AppendFormat("action={0}", "go_pay");
                    payPostdataBuilder.AppendFormat("&order_id={0}", order_id);
                    payPostdataBuilder.AppendFormat("&f_token={0}", f_token);
                    payPostdataBuilder.AppendFormat("&p_code={0}", "");
                    payPostdataBuilder.AppendFormat("&th_cardno={0}", "");
                    payPostdataBuilder.AppendFormat("&th_cardpwd={0}", "");

                    result = PostAndGet.HttpPostString("http://pay.37.com/controller/paygate.php", payPostdataBuilder.ToString(), ref cookie);

                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                                   + ",订单第三步提交返回:" + result, LogPathFile.Recharge);


                    if (!result.Contains("正在跳转"))
                    {
                        totalPrice += chargeVbiNum;
                        isContinue++;
                        continue;
                    }

                    #endregion

                    #region Vbi钱包充值

                    string spid      = Regex.Match(result, @"<input name='spid'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string spname    = Regex.Match(result, @"<input name='spname'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string spoid     = Regex.Match(result, @"<input name='spoid'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string spreq     = Regex.Match(result, @"<input name='spreq'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string sprec     = Regex.Match(result, @"<input name='sprec'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string userid    = Regex.Match(result, @"<input name='userid'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value;
                    string userip    = Regex.Match(result, @"<input name='userip'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value;
                    string spmd5     = Regex.Match(result, @"<input name='spmd5'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value;
                    string spcustom  = Regex.Match(result, @"<input name='spcustom'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value;
                    string spversion = Regex.Match(result, @"<input name='spversion'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value;
                    string money     = Regex.Match(result, @"<input name='money'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;
                    string urlcode   = Regex.Match(result, @"<input name='urlcode'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value;

                    StringBuilder vnetonePostdataBuilder = new StringBuilder();
                    vnetonePostdataBuilder.AppendFormat("spid={0}", spid);
                    vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid);
                    vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&userid={0}", userid);
                    vnetonePostdataBuilder.AppendFormat("&userip={0}", userip);
                    vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5);
                    vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8));
                    vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion);
                    vnetonePostdataBuilder.AppendFormat("&money={0}", money);
                    vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode);

                    OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi);

                    if (orderChargeAccount == null)
                    {
                        order.RechargeMsg += "未取到v币帐号||";
                        totalPrice++;
                        isContinue++;
                        continue;
                    }

                    result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie, chargeVbiNum);
                    #endregion

                    #region 充值结果判断
                    if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值"))
                    {
                        order.RechargeMsg         += spoid + "充值成功||";
                        order.SuccessfulAmount    += chargeVbiNum;
                        orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }
                    else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询"))
                    {
                        order.RechargeMsg         += spoid + "充值成功(请五分钟后再登陆商户网站进行帐户查询)||";
                        order.SuccessfulAmount    += chargeVbiNum;
                        orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }
                    else if (result.Contains("操作失败"))
                    {
                        order.RechargeMsg += spoid + "操作失败||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("充值过于频繁"))
                    {
                        order.RechargeMsg += "充值频繁||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("验证码输入不正确"))
                    {
                        order.RechargeMsg += spoid + "验证码输入不正确||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                        isContinue++;
                    }
                    else if (result.Contains("账户余额不足"))
                    {
                        order.RechargeMsg += "账户余额不足||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else if (result.Contains("支付密码不正确"))
                    {
                        order.RechargeMsg += spoid + "支付密码不正确||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else if (result.Contains("用户不存在"))
                    {
                        order.RechargeMsg += spoid + "用户不存在||";
                        totalPrice        += chargeVbiNum;
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false);
                        isContinue++;
                    }
                    else
                    {
                        order.RechargeMsg += spoid + "存疑||";
                        SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    }
                    #endregion

                    #endregion
                }

                #region 订单状态判断
                if (order.SuccessfulAmount >= totalPriceFixed)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.successful;
                }
                else if (order.SuccessfulAmount <= 0)
                {
                    if (order.RechargeMsg.Contains("帐号不存在") || order.RechargeMsg.Contains("用户不存在"))
                    {
                        order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    }
                }
                else
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                }
                #endregion

                return(order);
            }
            catch (Exception ex)
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",充值异常信息:" + ex.Message, LogPathFile.Exception);

                return(order);
            }
        }
コード例 #16
0
        public bool notigyOrderToSUP(Order order, bool isprocessing = false)
        {
            WriteLog.Write("方法:订单开始通知易约,订单号:" + order.OrderInsideID + ",订单状态:"
                           + order.RechargeStatus + "_" + EnumService.GetDescription((int)order.RechargeStatus), LogPathFile.Other.ToString());


            //充值成功=0,充值失败=1, 处理中=2,可疑订单=3
            int    State     = 0;
            string StateInfo = "充值成功";

            if (isprocessing)
            {
                State     = 2;
                StateInfo = EnumService.GetDescription(OrderRechargeStatus.processing);
            }
            else
            {
                switch (order.RechargeStatus)
                {
                case (int)OrderRechargeStatus.successful:
                    State = 0;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.successful);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }
                    break;

                case (int)OrderRechargeStatus.failure:
                    State = 1;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.failure);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }
                    break;

                case (int)OrderRechargeStatus.processing:
                    State     = 2;
                    StateInfo = EnumService.GetDescription(OrderRechargeStatus.processing);
                    break;

                case (int)OrderRechargeStatus.untreated:
                case (int)OrderRechargeStatus.suspicious:
                    State = 3;
                    if (string.IsNullOrEmpty(order.RechargeMsg))
                    {
                        StateInfo = EnumService.GetDescription(OrderRechargeStatus.suspicious);
                    }
                    else
                    {
                        StateInfo = order.RechargeMsg;
                    }

                    break;
                }
            }

            string sign = Md5Helper.MD5Encrypt(merchantID + order.OrderExternalID + State + key);

            string postData = string.Format("MerchantID={0}&OrderID={1}&State={2}&StateInfo={3}&ChargeAccount={4}&ChargeMac={5}&Sign={6}",
                                            merchantID, order.OrderExternalID, State, System.Web.HttpUtility.UrlEncode(StateInfo, Encoding.UTF8), "", "", sign);

            System.Net.CookieContainer cookie = new System.Net.CookieContainer();

            string result = PostAndGet.HttpPostString(notifyOrderurl, postData, ref cookie);


            WriteLog.Write("方法:订单通知易约结果,订单号:" + order.OrderInsideID + ", 易约通知返回:" + result, LogPathFile.Other.ToString());

            string notifyStatus = Regex.Match(result, @"<State>(.*?)</State>").Groups[0].Value;

            if (notifyStatus.Contains("0"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #17
0
        string ReCharge(Order order, string payment, ref string order_id)
        {
            #region 帐号登录

            CookieContainer cookie = new CookieContainer();

            if (!login(order, ref cookie))
            {
                return("帐号登录失败");
            }

            #endregion

            #region 获取参数 订单确认
            string        postURl  = "https://my.xunyou.com/index.php/payment/confirmPayment2014";
            StringBuilder postData = new StringBuilder();
            postData.AppendFormat("payment_object={0}", System.Web.HttpUtility.UrlEncode(payment, Encoding.Default));
            postData.AppendFormat("&isconversion={0}", "2");
            postData.AppendFormat("&product_id={0}", "2");
            postData.AppendFormat("&payment_login={0}", order.TargetAccount);
            postData.AppendFormat("&usernameinput={0}", order.TargetAccount);
            postData.AppendFormat("&payment_login_confirm={0}", order.TargetAccount);
            postData.AppendFormat("&payment_card={0}", "ICBC-NET");
            postData.AppendFormat("&selected_product_name={0}", "%E8%BF%85%E6%B8%B8VIP");
            postData.AppendFormat("&user_mask1={0}", "");
            postData.AppendFormat("&user_mask2={0}", "");
            postData.AppendFormat("&addition_product_id={0}", "");
            postData.AppendFormat("&userid={0}", "");
            postData.AppendFormat("&sub_product_class={0}", "");
            postData.AppendFormat("&client={0}", "	0");
            postData.AppendFormat("&payment_method={0}", "28");
            postData.AppendFormat("&eid={0}", "10612");
            postData.AppendFormat("&gameid={0}", "0");
            postData.AppendFormat("&gid={0}", "0");
            postData.AppendFormat("&cdkey={0}", "0");
            postData.AppendFormat("&payment_card_account={0}", "");
            postData.AppendFormat("&payment_card_password={0}", "");
            postData.AppendFormat("&payment_bank={0}", "8001");
            postData.AppendFormat("&vertifycode={0}", "");
            postData.AppendFormat("&mobile_num={0}", "");
            postData.AppendFormat("&packid={0}", "0");
            postData.AppendFormat("&mac={0}", "");
            postData.AppendFormat("&pageid={0}", "4");
            postData.AppendFormat("&pwd={0}", "");
            postData.AppendFormat("&spid={0}", "");
            postData.AppendFormat("&spid2={0}", "");
            string result = PostAndGet.HttpPostString(postURl, postData.ToString(), ref cookie, "https://my.xunyou.com/pay/?eid=10612");
            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

            if (result.Contains("用户不存在"))
            {
                return("用户不存在");
            }
            if (result.Contains("请更换其他支付方式"))
            {
                return("帐号未设置安全工具");
            }
            if (!result.Contains("确认订单"))
            {
                return("确认订单失败");
            }

            #endregion

            #region Vbi钱包充值


            string spid             = Regex.Match(result, @"value=""(.*?)"" name=""spid""").Groups[1].Value;
            string spname           = Regex.Match(result, @"value=""(.*?)"" name=""spname""").Groups[1].Value;
            string spoid            = Regex.Match(result, @"value=""(.*?)"" name=""spoid""").Groups[1].Value;
            string spreq            = Regex.Match(result, @"value=""(.*?)"" name=""spreq""").Groups[1].Value;
            string sprec            = Regex.Match(result, @"value=""(.*?)"" name=""sprec""").Groups[1].Value;
            string userip           = Regex.Match(result, @"value=""(.*?)"" name=""userip""").Groups[1].Value;
            string spcustom         = Regex.Match(result, @"value=""(.*?)"" name=""spcustom""").Groups[1].Value;
            string spversion        = Regex.Match(result, @"value=""(.*?)"" name=""spversion""").Groups[1].Value;
            string money            = Regex.Match(result, @"value=""(.*?)"" name=""money""").Groups[1].Value;
            string urlcode          = Regex.Match(result, @"value=""(.*?)"" name=""urlcode""").Groups[1].Value;
            string spmd5            = Regex.Match(result, @"value=""(.*?)"" name=""spmd5""").Groups[1].Value;
            string userid           = Regex.Match(result, @"value=""(.*?)"" name=""userid""").Groups[1].Value;
            string payment_object   = Regex.Match(result, @"value=""(.*?)"" name=""payment_object""").Groups[1].Value;
            string payment_orderid  = Regex.Match(result, @"value=""(.*?)"" name=""payment_orderid""").Groups[1].Value;
            string payment_login    = Regex.Match(result, @"value=""(.*?)"" name=""payment_login""").Groups[1].Value;
            string payment_product  = Regex.Match(result, @"value=""(.*?)"" name=""payment_product""").Groups[1].Value;
            string payment_paymoney = Regex.Match(result, @"value=""(.*?)"" name=""payment_paymoney""").Groups[1].Value;


            StringBuilder vnetonePostdataBuilder = new StringBuilder();
            vnetonePostdataBuilder.AppendFormat("spid={0}", spid);
            vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.Default));
            vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid);
            vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.Default));
            vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.Default));
            vnetonePostdataBuilder.AppendFormat("&userip={0}", userip);
            vnetonePostdataBuilder.AppendFormat("&spcustom={0}", spcustom);
            vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion);
            vnetonePostdataBuilder.AppendFormat("&money={0}", money);
            vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode);
            vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5);
            vnetonePostdataBuilder.AppendFormat("&userid={0}", userid);
            vnetonePostdataBuilder.AppendFormat("&payment_object={0}", System.Web.HttpUtility.UrlEncode(payment_object, Encoding.Default));
            vnetonePostdataBuilder.AppendFormat("&payment_orderid={0}", payment_orderid);
            vnetonePostdataBuilder.AppendFormat("&payment_login={0}", payment_login);
            vnetonePostdataBuilder.AppendFormat("&payment_product={0}", System.Web.HttpUtility.UrlEncode(payment_product, Encoding.Default));
            vnetonePostdataBuilder.AppendFormat("&payment_paymoney={0}", System.Web.HttpUtility.UrlEncode(payment_paymoney, Encoding.Default));


            OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi);

            if (orderChargeAccount == null)
            {
                return("未取到v币帐号");
            }

            result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",V币钱包充值返回:" + result, LogPathFile.Recharge);
            #endregion

            #region 迅游订单查询
            result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/index.php/payment/getOrderState/" + spoid, "", ref cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单查询结果:" + result, LogPathFile.Recharge);

            string xyOrderStatus = Regex.Match(result, @"{""state"":(.*?),").Groups[1].Value;
            string xyfpaysuccess = Regex.Match(result, @"""fpaysuccess"":""(.*?)"",").Groups[1].Value;

            order_id = spoid;

            if (xyOrderStatus == "1")
            {
                if (xyfpaysuccess == "1")
                {
                    orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue;
                    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    return("充值成功");
                }
                else if (xyfpaysuccess == "0")
                {
                    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    return("未支付成功");
                }
                else
                {
                    SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                    return("存疑");
                }
            }
            else
            {
                SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false);
                return("存疑");
            }

            #endregion
        }
コード例 #18
0
        public static string VbiCharge_Max(string data, Order order, OrderChargeAccount orderChargeAccount, CookieContainer cookie)
        {
            try
            {
                #region 固话钱包

                string result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", data, ref cookie);

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",订单第三步提交返回:" + result, LogPathFile.Recharge);

                if (result.Contains("操作失败"))
                {
                    return("操作失败_F");
                }

                string __VIEWSTATE       = Regex.Match(result, @"id=""__VIEWSTATE"" value=""(.*?)"" />").Groups[1].Value;
                string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION"" value=""(.*?)"" />").Groups[1].Value;

                #endregion

                #region 获取代充帐号
                string txtQBCard = orderChargeAccount.ChargeAccount; //代充账号
                string txtQBPwd  = orderChargeAccount.PayPassword;   //支付密码
                order.ChargeAccountInfo = order.ChargeAccountInfo + txtQBCard + "," + txtQBPwd + "||";
                #endregion

                #region 钱包最后一步提交
                int reChargeCount = 0;    //验证码重试次数
ReCharge:
                string txtQBValCode = ""; //验证码
                int codeid = 0;
                WrapperHelp.GetCodeByByte_UU("http://s2.vnetone.com/Validate/GetImageCodeSinWallet.aspx?time=148311417206464", ref cookie, 1004, ref txtQBValCode, ref codeid);

                StringBuilder PostdataBuilder = new StringBuilder();
                PostdataBuilder.AppendFormat("__VIEWSTATE={0}", System.Web.HttpUtility.UrlEncode(__VIEWSTATE, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&__EVENTVALIDATION={0}", System.Web.HttpUtility.UrlEncode(__EVENTVALIDATION, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&uid9qb={0}", System.Web.HttpUtility.UrlEncode(txtQBCard, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&zfpwd9qb={0}", VbiChargeHelper.GetPwdMethod(new string[] { txtQBPwd }));
                PostdataBuilder.AppendFormat("&TextBox8={0}", txtQBValCode);
                PostdataBuilder.AppendFormat("&ImageButton1.x={0}", "62");
                PostdataBuilder.AppendFormat("&ImageButton1.y={0}", "10");

                result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", PostdataBuilder.ToString(), ref cookie, "http://s2.vnetone.com/Default.aspx");

                if (result.Contains("验证码输入不正确") && reChargeCount < 10)
                {
                    WrapperHelp.reportError(codeid);
                    reChargeCount++;
                    goto ReCharge;
                }

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",订单第四步提交参数:" + PostdataBuilder.ToString() + ",订单第四步提交返回:" + result, LogPathFile.Recharge);
                #endregion

                return(result);
            }
            catch (Exception ex)
            {
                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",充值异常信息:" + ex.Message, LogPathFile.Exception);
                return("充值异常");
            }
        }
コード例 #19
0
ファイル: QueryXinqidian.cs プロジェクト: AnCalm/PayClient
        public Order Query(Order order)
        {
            string MerchantID = PayAndQueryXinqidian.merchantID;
            string key        = PayAndQueryXinqidian.key;
            string QueryUrl   = PayAndQueryXinqidian.QueryUrl;


            CookieContainer coockie = new CookieContainer();

            string UserId      = MerchantID;                              //	用户编号	必选	String	是
            string UserOrderId = order.OrderInsideID;                     //	用户订单号	必选	String	是
            string TimeStamp   = DateTime.Now.ToString("yyyyMMddHHmmss"); //时间戳	必选	String	是	格式:yyyyMMddHHmmss 允许最大时间误差为60分钟
            string Sign        = "";                                      //签名字符串	必选	String	否	加密后的字符串

            string strmd5 = "timestamp" + TimeStamp + "userid" + UserId + "userorderid" + UserOrderId + "key" + key;

            Sign = Md5Helper.GetMD5String_Default(strmd5);

            StringBuilder str = new StringBuilder();

            str.AppendFormat("UserId={0}", UserId);
            str.AppendFormat("&UserOrderId={0}", UserOrderId);
            str.AppendFormat("&TimeStamp={0}", TimeStamp);
            str.AppendFormat("&Sign={0}", Sign);


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " Xinqidian 订单加密参数:" + strmd5.ToString() + " Xinqidian 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " Xinqidian 订单查询:" + result, LogPathFile.Recharge.ToString());



            string Code      = Regex.Match(result, @"""Code"":(.*?),").Groups[1].Value;
            string Status    = Regex.Match(result, @"""Status"":""(.*?)"",").Groups[1].Value;
            string StatusMsg = Regex.Match(result, @"""Message"":""(.*?)""").Groups[1].Value;
            string OrderId   = Regex.Match(result, @"""OrderId"":""(.*?)""").Groups[1].Value;

            if (Code.Equals("1") && Status.Equals("1"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                if (StatusMsg == "响应成功")
                {
                    StatusMsg = EnumService.GetDescription(OrderRechargeStatus.successful);
                }

                order.RechargeMsg = StatusMsg + OrderId;
            }
            else if (Code.Equals("1") && Status.Equals("2"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                if (StatusMsg == "响应成功")
                {
                    StatusMsg = EnumService.GetDescription(OrderRechargeStatus.failure);
                }
                order.RechargeMsg = StatusMsg + OrderId;
            }
            else
            {
                //充值中
            }


            //只有当返回Code=1 并且 响应Content中Status为1时可作成功处理
            //当返回Code=1并且响应Content中Status为2时可作失败处理

            return(order);
        }
コード例 #20
0
        string ReCharge(Order order, string Accounts, CookieContainer cookie)
        {
            #region 参数提交

            string        tradeverifyUrl = "https://pay.91y.com/tradeverify/";
            StringBuilder tradeverifyStr = new StringBuilder();
            tradeverifyStr.AppendFormat("user_qq={0}", "");
            tradeverifyStr.AppendFormat("&pay_User={0}", Accounts);
            tradeverifyStr.AppendFormat("&pd_FrpId={0}", "ZONGY-NET");
            tradeverifyStr.AppendFormat("&pay_amount={0}", (int)order.ProductParValue);
            tradeverifyStr.AppendFormat("&pay_type={0}", "5");
            tradeverifyStr.AppendFormat("&pay_subtype={0}", "0");
            tradeverifyStr.AppendFormat("&step={0}", "2");
            string result = PostAndGet.HttpPostString_HX(tradeverifyUrl, tradeverifyStr.ToString(), ref cookie, "pay.91y.com", "https://pay.91y.com/gamecard/");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

            if (result.Contains("无法继续充值"))
            {
                string msg = "充值已达每日上限";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("用户不存在"))
            {
                string msg = "用户不存在";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("所选金额会超出每日限额"))
            {
                string msg = "所选金额会超出每日限额";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("订单提交失败"))
            {
                string msg = "订单提交失败";
                order.RechargeMsg = msg;
                return(msg);
            }

            #endregion

            #region 确认提交
            string pay_amount   = Regex.Match(result, @"id=""pay_amount""\s+name=""pay_amount""\s+value=""(.*?)""").Groups[1].Value;
            string pay_BankId   = Regex.Match(result, @"id=""pay_BankId""\s+name=""pay_BankId""\s+value=""(.*?)""").Groups[1].Value;
            string pay_ItemUser = Regex.Match(result, @"id=""pay_User""\s+name=""pay_ItemUser""\s+value=""(.*?)""").Groups[1].Value;
            string pay_UserID   = Regex.Match(result, @"id=""pay_UserID""\s+name=""pay_UserID""\s+value=""(.*?)""").Groups[1].Value;
            string pay_OrderId  = Regex.Match(result, @"id=""pay_OrderId""\s+name=""pay_OrderId""\s+value=""(.*?)""").Groups[1].Value;
            string pay_ItemName = Regex.Match(result, @"id=""pay_ItemName""\s+name=""pay_ItemName""\s+value=""(.*?)""").Groups[1].Value;
            string pay_Type     = Regex.Match(result, @"id=""pay_Type""\s+name=""pay_Type""\s+value=""(.*?)""").Groups[1].Value;
            string step         = Regex.Match(result, @"id=""pay_step""\s+name=""step""\s+value=""(.*?)""").Groups[1].Value;

            string servletUrl = "https://pay.91y.com/yeepay/Index.shtml";

            StringBuilder servletStr = new StringBuilder();
            servletStr.AppendFormat("pay_amount={0}", pay_amount);
            servletStr.AppendFormat("&pay_BankId={0}", pay_BankId);
            servletStr.AppendFormat("&pay_ItemUser={0}", pay_ItemUser);
            servletStr.AppendFormat("&pay_UserID={0}", pay_UserID);
            servletStr.AppendFormat("&pay_OrderId={0}", pay_OrderId);
            servletStr.AppendFormat("&pay_ItemName={0}", pay_ItemName);
            servletStr.AppendFormat("&pay_Type={0}", pay_Type);
            servletStr.AppendFormat("&step={0}", step);
            result = PostAndGet.HttpPostString(servletUrl, servletStr.ToString(), ref cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第二步提交返回:" + result, LogPathFile.Recharge);

            if (!result.Contains("确认提交"))
            {
                string msg = "确认提交订单失败";
                order.RechargeMsg = msg;
                return(msg);
            }


            #endregion

            #region 纵游卡提交

            Cards cards = SQLCards.GetChargeCards(OrderChargeAccountType.ZYCard, (decimal)order.ProductParValue);

            if (cards == null)
            {
                string msg = "取卡失败";
                order.RechargeMsg = msg;
                return(msg);
            }

            string a         = "yeepay";
            string orderId   = Regex.Match(result, @"id=""pay_OrderId""\s+name=""pay_OrderId""\s+value=""(.*?)""").Groups[1].Value;
            string paymoney  = Regex.Match(result, @"id=""pay_amount""\s+name=""pay_amount""\s+value=""(.*?)""").Groups[1].Value;
            string cardType  = "ZONGY-NET";
            string payUser   = Regex.Match(result, @"id=""pay_User""\s+name=""pay_ItemUser""\s+value=""(.*?)""").Groups[1].Value;
            string payUserID = Regex.Match(result, @"id=""pay_UserID""\s+name=""pay_UserID""\s+value=""(.*?)""").Groups[1].Value;
            string cardId    = cards.CardNumber;
            string cardPsw   = cards.CardPassWord;
            string t         = "0.08686665393995474";

            string        yeepayUrl = "https://pay.91y.com/servlet/do.ashx";
            StringBuilder yeepayStr = new StringBuilder();
            yeepayStr.AppendFormat("a={0}", a);
            yeepayStr.AppendFormat("&orderId={0}", orderId);
            yeepayStr.AppendFormat("&paymoney={0}", paymoney);
            yeepayStr.AppendFormat("&cardType={0}", cardType);
            yeepayStr.AppendFormat("&payUser={0}", payUser);
            yeepayStr.AppendFormat("&payUserID={0}", payUserID);
            yeepayStr.AppendFormat("&cardId={0}", cardId);
            yeepayStr.AppendFormat("&cardPsw={0}", cardPsw);
            yeepayStr.AppendFormat("&t={0}", t);
            result = PostAndGet.HttpGetString(yeepayUrl, yeepayStr.ToString(), ref cookie, "https://pay.91y.com/yeepay/Index.shtml");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交返回:" + result, LogPathFile.Recharge);

            if (result.Contains("输入字符串的格式不正确"))
            {
                string msg = "输入字符串的格式不正确";
                order.RechargeMsg = msg;
                return(msg);
            }

            #endregion

            #region 查询卡密结果

            int queryCount = 0;
ReQuery:
            if (queryCount > 10)
            {
                string msg = "查询卡密充值结果超时";
                order.RechargeMsg = orderId + msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);

                return(msg);
            }
            queryCount++;
            StringBuilder yeepaycheck = new StringBuilder();
            yeepaycheck.AppendFormat("a={0}", "yeepaycheck");
            yeepaycheck.AppendFormat("&orderId={0}", orderId);
            yeepaycheck.AppendFormat("&userID={0}", payUserID);
            yeepaycheck.AppendFormat("&t={0}", t);
            result = PostAndGet.HttpGetString(yeepayUrl, yeepaycheck.ToString(), ref cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交结果查询返回:" + result, LogPathFile.Recharge);

            if (result.Contains("充值失败"))
            {
                string msg = "充值失败(充值失败,请确认您的卡号密码后重试)";
                order.RechargeMsg = orderId + msg;;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);

                return(msg);
            }
            else if (result.Contains("充值成功"))
            {
                string msg = "充值成功";
                order.RechargeMsg = orderId + msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);
                return(msg);
            }
            else if (result.Contains("提交失败"))
            {
                string msg = "";

                if (result.Contains("订单号重复"))
                {
                    msg = "订单号重复||";
                }
                else
                {
                    msg = "订单提交失败||";
                }

                order.RechargeMsg = msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.untreated, msg);

                return(msg);
            }
            else
            {
                System.Threading.Thread.Sleep(1000);
                goto ReQuery;
            }
            #endregion 查询卡密结果
        }
コード例 #21
0
ファイル: QuerySW.cs プロジェクト: AnCalm/PayClient
        public Order Query(Order order)
        {
            string MerchantID = PayAndQuerySW.merchantID;
            string key        = PayAndQuerySW.key;
            string QueryUrl   = PayAndQuerySW.QueryUrl;

            CookieContainer coockie = new CookieContainer();

            string        strmd5 = MerchantID + order.OrderInsideID + key;
            string        sign   = Md5Helper.MD5Encrypt(strmd5);
            StringBuilder str    = new StringBuilder();

            str.AppendFormat("MerchantID={0}", MerchantID);                //商家编号
            str.AppendFormat("&MerchantOrderID={0}", order.OrderInsideID); //商家订单编号
            str.AppendFormat("&Sign={0}", sign);                           //数字签名


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " SW 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " SW 订单查询:" + result, LogPathFile.Recharge.ToString());

            string state       = Regex.Match(result, @"<state>(.*?)</state>").Groups[1].Value;
            string swOrderId   = Regex.Match(result, @"<order-id>(.*?)</order-id>").Groups[1].Value;
            string swStateInfo = Regex.Match(result, @"<state-info>(.*?)</state-info>").Groups[1].Value;


            if (state.Equals("101"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                order.RechargeMsg    = swStateInfo + "-" + swOrderId;
            }
            else if (state.Equals("201") || state.Equals("202") || state.Equals("203") || state.Equals("301") || state.Equals("302") || state.Equals("304") ||
                     state.Equals("305") || state.Equals("306") || state.Equals("307") || state.Equals("401") || state.Equals("405") || state.Equals("501"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                order.RechargeMsg    = swStateInfo + "-" + swOrderId;
            }
            else if (state.Equals("601"))
            {
                int status = getOrderStatus(swStateInfo, "601");
                order.RechargeStatus = status;
                order.RechargeMsg    = swStateInfo;

                //if (swStateInfo.Contains("帐号错误") || swStateInfo.Contains("充值失败:玩家账号不存在") || swStateInfo.Contains("充值失败:玩家账号不存在")
                //    || swStateInfo.Contains("批价失败,你的帐号无法存入Q币!失败原因:单日累计存款金额超过系统限额") || swStateInfo.Contains("交易失败")
                //    || swStateInfo.Contains("您输入的游戏账号无法充值")|| swStateInfo.Contains("充值已达每日上限")|| swStateInfo.Contains("所选金额会超出每日限额"))
                //{
                //    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                //    order.RechargeMsg = swStateInfo;
                //}
                //else
                //{
                //    order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                //    order.RechargeMsg = swStateInfo;
                //}
            }
            else if (state.Equals("102"))
            {//充值中
            }
            else
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious) + "-" + swOrderId;
            }

            return(order);
        }
コード例 #22
0
ファイル: QueryPanSuo.cs プロジェクト: AnCalm/PayClient
        public Order Query(Order order)
        {
            string MerchantID = PayAndQueryPanSuo.merchantID;
            string key        = PayAndQueryPanSuo.key;
            string QueryUrl   = PayAndQueryPanSuo.QueryUrl;


            CookieContainer coockie = new CookieContainer();


            string businessId       = MerchantID;                                           // 商户号	由SUP系统分配每个商户唯一的一个商户号
            string userOrderId      = order.OrderInsideID;                                  //	商户订单号(流水号)	最大长度不超过32位的唯一流水号
            string payoffPriceTotal = (order.BuyAmount * order.ProductParValue).ToString(); //结算总金额	系统和进货平台结算金额
            string sign             = "";                                                   //签名 case(md5(businessId + userOrderId +key)) MD5加密后小写


            string strmd5 = businessId + userOrderId + key;

            sign = Md5Helper.MD5Encrypt(strmd5);

            StringBuilder str = new StringBuilder();

            str.AppendFormat("businessId={0}", businessId);
            str.AppendFormat("&userOrderId={0}", userOrderId);
            str.AppendFormat("&payoffPriceTotal={0}", payoffPriceTotal);
            str.AppendFormat("&sign={0}", sign);


            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " PanSuo 订单查询参数:" + str.ToString(), LogPathFile.Recharge.ToString());

            string result = PostAndGet.HttpPostString(QueryUrl, str.ToString(), ref coockie);

            WriteLog.Write("方法:Query,订单号:" + order.OrderInsideID + " PanSuo 订单查询:" + result, LogPathFile.Recharge.ToString());

            //01	成功(订单最终状态)
            //02	失败(订单最终状态)
            //03	处理中(需要等待异步通知结果)
            //04	订单不存在
            //05	未知错误
            //06	签名错误
            //07	参数有误


            string state = Regex.Match(result, @"<result>(.*?)</result>").Groups[1].Value;
            string msg   = Regex.Match(result, @"<mes>(.*?)</mes>").Groups[1].Value;

            if (state.Equals("01"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.successful;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.successful);
            }
            else if (result.Equals("02") || result.Equals("04") || result.Equals("06"))
            {
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                if (string.IsNullOrEmpty(msg))
                {
                    order.RechargeMsg = EnumService.GetDescription(OrderRechargeStatus.failure);
                }
                else
                {
                    order.RechargeMsg = msg;
                }
            }
            else if (result.Equals("03"))
            {
                //充值中
            }
            else
            {
                order.RechargeStatus = (int)OrderRechargeStatus.suspicious;
                order.RechargeMsg    = EnumService.GetDescription(OrderRechargeStatus.suspicious);
            }

            return(order);
        }
コード例 #23
0
ファイル: Program.cs プロジェクト: AnCalm/PayClient
        static void Main(string[] args)
        {
            List <string> ses = new List <string>();

            ses.Add("444");
            ses.Add("4434");
            ses.Add("44e4");
            ses.Add("44e4");

            List <Order> orders  = new List <Order>();
            Order        order12 = new Order()
            {
                OrderID  = 1653631,
                IsNotify = true
            };
            Order order1 = new Order()
            {
                OrderID  = 1653630,
                IsNotify = true
            };

            orders.Add(order12);
            orders.Add(order1);

            new SQLOrder().MultiUpdateData(orders);

            CookieContainer coockie = new CookieContainer();
            string          result  = PostAndGet.HttpPostString("http://121.42.166.214:8099/select.aspx", "username=15071226434&type=qb&sporderid=01201904152304350000011081&buyhaoma=3258222489&sign=0a81867f2a42f8990cd6e47e0cc45a69", ref coockie);



            string AreaName   = "第四十九大区(王者/天使电信)";
            string Servername = "王者一区(电信)";
            string Area       = "";
            string Server     = "";

            new PayAndQuerySW().getmoyuAreaAndServer("魔域", AreaName, Servername, ref Area, ref Server);

            List <Order> dbOrderList = new SQLOrder().GetOrder_top1000();

            Order order123 = new Order()
            {
                OrderExternalID = "2695468386217401"
            };

            GetAndNotifySUPOrders.CheckRepeatOrder(order123, dbOrderList);

            bool bo = new PayAndQuerySW().isChinese("ksdflhg少哦好东西 41561");

            int ssssssss = new QuerySW().getOrderStatus("upay_oidb_0x4fd verify failed for uin[166355766] userip[223.4.205.37] valid[0] reason[4]", "601");

            Order order133 = new Order()
            {
                OrderInsideID = "11",
                BuyAmount     = 1,
                TargetAccount = "鄂尔多斯飞",
                //CustomerIp = "223.104.63.183"
            };

            new PayAndQueryBaiYou().SubmitOrder(order133);

            new ChargeInterface.Charge.PayFulu().Charge(order133);

            new PayAndQueryXunTong().SubmitOrder(order133);

//2018/6/24 21:27:58	方法:Kamen回调,ChargeTime:2018-06-24 21:27:55 CustomerOrderNo:01201806242127490000000008OrderNo:1375870705 ReMark:交易失败 Status:False
//2018/6/24 21:27:58	方法:Kamen回调,Kamen订单号:1375870705 本地系统订单号:01201806242127490000000008签名验证错误,Kamen数字签名69962afcc9ff56fdd4fadfbb04ea5841本地签名:D70A7255A9D91F4E867340B4288C55AF


            string md5str          = "chargetime=2018-06-24 21:27:55&customerorderno=01201806242127490000000008&orderno=1375870705&remark=" + System.Web.HttpUtility.UrlEncode("交易失败", Encoding.UTF8) + "&Status=False918BB8A545017EB8B5E26D9F62AD33E1";
            string ChargeTime      = "2016-02-18 11:44:06";
            string CustomerOrderNo = "t0001";
            string OrderNo         = "653063195";
            string ReMark          = "交易成功";
            string Status          = "True";
            string Secret          = "F636297CB44B2F02BA4651282266EC2F";
            string sData           = "chargetime=" + ChargeTime.Replace("/", "-") + "&customerorderno=" + CustomerOrderNo + "&orderno=" + OrderNo + "&remark="
                                     + ReMark + "&status=" + Status;

            //string sign = EncryptMd5UTF8(sData+Secret);

            md5str = "chargetime=2016-02-18 11:44:06&customerorderno=t0001&orderno=653063195&remark=交易成功&status=TrueF636297CB44B2F02BA4651282266EC2F";
            //md5str = "chargetime=2014-11-12 10:31:03&customerorderno=493171&orderno=338833405&remark=交易成功&status=True+商户密钥";

            string dfdd = System.Web.HttpUtility.UrlEncode(md5str, Encoding.UTF8);
            //ec01cb60874420ab1c11083b07dd98ad

            string checkSign = Md5Helper.EncryptMd5_Kamen1(sData + Secret);


            // 01201903312106160000107708 RuiLian 提交参数:oid=01201903312106160000107708&cid=100183&pid=1078&pn=%e7%b4%ab%e5%85%89%e9%98%81-&nb=1&fm=15.0000&ru=http%3a%2f%2f116.62.44.48%2fNotifyFromRuiLian.aspx&at=&ct=%e6%96%b0%e6%b5%aa%e5%be%ae%e5%8d%9a%e4%bc%9a%e5%91%98&fr=&fs=&rin=&pip=219.140.132.224&info1=&info2=&sign=7839fe0efd29c9775f86d392f1182918

            //Kamen数字签名69962afcc9ff56fdd4fadfbb04ea5841本地签名:D70A7255A9D91F4E867340B4288C55AF



            // "oid=101447975&cid=test&pid=10097&pn=123456&nb=1&fm=1&ru=backcallurl&at=xxx&ct=xxx&fr=xxx&fs=xxx&rin=xxx&pip=118.249.190.100&info1=xxx&info2=xxx
            //&sign=c608f410759bf59d925ceb9d9c02dad0"


            string md5str1 = "101447975-test-10097-123456-1-1-backcallurl-test";
            string sign1   = Md5Helper.GetMD5String_utf8(md5str1);
            string sign2   = Md5Helper.EncryptMd5_Kamen(md5str1);
            string sign3   = Md5Helper.EncryptMd5_Kamen1(md5str1);

            Order order = new Order();

            order.BuyAmount     = 10;
            order.TargetAccount = "15072412234";
            ChargeInterface.Charge.Pay_91_com pt = new ChargeInterface.Charge.Pay_91_com();
            order = pt.Charge(order);

            new QuerySW().Query(order);

            CookieContainer cookie = new CookieContainer();
            Cookie          ck     = new Cookie()
            {
                Name   = "test",
                Value  = "123",
                Domain = "www"
            };

            cookie.Add(ck);

            Common.CookieOperation.CookieHelper.WriteCookiesToDisk("357440019", cookie);

            CookieContainer cc = Common.CookieOperation.CookieHelper.ReadCookiesFromDisk("E:\\testcookie\\357440019");

            string ss = ChargeInterface.ChargeHelper.OrderHelper.OrderStatusForXml.GetOrderStatus("91y", "充值失败");

            Console.WriteLine(ss);
            ss = ChargeInterface.ChargeHelper.OrderHelper.OrderStatusForXml.GetOrderStatus("91y", "充值成功");

            Console.WriteLine(ss);
        }