protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='weixinpay'"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } 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; } TenpayUtil tu = new TenpayUtil(); string sp_billno = order.Code; //当前时间 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"].ToString(); //} sp_billno = TenpayUtil.partner + sp_billno; RequestHandler outParams = new RequestHandler(Context); outParams.init(); string productid = sp_billno; string timeStamp = TenpayUtil.getTimestamp(); string nonceStr = TenpayUtil.getNoncestr(); RequestHandler Params = new RequestHandler(Context); Params.setParameter("appid", TenpayUtil.appid); Params.setParameter("appkey", TenpayUtil.appkey); Params.setParameter("noncestr", nonceStr); Params.setParameter("timestamp", timeStamp); Params.setParameter("productid", productid); string sign = Params.createSHA1Sign(); Params.setParameter("sign", sign); parm = "weixin://wxpay/bizpayurl?sign=" + sign + "&appid=" + TenpayUtil.appid + "&productid=" + productid + "&timeStamp=" + timeStamp + "&nonceStr=" + nonceStr; Response.Write(parm); parm = QRfromGoogle(parm); }
protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='95epay'"); if (pay == null) { Log.Add("在线支付接口 95epay 配置错误"); Response.End(); return; } 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; } sorder.ord_no = order.Code; //订单编号 sorder.ord_amt = order.Money_Pay * currendy.ExchangeRate; //订单金额 sorder.ord_date = DateTime.Now.ToString("yyyyMMdd"); //交易日期时间 sorder.ver = "01"; sorder.mrch_no = pay.UserName; }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>»</em><a href=\"" + URL("P_UserMoney", "") + "\"><span>" + Tag("资金记录") + "</span></a><em>»</em><a href=\"" + URL("P_UserChangePassword", "") + "\"><span>" + Tag("充值") + "</span></a>"; DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } string onpaywhere = "IsUsed=1 and parentid=0 and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%'"; if (CurrentSite.IsMobile == 1) { onpaywhere += " and (showtype='' or showtype like '%wap%')"; } else { onpaywhere += " and (showtype='' or showtype like '%web%')"; } onlinepays = B_Lebi_OnlinePay.GetList(onpaywhere, "Sort desc"); if (CurrentUser.OnlinePay_id == 0) { if (onlinepays.Count > 0) { CurrentUser.OnlinePay_id = onlinepays.FirstOrDefault().id; } } pays = B_Lebi_Pay.GetList("Code!='OnlinePay ' and Code!='OfflinePay'", "Sort desc"); }
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手机端 } } }
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; }
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); }
protected void Page_Load(object sender, EventArgs e) { try { string ppTx = RequestTool.RequestSafeString("txn_id"); string ppStatus = RequestTool.RequestSafeString("payment_status"); string ppDate = RequestTool.RequestSafeString("payment_date"); string ppItem = RequestTool.RequestSafeString("item_name"); string ppPrice = RequestTool.RequestSafeString("mc_gross"); string ppitem_number = RequestTool.RequestSafeString("item_number");//存储站内订单号 Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(ppitem_number, "paypal"); if (pay == null) { Response.Write("系统错误"); Response.End(); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); string Content = ""; Content += "txn_id:" + ppTx + "<br>"; Content += "payment_status:" + ppStatus + "<br>"; Content += "payment_date:" + ppDate + "<br>"; Content += "item_name:" + ppItem + "<br>"; Content += "mc_gross:" + ppPrice + "<br>"; Content += "ppitem_number:" + ppitem_number + "<br>"; string txToken = Request.QueryString["tx"]; //paypal流水号 if (VerifyIPN()) //验证成功 { Response.Write("OK"); Order.OnlinePaySuccess(ppitem_number); } else { if (VerifyPDT(pay)) { Response.Write("OK"); Order.OnlinePaySuccess(ppitem_number); } else { Response.Write("False"); //SystemLog.Add("paypal验证失败"); } } } catch (Exception ex) { //Response.Write("False"); SystemLog.Add("paypal验证异常" + ex.Message); } }
/** * 生成直接支付url,支付url有效期为2小时,模式二 * @param productId 商品ID * @return 模式二URL */ public static string GetPayUrl(string productId) { //Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing..."); Lebi_Order order = B_Lebi_Order.GetModel("id=" + productId); if (order == null) { return(""); } Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "weixinpay"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return(""); } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); if (pay.FreeFeeRate == 1) { pay.FeeRate = 0; } if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } string order_price = (order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString("0"); SystemLog.Add("weixinpay-GetPayUrl" + "productId : " + productId); WxPayData data = new WxPayData(); data.SetValue("body", "订单号:" + order.Code); //商品描述 data.SetValue("attach", ""); //附加数据 data.SetValue("out_trade_no", order.Code); data.SetValue("total_fee", order_price); //总金额 data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //交易起始时间 data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间 data.SetValue("goods_tag", "订单号:" + order.Code); //商品标记 data.SetValue("trade_type", "NATIVE"); //交易类型 data.SetValue("product_id", productId); //商品ID try { WxPayData result = WxPayApi.UnifiedOrder(data); //调用统一下单接口 SystemLog.Add("weixinpay-GetPayUrl" + "result : " + result); string url = result.GetValue("code_url").ToString(); //获得统一下单接口返回的二维码链接 //Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url); return(url); } catch (System.NullReferenceException ex) { SystemLog.Add("weixinpay-GetPayUrl" + "result : " + ex.ToString()); return(ex.ToString()); } }
public void LoadPage() { if (CurrentUser.id == 0) { Response.Write("{\"msg\":\"" + Tag("请先登陆") + "\",\"url\":\"" + URL("P_Login", "") + "\"}"); return; } money = RequestTool.RequestDecimal("money"); DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } keyid = RequestTool.RequestInt("keyid"); tablename = RequestTool.RequestString("tablename"); }
protected void Page_Load(object sender, EventArgs e) { try { string RefId = Request.Params["RefId"]; string ResCode = Request.Params["ResCode"]; SaleOrderId = Convert.ToInt64(Request.Params["SaleOrderId"]); SaleReferenceId = Convert.ToInt64(Request.Params["SaleReferenceId"]); string OrderID = Convert.ToString(SaleOrderId); Lebi_Order order = B_Lebi_Order.GetModel("id=" + OrderID + ""); if (order == null) { Response.Write("416"); //Response.Write("系统错误"); Response.End(); return; } Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order.Code, "behpardakht"); if (pay == null) { Response.Write("系统错误"); Response.End(); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); string Content = ""; Content += "OrderCode:" + order.Code + "<br>"; Content += "ResCode:" + ResCode + "<br>"; Content += "SaleReferenceId:" + SaleReferenceId + "<br>"; if (yanzheng(pay) == 0)//验证成功 { Response.Write("0"); Order.OnlinePaySuccess(order.Code); } else { Response.Write("416"); //SystemLog.Add("paypal验证失败"); } } catch (Exception ex) { //Response.Write("False"); SystemLog.Add("behpardakht验证异常" + ex.Message); } }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { if (CurrentUser.id == 0) { Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + "")); } LoadTheme(themecode, siteid, languagecode, pcode); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>»</em><a href=\"" + URL("P_UserMoney", "") + "\"><span>" + Tag("资金记录") + "</span></a><em>»</em><a href=\"" + URL("P_UserCash", "") + "\"><span>" + Tag("提现") + "</span></a>"; DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } onlinepays = B_Lebi_OnlinePay.GetList("IsUsed=1 and parentid=0 and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%'", "Sort desc"); if (CurrentUser.OnlinePay_id == 0) { if (onlinepays.Count > 0) { CurrentUser.OnlinePay_id = onlinepays.FirstOrDefault().id; } else { CurrentUser.OnlinePay_id = 0; } } pageindex = RequestTool.RequestInt("page", 1); string where = "User_id=" + CurrentUser.id + ""; cashs = B_Lebi_Cash.GetList(where, "Time_add desc", PageSize, pageindex); CashCount = B_Lebi_Cash.Counts(where); PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}", pageindex, PageSize, CashCount, CurrentLanguage); NextPage = "?page=" + (pageindex + 1) + ""; decimal TakeMoneyLimit = 0; decimal.TryParse(SYS.TakeMoneyLimit, out TakeMoneyLimit); if (TakeMoneyLimit > CurrentUser.Money) { SubmitShow = false; } else { SubmitShow = true; } user_bank = B_Lebi_User_Bank.GetList("User_id=" + CurrentUser.id + "", "id desc"); }
public string FormatMoney(decimal money, int id) { Lebi_Currency currency = B_Lebi_Currency.GetModel(id); if (currency == null) { currency = B_Lebi_Currency.GetModel("id>0 order by IsDefault desc,Sort desc"); } if (currency == null) { currency = new Lebi_Currency(); } StringBuilder sb = new StringBuilder(); sb.Append("<font class=\"msige\">" + currency.Msige + "</font>"); sb.Append("<font class=\"money_1\">" + (money * currency.ExchangeRate).ToString("f" + currency.DecimalLength + "") + "</font>"); return(sb.ToString()); //return CurrentCurrency. + "" + money.ToString("0.00"); }
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"; }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); if (id == 0) { if (!EX_Admin.Power("currency_add", "添加币种")) { WindowNoPower(); } } else { if (!EX_Admin.Power("currency_edit", "编辑币种")) { WindowNoPower(); } } model = B_Lebi_Currency.GetModel(id); if (model == null) { model = new Lebi_Currency(); } }
protected void Page_Load(object sender, EventArgs e) { try { Shop.Bussiness.Site site = new Shop.Bussiness.Site(); int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("ERROR"); Response.End(); return; } Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id); if (order.IsPaid == 1) { Response.Write(Language.Tag("已付款", language.Code)); Response.End(); return; } order.Site_id_pay = CurrentSite.id; order.Language_id = CurrentLanguage.id; Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "yinlianqmf"); if (pay == null) { Response.Write(Language.Tag("系统错误", language.Code)); Response.End(); return; } if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } if (order.OnlinePay_id != pay.id) { order.OnlinePay_id = pay.id; order.OnlinePay_Code = pay.Code; order.OnlinePay = pay.Name; } B_Lebi_Order.Update(order); config = new UmsPayConfig(pay); Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); //string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/pinpay/notify_url.aspx"; Lebi_Site lebisite = B_Lebi_Site.GetModel(order.Site_id_pay); if (site == null) { returnurl = Shop.Bussiness.Site.Instance.WebPath; } else { Lebi_Language lang = B_Lebi_Language.GetModel(order.Language_id); string path = ""; if (lang != null) { path = lang.Path.TrimEnd('/'); } if (lebisite.Domain == "") { returnurl = Shop.Bussiness.Site.Instance.WebPath.TrimEnd('/') + lebisite.Path.TrimEnd('/') + path; } else { returnurl = Shop.Bussiness.Site.Instance.WebPath.TrimEnd('/') + path; } } returnurl = "http://" + RequestTool.GetRequestDomain() + returnurl.TrimEnd('/') + "/user/OrderDetails.aspx?id=" + order.id; decimal order_amount1 = order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100)); msg = Payment(config, order, order_amount1); } finally { } }
/// <summary> /// 生成新订单 /// </summary> public void order_save() { if (CurrentUserLevel.BuyRight != 1) { Response.Write("{\"msg\":\"" + Tag("您所在的分组不允许下单") + "\"}"); return; } int pay_id = RequestTool.RequestInt("pay_id", 0); int sid = RequestTool.RequestInt("sid", 0);//结算供应商ID int onlinepay_id = RequestTool.RequestInt("onlinepay_id", 0); decimal Money_UserCut = RequestTool.RequestDecimal("Money_UserCut", 0); int usermoneytype = RequestTool.RequestInt("usermoneytype", 0); string Pay_Password = RequestTool.RequestSafeString("Pay_Password"); Lebi_PickUp pick = null; DateTime pickdate = System.DateTime.Now; if (usermoneytype == 3) { if (Pay_Password == "") { Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}"); return; } else { if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}"); return; } } if (Money_UserCut > 0 && Money_UserCut > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } } Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id); if (pay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } Basket basket = new Basket(sid); int CustomOfflineMoney = RequestTool.RequestInt("CustomOfflineMoney" + pay.id, 0); decimal OfflineMoney = RequestTool.RequestDecimal("OfflineMoney" + pay.id, 0); if (CustomOfflineMoney == 1) { if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 if (OfflineMoney < basket.Money_Product) { Response.Write("{\"msg\":\"" + Tag("打款金额不能少于订单金额") + "\"}"); return; } } } if (pay.Code == "OnlinePay") { Lebi_OnlinePay onpay = B_Lebi_OnlinePay.GetModel(onlinepay_id); if (onpay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } } if (basket.Products.Count == 0) { Response.Write("{\"msg\":\"" + Tag("购物车为空") + "\"}"); return; } foreach (Lebi_User_Product up in basket.Products) { if (up.count < 1) { Response.Write("{\"msg\":\"" + Tag("购物车异常") + "\"}"); return; } } if (basket.Point_Buy > 0 && (basket.Point_Buy > CurrentUser.Point)) { Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}"); return; } int ProductCount = 0; foreach (Lebi_User_Product up in basket.Products) { Lebi_Product pro = B_Lebi_Product.GetModel(up.Product_id); if (pro.Type_id_ProductType != 323) { ProductCount += up.count; } //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10 if (pro.Type_id_ProductStatus != 101) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}"); return; } //}-> if (pro.Type_id_ProductType != 324) { int levelcount = ProductLevelCount(pro); if (up.count < levelcount) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}"); return; } } if (pro.Type_id_ProductType != 320 && pro.Time_Expired > System.DateTime.Now) { if (pro.Count_Limit < up.count && pro.Count_Limit > 0) { Response.Write("{\"msg\":\"" + Tag("购买数量大于限购数量") + "\"}"); return; } } if (SYS.IsNullStockSale != "1") { if (pro.Count_Stock - pro.Count_Freeze < up.count && pro.Type_id_ProductType != 324) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + "" + Tag("库存不足") + "\"}"); return; } } } //验证当前分组允许的最低订单提交金额 if (CurrentUserLevel.OrderSubmit > 0) { if (basket.Money_Product < CurrentUserLevel.OrderSubmit) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低金额为:") + FormatMoney(CurrentUserLevel.OrderSubmit) + "\"}"); return; } } //验证当前分组允许的最低订单提交数量 if (CurrentUserLevel.OrderSubmitCount > 0 && ProductCount > 0) { if (ProductCount < CurrentUserLevel.OrderSubmitCount) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低数量为:") + CurrentUserLevel.OrderSubmitCount + "\"}"); return; } } Lebi_User_Address shouhuo = B_Lebi_User_Address.GetModel(CurrentUser.User_Address_id); if (shouhuo == null) { Response.Write("{\"msg\":\"" + Tag("未设置收获地址") + "\"}"); return; } if (CurrentUser.Transport_Price_id == "") { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } foreach (BasketShop shop in basket.Shops) { Lebi_Transport_Price tprice = B_Lebi_Transport_Price.GetModel("id in (lbsql{" + CurrentUser.Transport_Price_id + "}) and Supplier_id=" + shop.Shop.id + ""); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } Lebi_Transport transport = B_Lebi_Transport.GetModel(tprice.Transport_id); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } //检查运费设置是否正确 if (!EX_Area.CheckAreaPrice(tprice, shouhuo.Area_id)) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } if (transport.Type_id_TransportType == 332)//自提检查 { int pickup_id = RequestTool.RequestInt("pickup_id" + shop.Shop.id); string pickdate_ = RequestTool.RequestString("pickupdate_" + pickup_id); try { pickdate = Convert.ToDateTime(pickdate_); } catch { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } pick = B_Lebi_PickUp.GetModel(pickup_id); if (pick == null) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (pick.IsCanWeekend == 0 && (pickdate.DayOfWeek == DayOfWeek.Saturday || pickdate.DayOfWeek == DayOfWeek.Sunday)) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (System.DateTime.Now.Date.AddDays(pick.BeginDays) > pickdate) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } string NoServiceDays = pick.NoServiceDays.TrimStart('0').Replace(".0", "."); string nowday = pickdate.ToString("M.d"); if (("," + NoServiceDays + ",").Contains("," + nowday + ",")) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } } } //检查代金券 string pay312 = RequestTool.RequestSafeString("pay312"); if (pay312 != "") { List <Lebi_Card> cs = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + pay312 + "})", "id asc"); int flag = cs.FirstOrDefault().IsCanOtherUse; if (flag == 0 && cs.Count > 1) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } foreach (Lebi_Card c in cs) { if (flag != c.IsCanOtherUse) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } if (!Basket.CheckCard(basket, c)) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } } } //检查代金券结束 //检查发票信息 int billtype_id = RequestTool.RequestInt("billtype_id", 0); Lebi_BillType billtype = B_Lebi_BillType.GetModel(billtype_id); if (ShopCache.GetBaseConfig().BillFlag == "1") { if (billtype == null) { Response.Write("{\"msg\":\"" + Tag("请设置发票内容") + "\"}"); return; } } CurrentUser.Pay_id = pay.id; CurrentUser.OnlinePay_id = onlinepay_id; Lebi_Order ordergroup; List <Lebi_Order> orders = Shop.Bussiness.Order.CreateOrder(CurrentUser, basket, shouhuo, billtype, CurrentCurrency, CurrentSite, CurrentLanguage, out ordergroup); CurrentUser.Count_Order = CurrentUser.Count_Order + orders.Count; B_Lebi_User.Update(CurrentUser); List <Lebi_Order> ordermodel = B_Lebi_Order.GetList("User_id=" + CurrentUser.id + "", "id desc"); ordergroup = ordermodel.FirstOrDefault(); if (OfflineMoney == 0) { OfflineMoney = ordergroup.Money_Order; } string remark = RequestTool.RequestSafeString("remark"); ordergroup.Remark_User = remark; bool needupdate = false; if (remark != "") { Lebi_Comment model = new Lebi_Comment(); model.Content = remark; model.Keyid = ordergroup.id; model.TableName = "Order"; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(model); needupdate = true; } if (pick != null) { ordergroup.PickUp_Date = pickdate; ordergroup.PickUp_id = pick.id; ordergroup.PickUp_Name = pick.Name; needupdate = true; } if (needupdate) { B_Lebi_Order.Update(ordergroup); } if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 //生成一笔充值单 //OfflineMoney Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } Lebi_Order order = new Lebi_Order(); order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); order.Money_Order = OfflineMoney; order.Money_Pay = OfflineMoney; order.User_id = CurrentUser.id; order.User_UserName = CurrentUser.UserName; order.IsPaid = 0; order.Currency_Code = ordergroup.Currency_Code; order.Currency_ExchangeRate = ordergroup.Currency_ExchangeRate; order.Currency_id = ordergroup.Currency_id; order.Currency_Msige = ordergroup.Currency_Msige; order.Type_id_OrderType = 214; order.Pay_id = pay.id; order.Pay = pay.Name; order.Site_id = CurrentSite.id; order.Language_id = CurrentLanguage.id; order.Remark_Admin = ""; order.Order_id = ordergroup.id; B_Lebi_Order.Add(order); } //if (orders.Count == 1) // ordergroup = orders.FirstOrDefault(); //Shop.Bussiness.Order.SupplierOrder(order);//根据商品供应商分单 Response.Write("{\"msg\":\"OK\",\"id\":\"" + ordergroup.id + "\"}"); return; }
/// <summary> /// 生成充值订单 /// </summary> public void CreateMoneyOrder() { decimal money = RequestTool.RequestDecimal("RMoney", 0); if (money == 0) { Response.Write("{\"msg\":\"" + Tag("充值金额必须大于0") + "\"}"); return; } Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } int onlinepay_id = RequestTool.RequestInt("onlinepay_id"); int pay_id = RequestTool.RequestInt("Pay_id"); int paytype = RequestTool.RequestInt("paytype"); //Lebi_MoneyOrder order = new Lebi_MoneyOrder(); //order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); //order.Money = money; //order.User_id = CurrentUser.id; //order.User_UserName = CurrentUser.UserName; //order.IsPaid = 0; //order.Currency_Code = DefaultCurrency.Code; //order.Currency_ExchangeRate = DefaultCurrency.ExchangeRate; //order.Currency_id = DefaultCurrency.id; //order.Currency_Msige = DefaultCurrency.Msige; //B_Lebi_MoneyOrder.Add(order); Lebi_Order order = new Lebi_Order(); order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); order.Money_Order = money; order.Money_Pay = money; order.User_id = CurrentUser.id; order.User_UserName = CurrentUser.UserName; order.IsPaid = 0; order.Currency_Code = DefaultCurrency.Code; order.Currency_ExchangeRate = DefaultCurrency.ExchangeRate; order.Currency_id = DefaultCurrency.id; order.Currency_Msige = DefaultCurrency.Msige; order.Type_id_OrderType = 214; Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id); if (paytype == 0) { Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel(onlinepay_id); if (onlinepay == null) { onlinepay = new Lebi_OnlinePay(); } order.OnlinePay_id = onlinepay.id; order.OnlinePay = onlinepay.Name; pay = B_Lebi_Pay.GetModel("Code='OnlinePay'"); } if (pay == null) { pay = new Lebi_Pay(); } order.Pay_id = pay.id; order.Pay = pay.Name; order.Site_id = CurrentSite.id; order.Language_id = CurrentLanguage.id; B_Lebi_Order.Add(order); order.id = B_Lebi_Order.GetMaxId(); Response.Write("{\"msg\":\"OK\",\"id\":\"" + order.id + "\",\"code\":\"" + order.Code + "\",\"url\":\"" + URL("P_Pay", order.id + "," + order.Code) + "\"}"); }
/** * @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; }
protected void Page_Load(object sender, EventArgs e) { int order_id = RequestTool.RequestInt("order_id", 0); order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("ERROR"); Response.End(); return; } Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id); if (order.IsPaid == 1) { Response.Write(Language.Tag("已付款", language.Code)); Response.End(); return; } order.Site_id_pay = CurrentSite.id; order.Language_id = CurrentLanguage.id; Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "weixinpayh5"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); if (pay.FreeFeeRate == 1) { pay.FeeRate = 0; } if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } if (order.OnlinePay_id != pay.id) { order.OnlinePay_id = pay.id; order.OnlinePay_Code = pay.Code; order.OnlinePay = pay.Name; } B_Lebi_Order.Update(order); Lebi_User user = B_Lebi_User.GetModel(order.User_id); if (user == null) { Response.Write("订单错误"); Response.End(); return; } returnurl = URL("P_UserOrderDetails", order.id); TenpayUtil tu = new TenpayUtil(order); appId = tu.appid; timeStamp = TenpayUtil.getTimestamp(); nonceStr = TenpayUtil.getNoncestr(); string order_price = (order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString("0"); string sp_billno = order.Code + "|" + TenpayUtil.UnixStamp(); shopname = Lang(CurrentSite.Name); string prepayId = order.weixin_prepay_id; //if (prepayId == "" || prepayId == "INVALID_REQUEST") //{ //创建支付应答对象 RequestHandler packageReqHandler = new RequestHandler(Context); //初始化 packageReqHandler.init(); //设置package订单参数 packageReqHandler.setParameter("body", order.Code); //商品信息 127字符 packageReqHandler.setParameter("appid", tu.appid); packageReqHandler.setParameter("mch_id", tu.mch_id); packageReqHandler.setParameter("nonce_str", nonceStr); packageReqHandler.setParameter("openid", user.bind_weixin_id); packageReqHandler.setParameter("out_trade_no", sp_billno); //商家订单号 packageReqHandler.setParameter("spbill_create_ip", RequestTool.GetClientIP()); //Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.setParameter("total_fee", order_price); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.setParameter("trade_type", "MWEB"); //packageReqHandler.setParameter("notify_url", HttpUtility.UrlEncode(tu.tenpay_notify)); packageReqHandler.setParameter("notify_url", tu.tenpay_notify); //Response.Write("body:" + order.Code + ",appid:" + tu.appid + ",mch_id:" + tu.mch_id + ",nonce_str:" + nonceStr + ",notify_url:" + HttpUtility.UrlEncode(tu.tenpay_notify) + ",openid:" + user.bind_weixin_id + ",out_trade_no:" + sp_billno + ",spbill_create_ip:" + RequestTool.GetClientIP() + ",total_fee:" + order_price + ",key:" + tu.key + ""); string sign = packageReqHandler.createMd5Sign("key", tu.key); packageReqHandler.setParameter("sign", sign); string data = packageReqHandler.parseXML(); string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder"); SystemLog.Add("prepayXml:" + prepayXml); Response.Write("prepayXml:" + prepayXml); //return; //获取预支付ID var xdoc = new XmlDocument(); xdoc.LoadXml(prepayXml); XmlNode xn = xdoc.SelectSingleNode("xml"); XmlNodeList xnl = xn.ChildNodes; //Response.Write("<br/>xml:" + xnl[0].InnerText + "|" + xnl[1].InnerText + "|" + xnl[2].InnerText + "|" + xnl[3].InnerText + "|" + xnl[4].InnerText + "|" + xnl[5].InnerText + "|" + xnl[6].InnerText + "|" + xnl[7].InnerText + "|" + xnl[8].InnerText + ""); if (xnl.Count > 7) { prepayId = xnl[7].InnerText; order.weixin_prepay_id = prepayId; B_Lebi_Order.Update(order); } if (xnl.Count > 9) { string url = xnl[9].InnerText; Response.Redirect(url); } //} }
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 }
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"]; }
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); }
protected void Page_Load(object sender, EventArgs e) { int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("ERROR"); Response.End(); return; } Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id); if (order.IsPaid == 1) { Response.Write(Language.Tag("已付款", language.Code)); Response.End(); return; } order.Site_id_pay = CurrentSite.id; order.Language_id = CurrentLanguage.id; Lebi_OnlinePay pay = Shop.Bussiness.Money.GetOnlinePay(order, "tenpayJSDZ"); if (pay == null) { Response.Write("系统错误"); Response.End(); return; } if (pay.FreeFeeRate == 1) { pay.FeeRate = 0; } if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } if (order.OnlinePay_id != pay.id) { order.OnlinePay_id = pay.id; order.OnlinePay_Code = pay.Code; order.OnlinePay = pay.Name; } B_Lebi_Order.Update(order); Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); string sp_billno = order.Code; string product_name = order.Code; string order_price = (order.Money_Pay * currendy.ExchangeRate * (1 + (pay.FeeRate / 100))).ToString("f" + currendy.DecimalLength + ""); string remarkexplain = ""; double money = 0; try { money = Convert.ToDouble(order_price); } catch { //Response.Write("支付金额格式错误!"); //Response.End(); //return; } //if (null == sp_billno) //{ // //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 // sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4); //} //else //{ // sp_billno = Request["order_no"].ToString(); //} //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); TenpayUtil tu = new TenpayUtil(order); //设置密钥 reqHandler.setKey(tu.tenpay_key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", tu.bargainor_id); //商户号 reqHandler.setParameter("out_trade_no", sp_billno); //商家订单号 reqHandler.setParameter("total_fee", (money * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", tu.tenpay_return); //交易完成后跳转的URL reqHandler.setParameter("notify_url", tu.tenpay_notify); //接收财付通通知的URL reqHandler.setParameter("body", order.Code); //商品描述 reqHandler.setParameter("bank_type", "DEFAULT"); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", product_name); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("attach", ""); //附加数据,原样返回 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", "1"); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); Response.Redirect(requestUrl); //Get的实现方式 // string a_link = "<a target=\"_blank\" href=\"" + requestUrl + "\">" + "财付通支付" + "</a>"; //Response.Write(a_link); //post实现方式 /* Response.Write("<form method=\"post\" action=\""+ reqHandler.getGateUrl() + "\" >\n"); * Hashtable ht = reqHandler.getAllParameters(); * foreach(DictionaryEntry de in ht) * { * Response.Write("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); * } * Response.Write("<input type=\"submit\" value=\"财付通支付\" >\n</form>\n");*/ //获取debug信息,建议把请求和debug信息写入日志,方便定位问题 string debuginfo = reqHandler.getDebugInfo(); Response.Write("<br/>requestUrl:" + requestUrl + "<br/>"); Response.Write("<br/>debuginfo:" + debuginfo + "<br/>"); }
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 + "×tamp=" + 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); }
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; }
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); }
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); //请将此处改成你的私钥文件所在路径 }
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); }
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); }
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); }