public ActionResult Detail(string id) { string uid = Session["memberID"].ToString(); OrderBuss oBll = new OrderBuss(); OrderDetail info = oBll.OrderDetail(uid, id); return(View(info)); }
protected void Page_Load(object sender, EventArgs e) { log.Info("*******************支付宝发送处理开始****************************"); string oid = this.Request.QueryString["oid"]; //商户订单号,商户网站订单系统中唯一订单号,必填 string out_trade_no = oid; log.Info("订单号:" + oid); //订单名称,必填 string subject = ""; //付款金额,必填 string total_fee = ""; //商品描述,可空 string body = ""; if (!string.IsNullOrEmpty(oid)) { log.Info("进入主方法"); OrderDetail orderDetail = obll.OrderDetail(oid); OrderDetailPay od = new OrderDetailPay(); od.OrderDetailsPayInit(oid, orderDetail); //商户订单号 log.Info(" 订单号:" + out_trade_no); total_fee = od.Price.ToString(); log.Info(" 订单金额:" + total_fee); //float postPrice = float.Parse(od.Freight.Substring(1)); // log.Info(" 运费:" + postPrice); /** if (postPrice > 0) * { * this.total_fee = goodPrice.ToString("f2"); * this.subject = od.Description + " ,运费:" + postPrice.ToString("f2"); * log.Info(" 合计 有运费的:" + this.subject); * }**/ subject = od.Description; body = od.Rinfo; // log.Info(" 合计:" + this.subject); } //////////////////////////////////////////////////////////////////////////////////////////////// //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("service", Config.service); sParaTemp.Add("partner", Config.partner); sParaTemp.Add("seller_id", Config.seller_id); sParaTemp.Add("_input_charset", Config.input_charset.ToLower()); sParaTemp.Add("payment_type", Config.payment_type); sParaTemp.Add("notify_url", Config.notify_url); sParaTemp.Add("return_url", Config.return_url); sParaTemp.Add("anti_phishing_key", Config.anti_phishing_key); sParaTemp.Add("exter_invoke_ip", Config.exter_invoke_ip); sParaTemp.Add("out_trade_no", out_trade_no); sParaTemp.Add("subject", subject); sParaTemp.Add("total_fee", total_fee); sParaTemp.Add("body", body); //其他业务参数根据在线开发文档,添加参数.文档地址:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.O9yorI&treeId=62&articleId=103740&docType=1 //如sParaTemp.Add("参数名","参数值"); //建立请求 string sHtmlText = Submit.BuildRequest(sParaTemp, "post", "确认"); Response.Write(sHtmlText); log.Info(" *******************支付宝发送处理结束**************************"); }
protected void Page_Load(object sender, EventArgs e) { log.Info("*******************微信支付处理开始****************************"); string orderId = Request.QueryString["oid"]; string state = Request.QueryString["state"]; string openId = Request.QueryString["openid"]; if (!string.IsNullOrEmpty(state) && string.IsNullOrEmpty(orderId)) { orderId = state; } log.Info("WXPay.Send---->orderId--->" + orderId + "&&openID=" + openId + "&&state" + state); JsApiPay jsApiPay = new JsApiPay(this); if (string.IsNullOrEmpty(openId)) { jsApiPay.GetOpenidAndAccessToken(orderId); openId = jsApiPay.openid; log.Info("WXPay.Send 获得---->openid:" + openId); if (string.IsNullOrEmpty(openId)) { log.Info("依然没有得到openid"); return; } else { log.Info("即将刷新送出openID和Oid"); Response.Redirect("/pay/weixin/send.aspx?oid=" + orderId + "&&openid=" + openId); } } else { //付款金额,必填 decimal total_fee = 0; if (!string.IsNullOrEmpty(orderId)) { log.Info("订单号:" + orderId); try { OrderDetail orderDetail = obll.OrderDetail(orderId); OrderDetailPay od = new OrderDetailPay(); od.OrderDetailsPayInit(orderId, orderDetail); total_fee = od.Price * 100; //JSAPI支付预处理 // jsApiPay.total_fee = Convert.ToInt32(total_fee); string body = orderDetail.opList[0].ProductName + "x" + orderDetail.opList[0].Num; WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(body, orderId, Convert.ToInt32(total_fee), openId); packString = jsApiPay.GetJsApiParameters(); //获取H5调起JS API参数 log.Info("WXPay.Send---->wxJsApiParam : " + packString); /** * Wxpay.WxPayHelper wxPayHelper = new Wxpay.WxPayHelper(); * //先设置基本信息 * wxPayHelper.SetAppId(_APPID); * wxPayHelper.SetAppKey(_APPSECRET); * wxPayHelper.SetPartnerKey(_KEY); * wxPayHelper.SetSignType("SHA1"); * * //设置请求package信息 * wxPayHelper.SetParameter("bank_type", "WX"); * wxPayHelper.SetParameter("body", orderDetail.opList[0].ProductName + "x" + orderDetail.opList[0].Num); * log.Info("body:" + orderDetail.opList[0].ProductName + "x" + orderDetail.opList[0].Num); * wxPayHelper.SetParameter("partner", _MCHID); * wxPayHelper.SetParameter("out_trade_no", orderId.ToString()); * wxPayHelper.SetParameter("total_fee", total_fee.ToString()); * log.Info("total_fee:" + total_fee); * wxPayHelper.SetParameter("fee_type", "1"); * wxPayHelper.SetParameter("notify_url", ConfigurationManager.AppSettings["notifyUrl"]); * wxPayHelper.SetParameter("spbill_create_ip", Request.UserHostAddress); * wxPayHelper.SetParameter("input_charset", "UTF-8"); * packString = wxPayHelper.CreateBizPackage();****/ } catch (Exception ex) { log.Info(ex.Message + ex.StackTrace); } } else { log.Info("xxxOrderID 为空xxx"); } } log.Info("*******************微信支付处理结束****************************"); }