Пример #1
0
        public void LoadPage()
        {
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Product'");
            int id = Rint("id");

            product = GetProduct(id);
            Lebi_Site site = B_Lebi_Site.GetModel("IsMobile=1 order by Sort desc");

            Shop.Bussiness.Site website = new Shop.Bussiness.Site();
            if (site != null)
            {
                if (site.Domain != "")
                {
                    tourl = "http://" + site.Domain + "/product.aspx?id=" + product.id;
                }
                else
                {
                    tourl = "http://" + ShopCache.GetMainSite().Domain + website.WebPath;
                    tourl = tourl.TrimEnd('/') + site.Path;
                    tourl = tourl.TrimEnd('/') + "/product.aspx?id=" + product.id;
                }
            }
            Response.Write(tourl);
            tourl = QRfromGoogle(tourl);
        }
Пример #2
0
        public WxPayConfig(Lebi_Order order)
        {
            string where = "";
            if (order != null)
            {
                where = "id = " + order.OnlinePay_id + "";
            }
            else
            {
                where = "Code='weixinpayh5'";
            }
            Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel(where);

            if (onlinepay == null)
            {
                Log.Add("在线支付接口 weixinpay 配置错误");
                return;
            }
            Shop.Bussiness.Site site    = new Shop.Bussiness.Site();
            B_BaseConfig        bconfig = new B_BaseConfig();
            BaseConfig          SYS     = bconfig.LoadConfig();

            MCHID = onlinepay.UserName;
            KEY   = onlinepay.UserKey;
            APPID = onlinepay.Appid;
            //SystemLog.Add("weixinpay-WxPayConfig" + "MCHID : " + MCHID + ",KEY : " + KEY + ",APPID : " + APPID);
            //APPSECRET = onlinepay.Appkey;
            //IP = HttpContext.Current.Request.ServerVariables.Get("Local_Addr");
            NOTIFY_URL = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpayh5/payNotifyUrl.aspx";
        }
Пример #3
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手机端
                }
            }
        }
Пример #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, "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;
        }
Пример #5
0
        public weixin(int _DT_id, Lebi_Site CurrentSite = null)
        {
            DT_id = _DT_id;
            BaseConfig_DT dtbcf = null;

            if (DT_id > 0)
            {
                dtbcf = ShopCache.GetBaseConfig_DT(DT_id);
                if (dtbcf != null)
                {
                    appid          = dtbcf.platform_weixin_id;
                    appkey         = dtbcf.platform_weixin_secret;
                    number         = dtbcf.platform_weixin_number;
                    platform_image = dtbcf.platform_weixin_image;
                }
            }
            if (DT_id == 0 || dtbcf == null)
            {
                if (CurrentSite != null)
                {
                    if (CurrentSite.platform_weixin_id != "" && CurrentSite.platform_weixin_secret != "")
                    {
                        appid  = CurrentSite.platform_weixin_id;
                        appkey = CurrentSite.platform_weixin_secret;
                        number = CurrentSite.platform_weixin_number;
                    }
                    if (appid == "")
                    {
                        appid = ShopCache.GetBaseConfig().platform_weixin_id;
                    }
                    if (appkey == "")
                    {
                        appkey = ShopCache.GetBaseConfig().platform_weixin_secret;
                    }
                    if (number == "")
                    {
                        number = ShopCache.GetBaseConfig().platform_weixin_number;
                    }
                    platform_image = ShopCache.GetBaseConfig().platform_weixin_image;
                }
                else
                {
                    BaseConfig bcf = ShopCache.GetBaseConfig();
                    appid          = bcf.platform_weixin_id;
                    appkey         = bcf.platform_weixin_secret;
                    number         = bcf.platform_weixin_number;
                    platform_image = bcf.platform_weixin_image;
                }
            }
            Model.weixin.token t = GetToken();
            Token = t.access_token;

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            url      = "https://api.weixin.qq.com/";
            reurnurl = ShopCache.GetBaseConfig().HTTPServer + "://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_weixin.aspx";
        }
Пример #6
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);
        }
Пример #7
0
        public string tenpay_notify = ""; //支付完成后的回调处理页面,*替换成notify_url.asp所在路径

        public TenpayUtil(Lebi_Order order)
        {
            Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel("id = " + order.OnlinePay_id + "");

            if (onlinepay == null)
            {
                Log.Add("在线支付接口 weixinpay 配置错误");
                return;
            }
            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            //B_BaseConfig bconfig = new B_BaseConfig();
            //BaseConfig SYS = bconfig.LoadConfig();
            mch_id        = onlinepay.UserName;
            key           = onlinepay.UserKey;
            appid         = onlinepay.Appid; // SYS.platform_weixin_id;
            appkey        = onlinepay.UserKey;
            tenpay_notify = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpay/payNotifyUrl.aspx";
        }
Пример #8
0
 public Facebook(int DT_id = 0)
 {
     url = "https://graph.facebook.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_facebook_id;
         appkey         = bcf.platform_facebook_secret;
         platform_image = bcf.platform_facebook_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_facebook_id;
         appkey         = bcf.platform_facebook_secret;
         platform_image = bcf.platform_facebook_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_facebook.aspx";
 }
Пример #9
0
 /// <summary>
 /// 初始化支付参数信息
 /// </summary>
 public UmsPayConfig(Lebi_OnlinePay pay)
 {
     //Lebi_OnlinePay pay = Money.GetOnlinePay(order, "yinlianqmf");
     //测试
     //商户号 898000093990002 终端号 99999999
     // 下单地址 https://116.228.21.162:8603/merFrontMgr/orderBusinessServlet
     // 订单查询地址 https://116.228.21.162:8603/merFrontMgr/orderQueryServlet
     // 银商验签公钥 http://116.228.21.162:9149/download_qmf/spackage 下载
     // 商户签名私钥 http://116.228.21.162:9149/download_qmf/spackage
     //正式
     //下单查询地址https://mpos.quanminfu.com:6004/merFrontMgr/orderBusinessServlet
     //订单查询地址 https://mpos.quanminfu.com:6004/merFrontMgr/orderQueryServlet
     _privateKey    = pay.UserKey;
     _publicKey     = pay.Email;
     _orderUrl      = "https://mpos.quanminfu.com:6004/merFrontMgr/orderBusinessServlet";
     _queryOrderUrl = "https://mpos.quanminfu.com:6004/merFrontMgr/orderQueryServlet";
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     _notifyUrl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/yinlianqmf/notify_url.aspx";;
     _merId     = pay.UserName;
     _merTermId = pay.terminal;
 }
Пример #10
0
 public Weibo(int _DT_id = 0)
 {
     DT_id = _DT_id;
     url   = "https://api.weibo.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_weibo_id;
         appkey         = bcf.platform_weibo_key;
         platform_image = bcf.platform_weibo_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_weibo_id;
         appkey         = bcf.platform_weibo_key;
         platform_image = bcf.platform_weibo_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_weibo.aspx";
 }
Пример #11
0
        public string tenpay_notify = "http://*****/payReturnUrl.aspx";    //支付完成后的回调处理页面;

        public TenpayUtil(Lebi_Order order)
        {
            /*tenpay      = System.Configuration.ConfigurationSettings.AppSettings["tenpay"];*/

            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "tenpayJSDZ");

            if (pay == null)
            {
                return;
            }
            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);

            Shop.Bussiness.Site site    = new Shop.Bussiness.Site();
            B_BaseConfig        bconfig = new B_BaseConfig();
            BaseConfig          SYS     = bconfig.LoadConfig();

            bargainor_id  = pay.UserName;
            tenpay_key    = pay.UserKey;
            tenpay_return = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/payReturnUrl.aspx";
            tenpay_notify = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/payNotifyUrl.aspx";
        }
Пример #12
0
 public Twitter(int _DT_id = 0)
 {
     DT_id = _DT_id;
     url   = "https://api.twitter.com/";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_twitter_key;
         appkey         = bcf.platform_twitter_secret;
         platform_image = bcf.platform_twitter_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_twitter_key;
         appkey         = bcf.platform_twitter_secret;
         platform_image = bcf.platform_twitter_image;
     }
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + ":8001" + site.WebPath + "/platform/login_twitter.aspx";
     //reurnurl = "http://demo.lebi.cn" + site.WebPath + "/platform/login.aspx";
     reurnurl = System.Web.HttpUtility.UrlEncode(reurnurl);
 }
Пример #13
0
 public Taobao(int _DT_id = 0)
 {
     DT_id  = _DT_id;
     url    = "https://oauth.taobao.com/";
     apiurl = "https://eco.taobao.com/router/rest";
     if (DT_id == 0)
     {
         BaseConfig bcf = ShopCache.GetBaseConfig();
         appid          = bcf.platform_taobao_key;
         appkey         = bcf.platform_taobao_secret;
         platform_image = bcf.platform_taobao_image;
     }
     else
     {
         BaseConfig_DT bcf = ShopCache.GetBaseConfig_DT(DT_id);
         appid          = bcf.platform_taobao_key;
         appkey         = bcf.platform_taobao_secret;
         platform_image = bcf.platform_taobao_image;
     }
     appid  = Shop.Bussiness.ShopCache.GetBaseConfig().platform_taobao_key;
     appkey = Shop.Bussiness.ShopCache.GetBaseConfig().platform_taobao_secret;
     Shop.Bussiness.Site site = new Shop.Bussiness.Site();
     reurnurl = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/platform/login_taobao.aspx";
 }
Пример #14
0
        public static string package  = "";                          //进行支付需要的包

        protected void Page_Load(object sender, EventArgs e)
        {
            Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='weixinpay'");

            if (pay == null)
            {
                Log.Add("在线支付接口 weixinpay 配置错误");
                return;
            }
            Shop.Bussiness.Site site    = new Shop.Bussiness.Site();
            B_BaseConfig        bconfig = new B_BaseConfig();
            BaseConfig          SYS     = bconfig.LoadConfig();

            partnerid  = pay.UserName;
            partnerkey = pay.UserKey;
            appid      = SYS.platform_weixin_id;
            appsecret  = SYS.platform_weixin_secret;
            appkey     = "";
            notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpay.aspx";

            Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id);
            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;
            }

            string order_price = (order.Money_Pay * currendy.ExchangeRate * 100).ToString();
            string sp_billno   = order.Code;

            Lebi_User user = B_Lebi_User.GetModel(order.User_id);

            if (user == null)
            {
                Response.Write("订单错误");
                Response.End();
                return;
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////
            //当前时间 yyyyMMdd
            string date = DateTime.Now.ToString("yyyyMMdd");

            if (null == sp_billno)
            {
                //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
                sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4);
            }
            else
            {
                sp_billno = Request["order_no"];
            }

            sp_billno = partnerid + sp_billno;


            //创建支付应答对象
            var packageReqHandler = new RequestHandler(Context);

            //初始化
            packageReqHandler.init();

            timeStamp = TenpayUtil.getTimestamp();
            nonceStr  = TenpayUtil.getNoncestr();


            //设置package订单参数

            packageReqHandler.setParameter("body", "test"); //商品信息 127字符
            packageReqHandler.setParameter("appid", user.bind_weixin_id);
            packageReqHandler.setParameter("mch_id", mchid);
            packageReqHandler.setParameter("nonce_str", nonceStr.ToLower());
            packageReqHandler.setParameter("notify_url", notify_url);
            packageReqHandler.setParameter("openid", "openid");
            packageReqHandler.setParameter("out_trade_no", sp_billno);                        //商家订单号
            packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
            packageReqHandler.setParameter("total_fee", "1");                                 //商品金额,以分为单位(money * 100).ToString()
            packageReqHandler.setParameter("trade_type", "JSAPI");

            //获取package包
            sign = packageReqHandler.CreateMd5Sign("key", appkey);
            WriteFile(Server.MapPath("") + "\\Log.txt", sign);
            packageReqHandler.setParameter("sign", sign);

            string data = packageReqHandler.parseXML();

            WriteFile(Server.MapPath("") + "\\Log.txt", data);

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

            WriteFile(Server.MapPath("") + "\\Log.txt", prepayXml);

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

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

            if (xnl.Count > 7)
            {
                prepayId = xnl[7].InnerText;
                package  = string.Format("prepay_id={0}", prepayId);
                WriteFile(Server.MapPath("") + "\\Log.txt", package);
            }

            //设置支付参数
            var paySignReqHandler = new RequestHandler(Context);

            paySignReqHandler.setParameter("appId", appId);
            paySignReqHandler.setParameter("timeStamp", timeStamp);
            paySignReqHandler.setParameter("nonceStr", nonceStr);
            paySignReqHandler.setParameter("package", package);
            paySignReqHandler.setParameter("signType", "MD5");
            paySign = paySignReqHandler.CreateMd5Sign("key", appkey);


            WriteFile(Server.MapPath("") + "\\Log.txt", paySign);
        }
Пример #15
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;
        }
Пример #16
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);
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //OrderTime 订单时间 N 14 M 格式: hhmmss
            //OrderDate 订单日期 N 8 M 格式:yyyyMMdd
            //MerOrderId 商户订单号 AN 32 M
            //TransType 交易类型 AN 32 M 固定值:NoticePay
            //TransAmt 交易金额 N 12 M 单位分
            //MerId 商户号 N 32 M
            //MerTermId 终端号 N 8 M
            //TransId 银商订单号 AN 32 M
            //TransState 交易状态 N 2 M
            //RefId 系统检索号 N 12 M
            //Account 支付卡号 N 30 M 支付卡号
            //TransDesc 交易描述 ANS 256 O
            //LiqDate 清算日期 N 8 M yyyyMMdd
            //Reserve 备用字段 ANS 256 O 备用字段
            //Signature 签名数据 ANS 256 M HexStr
            string OrderTime  = RequestTool.RequestString("OrderTime");
            string OrderDate  = RequestTool.RequestString("OrderDate");
            string MerOrderId = RequestTool.RequestString("MerOrderId");
            string TransType  = RequestTool.RequestString("TransType");
            string TransAmt   = RequestTool.RequestString("TransAmt");
            string MerId      = RequestTool.RequestString("MerId");
            string MerTermId  = RequestTool.RequestString("MerTermId");
            string TransId    = RequestTool.RequestString("TransId");
            string TransState = RequestTool.RequestString("TransState");
            string RefId      = RequestTool.RequestString("RefId");
            string Account    = RequestTool.RequestString("Account");
            string TransDesc  = RequestTool.RequestString("TransDesc");
            string LiqDate    = RequestTool.RequestString("LiqDate");
            string Reserve    = RequestTool.RequestString("Reserve");
            string Signature  = RequestTool.RequestString("Signature");
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("OrderTime", "OrderTime");
            dic.Add("OrderDate", "OrderDate");
            dic.Add("MerOrderId", "MerOrderId");
            dic.Add("TransType", "TransType");
            dic.Add("TransAmt", "TransAmt");
            dic.Add("MerId", "MerId");
            dic.Add("MerTermId", "MerTermId");
            dic.Add("TransId", "TransId");
            dic.Add("TransState", "TransState");
            dic.Add("RefId", "RefId");
            dic.Add("Account", "Account");
            dic.Add("TransDesc", "TransDesc");
            dic.Add("LiqDate", "LiqDate");
            dic.Add("Reserve", "Reserve");
            dic.Add("Signature", "Signature");

            Shop.Bussiness.Site site  = new Shop.Bussiness.Site();
            Lebi_Order          order = B_Lebi_Order.GetModel("Code='" + MerOrderId + "'");

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

            if (pay == null)
            {
                return;
            }
            UmsPayConfig config = new UmsPayConfig(pay);

            if (CallbackVerify(config, dic))
            {
                Order.OnlinePaySuccess("yinlianqmf", MerOrderId);
            }
        }
Пример #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\"}");
            }




        }
Пример #19
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);
        }
Пример #20
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);
        }
Пример #21
0
        protected void Page_Load(Object sender, EventArgs E)
        {
            Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(Request["orderId"].ToString().Trim(), "kuaiqian");

            if (pay == null)
            {
                Response.Write("系统错误");
                Response.End();
                return;
            }

            //获取人民币网关账户号
            String merchantAcctId = Request["merchantAcctId"].ToString().Trim();

            //设置人民币网关密钥
            ///区分大小写
            String key = pay.UserKey;

            //获取网关版本.固定值
            ///快钱会根据版本号来调用对应的接口处理程序。
            ///本代码版本号固定为v2.0
            String version = Request["version"].ToString().Trim();

            //获取语言种类.固定选择值。
            ///只能选择1、2、3
            ///1代表中文;2代表英文
            ///默认值为1
            String language = Request["language"].ToString().Trim();

            //签名类型.固定值
            ///1代表MD5签名
            ///当前版本固定为1
            String signType = Request["signType"].ToString().Trim();

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

            //获取银行代码
            ///参见银行代码列表
            String bankId = Request["bankId"].ToString().Trim();

            //获取商户订单号
            String orderId = Request["orderId"].ToString().Trim();

            //获取订单提交时间
            ///获取商户提交订单时的时间.14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如:20080101010101
            String orderTime = Request["orderTime"].ToString().Trim();

            //获取原始订单金额
            ///订单提交到快钱时的金额,单位为分。
            ///比方2 ,代表0.02元
            String orderAmount = Request["orderAmount"].ToString().Trim();

            //获取快钱交易号
            ///获取该交易在快钱的交易号
            String dealId = Request["dealId"].ToString().Trim();

            //获取银行交易号
            ///如果使用银行卡支付时,在银行的交易号。如不是通过银行支付,则为空
            String bankDealId = Request["bankDealId"].ToString().Trim();

            //获取在快钱交易时间
            ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
            ///如;20080101010101
            String dealTime = Request["dealTime"].ToString().Trim();

            //获取实际支付金额
            ///单位为分
            ///比方 2 ,代表0.02元
            String payAmount = Request["payAmount"].ToString().Trim();

            //获取交易手续费
            ///单位为分
            ///比方 2 ,代表0.02元
            String fee = Request["fee"].ToString().Trim();

            //获取扩展字段1
            String ext1 = Request["ext1"].ToString().Trim();

            //获取扩展字段2
            String ext2 = Request["ext2"].ToString().Trim();

            //获取处理结果
            ///10代表 成功; 11代表 失败
            String payResult = Request["payResult"].ToString().Trim();

            //获取错误代码
            ///详细见文档错误代码列表
            String errCode = Request["errCode"].ToString().Trim();

            //获取加密签名串
            String signMsg = Request["signMsg"].ToString().Trim();



            //生成加密串。必须保持如下顺序。
            String merchantSignMsgVal = "";

            merchantSignMsgVal = appendParam(merchantSignMsgVal, "merchantAcctId", merchantAcctId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "version", version);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "language", language);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "signType", signType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payType", payType);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankId", bankId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderId", orderId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderTime", orderTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "orderAmount", orderAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealId", dealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "bankDealId", bankDealId);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "dealTime", dealTime);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payAmount", payAmount);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "fee", fee);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext1", ext1);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "ext2", ext2);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "payResult", payResult);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "errCode", errCode);
            merchantSignMsgVal = appendParam(merchantSignMsgVal, "key", key);

            //如果在web.config文件中设置了编码方式,例如<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>(如未设则默认为utf-8),
            //那么,GetMD5()方法中所传递的编码方式也必须与此保持一致。
            String merchantSignMsg = GetMD5(merchantSignMsgVal, "utf-8");

            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            //商家进行数据处理,并跳转会商家显示支付结果的页面
            ///首先进行签名字符串验证
            if (signMsg.ToUpper() == merchantSignMsg.ToUpper())
            {
                switch (payResult)
                {
                case "10":
                    /*
                     * ' 商户网站逻辑处理,比方更新订单支付状态为成功
                     * ' 特别注意:只有signMsg.ToUpper() == merchantSignMsg.ToUpper(),且payResult=10,才表示支付成功!同时将订单金额与提交订单前的订单金额进行对比校验。
                     */
                    Order.OnlinePaySuccess("kuaiqian", orderId, dealId, false);
                    //报告给快钱处理结果,并提供将要重定向的地址。
                    rtnOk  = 1;
                    rtnUrl = site.WebPath + "/user/Orders.aspx";
                    break;

                default:

                    rtnOk = 1;
                    //rtnUrl = "http://www.yoursite.com/show.aspx?msg=false";
                    rtnUrl = site.WebPath + "/user/Orders.aspx";
                    break;
                }
            }
            else
            {
                rtnOk = 1;
                //rtnUrl = "http://www.yoursite.com/show.aspx?msg=error";
                rtnUrl = site.WebPath + "/user/Orders.aspx";
            }
        }
Пример #22
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
            {
            }
        }
Пример #23
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);
        }
Пример #24
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;
        }
Пример #25
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);           //请将此处改成你的私钥文件所在路径
        }
Пример #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, "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"];
        }
Пример #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='alipaybatch'");

            if (pay == null)
            {
                Response.Write("参数错误");
                Response.End();
                return;
            }
            Shop.Bussiness.Site site = new Shop.Bussiness.Site();
            string ids = RequestTool.RequestString("ids");

            if (ids == "")
            {
                Response.Write("参数错误");
                Response.End();
                return;
            }

            List <Lebi_Cash> models = B_Lebi_Cash.GetList("id in (" + ids + ")", "");
            decimal          money  = 0;
            string           con    = "";

            foreach (Lebi_Cash model in models)
            {
                money = money + model.Money - model.Fee;
                //string t = "" + model.id + "^" + model.AccountCode + "^" + model.AccountName + "^" + (model.Money - model.Fee) + "^" + model.Remark + "";
                string t = "" + model.id + "^" + model.AccountCode + "^" + model.AccountName + "^" + (model.Money - model.Fee) + "^提现申请";
                con += t + "|";
            }
            con = con.TrimEnd('|');
            Lebi_Cash_alipay cash = new Lebi_Cash_alipay();

            cash.alipay_user     = pay.Email;
            cash.alipay_username = "";
            cash.Cash_ids        = ids;
            cash.Code            = Shop.Bussiness.Order.CreateOrderCode();
            cash.Content         = con;
            cash.count           = models.Count;
            cash.Money           = money;
            B_Lebi_Cash_alipay.Add(cash);

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

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


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

            //付款账号
            string email = pay.Email;
            //必填

            //付款账户名
            string account_name = pay.UserRealName;
            //必填,个人支付宝账号是真实姓名公司支付宝账号是公司名称

            //付款当天日期
            string pay_date = System.DateTime.Now.ToString("yyyyMMdd");
            //必填,格式:年[4位]月[2位]日[2位],如:20100801

            //批次号
            string batch_no = cash.Code;
            //必填,格式:当天日期[8位]+序列号[3至16位],如:201008010000001

            //付款总金额
            string batch_fee = money.ToString();
            //必填,即参数detail_data的值中所有金额的总和

            //付款笔数
            string batch_num = models.Count.ToString();
            //必填,即参数detail_data的值中,“|”字符出现的数量加1,最大支持1000笔(即“|”字符出现的数量999个)

            //付款详细数据
            string detail_data = con;
            //必填,格式:流水号1^收款方帐号1^真实姓名^付款金额1^备注说明1|流水号2^收款方帐号2^真实姓名^付款金额2^备注说明2....


            ////////////////////////////////////////////////////////////////////////////////////////////////

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

            sParaTemp.Add("partner", Config.Partner);
            sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
            sParaTemp.Add("service", "batch_trans_notify");
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("email", email);
            sParaTemp.Add("account_name", account_name);
            sParaTemp.Add("pay_date", pay_date);
            sParaTemp.Add("batch_no", batch_no);
            sParaTemp.Add("batch_fee", batch_fee);
            sParaTemp.Add("batch_num", batch_num);
            sParaTemp.Add("detail_data", detail_data);

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

            Response.Write(sHtmlText);
        }
Пример #28
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);
        }
Пример #29
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
        }