Beispiel #1
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            if (CurrentUser.id == 0)
            {
                //Response.Redirect("login.aspx");
                Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_Basket", "") + "\"><span>" + Tag("购物车") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_Cashier", "") + "\"><span>" + Tag("订单已提交") + "</span></a>";

            order_id = Rint("order_id");
            order    = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                PageError();
            }
            if (order.User_id != CurrentUser.id)
            {
                PageError();
            }
            else
            {
                if (order.Type_id_OrderType == 215)
                {
                    List <Lebi_Order> ors   = B_Lebi_Order.GetList("Order_id=" + order.id + "", "");
                    decimal           moeny = 0;
                    foreach (Lebi_Order or in ors)
                    {
                        moeny += or.Money_Pay;
                    }
                    order.Money_Pay = moeny;
                    B_Lebi_Order.Update(order);
                }
            }
        }
Beispiel #2
0
        public int pages = 0;//1手机页面
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("订单错误");
                Response.End();
                return;
            }
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "qianhai");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            order.Site_id_pay = CurrentSite.id;
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            business  = pay.UserName;
            OrderCode = order.Code;
            Pid       = order.Code;
            currency  = pay.Currency_Code;
            terminal  = pay.terminal;
            Money     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("0.00");
            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/qianhai/ReturnUrl.aspx";

            billing_firstName = RequestTool.RequestSafeString("billing_firstName");
            billing_lastName  = RequestTool.RequestSafeString("billing_lastName");
            billing_email     = RequestTool.RequestSafeString("billing_email");
            billing_phone     = RequestTool.RequestSafeString("billing_phone");
            billing_country   = RequestTool.RequestSafeString("billing_country");
            billing_city      = RequestTool.RequestSafeString("billing_city");
            billing_address   = RequestTool.RequestSafeString("billing_address");
            billing_zip       = RequestTool.RequestSafeString("billing_zip");



            //account+terminal+backUrl+order_number+order_currency+order_amount+billing_firstName+billing_lastName+billing_email+secureCode
            scode = pay.UserName + pay.terminal + ReturnUrl + order.Code + currency + Money + billing_firstName + billing_lastName + billing_email + pay.UserKey;
            scode = GetSHA256(scode).ToUpper();

            if (CurrentSite != null)
            {
                if (CurrentSite.IsMobile == 1)
                {
                    pages = 1;//1手机端
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int order_id = RequestTool.RequestInt("order_id", 0);

            order = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "qianhai");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            business = pay.UserName;


            currency = pay.Currency_Code;
            Money    = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/qianhai/ReturnUrl.aspx";

            //account+terminal+backUrl+order_number+order_currency+order_amount+billing_firstName+billing_lastName+billing_email+secureCode
            //scode = pay.UserName + "" + ReturnUrl + order.Code + pay.Currency_Code + Money + "" + "" + "" + pay.UserKey;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int order_id = RequestTool.RequestInt("order_id", 0);

            order = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "molpay");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            business = pay.UserName;
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            OrderCode = order.Code;
            mid       = pay.UserName;
            Money     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/paypal/ReturnUrl.aspx";
            vcode     = MOLMD5.Sign(Money + pay.UserName + order.Code + pay.UserKey);
        }
Beispiel #5
0
        /// <summary>
        /// 取消订单
        /// </summary>
        public void OrderCancal()
        {
            int        id     = RequestTool.RequestInt("id", 0);
            string     Remark = RequestTool.RequestSafeString("Remark");
            Lebi_Order order  = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + id + ""); //增加未审核判断 by lebi.kingdge 2015-04-21

            if (order == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            if (!Shop.Bussiness.Order.CancelOrder(order))
            {
                Response.Write("{\"msg\":\"" + Tag("已取消") + "\"}");
                return;
            }
            if (order.IsShipped == 1 || order.IsShipped_All == 1 || order.IsCompleted == 1 || order.IsReceived == 1 || order.IsReceived_All == 1)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            Lebi_Comment model = new Lebi_Comment();

            if (Remark != "")
            {
                model.Content = Tag("取消订单") + ":" + Remark;
            }
            else
            {
                model.Content = Tag("取消订单");
            }
            model.Keyid         = order.id;
            model.TableName     = "Order";
            model.User_id       = CurrentUser.id;
            model.User_UserName = CurrentUser.UserName;
            B_Lebi_Comment.Add(model);
            if (order.IsPaid == 0)
            {
                Shop.Bussiness.Order.Order_Cancal(order);
            }
            else
            {
                order.IsRefund    = 2;
                order.Time_Refund = System.DateTime.Now;
                B_Lebi_Order.Update(order);
            }
            Log.Add("取消订单", "Order", order.id.ToString(), CurrentUser);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("order_edit", "编辑订单"))
            {
                WindowNoPower();
            }
            int        id      = RequestTool.RequestInt("id", 0);
            int        orderid = RequestTool.RequestInt("orderid", 0);
            Lebi_Order order   = B_Lebi_Order.GetModel(orderid);

            if (order != null)
            {
                order.KeyCode = GetMd5Str(order.Code);
                B_Lebi_Order.Update(order);
            }
            QuickPayURL = "http://" + RequestTool.GetRequestDomain() + WebPath.TrimEnd('/') + "/OrderQuickPay/?k=" + order.KeyCode;
        }
Beispiel #7
0
        /// <summary>
        /// 修改订单的自提时间
        /// </summary>
        public void OrderPickUpDate_Edit()
        {
            int        orderid = RequestTool.RequestInt("orderid", 0);
            Lebi_Order order   = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + orderid + "");//and IsCompleted = 0 and IsReceived=0

            if (order == null)
            {
                Response.Write("{\"msg\":\"" + Tag("输入错误") + "\"}");
                return;
            }
            if (order.IsCompleted == 1 || order.IsReceived != 0)
            {
                Response.Write("{\"msg\":\"" + Tag("当前订单状态不允许修改") + "\"}");
                return;
            }
            DateTime pickupdate = RequestTool.RequestTime("pickupdate");

            order.PickUp_Date = pickupdate;
            B_Lebi_Order.Update(order);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #8
0
 /// <summary>
 /// 编辑订单-订单状态变更
 /// </summary>
 public void Order_Status()
 {
     if (CurrentUser.id > 0)//已经登录
     {
         int        id    = RequestTool.RequestInt("id", 0);
         string     type  = RequestTool.RequestSafeString("type");
         Lebi_Order model = B_Lebi_Order.GetModel("User_id = " + CurrentUser.id + " and id = " + id + "");
         if (model == null)
         {
             Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
         }
         else
         {
             if (type == "invalid")
             {
                 if (Shop.Bussiness.Order.CancelOrder(model))
                 {
                     model.IsInvalid      = 1;
                     model.Time_Completed = System.DateTime.Now;
                     //if (model.IsPaid == 1)  //如果已付款,返回到预存款账户 by lebi.kingdge 20151018
                     //{
                     //    model.IsPaid = 0;
                     //    Money.AddMoney(CurrentUser, model.Money_Pay + model.Money_UserCut, 195, null, Tag("取消订单") + " " + model.Code, Tag("取消订单") + " " + model.Code);
                     //}
                     B_Lebi_Order.Update(model);
                 }
             }
             //if (type == "received")
             //{
             //    model.IsReceived = 1;
             //    model.Time_Received = System.DateTime.Now;
             //    B_Lebi_Order.Update(model);
             //}
         }
         Response.Write("{\"msg\":\"OK\"}");
     }
 }
        /// <summary>
        /// 订单发货通知-不更新库存
        /// </summary>
        public void mSndGoods()
        {
            //OrderID	订单编号
            //OrderNO	原始订单编号
            //CustomerID	客户网名
            //SndStyle	发货方式
            //BillID	货运单号
            //SndDate	发货时间
            string             OrderID    = RequestTool.RequestString("OrderID");
            string             OrderNO    = RequestTool.RequestString("OrderNO");
            string             CustomerID = RequestTool.RequestString("CustomerID");
            string             SndStyle   = RequestTool.RequestString("SndStyle");
            string             BillID     = RequestTool.RequestString("BillID");
            string             SndDate    = RequestTool.RequestString("SndDate");
            Lebi_Order         model      = B_Lebi_Order.GetModel("Code=lbsql{'" + OrderNO + "'}");
            Lebi_Language_Code lang       = Language.DefaultLanguage();
            string             res        = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";

            if (model == null)
            {
                res += "<rsp><result>0</result><cause>无此单号</cause></rsp>";
                Response.Write(res);
                return;
            }

            Lebi_Transport tran = B_Lebi_Transport.GetModel("[Name]=lbsql{'" + SndStyle + "'}");

            if (tran == null)
            {
                tran = new Lebi_Transport();
            }
            Lebi_Transport_Order torder = new Lebi_Transport_Order();

            torder.Code     = BillID;
            torder.Order_id = model.id;

            torder.T_Address      = model.T_Address;
            torder.T_Email        = model.T_Email;
            torder.T_MobilePhone  = model.T_MobilePhone;
            torder.T_Name         = model.T_Name;
            torder.T_Phone        = model.T_Phone;
            torder.Transport_Code = tran == null ? model.Transport_Code : tran.Code;
            torder.Transport_id   = tran == null ? model.Transport_id : tran.id;
            torder.Transport_Name = tran == null ? model.Transport_Name : tran.Name;
            torder.User_id        = model.User_id;
            List <TransportProduct>   tps = new List <TransportProduct>();
            TransportProduct          tp;
            List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", "");
            bool isfahuo_all = true;

            foreach (Lebi_Order_Product pro in pros)
            {
                tp                = new TransportProduct();
                tp.Count          = pro.Count;
                tp.ImageBig       = pro.ImageBig;
                tp.ImageMedium    = pro.ImageMedium;
                tp.ImageOriginal  = pro.ImageOriginal;
                tp.ImageSmall     = pro.ImageSmall;
                tp.Product_Number = pro.Product_Number;
                tp.Product_id     = pro.Product_id;
                tp.Product_Name   = pro.Product_Name;
                tps.Add(tp);

                pro.Count_Shipped = pro.Count;

                B_Lebi_Order_Product.Update(pro);
                //更新库存
                Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                EX_Product.ProductStock_Change(product, (0 - pro.Count), 302, model);
            }

            JavaScriptSerializer jss = new JavaScriptSerializer();

            torder.Product = jss.Serialize(tps);
            torder.Type_id_TransportOrderStatus = 220;//默认状态:在途
            B_Lebi_Transport_Order.Add(torder);
            model.IsShipped     = 1;
            model.IsShipped_All = isfahuo_all ? 1 : 0;
            model.Time_Shipped  = System.DateTime.Now;;
            B_Lebi_Order.Update(model);
            Log.Add("订单发货-网站管家", "Order", model.id.ToString());
            //发送邮件
            if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdanfahuo"))
            {
                Lebi_User user = B_Lebi_User.GetModel(model.User_id);
                Email.SendEmail_ordershipping(user, model, torder);
            }
            res += "<rsp><result>1</result></rsp>";
            Response.Write(res);
            Log.Add("订单编号:" + OrderNO + "--" + res, "网店管家同步发货", "");
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "95epay");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();

            MerNo     = pay.UserName;
            BillNo    = order.Code;
            Amount    = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
            ReturnURL = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/95epay/PayResult.aspx";
            NotifyURL = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/95epay/PayNotify.aspx";

            string MD5key = pay.UserKey;//Md5加密私钥[注册时产生]
            string md5md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(MD5key, "MD5").ToUpper();
            string md5src = "Amount=" + Amount + "&BillNo=" + BillNo + "&MerNo=" + MerNo + "&ReturnURL=" + ReturnURL + "&" + md5md5;

            MD5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5src, "MD5").ToUpper();

            PaymentType = "ICBC";
            PayType     = "CSPAY";//KJPAY手机端
            try
            {
                //Lebi_Site currentsite = Session["CurrentSite"] as Lebi_Site;
                if (CurrentSite != null)
                {
                    if (CurrentSite.IsMobile == 1)
                    {
                        PayType = "KJPAY";//KJPAY手机端
                    }
                }
            }
            catch
            {
                PayType = "CSPAY";
            }
            MerRemark = HttpContext.Current.Request.Url.Host;
            products  = order.Code;
        }
Beispiel #11
0
        private void StartINIStd()
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "INIpayWap");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();

            //각 필드 설정
            //string strMid = "INIwebplat";
            strMid      = pay.UserName;
            strVersion  = "1.0";
            strGoodName = order.Code;
            strPrice    = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("0");
            strCurrency = "WON";

            //Lebi_Transport_Order torder = B_Lebi_Transport_Order.GetModel("Order_id=" + order.id + "");
            //if (torder == null)
            //    torder = new Lebi_Transport_Order();
            strBuyerName  = order.User_UserName;
            strBuyerTel   = order.T_MobilePhone;
            strBuyerEmail = order.T_Email;



            // TimeStamp 생성
            string timeTemp = "" + DateTime.UtcNow.Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;

            string[] artime = timeTemp.Split('.');
            timestamp = artime[0];

            //oid = strMid + "_" + timestamp;
            oid = order.Code;
            //Signature 생성 - 알파벳 순으로 정렬후 hash
            string param = "oid=" + oid + "&price=" + strPrice + "&timestamp=" + timestamp;

            signature = ComputeHash(param);

            //closeURL
            //string close = "http://127.0.0.1/close.aspx";
            //closeUrl.Text = close;

            //popupURL
            //string popup = "http://127.0.0.1/popup.aspx";
            //popupUrl.Text = popup;

            //가맹점 전환 페이지 설정
            //string strReturnUrl = "http://127.0.0.1/INIStdPayReturn.aspx";
            string strReturnUrl = "http://" + RequestTool.GetRequestDomain() + "/onlinepay/INIpayWap/INIStdPayReturn.aspx";

            returnUrl = strReturnUrl;

            // 가맹점확인을 위한 signKey 를 해쉬값으로 변경(SHA-256)
            string signKey = pay.UserKey;   // 가맹점에 제공된 키(이니라이트키) (가맹점 수정후 고정) !!!절대!! 전문 데이터로 설정금지

            mKey = ComputeHash(signKey);
        }
Beispiel #12
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_Pay", "") + "\"><span>" + Tag("在线付款") + "</span></a>";

            order_id = Rint("order_id");
            pagefrom = Rstring("pagefrom");
            order    = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                PageError();
            }
            if (order.User_id != CurrentUser.id || order.IsInvalid == 1 || order.IsPaid == 1)
            {
                PageError();
            }
            else
            {
                if (order.Type_id_OrderType == 215)
                {
                    List <Lebi_Order> ors   = B_Lebi_Order.GetList("Order_id=" + order.id + "", "");
                    decimal           moeny = 0;
                    foreach (Lebi_Order or in ors)
                    {
                        moeny += or.Money_Pay;
                    }
                    order.Money_Pay = moeny;
                    B_Lebi_Order.Update(order);
                }
            }
            //string onpaywhere = "IsUsed=1 and Supplier_id=" + order.Supplier_id + " and ','+Language_ids+',' like '%," + order.Language_id + ",%'";
            string onpaywhere = "IsUsed=1 and parentid=0 and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%'";

            //if (order.Supplier_id == 0)
            //    onpaywhere += " and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%' and Supplier_id=0";
            //if (order.Supplier_id > 0)
            //{
            //    if (EX_Supplier.GetUser(order.Supplier_id).IsCash == 1)
            //    {
            //        onpaywhere += " and Supplier_id=" + order.Supplier_id + "";
            //    }
            //    else
            //    {
            //        onpaywhere += " and Supplier_id=0";
            //    }
            //}
            if (CurrentSite.IsMobile == 1)
            {
                onpaywhere += " and (showtype='' or showtype like '%wap%')";
            }
            else
            {
                onpaywhere += " and (showtype='' or showtype like '%web%')";
            }
            onlinepays     = B_Lebi_OnlinePay.GetList(onpaywhere, "Sort desc");
            order_products = B_Lebi_Order_Product.GetList("Order_id = " + order.id, "id desc");
            string useragent = Request.UserAgent.ToString().ToLower();

            if (useragent.Contains("micromessenger"))
            {
                Isweixin = true;
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            pay = Shop.Bussiness.Money.GetOnlinePay(order, "huifubao");
            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            business  = pay.UserName;
            OrderCode = order.Code;
            Pid       = order.Code;
            Money     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/paypal/ReturnUrl.aspx";



            #region 获取参数值
            version    = 1;                                            //当前接口版本号 1
            user_ip    = GetIP();                                      //用户所在客户端的真实ip。如 127.127.12.12
            goods_name = order.Code;                                   //商品名称, 长度最长50字符

            agent_bill_id = order.Code;                                //商户系统内部的定单号(要保证唯一)。长度最长50字符
            goods_note    = order.Code;                                //支付说明, 长度50字符
            remark        = order.Code;                                //商户自定义 原样返回,长度最长50字符
            is_test       = 0;                                         //是否测试 1 为测试
            pay_type      = 20;                                        //支付类型见7.1表

            pay_code = "";                                             //银行

            pay_amt         = Money;                                   //订单总金额 不可为空,单位:元,小数点后保留两位。12.37
            goods_num       = "1";                                     //产品数量,长度最长20字符
            agent_bill_time = DateTime.Now.ToString("yyyyMMddHHmmss"); //提交单据的时间yyyyMMddHHmmss 20100225102000
                                                                       //agent_id = "商户ID";                                                      //商户编号
            agent_id = pay.UserName;
            //key = "商户key";                                                          //商户密钥
            key = pay.UserKey;

            /*
             * //如果需要测试,请把取消关于is_test的注释  订单会显示详细信息
             *
             * is_test = "1";
             */

            notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/huifubao/Return.aspx";
            return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/huifubao/Notify.aspx";

            sign = GetSign();

            #endregion
        }
Beispiel #14
0
        /// <summary>
        /// 退货单发货
        /// </summary>
        public void torder_shipping()
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order model    = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + order_id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            if (model.IsVerified != 1)
            {
                Response.Write("{\"msg\":\"" + Tag("请等待客服人员确认") + "\"}");
                return;
            }
            Lebi_Transport_Order torder = B_Lebi_Transport_Order.GetModel("Order_id=" + model.id + "");

            if (torder != null)
            {
                torder.Code           = RequestTool.RequestSafeString("Code");
                torder.Transport_Name = RequestTool.RequestSafeString("Transport_Name");
                B_Lebi_Transport_Order.Update(torder);
            }
            else
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(model.Supplier_id);
                if (supplier == null)
                {
                    supplier = new Lebi_Supplier();
                }
                torder          = new Lebi_Transport_Order();
                torder.Code     = RequestTool.RequestSafeString("Code");
                torder.Order_id = model.id;

                torder.T_Address     = model.T_Address;
                torder.T_Email       = model.T_Email;
                torder.T_MobilePhone = model.T_MobilePhone;
                torder.T_Name        = model.T_Name;
                torder.T_Phone       = model.T_Phone;
                //torder.Transport_Code = model.Transport_Code;
                //torder.Transport_id = model.Transport_id;
                torder.Transport_Name   = RequestTool.RequestSafeString("Transport_Name");
                torder.User_id          = model.User_id;
                torder.Supplier_id      = supplier.id;
                torder.Supplier_SubName = supplier.SubName;
                List <TransportProduct>   tps = new List <TransportProduct>();
                TransportProduct          tp;
                List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", "");

                foreach (Lebi_Order_Product pro in pros)
                {
                    tp                = new TransportProduct();
                    tp.Count          = pro.Count;
                    tp.ImageBig       = pro.ImageBig;
                    tp.ImageMedium    = pro.ImageMedium;
                    tp.ImageOriginal  = pro.ImageOriginal;
                    tp.ImageSmall     = pro.ImageSmall;
                    tp.Product_Number = pro.Product_Number;
                    tp.Product_id     = pro.Product_id;
                    tp.Product_Name   = pro.Product_Name;
                    tps.Add(tp);

                    pro.Count_Shipped = pro.Count;

                    B_Lebi_Order_Product.Update(pro);
                }

                JavaScriptSerializer jss = new JavaScriptSerializer();
                torder.Product = jss.Serialize(tps);
                torder.Type_id_TransportOrderStatus = 220;//默认状态:在途
                B_Lebi_Transport_Order.Add(torder);
                model.IsShipped     = 1;
                model.IsShipped_All = 1;

                B_Lebi_Order.Update(model);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #15
0
        /// <summary>
        /// 生成新订单
        /// </summary>
        public void order_save()
        {
            if (CurrentUserLevel.BuyRight != 1)
            {
                Response.Write("{\"msg\":\"" + Tag("您所在的分组不允许下单") + "\"}");
                return;
            }
            int         pay_id        = RequestTool.RequestInt("pay_id", 0);
            int         sid           = RequestTool.RequestInt("sid", 0);//结算供应商ID
            int         onlinepay_id  = RequestTool.RequestInt("onlinepay_id", 0);
            decimal     Money_UserCut = RequestTool.RequestDecimal("Money_UserCut", 0);
            int         usermoneytype = RequestTool.RequestInt("usermoneytype", 0);
            string      Pay_Password  = RequestTool.RequestSafeString("Pay_Password");
            Lebi_PickUp pick          = null;
            DateTime    pickdate      = System.DateTime.Now;

            if (usermoneytype == 3)
            {
                if (Pay_Password == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}");
                    return;
                }
                else
                {
                    if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password)
                    {
                        Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}");
                        return;
                    }
                }
                if (Money_UserCut > 0 && Money_UserCut > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
            }
            Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id);

            if (pay == null)
            {
                Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}");
                return;
            }
            Basket  basket             = new Basket(sid);
            int     CustomOfflineMoney = RequestTool.RequestInt("CustomOfflineMoney" + pay.id, 0);
            decimal OfflineMoney       = RequestTool.RequestDecimal("OfflineMoney" + pay.id, 0);

            if (CustomOfflineMoney == 1)
            {
                if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay")
                {
                    //订单如果选择了线下支付,并且非货到付款
                    if (OfflineMoney < basket.Money_Product)
                    {
                        Response.Write("{\"msg\":\"" + Tag("打款金额不能少于订单金额") + "\"}");
                        return;
                    }
                }
            }
            if (pay.Code == "OnlinePay")
            {
                Lebi_OnlinePay onpay = B_Lebi_OnlinePay.GetModel(onlinepay_id);
                if (onpay == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}");
                    return;
                }
            }

            if (basket.Products.Count == 0)
            {
                Response.Write("{\"msg\":\"" + Tag("购物车为空") + "\"}");
                return;
            }
            foreach (Lebi_User_Product up in basket.Products)
            {
                if (up.count < 1)
                {
                    Response.Write("{\"msg\":\"" + Tag("购物车异常") + "\"}");
                    return;
                }
            }
            if (basket.Point_Buy > 0 && (basket.Point_Buy > CurrentUser.Point))
            {
                Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}");
                return;
            }
            int ProductCount = 0;

            foreach (Lebi_User_Product up in basket.Products)
            {
                Lebi_Product pro = B_Lebi_Product.GetModel(up.Product_id);
                if (pro.Type_id_ProductType != 323)
                {
                    ProductCount += up.count;
                }
                //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10
                if (pro.Type_id_ProductStatus != 101)
                {
                    Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}");
                    return;
                }
                //}->
                if (pro.Type_id_ProductType != 324)
                {
                    int levelcount = ProductLevelCount(pro);
                    if (up.count < levelcount)
                    {
                        Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}");
                        return;
                    }
                }
                if (pro.Type_id_ProductType != 320 && pro.Time_Expired > System.DateTime.Now)
                {
                    if (pro.Count_Limit < up.count && pro.Count_Limit > 0)
                    {
                        Response.Write("{\"msg\":\"" + Tag("购买数量大于限购数量") + "\"}");
                        return;
                    }
                }
                if (SYS.IsNullStockSale != "1")
                {
                    if (pro.Count_Stock - pro.Count_Freeze < up.count && pro.Type_id_ProductType != 324)
                    {
                        Response.Write("{\"msg\":\"" + Lang(pro.Name) + "" + Tag("库存不足") + "\"}");
                        return;
                    }
                }
            }
            //验证当前分组允许的最低订单提交金额
            if (CurrentUserLevel.OrderSubmit > 0)
            {
                if (basket.Money_Product < CurrentUserLevel.OrderSubmit)
                {
                    Response.Write("{\"msg\":\"" + Tag("单笔订单最低金额为:") + FormatMoney(CurrentUserLevel.OrderSubmit) + "\"}");
                    return;
                }
            }
            //验证当前分组允许的最低订单提交数量
            if (CurrentUserLevel.OrderSubmitCount > 0 && ProductCount > 0)
            {
                if (ProductCount < CurrentUserLevel.OrderSubmitCount)
                {
                    Response.Write("{\"msg\":\"" + Tag("单笔订单最低数量为:") + CurrentUserLevel.OrderSubmitCount + "\"}");
                    return;
                }
            }
            Lebi_User_Address shouhuo = B_Lebi_User_Address.GetModel(CurrentUser.User_Address_id);

            if (shouhuo == null)
            {
                Response.Write("{\"msg\":\"" + Tag("未设置收获地址") + "\"}");
                return;
            }
            if (CurrentUser.Transport_Price_id == "")
            {
                Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                return;
            }

            foreach (BasketShop shop in basket.Shops)
            {
                Lebi_Transport_Price tprice = B_Lebi_Transport_Price.GetModel("id in (lbsql{" + CurrentUser.Transport_Price_id + "}) and Supplier_id=" + shop.Shop.id + "");
                if (tprice == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                Lebi_Transport transport = B_Lebi_Transport.GetModel(tprice.Transport_id);
                if (tprice == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                //检查运费设置是否正确
                if (!EX_Area.CheckAreaPrice(tprice, shouhuo.Area_id))
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                if (transport.Type_id_TransportType == 332)//自提检查
                {
                    int    pickup_id = RequestTool.RequestInt("pickup_id" + shop.Shop.id);
                    string pickdate_ = RequestTool.RequestString("pickupdate_" + pickup_id);

                    try
                    {
                        pickdate = Convert.ToDateTime(pickdate_);
                    }
                    catch
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }

                    pick = B_Lebi_PickUp.GetModel(pickup_id);
                    if (pick == null)
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    if (pick.IsCanWeekend == 0 && (pickdate.DayOfWeek == DayOfWeek.Saturday || pickdate.DayOfWeek == DayOfWeek.Sunday))
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    if (System.DateTime.Now.Date.AddDays(pick.BeginDays) > pickdate)
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    string NoServiceDays = pick.NoServiceDays.TrimStart('0').Replace(".0", ".");
                    string nowday        = pickdate.ToString("M.d");
                    if (("," + NoServiceDays + ",").Contains("," + nowday + ","))
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                }
            }
            //检查代金券
            string pay312 = RequestTool.RequestSafeString("pay312");

            if (pay312 != "")
            {
                List <Lebi_Card> cs = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + pay312 + "})", "id asc");
                int flag            = cs.FirstOrDefault().IsCanOtherUse;
                if (flag == 0 && cs.Count > 1)
                {
                    Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                    return;
                }
                foreach (Lebi_Card c in cs)
                {
                    if (flag != c.IsCanOtherUse)
                    {
                        Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                        return;
                    }
                    if (!Basket.CheckCard(basket, c))
                    {
                        Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                        return;
                    }
                }
            }
            //检查代金券结束
            //检查发票信息
            int           billtype_id = RequestTool.RequestInt("billtype_id", 0);
            Lebi_BillType billtype    = B_Lebi_BillType.GetModel(billtype_id);

            if (ShopCache.GetBaseConfig().BillFlag == "1")
            {
                if (billtype == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("请设置发票内容") + "\"}");
                    return;
                }
            }
            CurrentUser.Pay_id       = pay.id;
            CurrentUser.OnlinePay_id = onlinepay_id;
            Lebi_Order        ordergroup;
            List <Lebi_Order> orders = Shop.Bussiness.Order.CreateOrder(CurrentUser, basket, shouhuo, billtype, CurrentCurrency, CurrentSite, CurrentLanguage, out ordergroup);

            CurrentUser.Count_Order = CurrentUser.Count_Order + orders.Count;
            B_Lebi_User.Update(CurrentUser);
            List <Lebi_Order> ordermodel = B_Lebi_Order.GetList("User_id=" + CurrentUser.id + "", "id desc");

            ordergroup = ordermodel.FirstOrDefault();
            if (OfflineMoney == 0)
            {
                OfflineMoney = ordergroup.Money_Order;
            }
            string remark = RequestTool.RequestSafeString("remark");

            ordergroup.Remark_User = remark;
            bool needupdate = false;

            if (remark != "")
            {
                Lebi_Comment model = new Lebi_Comment();
                model.Content       = remark;
                model.Keyid         = ordergroup.id;
                model.TableName     = "Order";
                model.User_id       = CurrentUser.id;
                model.User_UserName = CurrentUser.UserName;
                B_Lebi_Comment.Add(model);
                needupdate = true;
            }

            if (pick != null)
            {
                ordergroup.PickUp_Date = pickdate;
                ordergroup.PickUp_id   = pick.id;
                ordergroup.PickUp_Name = pick.Name;
                needupdate             = true;
            }
            if (needupdate)
            {
                B_Lebi_Order.Update(ordergroup);
            }

            if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay")
            {
                //订单如果选择了线下支付,并且非货到付款
                //生成一笔充值单
                //OfflineMoney

                Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1");
                if (DefaultCurrency == null)
                {
                    DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault();
                }
                Lebi_Order order = new Lebi_Order();
                order.Code                  = "M" + Shop.Bussiness.Order.CreateOrderCode();
                order.Money_Order           = OfflineMoney;
                order.Money_Pay             = OfflineMoney;
                order.User_id               = CurrentUser.id;
                order.User_UserName         = CurrentUser.UserName;
                order.IsPaid                = 0;
                order.Currency_Code         = ordergroup.Currency_Code;
                order.Currency_ExchangeRate = ordergroup.Currency_ExchangeRate;
                order.Currency_id           = ordergroup.Currency_id;
                order.Currency_Msige        = ordergroup.Currency_Msige;
                order.Type_id_OrderType     = 214;
                order.Pay_id                = pay.id;
                order.Pay          = pay.Name;
                order.Site_id      = CurrentSite.id;
                order.Language_id  = CurrentLanguage.id;
                order.Remark_Admin = "";
                order.Order_id     = ordergroup.id;
                B_Lebi_Order.Add(order);
            }
            //if (orders.Count == 1)
            //    ordergroup = orders.FirstOrDefault();
            //Shop.Bussiness.Order.SupplierOrder(order);//根据商品供应商分单
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + ordergroup.id + "\"}");
            return;
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "alipayWAP");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();

            //支付宝网关地址
            string GATEWAY_NEW = "http://wappaygw.alipay.com/service/rest.htm?";

            ////////////////////////////////////////////调用授权接口alipay.wap.trade.create.direct获取授权码token////////////////////////////////////////////

            //返回格式
            string format = "xml";
            //必填,不需要修改

            //返回格式
            string v = "2.0";
            //必填,不需要修改

            //请求号
            string req_id = DateTime.Now.ToString("yyyyMMddHHmmss");
            //必填,须保证每次请求都是唯一

            //req_data详细信息

            //服务器异步通知页面路径
            string notify_url = "http://" + RequestTool.GetRequestDomain() + "/onlinepay/alipayWAP/notify_url.aspx";
            //需http://格式的完整路径,不允许加?id=123这类自定义参数

            //页面跳转同步通知页面路径
            string call_back_url = "http://" + RequestTool.GetRequestDomain() + "/onlinepay/alipayWAP/call_back_url.aspx";
            //需http://格式的完整路径,不允许加?id=123这类自定义参数

            //操作中断返回地址
            string merchant_url = "javascript:history.back();";
            //用户付款中途退出返回商户的地址。需http://格式的完整路径,不允许加?id=123这类自定义参数

            //商户订单号
            string out_trade_no = order.Code;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = order.Code;
            //必填

            //付款金额
            string total_fee = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
            //必填
            Config config = new Config(order);
            //请求业务参数详细
            string req_dataToken = "<direct_trade_create_req><notify_url>" + notify_url + "</notify_url><call_back_url>" + call_back_url + "</call_back_url><seller_account_name>" + config.Seller_email + "</seller_account_name><out_trade_no>" + out_trade_no + "</out_trade_no><subject>" + subject + "</subject><total_fee>" + total_fee + "</total_fee><merchant_url>" + merchant_url + "</merchant_url></direct_trade_create_req>";
            //必填

            //把请求参数打包成数组
            Dictionary <string, string> sParaTempToken = new Dictionary <string, string>();

            sParaTempToken.Add("partner", config.Partner);
            sParaTempToken.Add("_input_charset", config.Input_charset.ToLower());
            sParaTempToken.Add("sec_id", config.Sign_type.ToUpper());
            sParaTempToken.Add("service", "alipay.wap.trade.create.direct");
            sParaTempToken.Add("format", format);
            sParaTempToken.Add("v", v);
            sParaTempToken.Add("req_id", req_id);
            sParaTempToken.Add("req_data", req_dataToken);
            Submit submit = new Submit(order);
            //建立请求
            string sHtmlTextToken = submit.BuildRequest(GATEWAY_NEW, sParaTempToken);
            //URLDECODE返回的信息
            Encoding code = Encoding.GetEncoding(config.Input_charset);

            sHtmlTextToken = HttpUtility.UrlDecode(sHtmlTextToken, code);

            //解析远程模拟提交后返回的信息
            Dictionary <string, string> dicHtmlTextToken = submit.ParseResponse(sHtmlTextToken);

            //获取token
            string request_token = "";

            try
            {
                request_token = dicHtmlTextToken["request_token"];
            }
            catch
            {
            }

            ////////////////////////////////////////////根据授权码token调用交易接口alipay.wap.auth.authAndExecute////////////////////////////////////////////


            //业务详细
            string req_data = "<auth_and_execute_req><request_token>" + request_token + "</request_token></auth_and_execute_req>";
            //必填

            //把请求参数打包成数组
            Dictionary <string, string> sParaTemp = new Dictionary <string, string>();

            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("_input_charset", config.Input_charset.ToLower());
            sParaTemp.Add("sec_id", config.Sign_type.ToUpper());
            sParaTemp.Add("service", "alipay.wap.auth.authAndExecute");
            sParaTemp.Add("format", format);
            sParaTemp.Add("v", v);
            sParaTemp.Add("req_data", req_data);

            //建立请求

            string sHtmlText = submit.BuildRequest(GATEWAY_NEW, sParaTemp, "get", "确认");

            Response.Write(sHtmlText);
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "alipayHaiWai");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //Return URL
            string return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipayHaiWai/return_url.aspx";
            //After the payment transaction is done
            //Notification URL
            string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipayHaiWai/notify_url.aspx";
            //The URL for receiving notifications after the payment process.

            //Goods name
            string subject = order.Code;
            //required,The name of the goods.

            //Goods description
            string body = order.Code;
            //A detailed description of the goods.

            //Outside trade ID
            string out_trade_no = order.Code;
            //required,A numbered transaction ID (Unique inside the partner system)

            //Currency
            string currency = pay.Currency_Code;
            //required,The settlement currency merchant named in contract.

            //Payment sum
            string total_fee = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
            //required,A floating number ranging 0.01~1000000.00


            ////////////////////////////////////////////////////////////////////////////////////////////////
            Config config = new Config(order);
            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("_input_charset", config.Input_charset.ToLower());
            sParaTemp.Add("service", "create_forex_trade");
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("body", body);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("currency", currency);
            if (currency.ToLower() == "cny")
            {
                sParaTemp.Add("rmb_fee", total_fee);
            }
            else
            {
                sParaTemp.Add("total_fee", total_fee);
            }


            //建立请求
            Submit submit    = new Submit(order);
            string sHtmlText = submit.BuildRequest(sParaTemp, "get", "确认");

            Response.Write(sHtmlText);
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {


            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            int order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);
            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "authroize");
            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay = pay.Name;
            }
            B_Lebi_Order.Update(order);
            ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
            {
                name = pay.UserName,
                ItemElementName = ItemChoiceType.transactionKey,
                Item = pay.Email,
            };

            ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;

            //create a transaction
            var opaqueDataType = new opaqueDataType
            {
                dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT",
                dataKey = RequestTool.RequestString("datakey"),
                dataValue = RequestTool.RequestString("datavalue"),

            };

            var decryptPaymentDataRequest = new decryptPaymentDataRequest()
            {
                opaqueData = opaqueDataType,
                callId = RequestTool.RequestString("callid")
            };


            SystemLog.Add("orderid:" + order.id + "datakey:" + RequestTool.RequestString("datakey"));
            SystemLog.Add("orderid:" + order.id + "datavalue:" + RequestTool.RequestString("datavalue"));
            SystemLog.Add("orderid:" + order.id + "callid:" + RequestTool.RequestString("callid"));
            //create controller, execute and get response
            var decryptPaymentDataController = new decryptPaymentDataController(decryptPaymentDataRequest);
            decryptPaymentDataController.Execute();
            var decryptPaymentDataResponse = decryptPaymentDataController.GetApiResponse();

            if (decryptPaymentDataResponse != null)
            {
                //validate response
                //Console.WriteLine("Result : " + decryptPaymentDataResponse.messages.message);
                //Console.WriteLine("       : " + decryptPaymentDataResponse.messages.resultCode);
                //Console.WriteLine("First Name : " + decryptPaymentDataResponse.billingInfo.firstName);
                //Console.WriteLine("Last name  : " + decryptPaymentDataResponse.billingInfo.lastName);
                //Console.WriteLine("Card Number : " + decryptPaymentDataResponse.cardInfo.cardNumber);
                //Console.WriteLine("Amount : " + decryptPaymentDataResponse.paymentDetails.amount);
                if (decryptPaymentDataResponse.messages.resultCode == messageTypeEnum.Ok)
                {
                    Shop.Bussiness.Order.OnlinePaySuccess("authroize", order.Code, "", false);
                    Response.Write("{\"status\":\"ok\",\"msg\":\"" + decryptPaymentDataResponse.messages.message + "\"}");
                }
                else
                {
                    Response.Write("{\"status\":\"error\",\"msg\":\"error1-" + decryptPaymentDataResponse.messages.message + "\"}");
                }

            }
            else
            {
                Response.Write("{\"status\":\"error\",\"msg\":\"error\"}");
            }




        }
Beispiel #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Shop.Bussiness.Site site = new Shop.Bussiness.Site();
                int        order_id      = RequestTool.RequestInt("order_id", 0);
                Lebi_Order order         = B_Lebi_Order.GetModel(order_id);
                if (order == null)
                {
                    Response.Write("ERROR");
                    Response.End();
                    return;
                }
                Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);
                if (order.IsPaid == 1)
                {
                    Response.Write(Language.Tag("已付款", language.Code));
                    Response.End();
                    return;
                }
                order.Site_id_pay = CurrentSite.id;
                order.Language_id = CurrentLanguage.id;
                Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "dinpay");
                if (pay == null)
                {
                    Response.Write("系统错误");
                    Response.End();
                    return;
                }
                if (pay.FreeFeeRate == 1)
                {
                    pay.FeeRate = 0;
                }
                if (pay.FeeRate > 0)
                {
                    order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
                }
                if (order.OnlinePay_id != pay.id)
                {
                    order.OnlinePay_id   = pay.id;
                    order.OnlinePay_Code = pay.Code;
                    order.OnlinePay      = pay.Name;
                }
                B_Lebi_Order.Update(order);
                Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
                //参数编码字符集(必选)
                string input_charset1 = "UTF-8";

                //接口版本(必选)固定值:V3.0
                string interface_version1 = "V3.0";

                //商家号(必填)
                string merchant_code1 = pay.UserName;

                //后台通知地址(必填)
                string notify_url1 = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/pinpay/notify_url.aspx";

                //定单金额(必填)
                string order_amount1 = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");;

                //商家定单号(必填)
                string order_no1 = order.Code;

                //商家定单时间(必填)
                string order_time1 = order.Time_Add.ToString("yyyy-MM-dd HH:mm:ss");

                //签名方式(必填)
                string sign_type1 = "MD5";

                //商品编号(选填)
                string product_code1 = RequestTool.RequestString("product_code");

                //商品描述(选填)
                string product_desc1 = RequestTool.RequestString("product_desc");

                //商品名称(必填)
                string product_name1 = order.Code;

                //端口数量(选填)
                string product_num1 = RequestTool.RequestString("product_num");

                //页面跳转同步通知地址(选填)
                string return_url1 = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/pinpay/return_url.aspx";

                //业务类型(必填)
                string service_type1 = "direct_pay";

                //商品展示地址(选填)
                string show_url1 = RequestTool.RequestString("show_url");

                //公用业务扩展参数(选填)
                string extend_param1 = RequestTool.RequestString("extend_param");

                //公用业务回传参数(选填)
                string extra_return_param1 = RequestTool.RequestString("extra_return_param");

                // 直联通道代码(选填)
                string bank_code1 = RequestTool.RequestString("bank_code");

                //客户端IP(选填)
                string client_ip1 = RequestTool.RequestString("client_ip");

                /* 注  new String(参数.getBytes("ISO-8859-1"),"此页面编码格式"); 若为GBK编码 则替换UTF-8 为GBK*/


                /*
                **
                ** 签名顺序按照参数名a到z的顺序排序,若遇到相同首字母,则看第二个字母,以此类推,同时将商家支付密钥key放在最后参与签名,
                ** 组成规则如下:
                ** 参数名1=参数值1&参数名2=参数值2&……&参数名n=参数值n&key=key值
                **/

                string signSrc = "";

                //组织订单信息
                if (bank_code1 != "")
                {
                    signSrc = signSrc + "bank_code=" + bank_code1 + "&";
                }
                if (client_ip1 != "")
                {
                    signSrc = signSrc + "client_ip=" + client_ip1 + "&";
                }
                if (extend_param1 != "")
                {
                    signSrc = signSrc + "extend_param=" + extend_param1 + "&";
                }
                if (extra_return_param1 != "")
                {
                    signSrc = signSrc + "extra_return_param=" + extra_return_param1 + "&";
                }
                if (input_charset1 != "")
                {
                    signSrc = signSrc + "input_charset=" + input_charset1 + "&";
                }
                if (interface_version1 != "")
                {
                    signSrc = signSrc + "interface_version=" + interface_version1 + "&";
                }
                if (merchant_code1 != "")
                {
                    signSrc = signSrc + "merchant_code=" + merchant_code1 + "&";
                }
                if (notify_url1 != "")
                {
                    signSrc = signSrc + "notify_url=" + notify_url1 + "&";
                }
                if (order_amount1 != "")
                {
                    signSrc = signSrc + "order_amount=" + order_amount1 + "&";
                }
                if (order_no1 != "")
                {
                    signSrc = signSrc + "order_no=" + order_no1 + "&";
                }
                if (order_time1 != "")
                {
                    signSrc = signSrc + "order_time=" + order_time1 + "&";
                }
                if (product_code1 != "")
                {
                    signSrc = signSrc + "product_code=" + product_code1 + "&";
                }
                if (product_desc1 != "")
                {
                    signSrc = signSrc + "product_desc=" + product_desc1 + "&";
                }
                if (product_name1 != "")
                {
                    signSrc = signSrc + "product_name=" + product_name1 + "&";
                }
                if (product_num1 != "")
                {
                    signSrc = signSrc + "product_num=" + product_num1 + "&";
                }
                if (return_url1 != "")
                {
                    signSrc = signSrc + "return_url=" + return_url1 + "&";
                }
                if (service_type1 != "")
                {
                    signSrc = signSrc + "service_type=" + service_type1 + "&";
                }
                if (show_url1 != "")
                {
                    signSrc = signSrc + "show_url=" + show_url1 + "&";
                }

                //设置密钥
                string key = pay.UserKey;


                signSrc = signSrc + "key=" + key;

                string singInfo = signSrc;
                //Response.Write("singInfo=" + singInfo + "<br>");


                //签名
                string sign1 = FormsAuthentication.HashPasswordForStoringInConfigFile(singInfo, "md5").ToLower();
                //Response.Write("sign1=" + sign1 + "<br>");

                sign.Value               = sign1;
                merchant_code.Value      = merchant_code1;
                bank_code.Value          = bank_code1;
                order_no.Value           = order_no1;
                order_amount.Value       = order_amount1;
                service_type.Value       = service_type1;
                input_charset.Value      = input_charset1;
                notify_url.Value         = notify_url1;
                interface_version.Value  = interface_version1;
                sign_type.Value          = sign_type1;
                order_time.Value         = order_time1;
                product_name.Value       = product_name1;
                client_ip.Value          = client_ip1;
                extend_param.Value       = extend_param1;
                extra_return_param.Value = extra_return_param1;
                product_code.Value       = product_code1;
                product_desc.Value       = product_desc1;
                product_num.Value        = product_num1;
                return_url.Value         = return_url1;
                show_url.Value           = show_url1;
            }
            finally
            {
            }
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int order_id = RequestTool.RequestInt("order_id", 0);

            order = B_Lebi_Order.GetModel(order_id);
            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }

            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }

            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "weixinpayh5");

            if (pay == null)
            {
                Log.Add("在线支付接口 weixinpay 配置错误");
                return;
            }

            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_User user = B_Lebi_User.GetModel(order.User_id);

            if (user == null)
            {
                Response.Write("订单错误");
                Response.End();
                return;
            }


            returnurl = URL("P_UserOrderDetails", order.id);
            TenpayUtil tu = new TenpayUtil(order);

            appId     = tu.appid;
            timeStamp = TenpayUtil.getTimestamp();
            nonceStr  = TenpayUtil.getNoncestr();
            string order_price = (order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString("0");
            string sp_billno   = order.Code + "|" + TenpayUtil.UnixStamp();

            shopname = Lang(CurrentSite.Name);
            string prepayId = order.weixin_prepay_id;
            //if (prepayId == "" || prepayId == "INVALID_REQUEST")
            //{
            //创建支付应答对象
            RequestHandler packageReqHandler = new RequestHandler(Context);

            //初始化
            packageReqHandler.init();
            //设置package订单参数
            packageReqHandler.setParameter("body", order.Code); //商品信息 127字符
            packageReqHandler.setParameter("appid", tu.appid);
            packageReqHandler.setParameter("mch_id", tu.mch_id);
            packageReqHandler.setParameter("nonce_str", nonceStr);
            packageReqHandler.setParameter("openid", user.bind_weixin_id);
            packageReqHandler.setParameter("out_trade_no", sp_billno);                     //商家订单号
            packageReqHandler.setParameter("spbill_create_ip", RequestTool.GetClientIP()); //Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
            packageReqHandler.setParameter("total_fee", order_price);                      //商品金额,以分为单位(money * 100).ToString()
            packageReqHandler.setParameter("trade_type", "MWEB");
            //packageReqHandler.setParameter("notify_url", HttpUtility.UrlEncode(tu.tenpay_notify));
            packageReqHandler.setParameter("notify_url", tu.tenpay_notify);
            //Response.Write("body:" + order.Code + ",appid:" + tu.appid + ",mch_id:" + tu.mch_id + ",nonce_str:" + nonceStr + ",notify_url:" + HttpUtility.UrlEncode(tu.tenpay_notify) + ",openid:" + user.bind_weixin_id + ",out_trade_no:" + sp_billno + ",spbill_create_ip:" + RequestTool.GetClientIP() + ",total_fee:" + order_price + ",key:" + tu.key + "");
            string sign = packageReqHandler.createMd5Sign("key", tu.key);

            packageReqHandler.setParameter("sign", sign);
            string data      = packageReqHandler.parseXML();
            string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder");

            SystemLog.Add("prepayXml:" + prepayXml);
            Response.Write("prepayXml:" + prepayXml);

            //return;
            //获取预支付ID
            var xdoc = new XmlDocument();

            xdoc.LoadXml(prepayXml);
            XmlNode     xn  = xdoc.SelectSingleNode("xml");
            XmlNodeList xnl = xn.ChildNodes;

            //Response.Write("<br/>xml:" + xnl[0].InnerText + "|" + xnl[1].InnerText + "|" + xnl[2].InnerText + "|" + xnl[3].InnerText + "|" + xnl[4].InnerText + "|" + xnl[5].InnerText + "|" + xnl[6].InnerText + "|" + xnl[7].InnerText + "|" + xnl[8].InnerText + "");
            if (xnl.Count > 7)
            {
                prepayId = xnl[7].InnerText;
                order.weixin_prepay_id = prepayId;
                B_Lebi_Order.Update(order);
            }
            if (xnl.Count > 9)
            {
                string url = xnl[9].InnerText;
                Response.Redirect(url);
            }
            //}
        }
Beispiel #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int        order_id = RequestTool.RequestInt("order_id", 0);
        Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

        if (order == null)
        {
            Response.Write("ERROR");
            Response.End();
            return;
        }
        Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

        if (order.IsPaid == 1)
        {
            Response.Write(Language.Tag("已付款", language.Code));
            Response.End();
            return;
        }
        order.Site_id_pay = CurrentSite.id;
        order.Language_id = CurrentLanguage.id;
        Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "tenpayJSDZ");

        if (pay == null)
        {
            Response.Write("系统错误");
            Response.End();
            return;
        }
        if (pay.FreeFeeRate == 1)
        {
            pay.FeeRate = 0;
        }
        if (pay.FeeRate > 0)
        {
            order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
        }
        if (order.OnlinePay_id != pay.id)
        {
            order.OnlinePay_id   = pay.id;
            order.OnlinePay_Code = pay.Code;
            order.OnlinePay      = pay.Name;
        }
        B_Lebi_Order.Update(order);
        Lebi_Currency currendy      = B_Lebi_Currency.GetModel(pay.Currency_id);
        string        sp_billno     = order.Code;
        string        product_name  = order.Code;
        string        order_price   = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
        string        remarkexplain = "";
        double        money         = 0;

        try
        {
            money = Convert.ToDouble(order_price);
        }
        catch
        {
            //Response.Write("支付金额格式错误!");
            //Response.End();
            //return;
        }
        //if (null == sp_billno)
        //{
        //    //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
        //    sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4);
        //}
        //else
        //{
        //    sp_billno = Request["order_no"].ToString();
        //}

        //创建RequestHandler实例
        RequestHandler reqHandler = new RequestHandler(Context);

        //初始化
        reqHandler.init();
        TenpayUtil tu = new TenpayUtil(order);

        //设置密钥
        reqHandler.setKey(tu.tenpay_key);
        reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm");



        //-----------------------------
        //设置支付参数
        //-----------------------------

        reqHandler.setParameter("partner", tu.bargainor_id);                       //商户号
        reqHandler.setParameter("out_trade_no", sp_billno);                        //商家订单号
        reqHandler.setParameter("total_fee", (money * 100).ToString());            //商品金额,以分为单位
        reqHandler.setParameter("return_url", tu.tenpay_return);                   //交易完成后跳转的URL
        reqHandler.setParameter("notify_url", tu.tenpay_notify);                   //接收财付通通知的URL
        reqHandler.setParameter("body", order.Code);                               //商品描述
        reqHandler.setParameter("bank_type", "DEFAULT");                           //银行类型(中介担保时此参数无效)
        reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
        reqHandler.setParameter("fee_type", "1");                                  //币种,1人民币
        reqHandler.setParameter("subject", product_name);                          //商品名称(中介交易时必填)


        //系统可选参数
        reqHandler.setParameter("sign_type", "MD5");
        reqHandler.setParameter("service_version", "1.0");
        reqHandler.setParameter("input_charset", "UTF-8");
        reqHandler.setParameter("sign_key_index", "1");

        //业务可选参数

        reqHandler.setParameter("attach", "");                                          //附加数据,原样返回
        reqHandler.setParameter("product_fee", "0");                                    //商品费用,必须保证transport_fee + product_fee=total_fee
        reqHandler.setParameter("transport_fee", "0");                                  //物流费用,必须保证transport_fee + product_fee=total_fee
        reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss
        reqHandler.setParameter("time_expire", "");                                     //订单失效时间,格式为yyyymmddhhmmss
        reqHandler.setParameter("buyer_id", "");                                        //买方财付通账号
        reqHandler.setParameter("goods_tag", "");                                       //商品标记
        reqHandler.setParameter("trade_mode", "1");                                     //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择)
        reqHandler.setParameter("transport_desc", "");                                  //物流说明
        reqHandler.setParameter("trans_type", "1");                                     //交易类型,1实物交易,2虚拟交易
        reqHandler.setParameter("agentid", "");                                         //平台ID
        reqHandler.setParameter("agent_type", "");                                      //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式
        reqHandler.setParameter("seller_id", "");                                       //卖家商户号,为空则等同于partner



        //获取请求带参数的url
        string requestUrl = reqHandler.getRequestURL();

        Response.Redirect(requestUrl);
        //Get的实现方式
        // string a_link = "<a target=\"_blank\" href=\"" + requestUrl + "\">" + "财付通支付" + "</a>";
        //Response.Write(a_link);


        //post实现方式

        /* Response.Write("<form method=\"post\" action=\""+ reqHandler.getGateUrl() + "\" >\n");
         * Hashtable ht = reqHandler.getAllParameters();
         * foreach(DictionaryEntry de in ht)
         * {
         *   Response.Write("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n");
         * }
         * Response.Write("<input type=\"submit\" value=\"财付通支付\" >\n</form>\n");*/


        //获取debug信息,建议把请求和debug信息写入日志,方便定位问题
        string debuginfo = reqHandler.getDebugInfo();

        Response.Write("<br/>requestUrl:" + requestUrl + "<br/>");
        Response.Write("<br/>debuginfo:" + debuginfo + "<br/>");
    }
Beispiel #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "wangyinzaixian");

            if (pay == null)
            {
                Response.Write(Language.Tag("系统错误", language.Code));
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.IsPaid == 0 && order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            //ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/wangyinzaixian/Receive.aspx";
            v_mid = pay.UserName;                                                                                         // 商户号,这里为测试商户号20000400,替换为自己的商户号即可
            v_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/wangyinzaixian/Receive.aspx"; // 商户自定义返回接收支付结果的页面
            // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
            string key = pay.UserKey;                                                                                     // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/

            // 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
            // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了
            v_oid = order.Code;

            if (v_oid == null || v_oid.Equals(""))
            {
                DateTime dt      = DateTime.Now;
                string   v_ymd   = dt.ToString("yyyyMMdd"); // yyyyMMdd
                string   timeStr = dt.ToString("HHmmss");   // HHmmss
                v_oid = v_ymd + v_mid + timeStr;
            }
            v_amount    = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
            v_moneytype = "CNY";
            string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // 拼凑加密串

            v_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();
            //收货信息
            v_rcvname = order.User_UserName;
            v_rcvaddr = order.T_Address;
            //v_rcvtel = Request["v_rcvtel"];
            //v_rcvpost = Request["v_rcvpost"];
            //v_rcvemail = Request["v_rcvemail"];
            //v_rcvmobile = Request["v_rcvmobile"];
            //订货人信息
            //v_ordername = Request["v_ordername"];
            //v_orderaddr = Request["v_orderaddr"];
            //v_ordertel = Request["v_ordertel"];
            //v_orderpost = Request["v_orderpost"];
            //v_orderemail = Request["v_orderemail"];
            //v_ordermobile = Request["v_ordermobile"];
            //remark1 = Request["remark1"];
            //remark2 = Request["remark2"];
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            conekta.Api.version = "2.0.0";
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            //SystemLog.Add("订单:" + order.Code + "-" + CurrentSite.id + "--" + CurrentLanguage.id);
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "conekta");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            conekta.Api.apiKey = pay.UserKey;
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }

            B_Lebi_Order.Update(order);
            if (order.weixin_prepay_id.Contains("oxxopay"))
            {
                //"oxxopay:" + JsonConvert.SerializeObject(jo) + ";";
                string oxxo = RegexTool.GetRegValue(order.weixin_prepay_id, "oxxopay:(.*?)};") + "}";
                try
                {
                    JObject jo = (JObject)JsonConvert.DeserializeObject(oxxo);
                    reference = jo["reference"].ToString();
                    money     = jo["money"].ToString();
                }
                catch (Exception ex)
                {
                    //Response.Write(ex.ToString());
                }
            }
            else
            {
            }

            if (money == order.Money_Pay.ToString())
            {
                return;
            }
            money = order.Money_Pay.ToString();
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ////////////////////////////////////////////请求参数////////////////////////////////////////////


            //页面跳转同步通知页面路径
            string return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/conektapay/return_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/

            //卖家支付宝帐户
            string seller_email = pay.Email;
            //必填

            //商户订单号
            string out_trade_no = order.Code;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = order.Code;
            //必填

            //付款金额
            string total_fee = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100)) * 100).ToString("f0");

            //必填

            try
            {
                string ostring = @"{
                    ""line_items"": [{
                        ""name"": ""ordercode_{ordercode}"",
                        ""unit_price"": {money},
                        ""quantity"": 1
                    }],
                    ""shipping_lines"": [{
                        ""amount"": 0,
                        ""carrier"": ""xxxxxx""
                    }], //shipping_lines - physical goods only
                    ""currency"": ""MXN"",
                    ""customer_info"": {
                      ""name"": ""{u_name}"",
                      ""email"": ""{u_email}"",
                      ""phone"": ""{u_phone}""
                    },
                    ""shipping_contact"":{
                       ""address"": {
                         ""street1"": ""xxx xxx"",
                         ""postal_code"": ""06100"",
                         ""country"": ""MX""
                       }
                    }, //required only for physical goods
                    ""charges"":[{
                      ""payment_method"": {
                        ""type"": ""oxxo_cash""
                      }
                    }]
               }";

                ostring = ostring.Replace("{ordercode}", order.Code);
                ostring = ostring.Replace("{money}", total_fee);
                ostring = ostring.Replace("{u_name}", order.User_UserName);
                ostring = ostring.Replace("{u_email}", order.T_Email);
                ostring = ostring.Replace("{u_phone}", order.T_MobilePhone);
                ostring = ostring.Replace("{t_name}", order.T_Name);

                conekta.Order order1 = new conekta.Order().create(ostring);


                //ostring = string.Format(ostring, order.Code, total_fee, order.T_Name, order.T_Email, order.T_MobilePhone);
                //conekta.Order corder = new conekta.Order().create(ostring);
                //Response.Write("ID: " + order1.id);
                //Response.Write("ID111: " + order1.charges.toJSON());

                //ID: ord_2jDzPMV51K1i9z9Ti
                //ID111: { "has_more":false,"data":[{"id":"5b91d84aedbb6e28f3ef1639","livemode":false,"created_at":1536284746,"currency":"MXN","payment_method":{"service_name":"OxxoPay","barcode_url":"https://s3.amazonaws.com/cash_payment_barcodes/sandbox_reference.png","object":"cash_payment","type":"oxxo","expires_at":1538870400,"store_name":"OXXO","reference":"98000000140098"},"object":"charge","description":"Payment from order","status":"pending_payment","amount":13500,"fee":549,"customer_id":"","order_id":"ord_2jDzPMV51K1i9z9Ti"}],"_type":"conekta.Charge, conekta, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"}


                //Response.Write("Payment Method: " + order1.charges[0].payment_method.service_name);
                //Response.Write("Reference: " + order1.charges[0].payment_method.reference);
                //Response.Write("$" + (order1.amount / 100) + order1.currency);
                //Response.Write("Order");
                //Response.Write(order1.line_items[0].quantity + " - "
                //            + order1.line_items[0].name + " - "
                //            + (order1.line_items.unit_price / 100));
                reference            = RegexTool.GetRegValue(order1.charges.toJSON(), "\"reference\":\"(\\d+)\"");
                order.OnlinePay_Code = order1.id;
                JObject jo = new JObject();
                jo["reference"]        = reference;
                jo["money"]            = money;
                order.weixin_prepay_id = "oxxopay:" + JsonConvert.SerializeObject(jo) + ";";
                B_Lebi_Order.Update(order);
            }
            catch (ConektaException ex)
            {
                foreach (JObject obj in ex.details)
                {
                    Response.Write("message:\t" + obj.GetValue("message") + "___" + "debug:\t" + obj.GetValue("debug_message") + "___" + "code:\t" + obj.GetValue("code"));
                    Response.End();
                    SystemLog.Add("message:\t" + obj.GetValue("message") + "___" + "debug:\t" + obj.GetValue("debug_message") + "___" + "code:\t" + obj.GetValue("code"));
                    //System.Console.WriteLine("\n [ERROR]:\n");
                    //System.Console.WriteLine("message:\t" + obj.GetValue("message"));
                    //System.Console.WriteLine("debug:\t" + obj.GetValue("debug_message"));
                    //System.Console.WriteLine("code:\t" + obj.GetValue("code"));
                }
            }
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string baseUrl = "http://自己的域名";
            string merId   = "00000***21";                       //商户号(MerId)
            string appId   = "000000***2";                       //应用ID(AppId)
            string payKey  = "6823fcfe11517******5b8e4c4dc9be9"; //支付Key(PayKey)

            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            //SystemLog.Add("订单:" + order.Code + "-" + CurrentSite.id + "--" + CurrentLanguage.id);
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "tonglianPay");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //支付类型
            int payment_type = RequestTool.RequestInt("paytype");
            //必填,不能修改
            //服务器异步通知页面路径
            string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/tonglianPay/notify_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数

            //页面跳转同步通知页面路径
            string return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/tonglianPay/return_url.aspx";

            //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/


            merId  = pay.UserName;
            appId  = pay.Appid;
            payKey = pay.UserKey;
            //商户订单号
            string out_trade_no = order.Code;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = order.Code;
            //必填

            //付款金额
            int total_fee = Convert.ToInt32(order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100)) * 100);
            //必填

            SortedDictionary <string, object> dict = new SortedDictionary <string, object>();

            dict["MerId"]     = merId;
            dict["AppId"]     = appId;
            dict["NonceStr"]  = PayHelp.GenerateNonceStr();
            dict["OrderId"]   = order.Code;
            dict["TotalFee"]  = total_fee;    //单位分
            dict["PayType"]   = payment_type; //1: 支付宝H5 2:微信H5 3:快捷支付 4:网关支付
            dict["IPVal"]     = GetHostAddress();
            dict["NotifyUrl"] = return_url;
            dict["ReturnUrl"] = notify_url;

            dict["Sign"] = PayHelp.MakeSign(dict, payKey);

            string resultStr = HttpHelp.PostMode("http://www.6q0b15.cn/PaySDK/PayAPI/ReadyPay", "xmlData=" + PayHelp.ToXml(dict));

            SystemLog.Add(resultStr);
            // return resultStr;
            try
            {
                JavaScriptSerializer jss = new JavaScriptSerializer();


                var model = jss.Deserialize <payreturn>(resultStr);
                if (model.status == 1)
                {
                    Response.Redirect(model.url);
                }
                else
                {
                    Response.Write(model.info);
                }
            }
            catch (Exception ex)
            {
                SystemLog.Add(ex.ToString());
            }
        }
Beispiel #25
0
        /// <summary>
        /// 生成退货单
        /// </summary>
        public void torder_save()
        {
            int    order_id = RequestTool.RequestInt("order_id", 0);
            string opid     = RequestTool.RequestSafeString("opid");

            if (opid == "")
            {
                Response.Write("{\"msg\":\"" + Tag("未选择任何商品") + "\"}");
                return;
            }
            int        count = 0;
            Lebi_Order order = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            if (order.User_id != CurrentUser.id)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            List <Lebi_Order_Product> ops = B_Lebi_Order_Product.GetList("id in (lbsql{" + opid + "}) and Order_id=" + order.id + "", "");

            foreach (Lebi_Order_Product op in ops)
            {
                int rcount = RequestTool.RequestInt("product_" + op.id, 0);
                if (rcount > (op.Count_Received - op.Count_Return))
                {
                    Response.Write("{\"msg\":\"" + Tag("退货数量不能大于收货数量") + "\"}");
                    return;
                }
                if (rcount < 1)
                {
                    Response.Write("{\"msg\":\"" + Tag("退货数量不能小于1") + "\"}");
                    return;
                }
                count = count + rcount;
            }
            if (count == 0)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            //CurrentUser.Count_Order = CurrentUser.Count_Order + 1;
            //B_Lebi_User.Update(CurrentUser);
            //foreach (Lebi_Order_Product op in ops)
            //{
            //    op.Count_Return = op.Count_Return + RequestTool.RequestInt("product_" + op.id, 0);
            //    B_Lebi_Order_Product.Update(op);
            //}
            Lebi_Order model = new Lebi_Order();

            model.Order_id          = order.id;
            model.User_id           = CurrentUser.id;
            model.User_UserName     = CurrentUser.UserName;
            model.T_Name            = order.T_Name;
            model.T_Address         = order.T_Address;
            model.T_Area_id         = order.T_Area_id;
            model.T_MobilePhone     = order.T_MobilePhone;
            model.T_Phone           = order.T_Phone;
            model.T_Postalcode      = order.T_Postalcode;
            model.Weight            = 0;
            model.Money_Product     = 0;
            model.Type_id_OrderType = 212;
            model.Code        = Shop.Bussiness.Order.CreateOrderCode();
            model.Supplier_id = order.Supplier_id;
            model.Site_id     = CurrentSite.id;
            model.Language_id = CurrentLanguage.id;
            B_Lebi_Order.Add(model);
            model.id = B_Lebi_Order.GetMaxId();

            foreach (Lebi_Order_Product op in ops)
            {
                count           = RequestTool.RequestInt("product_" + op.id, 0);
                op.Count_Return = op.Count_Return + count;
                B_Lebi_Order_Product.Update(op);

                op.Count          = count;
                op.Count_Shipped  = 0;
                op.Count_Received = 0;
                op.Order_Code     = model.Code;
                op.Order_id       = model.id;
                op.Money          = op.Price * op.Count;

                B_Lebi_Order_Product.Add(op);
                model.Money_Product = model.Money_Product + (op.Price - op.Money_Give_one - op.Money_Card312_one) * count;
                model.Weight        = model.Weight + op.Weight * count;
                model.Volume        = model.Weight + op.Volume * count;
                model.Point         = model.Point + op.Point_Give_one;
            }
            model.Money_Product = 0 - model.Money_Product;
            model.Money_Order   = model.Money_Product;
            model.Money_Pay     = model.Money_Product;
            model.Money_Give    = 0 - model.Money_Order;
            model.Point         = 0 - model.Point;
            B_Lebi_Order.Update(model);
            //处理留言
            Lebi_Comment com = new Lebi_Comment();

            com.Content       = RequestTool.RequestSafeString("say");
            com.Keyid         = model.id;
            com.TableName     = "Order";
            com.User_id       = CurrentUser.id;
            com.User_UserName = CurrentUser.UserName;
            B_Lebi_Comment.Add(com);
            Lebi_User  user       = B_Lebi_User.GetModel(CurrentUser.id);
            Lebi_Order ordermodel = B_Lebi_Order.GetModel("Order_id=" + order_id + "");

            //发送邮件
            if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdantijiao") || ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("ordersubmit"))
            {
                Email.SendEmail_ordersubmit(user, ordermodel);
            }
            //发送短信
            if (ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_ordersubmit") || ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_Admin_ordersubmit"))
            {
                SMS.SendSMS_ordersubmit(user, order);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "chinapnr");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();



            Version = "10";         //版本号
            CmdId   = "Buy";
            MerId   = pay.UserName; //商户号
            OrdId   = order.Code;   //订单编号
            if (OrdId.Length > 20)
            {
                OrdId = "lebiorderid_" + order.id.ToString();
            }
            OrdAmt     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + ""); //订单金额
            CurCode    = pay.Currency_Code;                                                                                                 //币种
            Pid        = "";                                                                                                                //商品编号
            RetUrl     = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/chinapnr/Buy_return_url.aspx";
            BgRetUrl   = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/chinapnr/Buy_notify_url.aspx";
            MerPriv    = ""; //商户私有域,你可以转递一些贵网站系统中特有的参数 选填项
            GateId     = ""; //银行网关号,如果输入网关号将直接跳至银行支付页面   网关号可向汇付销售人员获取  选填项
            UsrMp      = ""; //用户手机号  选填项
            DivDetails = ""; //分帐信息,当存在将支付款项分别入帐时需要 选填项
            PayUsrId   = ""; //付款人的汇付用户号 选填项

            //签名
            String MsgData;

            MsgData = Version + CmdId + MerId + OrdId + OrdAmt + CurCode + Pid + RetUrl + MerPriv + GateId + UsrMp + DivDetails + PayUsrId + BgRetUrl;
            CHINAPNRLib.NetpayClient SignObject = new NetpayClientClass();
            string keypath = System.Web.HttpContext.Current.Server.MapPath("~/" + pay.Email.TrimStart('/'));

            ChkValue = SignObject.SignMsg0(MerId, keypath, MsgData, MsgData.Length);           //请将此处改成你的私钥文件所在路径
        }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        order_id    = RequestTool.RequestInt("order_id", 0);
            int        language_id = RequestTool.RequestInt("language_id", 0);
            Lebi_Order order       = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "alipayDBJY");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            BaseConfig    SYS      = ShopCache.GetBaseConfig();

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();

            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //支付类型
            string payment_type = "1";
            //必填,不能修改
            //服务器异步通知页面路径
            string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipayDBJY/notify_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数

            //页面跳转同步通知页面路径
            string return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipayDBJY/return_url.aspx";
            //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/

            //卖家支付宝帐户
            string seller_email = pay.Email;
            //必填

            //商户订单号
            string out_trade_no = order.Code;
            //商户网站订单系统中唯一订单号,必填

            //订单名称
            string subject = order.Code;
            //必填

            //付款金额
            string price = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");
            //必填

            //商品数量
            string quantity = "1";
            //必填,建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
            //物流费用
            string logistics_fee = (order.Money_Transport * currendy.ExchangeRate).ToString("f" + currendy.DecimalLength + "");
            //必填,即运费
            //物流类型
            string logistics_type = "EXPRESS";
            //必填,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
            //物流支付方式
            string logistics_payment = "SELLER_PAY";
            //必填,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
            //订单描述

            string body = "";
            //商品展示地址
            string show_url = "";
            //需以http://开头的完整路径,如:http://www.xxx.com/myorder.html

            //收货人姓名
            string receive_name = "";
            //如:张三

            //收货人地址
            string receive_address = "";
            //如:XX省XXX市XXX区XXX路XXX小区XXX栋XXX单元XXX号

            //收货人邮编
            string receive_zip = "";
            //如:123456

            //收货人电话号码
            string receive_phone = "";
            //如:0571-88158090

            //收货人手机号码
            string receive_mobile = "";
            //如:13312341234

            Config config = new Config(order);
            ////////////////////////////////////////////////////////////////////////////////////////////////

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", config.Partner);
            sParaTemp.Add("_input_charset", config.Input_charset.ToLower());
            sParaTemp.Add("service", "create_partner_trade_by_buyer");
            sParaTemp.Add("payment_type", payment_type);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("seller_email", seller_email);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("price", price);
            sParaTemp.Add("quantity", quantity);
            sParaTemp.Add("logistics_fee", logistics_fee);
            sParaTemp.Add("logistics_type", logistics_type);
            sParaTemp.Add("logistics_payment", logistics_payment);
            sParaTemp.Add("body", body);
            sParaTemp.Add("show_url", show_url);
            sParaTemp.Add("receive_name", receive_name);
            sParaTemp.Add("receive_address", receive_address);
            sParaTemp.Add("receive_zip", receive_zip);
            sParaTemp.Add("receive_phone", receive_phone);
            sParaTemp.Add("receive_mobile", receive_mobile);

            //建立请求
            Submit submit    = new Submit(order);
            string sHtmlText = submit.BuildRequest(sParaTemp, "get", "确认");

            Response.Write(sHtmlText);
        }
Beispiel #28
0
        /**
         * @Description: 快钱人民币支付网关接口范例
         * @Copyright (c) 上海快钱信息服务有限公司
         * @version 2.0
         */
        protected void Page_Load(Object sender, EventArgs E)
        {
            int        order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order    = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language order_language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", order_language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "kuaiqian");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            //人民币网关账户号
            ///请登录快钱系统获取用户编号,用户编号后加01即为人民币网关账户号。
            merchantAcctId.Value = pay.UserName;

            //人民币网关密钥
            ///区分大小写.请与快钱联系索取
            String key = pay.UserKey;

            //字符集.固定选择值。可为空。
            ///只能选择1、2、3.
            ///1代表UTF-8; 2代表GBK; 3代表gb2312
            ///默认值为1
            inputCharset.Value = "1";

            //接受支付结果的页面地址.与[bgUrl]不能同时为空。必须是绝对地址。
            ///如果[bgUrl]为空,快钱将支付结果Post到[pageUrl]对应的地址。
            ///如果[bgUrl]不为空,并且[bgUrl]页面指定的<redirecturl>地址不为空,则转向到<redirecturl>对应的地址
            pageUrl.Value = "";

            //服务器接受支付结果的后台地址.与[pageUrl]不能同时为空。必须是绝对地址。
            ///快钱通过服务器连接的方式将交易结果发送到[bgUrl]对应的页面地址,在商户处理完成后输出的<result>如果为1,页面会转向到<redirecturl>对应的地址。
            ///如果快钱未接收到<redirecturl>对应的地址,快钱将把支付结果post到[pageUrl]对应的页面。
            //bgUrl.Value = "http://www.yoursite.com/receive.aspx";
            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            bgUrl.Value = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/kuaiqian/receive.aspx";
            //网关版本.固定值
            ///快钱会根据版本号来调用对应的接口处理程序。
            ///本代码版本号固定为v2.0
            version.Value = "v2.0";

            //语言种类.固定选择值。
            ///只能选择1、2、3
            ///1代表中文;2代表英文
            ///默认值为1
            language.Value = "1";

            //签名类型.固定值
            ///1代表MD5签名
            ///当前版本固定为1
            signType.Value = "1";

            //支付人姓名
            ///可为中文或英文字符
            payerName.Value = order.User_UserName;

            //支付人联系方式类型.固定选择值
            ///只能选择1
            ///1代表Email
            payerContactType.Value = "1";

            //支付人联系方式
            ///只能选择Email或手机号
            payerContact.Value = order.T_Email;

            //商户订单号
            ///由字母、数字、或[-][_]组成
            orderId.Value = order.Code;

            //订单金额
            ///以分为单位,必须是整型数字
            ///比方2,代表0.02元
            orderAmount.Value = Convert.ToInt32(order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString();

            //订单提交时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如;20080101010101
            orderTime.Value = DateTime.Now.ToString("yyyyMMddHHmmss");

            //商品名称
            ///可为中文或英文字符
            productName.Value = order.Code;

            //商品数量
            ///可为空,非空时必须为数字
            productNum.Value = "1";

            //商品代码
            ///可为字符或者数字
            productId.Value = "";

            //商品描述
            productDesc.Value = "";

            //扩展字段1
            ///在支付结束后原样返回给商户
            ext1.Value = "";

            //扩展字段2
            ///在支付结束后原样返回给商户
            ext2.Value = "";

            //支付方式.固定选择值
            ///只能选择00、10、11、12、13、14
            ///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
            payType.Value = "00";

            //银行代码
            ///实现直接跳转到银行页面去支付,只在payType=10时才需设置参数
            ///具体代码参见 接口文档银行代码列表
            bankId.Value = "";

            //同一订单禁止重复提交标志
            ///固定选择值: 1、0
            ///1代表同一订单号只允许提交1次;0表示同一订单号在没有支付成功的前提下可重复提交多次。默认为0建议实物购物车结算类商户采用0;虚拟产品类商户采用1
            redoFlag.Value = "0";

            //快钱的合作伙伴的账户号
            ///如未和快钱签订代理合作协议,不需要填写本参数
            pid.Value = "";


            //生成加密签名串
            ///请务必按照如下顺序和规则组成加密串!
            String signMsgVal = "";

            signMsgVal = appendParam(signMsgVal, "inputCharset", inputCharset.Value);
            signMsgVal = appendParam(signMsgVal, "pageUrl", pageUrl.Value);
            signMsgVal = appendParam(signMsgVal, "bgUrl", bgUrl.Value);
            signMsgVal = appendParam(signMsgVal, "version", version.Value);
            signMsgVal = appendParam(signMsgVal, "language", language.Value);
            signMsgVal = appendParam(signMsgVal, "signType", signType.Value);
            signMsgVal = appendParam(signMsgVal, "merchantAcctId", merchantAcctId.Value);
            signMsgVal = appendParam(signMsgVal, "payerName", payerName.Value);
            signMsgVal = appendParam(signMsgVal, "payerContactType", payerContactType.Value);
            signMsgVal = appendParam(signMsgVal, "payerContact", payerContact.Value);
            signMsgVal = appendParam(signMsgVal, "orderId", orderId.Value);
            signMsgVal = appendParam(signMsgVal, "orderAmount", orderAmount.Value);
            signMsgVal = appendParam(signMsgVal, "orderTime", orderTime.Value);
            signMsgVal = appendParam(signMsgVal, "productName", productName.Value);
            signMsgVal = appendParam(signMsgVal, "productNum", productNum.Value);
            signMsgVal = appendParam(signMsgVal, "productId", productId.Value);
            signMsgVal = appendParam(signMsgVal, "productDesc", productDesc.Value);
            signMsgVal = appendParam(signMsgVal, "ext1", ext1.Value);
            signMsgVal = appendParam(signMsgVal, "ext2", ext2.Value);
            signMsgVal = appendParam(signMsgVal, "payType", payType.Value);
            signMsgVal = appendParam(signMsgVal, "bankId", bankId.Value);
            signMsgVal = appendParam(signMsgVal, "redoFlag", redoFlag.Value);
            signMsgVal = appendParam(signMsgVal, "pid", pid.Value);
            signMsgVal = appendParam(signMsgVal, "key", key);

            //如果在web.config文件中设置了编码方式,例如<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>(如未设则默认为utf-8),
            //那么,inputCharset的取值应与已设置的编码方式相一致;
            //同时,GetMD5()方法中所传递的编码方式也必须与此保持一致。
            signMsg.Value = GetMD5(signMsgVal, "utf-8").ToUpper();


            //?
            //Lab_orderId.Text = orderId.Value;
            //Lab_orderAmount.Text = orderAmount.Value;
            //Lab_payerName.Text = payerName.Value;
            //Lab_productName.Text = productName.Value;
        }
Beispiel #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Shop.Bussiness.Site site = new Shop.Bussiness.Site();
                int        order_id      = RequestTool.RequestInt("order_id", 0);
                Lebi_Order order         = B_Lebi_Order.GetModel(order_id);
                if (order == null)
                {
                    Response.Write("ERROR");
                    Response.End();
                    return;
                }
                Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);
                if (order.IsPaid == 1)
                {
                    Response.Write(Language.Tag("已付款", language.Code));
                    Response.End();
                    return;
                }
                order.Site_id_pay = CurrentSite.id;
                order.Language_id = CurrentLanguage.id;
                Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "yinlianqmf");
                if (pay == null)
                {
                    Response.Write(Language.Tag("系统错误", language.Code));
                    Response.End();
                    return;
                }
                if (pay.FeeRate > 0)
                {
                    order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
                }
                if (order.OnlinePay_id != pay.id)
                {
                    order.OnlinePay_id   = pay.id;
                    order.OnlinePay_Code = pay.Code;
                    order.OnlinePay      = pay.Name;
                }
                B_Lebi_Order.Update(order);
                config = new UmsPayConfig(pay);
                Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
                //string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/pinpay/notify_url.aspx";


                Lebi_Site lebisite = B_Lebi_Site.GetModel(order.Site_id_pay);
                if (site == null)
                {
                    returnurl = Shop.Bussiness.Site.Instance.WebPath;
                }
                else
                {
                    Lebi_Language lang = B_Lebi_Language.GetModel(order.Language_id);
                    string        path = "";
                    if (lang != null)
                    {
                        path = lang.Path.TrimEnd('/');
                    }
                    if (lebisite.Domain == "")
                    {
                        returnurl = Shop.Bussiness.Site.Instance.WebPath.TrimEnd('/') + lebisite.Path.TrimEnd('/') + path;
                    }
                    else
                    {
                        returnurl = Shop.Bussiness.Site.Instance.WebPath.TrimEnd('/') + path;
                    }
                }


                returnurl = "http://" + RequestTool.GetRequestDomain() + returnurl.TrimEnd('/') + "/user/OrderDetails.aspx?id=" + order.id;
                decimal order_amount1 = order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100));
                msg = Payment(config, order, order_amount1);
            }
            finally
            {
            }
        }
Beispiel #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            order_id = RequestTool.RequestInt("order_id", 0);
            Lebi_Order order = B_Lebi_Order.GetModel(order_id);

            if (order == null)
            {
                Response.Write("ERROR");
                Response.End();
                return;
            }
            Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id);

            if (order.IsPaid == 1)
            {
                Response.Write(Language.Tag("已付款", language.Code));
                Response.End();
                return;
            }
            order.Site_id_pay = CurrentSite.id;
            order.Language_id = CurrentLanguage.id;
            pay = Shop.Bussiness.Money.GetOnlinePay(order, "behpardakht");
            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }
            if (pay.FreeFeeRate == 1)
            {
                pay.FeeRate = 0;
            }
            if (pay.FeeRate > 0)
            {
                order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100;
            }
            if (order.OnlinePay_id != pay.id)
            {
                order.OnlinePay_id   = pay.id;
                order.OnlinePay_Code = pay.Code;
                order.OnlinePay      = pay.Name;
            }
            B_Lebi_Order.Update(order);
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            business  = pay.UserName;
            OrderCode = order.Code;
            Pid       = order.Code;
            Money     = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + "");

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            ReturnUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/behpardakht/ReturnUrl.aspx";

            //BPService.PaymentGatewayImplService bpService = new BPService.PaymentGatewayImplService();
            //result = bpService.bpPayRequest(Int64.Parse(TerminalIdTextBox.Text),
            //    UserNameTextBox.Text,
            //    UserPasswordTextBox.Text,
            //    Int64.Parse(PayOrderIdTextBox.Text),
            //    Int64.Parse(PayAmountTextBox.Text),
            //    PayDateTextBox.Text,
            //    PayTimeTextBox.Text,
            //    PayAdditionalDataTextBox.Text,
            //    PayCallBackUrlTextBox.Text,
            //    Int64.Parse(PayPayerIdTextBox.Text));


            object[] args = new object[10];
            args[0] = Int64.Parse(pay.terminal);
            args[1] = pay.UserName;
            args[2] = pay.UserKey;
            args[3] = order.id;
            args[4] = Convert.ToInt64(Money);
            args[5] = order.Time_Add.ToString("yyyyMMdd");
            args[6] = order.Time_Add.ToString("HHmmss");
            args[7] = order.Code;
            args[8] = ReturnUrl;
            args[9] = 0;

            string web    = "https://bpm.shaparak.ir/pgwchannel/services/pgw";
            object obj    = WebServiceTool.InvokeWebService(web, "PaymentGatewayImplService", "bpPayRequest", args, "https://bpm.shaparak.ir/pgwchannel/services/pgw?wsdl=IPaymentGateway.wsdl");
            string result = "";

            try
            {
                result = Convert.ToString(obj);
            }
            catch
            {
                result = "";
            }

            String[] resultArray = result.Split(',');
            if (resultArray[0] == "0")
            {
                refid = resultArray[1];
                order.OnlinePay_Code = refid;
            }
            //ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false);
        }