コード例 #1
0
ファイル: wap_alipay_notify_url.cs プロジェクト: zwkjgs/XKD
 private void DoOneTao(string out_trade_no, string trade_status, string trade_no, System.Collections.Generic.SortedDictionary <string, string> sPara)
 {
     if (trade_status == "TRADE_SUCCESS" || trade_status == "TRADE_FINISHED")
     {
         OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, out_trade_no, "");
         if (addParticipant == null)
         {
             base.Response.Write("success");
             Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
             return;
         }
         addParticipant.PayTime = new System.DateTime?(System.DateTime.Now);
         addParticipant.PayWay  = "alipay";
         addParticipant.PayNum  = trade_no;
         addParticipant.Remark  = "订单已支付:支付金额为¥" + sPara["total_fee"];
         if (!addParticipant.IsPay && OneyuanTaoHelp.SetPayinfo(addParticipant))
         {
             OneyuanTaoHelp.SetOneyuanTaoFinishedNum(addParticipant.ActivityId, 0);
         }
         else
         {
             Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
         }
     }
     else
     {
         Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
     }
     base.Response.Write("success");
 }
コード例 #2
0
 private void DoOneTao(string out_trade_no, string trade_status, string trade_no, SortedDictionary <string, string> sPara)
 {
     if ((trade_status == "TRADE_SUCCESS") || (trade_status == "TRADE_FINISHED"))
     {
         OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, out_trade_no, "");
         if (info == null)
         {
             base.Response.Write("success");
             Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
             return;
         }
         info.PayTime = new DateTime?(DateTime.Now);
         info.PayWay  = "alipay";
         info.PayNum  = trade_no;
         info.Remark  = "订单已支付:支付金额为¥" + sPara["total_fee"];
         if (!info.IsPay && OneyuanTaoHelp.SetPayinfo(info))
         {
             OneyuanTaoHelp.SetOneyuanTaoFinishedNum(info.ActivityId, 0);
         }
         else
         {
             Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
         }
     }
     else
     {
         Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
     }
     base.Response.Write("success");
 }
コード例 #3
0
ファイル: wx_Pay.cs プロジェクト: 123456-cq/xkq34_src
        private void DoOneTao(string Pid, PayInfo PayInfo)
        {
            OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, Pid, "");

            if (info == null)
            {
                base.Response.Write("success");
            }
            else
            {
                info.PayTime = new DateTime?(DateTime.Now);
                info.PayWay  = "weixin";
                info.PayNum  = Pid;
                info.Remark  = "订单已支付:支付金额为¥" + PayInfo.TotalFee.ToString();
                if (!info.IsPay && OneyuanTaoHelp.SetPayinfo(info))
                {
                    OneyuanTaoHelp.SetOneyuanTaoFinishedNum(info.ActivityId, 0);
                }
                else
                {
                    Globals.Debuglog(JsonConvert.SerializeObject(PayInfo), "_Debuglog.txt");
                }
                base.Response.Write("success");
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Collections.Generic.SortedDictionary <string, string> requestPost = this.GetRequestPost();
            Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
            if (requestPost.Count <= 0)
            {
                base.Response.Write("无通知参数");
                return;
            }
            Notify notify = new Notify();
            bool   flag   = notify.Verify(requestPost, base.Request.Form["notify_id"], base.Request.Form["sign"]);

            if (flag)
            {
                string text     = base.Request.Form["batch_no"];
                string arg_96_0 = base.Request.Form["success_num"];
                string text2    = base.Request.Form["result_details"];
                if (!OneyuanTaoHelp.IsExistAlipayRefundNUm(text) && !string.IsNullOrEmpty(text2))
                {
                    try
                    {
                        string[] array = text2.Split(new char[]
                        {
                            '#'
                        });
                        System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
                        string[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            string   text3  = array2[i];
                            string[] array3 = text3.Split(new char[]
                            {
                                '^'
                            });
                            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, "", array3[0].Trim());
                            if (addParticipant != null)
                            {
                                if (text3.Contains("SUCCESS"))
                                {
                                    list.Add(addParticipant.ActivityId);
                                    addParticipant.Remark    = "退款成功";
                                    addParticipant.RefundNum = text;
                                    OneyuanTaoHelp.SetRefundinfo(addParticipant);
                                }
                                else
                                {
                                    addParticipant.Remark = "退款失败:" + text3;
                                    OneyuanTaoHelp.SetRefundinfoErr(addParticipant);
                                }
                            }
                        }
                        list = list.Distinct <string>().ToList <string>();
                        if (list.Count > 0)
                        {
                            OneyuanTaoHelp.SetIsAllRefund(list);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        Globals.Debuglog(base.Request.Form.ToString() + ":exception->" + ex.Message, "_Debuglog.txt");
                    }
                }
                base.Response.Write("success");
                return;
            }
            base.Response.Write("fail");
            Globals.Debuglog(base.Request.Form.ToString(), "alipayrefun.txt");
        }
コード例 #5
0
ファイル: wx_OneTaoSubmit.cs プロジェクト: zwkjgs/XKD
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(text))
            {
                this.pay_json = "{\"msg\":\"订单参数错误!\"}";
                return;
            }
            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text, "");

            if (addParticipant == null)
            {
                this.pay_json = "{\"msg\":\"订单不存在了!\"}";
                return;
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(addParticipant.ActivityId);

            if (oneyuanTaoInfoById == null)
            {
                this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}";
                return;
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (oneTaoState != OneTaoState.进行中)
            {
                this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                return;
            }
            if (oneTaoState != OneTaoState.进行中)
            {
                this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                return;
            }
            if (oneyuanTaoInfoById.ReachType == 1 && oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum)
            {
                this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}";
                return;
            }
            decimal     totalPrice  = addParticipant.TotalPrice;
            PackageInfo packageInfo = new PackageInfo();

            packageInfo.Body       = "一元夺宝。当前活动编号:" + addParticipant.ActivityId;
            packageInfo.NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host);
            packageInfo.OutTradeNo = text;
            packageInfo.TotalFee   = (int)(totalPrice * 100m);
            if (packageInfo.TotalFee < 1m)
            {
                packageInfo.TotalFee = 1m;
            }
            string     openId        = "";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                openId = currentMember.OpenId;
            }
            else
            {
                this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}";
            }
            packageInfo.OpenId = openId;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            PayClient    payClient;

            if (masterSettings.EnableSP)
            {
                payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            if (!payClient.checkSetParams(out this.CheckValue))
            {
                return;
            }
            if (!payClient.checkPackage(packageInfo, out this.CheckValue))
            {
                return;
            }
            PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo);

            this.pay_json = this.ConvertPayJson(payRequestInfo);
            if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx"))
            {
                this.CheckValue = payRequestInfo.package;
            }
        }
コード例 #6
0
ファイル: RefoundList.cs プロジェクト: 123456-cq/xkq34_src
        private void AjaxAction(string action)
        {
            string s = "{\"state\":false,\"msg\":\"未定义操作\"}";
            NameValueCollection form = base.Request.Form;
            string str8 = action;

            if (str8 != null)
            {
                if (!(str8 == "WeiXinRefund"))
                {
                    if (str8 == "WeiXinBacthRefund")
                    {
                        string pids = base.Request.Form["Pids"];
                        s = this.BatchWxRefund(pids);
                    }
                    else if (str8 == "BatchRefund")
                    {
                        s = "{\"state\":false,\"msg\":\"初始化中!\"}";
                        string str7 = base.Request.Form["vaid"];
                        if (string.IsNullOrEmpty(str7))
                        {
                            s = "{\"state\":false,\"msg\":\"参数错误!\"}";
                        }
                        else
                        {
                            List <string> list2 = OneyuanTaoHelp.GetParticipantPids(str7, true, false, "weixin");
                            if (list2.Count > 0)
                            {
                                string WxPids = string.Join(",", list2);
                                new Thread(() => Globals.Debuglog(this.BatchWxRefund(WxPids), "_wxrefund.txt")).Start();
                            }
                            if (OneyuanTaoHelp.GetParticipantPids(str7, true, false, "alipay").Count > 0)
                            {
                                s = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}";
                            }
                            else if (list2.Count > 0)
                            {
                                s = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}";
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}";
                                OneyuanTaoHelp.SetIsAllRefund(new List <string> {
                                    str7
                                });
                            }
                        }
                    }
                }
                else
                {
                    string str2 = form["Pid"];
                    if (!string.IsNullOrEmpty(str2))
                    {
                        OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str2, "");
                        if ((info != null) && info.IsPay)
                        {
                            if (!info.IsRefund)
                            {
                                string str3 = info.out_refund_no;
                                if (string.IsNullOrEmpty(str3))
                                {
                                    str3 = RefundHelper.GenerateRefundOrderId();
                                    OneyuanTaoHelp.Setout_refund_no(str2, str3);
                                }
                                string wxRefundNum = "";
                                string str5        = RefundHelper.SendWxRefundRequest(str2, info.TotalPrice, info.TotalPrice, str3, out wxRefundNum);
                                if (str5 == "")
                                {
                                    s              = "{\"state\":true,\"msg\":\"退款成功\"}";
                                    info.Remark    = "退款成功";
                                    info.RefundNum = wxRefundNum;
                                    OneyuanTaoHelp.SetRefundinfo(info);
                                    OneyuanTaoHelp.SetIsAllRefund(new List <string> {
                                        info.ActivityId
                                    });
                                }
                                else
                                {
                                    info.Remark = "退款失败:" + str5.Replace("OK", "");
                                    OneyuanTaoHelp.SetRefundinfoErr(info);
                                    s = "{\"state\":false,\"msg\":\"" + info.Remark + "\"}";
                                }
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"该订单已退款!\"}";
                            }
                        }
                        else
                        {
                            s = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}";
                        }
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"参数错误!\"}";
                    }
                }
            }
            base.Response.ClearContent();
            base.Response.ContentType = "application/json";
            base.Response.Write(s);
            base.Response.End();
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(str))
            {
                this.pay_json = "{\"msg\":\"订单参数错误!\"}";
            }
            else
            {
                OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str, "");
                if (info == null)
                {
                    this.pay_json = "{\"msg\":\"订单不存在了!\"}";
                }
                else
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId);
                    if (oneyuanTaoInfoById == null)
                    {
                        this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}";
                    }
                    else
                    {
                        OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);
                        if (state != OneTaoState.进行中)
                        {
                            this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                        }
                        else if (state != OneTaoState.进行中)
                        {
                            this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                        }
                        else if ((oneyuanTaoInfoById.ReachType == 1) && ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum))
                        {
                            this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}";
                        }
                        else
                        {
                            PayClient   client;
                            decimal     totalPrice = info.TotalPrice;
                            PackageInfo package    = new PackageInfo
                            {
                                Body       = Globals.SubStr(oneyuanTaoInfoById.ProductTitle, 0x24, "...") + "。活动编号:" + info.ActivityId,
                                NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                                OutTradeNo = str,
                                TotalFee   = (int)(totalPrice * 100M)
                            };
                            if (package.TotalFee < 1M)
                            {
                                package.TotalFee = 1M;
                            }
                            string     openId        = "";
                            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                            if (currentMember != null)
                            {
                                openId = currentMember.OpenId;
                            }
                            else
                            {
                                this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}";
                            }
                            package.OpenId = openId;
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                            if (masterSettings.EnableSP)
                            {
                                client = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
                            }
                            else
                            {
                                client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
                            }
                            if (client.checkSetParams(out this.CheckValue) && client.checkPackage(package, out this.CheckValue))
                            {
                                PayRequestInfo req = client.BuildPayRequest(package);
                                this.pay_json = this.ConvertPayJson(req);
                                if (!req.package.ToLower().StartsWith("prepay_id=wx"))
                                {
                                    this.CheckValue = req.package;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #8
0
        private void DoOneTaoPay(string Pid)
        {
            if (string.IsNullOrEmpty(Pid))
            {
                base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, Pid, "");

            if (info == null)
            {
                base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId);

            if (oneyuanTaoInfoById == null)
            {
                base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (state != OneTaoState.进行中)
            {
                base.Response.Write("当前活动" + state.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            if ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum)
            {
                base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>");
                base.Response.End();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       partner        = masterSettings.Alipay_Pid;
            string       str3           = masterSettings.Alipay_Key;
            string       str4           = "utf-8";

            Core.setConfig(partner, "MD5", str3, str4);
            string  str5       = "1";
            string  str6       = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx");
            string  str7       = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string  str8       = Pid;
            string  str9       = "订单支付";
            decimal totalPrice = info.TotalPrice;
            string  str10      = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid;
            string  str11      = "一元夺宝支付,当前支付编号-" + Pid + " ...";
            string  str12      = "1m";
            string  str13      = "";
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", partner);
            sParaTemp.Add("seller_id", partner);
            sParaTemp.Add("_input_charset", str4);
            sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
            sParaTemp.Add("payment_type", str5);
            sParaTemp.Add("notify_url", str7);
            sParaTemp.Add("return_url", str6);
            sParaTemp.Add("out_trade_no", str8);
            sParaTemp.Add("subject", str9);
            sParaTemp.Add("total_fee", totalPrice.ToString("F"));
            sParaTemp.Add("show_url", str10);
            sParaTemp.Add("body", str11);
            sParaTemp.Add("it_b_pay", str12);
            sParaTemp.Add("extern_token", str13);
            string s = Core.BuildRequest(sParaTemp, "get", "确认");

            base.Response.Write(s);
        }
コード例 #9
0
ファイル: VOneTaoPayView.cs プロジェクト: llenroc/kangaroo
        protected override void AttachChildControls()
        {
            string text = Globals.RequestQueryStr("Pid");

            if (string.IsNullOrEmpty(text))
            {
                base.GotoResourceNotFound("");
            }
            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text, "");

            if (addParticipant == null)
            {
                base.GotoResourceNotFound("");
            }
            string         activityId         = addParticipant.ActivityId;
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId);

            if (oneyuanTaoInfoById == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litProdcutName      = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litProdcutAttr      = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutAttr");
            this.litActivityID       = (System.Web.UI.WebControls.Literal) this.FindControl("litActivityID");
            this.litReachType        = (System.Web.UI.WebControls.Literal) this.FindControl("litReachType");
            this.litPrice            = (System.Web.UI.WebControls.Literal) this.FindControl("litPrice");
            this.litBuyNum           = (System.Web.UI.WebControls.Literal) this.FindControl("litBuyNum");
            this.litPayPrice         = (System.Web.UI.WebControls.Literal) this.FindControl("litPayPrice");
            this.ProductImg          = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("ProductImg");
            this.PayWaytxt           = (System.Web.UI.HtmlControls.HtmlContainerControl) this.FindControl("PayWaytxt");
            this.PayBtn              = (System.Web.UI.HtmlControls.HtmlContainerControl) this.FindControl("PayBtn");
            this.litProdcutName.Text = oneyuanTaoInfoById.ProductTitle;
            this.litProdcutAttr.Text = addParticipant.SkuIdStr;
            this.litActivityID.Text  = activityId;
            this.litReachType.Text   = "";
            this.litPrice.Text       = oneyuanTaoInfoById.EachPrice.ToString("F2");
            this.litBuyNum.Text      = addParticipant.BuyNum.ToString();
            this.litPayPrice.Text    = addParticipant.TotalPrice.ToString("F2");
            this.ProductImg.Src      = oneyuanTaoInfoById.ProductImg;
            if (oneyuanTaoInfoById.ReachType == 1)
            {
                this.litReachType.Text = "满足参与人数自动开奖";
            }
            else if (oneyuanTaoInfoById.ReachType == 2)
            {
                this.litReachType.Text = "活动到期自动开奖";
            }
            else
            {
                this.litReachType.Text = "活动到期时且满足参与人数自动开奖";
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       str            = "商家尚未开启网上支付功能!";

            this.PayBtn.Visible = false;
            if (!this.Page.Request.UserAgent.ToLower().Contains("micromessenger") && masterSettings.EnableAlipayRequest)
            {
                str = "支付宝手机支付";
                this.PayBtn.Visible = true;
            }
            else if (masterSettings.EnableWeiXinRequest && this.Page.Request.UserAgent.ToLower().Contains("micromessenger"))
            {
                str = "微信支付";
                this.PayBtn.Visible = true;
            }
            this.PayWaytxt.InnerText = "当前可用支付方式:" + str;
            this.PayWaytxt.Attributes.Add("Pid", text);
            PageTitle.AddSiteNameTitle("结算支付");
        }
コード例 #10
0
ファイル: wap_alipaySubmit.cs プロジェクト: llenroc/kangaroo
        private void DoOneTaoPay(string Pid)
        {
            if (string.IsNullOrEmpty(Pid))
            {
                base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, Pid, "");

            if (addParticipant == null)
            {
                base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            string         activityId         = addParticipant.ActivityId;
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId);

            if (oneyuanTaoInfoById == null)
            {
                base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (oneTaoState != OneTaoState.进行中)
            {
                base.Response.Write("当前活动" + oneTaoState.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            if (oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum)
            {
                base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>");
                base.Response.End();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       alipay_Pid     = masterSettings.Alipay_Pid;
            string       alipay_Key     = masterSettings.Alipay_Key;
            string       text           = "utf-8";

            Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text);
            string       value           = "1";
            string       value2          = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx");
            string       value3          = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string       value4          = "订单支付";
            decimal      totalPrice      = addParticipant.TotalPrice;
            string       value5          = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid;
            SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(false);
            string       value6          = masterSettings2.SiteName + "支付,当前支付编号-" + Pid + " ...";
            string       value7          = "1m";
            string       value8          = "";
            string       s = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(new System.Collections.Generic.SortedDictionary <string, string>
            {
                {
                    "partner",
                    alipay_Pid
                },
                {
                    "seller_id",
                    alipay_Pid
                },
                {
                    "_input_charset",
                    text
                },
                {
                    "service",
                    "alipay.wap.create.direct.pay.by.user"
                },
                {
                    "payment_type",
                    value
                },
                {
                    "notify_url",
                    value3
                },
                {
                    "return_url",
                    value2
                },
                {
                    "out_trade_no",
                    Pid
                },
                {
                    "subject",
                    value4
                },
                {
                    "total_fee",
                    totalPrice.ToString("F")
                },
                {
                    "show_url",
                    value5
                },
                {
                    "body",
                    value6
                },
                {
                    "it_b_pay",
                    value7
                },
                {
                    "extern_token",
                    value8
                }
            }, "get", "确认");

            base.Response.Write(s);
        }
コード例 #11
0
        private void AjaxAction(string action)
        {
            string str = "{\"state\":false,\"msg\":\"未定义操作\"}";
            NameValueCollection form = base.Request.Form;
            string str1 = action;
            string str2 = str1;

            if (str1 != null)
            {
                if (str2 == "WeiXinRefund")
                {
                    string item = form["Pid"];
                    if (string.IsNullOrEmpty(item))
                    {
                        str = "{\"state\":false,\"msg\":\"参数错误!\"}";
                    }
                    else
                    {
                        OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, item, "");
                        if (addParticipant == null || !addParticipant.IsPay)
                        {
                            str = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}";
                        }
                        else if (addParticipant.IsRefund)
                        {
                            str = "{\"state\":false,\"msg\":\"该订单已退款!\"}";
                        }
                        else
                        {
                            string outRefundNo = addParticipant.out_refund_no;
                            if (string.IsNullOrEmpty(outRefundNo))
                            {
                                outRefundNo = RefundHelper.GenerateRefundOrderId();
                                OneyuanTaoHelp.Setout_refund_no(item, outRefundNo);
                            }
                            string str3 = "";
                            string str4 = RefundHelper.SendWxRefundRequest(item, addParticipant.TotalPrice, addParticipant.TotalPrice, outRefundNo, out str3);
                            if (str4 != "")
                            {
                                addParticipant.Remark = string.Concat("退款失败:", str4.Replace("OK", ""));
                                OneyuanTaoHelp.SetRefundinfoErr(addParticipant);
                                str = string.Concat("{\"state\":false,\"msg\":\"", addParticipant.Remark, "\"}");
                            }
                            else
                            {
                                str = "{\"state\":true,\"msg\":\"退款成功\"}";
                                addParticipant.Remark    = "退款成功";
                                addParticipant.RefundNum = str3;
                                OneyuanTaoHelp.SetRefundinfo(addParticipant);
                                OneyuanTaoHelp.SetIsAllRefund(new List <string>()
                                {
                                    addParticipant.ActivityId
                                });
                            }
                        }
                    }
                }
                else if (str2 == "WeiXinBacthRefund")
                {
                    string item1 = base.Request.Form["Pids"];
                    str = this.BatchWxRefund(item1);
                }
                else if (str2 == "BatchRefund")
                {
                    str = "{\"state\":false,\"msg\":\"初始化中!\"}";
                    string item2 = base.Request.Form["vaid"];
                    if (!string.IsNullOrEmpty(item2))
                    {
                        List <string> participantPids = OneyuanTaoHelp.GetParticipantPids(item2, true, false, "weixin");
                        if (participantPids.Count > 0)
                        {
                            string str5 = string.Join(",", participantPids);
                            (new Thread(() => Globals.Debuglog(this.BatchWxRefund(str5), "_wxrefund.txt"))).Start();
                        }
                        if (OneyuanTaoHelp.GetParticipantPids(item2, true, false, "alipay").Count > 0)
                        {
                            str = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}";
                        }
                        else if (participantPids.Count <= 0)
                        {
                            str = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}";
                            OneyuanTaoHelp.SetIsAllRefund(new List <string>()
                            {
                                item2
                            });
                        }
                        else
                        {
                            str = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}";
                        }
                    }
                    else
                    {
                        str = "{\"state\":false,\"msg\":\"参数错误!\"}";
                    }
                }
            }
            base.Response.ClearContent();
            base.Response.ContentType = "application/json";
            base.Response.Write(str);
            base.Response.End();
        }
コード例 #12
0
        private void AjaxAction(string action)
        {
            string s = "{\"state\":false,\"msg\":\"未定义操作\"}";

            System.Collections.Specialized.NameValueCollection form = base.Request.Form;
            if (action != null)
            {
                if (!(action == "WeiXinRefund"))
                {
                    if (!(action == "WeiXinBacthRefund"))
                    {
                        if (action == "BatchRefund")
                        {
                            string text = base.Request.Form["vaid"];
                            if (string.IsNullOrEmpty(text))
                            {
                                s = "{\"state\":false,\"msg\":\"参数错误!\"}";
                            }
                            else
                            {
                                System.Collections.Generic.List <string> participantPids = OneyuanTaoHelp.GetParticipantPids(text, true, false, "weixin");
                                if (participantPids.Count > 0)
                                {
                                    string WxPids = string.Join(",", participantPids);
                                    new System.Threading.Thread(() =>
                                    {
                                        Globals.Debuglog(this.BatchWxRefund(WxPids), "_wxrefund.txt");
                                    }).Start();
                                }
                                System.Collections.Generic.List <string> participantPids2 = OneyuanTaoHelp.GetParticipantPids(text, true, false, "alipay");
                                if (participantPids2.Count > 0)
                                {
                                    s = "{\"state\":true,\"msg\":\"转向支付宝退款中...!\",\"alipay\":true}";
                                }
                                else if (participantPids.Count > 0)
                                {
                                    s = "{\"state\":true,\"msg\":\"正在后台处理微信退款,请稍后刷新!\",\"alipay\":false}";
                                }
                                else
                                {
                                    s = "{\"state\":false,\"msg\":\"没有退款数据可以操作!\",\"alipay\":false}";
                                    OneyuanTaoHelp.SetIsAllRefund(new System.Collections.Generic.List <string>
                                    {
                                        text
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        string pids = base.Request.Form["Pids"];
                        s = this.BatchWxRefund(pids);
                    }
                }
                else
                {
                    string text2 = form["Pid"];
                    if (!string.IsNullOrEmpty(text2))
                    {
                        OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text2, "");
                        if (addParticipant != null && addParticipant.IsPay)
                        {
                            if (!addParticipant.IsRefund)
                            {
                                string text3 = addParticipant.out_refund_no;
                                if (string.IsNullOrEmpty(text3))
                                {
                                    text3 = RefundHelper.GenerateRefundOrderId();
                                    OneyuanTaoHelp.Setout_refund_no(text2, text3);
                                }
                                string refundNum = "";
                                string text4     = RefundHelper.SendWxRefundRequest(text2, addParticipant.TotalPrice, addParticipant.TotalPrice, text3, out refundNum);
                                if (text4 == "")
                                {
                                    s = "{\"state\":true,\"msg\":\"退款成功\"}";
                                    addParticipant.Remark    = "退款成功";
                                    addParticipant.RefundNum = refundNum;
                                    OneyuanTaoHelp.SetRefundinfo(addParticipant);
                                    OneyuanTaoHelp.SetIsAllRefund(new System.Collections.Generic.List <string>
                                    {
                                        addParticipant.ActivityId
                                    });
                                }
                                else
                                {
                                    addParticipant.Remark = "退款失败:" + text4.Replace("OK", "");
                                    OneyuanTaoHelp.SetRefundinfoErr(addParticipant);
                                    s = "{\"state\":false,\"msg\":\"" + addParticipant.Remark + "\"}";
                                }
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"该订单已退款!\"}";
                            }
                        }
                        else
                        {
                            s = "{\"state\":false,\"msg\":\"用户记录不存在或者用户未支付!\"}";
                        }
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"参数错误!\"}";
                    }
                }
            }
            base.Response.ClearContent();
            base.Response.ContentType = "application/json";
            base.Response.Write(s);
            base.Response.End();
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> requestPost = this.GetRequestPost();

            Globals.Debuglog(base.Request.Form.ToString(), "_Debuglog.txt");
            if (requestPost.Count > 0)
            {
                Notify notify = new Notify();
                if (notify.Verify(requestPost, base.Request.Form["notify_id"], base.Request.Form["sign"]))
                {
                    string str   = base.Request.Form["batch_no"];
                    string text1 = base.Request.Form["success_num"];
                    string str2  = base.Request.Form["result_details"];
                    if (!OneyuanTaoHelp.IsExistAlipayRefundNUm(str) && !string.IsNullOrEmpty(str2))
                    {
                        try
                        {
                            string[]      strArray = str2.Split(new char[] { '#' });
                            List <string> source   = new List <string>();
                            foreach (string str3 in strArray)
                            {
                                string[] strArray2             = str3.Split(new char[] { '^' });
                                OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, "", strArray2[0].Trim());
                                if (info != null)
                                {
                                    if (str3.Contains("SUCCESS"))
                                    {
                                        source.Add(info.ActivityId);
                                        info.Remark    = "退款成功";
                                        info.RefundNum = str;
                                        OneyuanTaoHelp.SetRefundinfo(info);
                                    }
                                    else
                                    {
                                        info.Remark = "退款失败:" + str3;
                                        OneyuanTaoHelp.SetRefundinfoErr(info);
                                    }
                                }
                            }
                            source = source.Distinct <string>().ToList <string>();
                            if (source.Count > 0)
                            {
                                OneyuanTaoHelp.SetIsAllRefund(source);
                            }
                        }
                        catch (Exception exception)
                        {
                            Globals.Debuglog(base.Request.Form.ToString() + ":exception->" + exception.Message, "_Debuglog.txt");
                        }
                    }
                    base.Response.Write("success");
                }
                else
                {
                    base.Response.Write("fail");
                    Globals.Debuglog(base.Request.Form.ToString(), "alipayrefun.txt");
                }
            }
            else
            {
                base.Response.Write("无通知参数");
            }
        }