public void Submit(ViewModel.PaymentViewModel model) { var order = _uow.OrderService.Get(t => t.OrderId == model.OrderId && t.TradeNo == model.TradeNo); if (order == null) Response.Redirect("PayError"); model.OrderModel = order; model.FrontCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("FrontPayUrl"); model.BackCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("BackPayUrl"); if (model.Source == Model.Enum.PaySource.Donation) { model.ProdUrl = Ichari.Common.WebUtils.GetAppSettingValue("DonateUrl"); model.ProdName = Ichari.Common.WebUtils.GetAppSettingValue("DonationName"); } switch (model.PayWayType) { case PayWay.UnionPay : // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(Server.MapPath("~/conf.xml.config")); var p = GenParams(model); var srv = new FrontPaySrv(p); //写入订单支付记录 SavePayLog(model); Response.ContentEncoding = srv.Charset; _log.Info(srv.CreateHtml()); Response.Write(srv.CreateHtml()); break; } }
/// <summary> /// 银联支付发送请求 /// </summary> /// <param name="upa"></param> /// <param name="writeEcoding"></param> /// <returns></returns> public string UPOPSendRequesWriter(UPOPPara upa, out Encoding writeEcoding) { // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(configPath); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary<string, string> param = new System.Collections.Generic.Dictionary<string, string>(); // 填写参数 param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["commodityUrl"] = upa.showProUrl; // 商品URL param["commodityName"] = upa.proShowName; // 商品名称 param["commodityUnitPrice"] =AlipayConfig.MoneyFormatEco(upa.price); // 商品单价,分为单位 param["commodityQuantity"] = upa.count; // 商品数量 param["orderNumber"] = upa.orderNumber; // 订单号,必须唯一 param["orderAmount"] = AlipayConfig.MoneyFormatEco(upa.total); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["customerIp"] = ""; // 用户IP param["frontEndUrl"] = upa.returnUrl; // 前台回调URL param["backEndUrl"] = upa.notifyUrl; // 后台回调URL // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 writeEcoding = srv.Charset; // 指定输出编码 return srv.CreateHtml(); }
public void Submit(ViewModel.PaymentViewModel model) { var order = _uow.OrderService.Get(t => t.OrderId == model.OrderId && t.TradeNo == model.TradeNo); if (order == null) { Response.Redirect("PayError"); } model.OrderModel = order; model.FrontCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("FrontPayUrl"); model.BackCallbackUrl = Ichari.Common.WebUtils.GetAppSettingValue("BackPayUrl"); if (model.Source == Model.Enum.PaySource.Donation) { model.ProdUrl = Ichari.Common.WebUtils.GetAppSettingValue("DonateUrl"); model.ProdName = Ichari.Common.WebUtils.GetAppSettingValue("DonationName"); } switch (model.PayWayType) { case PayWay.UnionPay: // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(Server.MapPath("~/conf.xml.config")); var p = GenParams(model); var srv = new FrontPaySrv(p); //写入订单支付记录 SavePayLog(model); Response.ContentEncoding = srv.Charset; _log.Info(srv.CreateHtml()); Response.Write(srv.CreateHtml()); break; } }
/// <summary> /// 银联支付发送请求 /// </summary> /// <param name="upa"></param> /// <param name="writeEcoding"></param> /// <returns></returns> public string UPOPSendRequesWriter(UPOPPara upa, out Encoding writeEcoding) { // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(configPath); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary <string, string> param = new System.Collections.Generic.Dictionary <string, string>(); // 填写参数 param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["commodityUrl"] = upa.showProUrl; // 商品URL param["commodityName"] = upa.proShowName; // 商品名称 param["commodityUnitPrice"] = AlipayConfig.MoneyFormatEco(upa.price); // 商品单价,分为单位 param["commodityQuantity"] = upa.count; // 商品数量 param["orderNumber"] = upa.orderNumber; // 订单号,必须唯一 param["orderAmount"] = AlipayConfig.MoneyFormatEco(upa.total); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["customerIp"] = ""; // 用户IP param["frontEndUrl"] = upa.returnUrl; // 前台回调URL param["backEndUrl"] = upa.notifyUrl; // 后台回调URL // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 writeEcoding = srv.Charset; // 指定输出编码 return(srv.CreateHtml()); }
public override string CreateUrl(ParameterInfo unionPay) { var info = unionPay as UnionPayParasInfo; if (info == null) { return(""); } UPOPSrv.LoadConf(HttpContext.Current.Server.MapPath("~/App_Data/xml/unionPay.config")); var paras = new Dictionary <string, string> { { "transType", "01" }, { "commodityUrl", Uri.EscapeUriString(info.ProductUrl) }, { "commodityName", info.ProductName }, { "commodityUnitPrice", info.UnitPrice.ToString() }, { "orderNumber", info.OrderNum }, { "orderAmount", (Math.Round(info.Amount, 2) * 100).ToString("F0") }, { "orderCurrency", info.Cur }, { "orderTime", DateTime.Now.ToString("yyyyMMddHHmmss") }, { "customerIp", Utils.GetRealIp() }, { "frontEndUrl", info.ReturnUrl }, { "backEndUrl", info.NotifyUrl } }; var srv = new FrontPaySrv(paras); return(srv.CreateHtml()); }
protected void Page_Load(object sender, EventArgs e) { double dMoney = double.Parse(Request.QueryString["m"].ToString()); double dFee = double.Parse(Request.QueryString["f"].ToString()); long NewPayNumber = -1; string ReturnDescription = ""; if(DAL.Procedures.P_GetNewPayNumber(_Site.ID, _User.ID, "UPOP", (dMoney - dFee), dFee, ref NewPayNumber, ref ReturnDescription) < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if ((NewPayNumber < 0) || (ReturnDescription != "")) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().BaseType.FullName); return; } // **************演示前台交易的请求*********************** // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(Server.MapPath("~/App_Data/conf.xml.config")); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary<string, string> param = new System.Collections.Generic.Dictionary<string, string>(); // 随机构造一个订单号(演示用) //Random rnd = new Random(); //string orderID = DateTime.Now.ToString("yyyyMMddHHmmss") + (rnd.Next(900) + 100).ToString().Trim(); // 填写参数 param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["commodityUrl"] = "http://emall.chinapay.com/product?name=商品"; // 商品URL param["commodityName"] = "帐户充值"; // 商品名称 param["commodityUnitPrice"] = (dMoney * 100).ToString(); // 商品单价,分为单位 param["commodityQuantity"] = "1"; // 商品数量 param["orderNumber"] = NewPayNumber.ToString(); // 订单号,必须唯一 param["orderAmount"] = (dMoney * 100 + dFee * 100).ToString(); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["customerIp"] = "172.17.136.34"; // 用户IP param["frontEndUrl"] = "http://219.143.228.243:81/Home/Room/OnlinePay/UnionPay/FrontRecieve.aspx"; // 前台回调URL // 后台回调URL(前台请求时可为空)used to recieve data from unionpay automatically, use this data as the primary source param["backEndUrl"] = ""; // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 Response.ContentEncoding = srv.Charset; // 指定输出编码 Response.Write(srv.CreateHtml()); // 写入页面 }
protected void Page_Load(object sender, EventArgs e) { double dMoney = double.Parse(Request.QueryString["m"].ToString()); double dFee = double.Parse(Request.QueryString["f"].ToString()); long NewPayNumber = -1; string ReturnDescription = ""; if (DAL.Procedures.P_GetNewPayNumber(_Site.ID, _User.ID, "UPOP", (dMoney - dFee), dFee, ref NewPayNumber, ref ReturnDescription) < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if ((NewPayNumber < 0) || (ReturnDescription != "")) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().BaseType.FullName); return; } // **************演示前台交易的请求*********************** // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(Server.MapPath("~/App_Data/conf.xml.config")); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary <string, string> param = new System.Collections.Generic.Dictionary <string, string>(); // 随机构造一个订单号(演示用) //Random rnd = new Random(); //string orderID = DateTime.Now.ToString("yyyyMMddHHmmss") + (rnd.Next(900) + 100).ToString().Trim(); // 填写参数 param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["commodityUrl"] = "http://emall.chinapay.com/product?name=商品"; // 商品URL param["commodityName"] = "帐户充值"; // 商品名称 param["commodityUnitPrice"] = (dMoney * 100).ToString(); // 商品单价,分为单位 param["commodityQuantity"] = "1"; // 商品数量 param["orderNumber"] = NewPayNumber.ToString(); // 订单号,必须唯一 param["orderAmount"] = (dMoney * 100 + dFee * 100).ToString(); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["customerIp"] = "172.17.136.34"; // 用户IP param["frontEndUrl"] = "http://219.143.228.243:81/Home/Room/OnlinePay/UnionPay/FrontRecieve.aspx"; // 前台回调URL // 后台回调URL(前台请求时可为空)used to recieve data from unionpay automatically, use this data as the primary source param["backEndUrl"] = ""; // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 Response.ContentEncoding = srv.Charset; // 指定输出编码 Response.Write(srv.CreateHtml()); // 写入页面 }
private string PayByUnion(string orderNo, decimal orderPrice) { UPOPSrv.LoadConf(UnionpayConfig.Path); Dictionary <string, string> param = new Dictionary <string, string>(); UnionpayConfigModel unionpayConfig = UnionpayConfig.GetParams(); //交易类型,前台只支持 CONSUME 和 PRE_AUTH param["transType"] = UPOPSrv.TransType.CONSUME; //商品URL param["commodityUrl"] = Common.ServiceUrl; //商品名称 string subject = unionpayConfig.CommodityName; //if (String.IsNullOrEmpty(subject)) subject = "订单 - " + orderNo; param["commodityName"] = subject; //商品单价(分为单位) param["commodityUnitPrice"] = (orderPrice * 100).ToString("F0"); //商品数量 param["commodityQuantity"] = "1"; //订单号(必须唯一) param["orderNumber"] = orderNo; //交易金额 param["orderAmount"] = param["commodityUnitPrice"]; //币种 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; //交易时间 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); //用户IP param["customerIp"] = HttpContext.Request.UserHostAddress; //后台通知URL param["backEndUrl"] = "http://zaixian.abc.com.cn/PayNotice/NotifyUnion"; //前台返回URL param["frontEndUrl"] = "http://zaixian.abc.com.cn/PayNotice/NotifyUnion"; FrontPaySrv srv = new FrontPaySrv(param); return(srv.CreateHtml()); }
public void Pay(string title, string orderNo, decimal tradeMoney, string notifyUrl, string returnUrl) { var param = new Dictionary <string, string> { { "transType", UPOPSrv.TransType.CONSUME }, //交易类型,前台只支持CONSUME 和PRE_AUTH { "commodityUrl", "" }, //商品URL { "commodityName", title }, //商品名称 { "commodityUnitPrice", "1" }, //商品单价,分为单位 { "commodityQuantity", "1" }, //商品数量 { "orderNumber", orderNo }, //订单号 { "orderAmount", (tradeMoney * 100).ToString().Split('.')[0] }, //交易金额 { "orderCurrency", UPOPSrv.CURRENCY_CNY }, //币种 { "orderTime", DateTime.Now.ToString("yyyyMMddHHmmss") }, //交易时间 { "customerIp", HttpContext.Current.Request.UserHostAddress }, //用户IP { "frontEndUrl", notifyUrl }, //前台回调URL { "backEndUrl", returnUrl } //后台回调URL(前台请求时可为空) }; var srv = new FrontPaySrv(param); HttpContext.Current.Response.Write(srv.CreateHtml()); }
/// <summary> /// 银联在线支付 /// </summary> void YinLian(Entity.DingDan info) { if (info != null) { //info.DanJia = (decimal)0.01; //info.DingDanJinE = (decimal)0.01; // 要使用各种Srv必须先使用LoadConf载入配置 UPOPSrv.LoadConf(HttpContext.Current.Server.MapPath("/App_Data/conf.xml.config")); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary <string, string> param = new System.Collections.Generic.Dictionary <string, string>(); // 填写参数 param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["commodityUrl"] = "http://gaokao.gelunjiaoyu.com/Art/GouMai/ReturnUrl.aspx"; // 商品URL param["commodityName"] = "格伦高考报考网-“报考卡”"; // 商品名称 param["commodityUnitPrice"] = ((int)((info.DanJia) * 100)).ToString(); // 商品单价,分为单位 param["commodityQuantity"] = info.Count.ToString(); // 商品数量 param["orderNumber"] = info.DingDanHao; // 订单号,必须唯一 param["orderAmount"] = ((int)((info.DingDanJinE) * 100)).ToString(); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["customerIp"] = System.Web.HttpContext.Current.Request.UserHostAddress; // 用户IP param["frontEndUrl"] = "http://gaokao.gelunjiaoyu.com/Art/GouMai/YinLian/FontPay.aspx"; // 前台回调URL param["backEndUrl"] = "http://gaokao.gelunjiaoyu.com/Art/GouMai/YinLian/BackPay.aspx"; // 后台回调URL // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 Response.ContentEncoding = srv.Charset; // 指定输出编码 Response.Write(srv.CreateHtml()); // 写入页面 } else { ClientScript.RegisterStartupScript(GetType(), "", "<script>artDialog11('该订单不存在...');return false;</script>"); return; } }
public override string CreateUrl(ParameterInfo unionPay) { var info = unionPay as UnionPayParasInfo; if (info == null) return ""; UPOPSrv.LoadConf(HttpContext.Current.Server.MapPath("~/App_Data/xml/unionPay.config")); var paras = new Dictionary<string, string> { {"transType", "01"}, {"commodityUrl", Uri.EscapeUriString(info.ProductUrl)}, {"commodityName", info.ProductName}, {"commodityUnitPrice", info.UnitPrice.ToString()}, {"orderNumber", info.OrderNum}, {"orderAmount", (Math.Round(info.Amount, 2)*100).ToString("F0")}, {"orderCurrency", info.Cur}, {"orderTime", DateTime.Now.ToString("yyyyMMddHHmmss")}, {"customerIp", Utils.GetRealIp()}, {"frontEndUrl", info.ReturnUrl}, {"backEndUrl", info.NotifyUrl} }; var srv = new FrontPaySrv(paras); return srv.CreateHtml(); }
public override void SendRequest(PaymentOrder order) { param["transType"] = UPOPSrv.TransType.CONSUME; // 交易类型,前台只支持CONSUME 和 PRE_AUTH param["orderNumber"] = order.PaymentNo; // 订单号,必须唯一 param["orderAmount"] = Math.Round(order.Money * 100).ToString(); // 交易金额 param["orderCurrency"] = UPOPSrv.CURRENCY_CNY; // 币种 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); // 交易时间 param["frontEndUrl"] = order.ReturnUrl; // 前台回调URL param["backEndUrl"] = order.NoticeUrl; // 后台回调URL param["merId"] = Config["unionpay_account"].Values.ToString(); // 商户编号 param["customerIp"] = GetIP(); //以下两个参数为网银直连支付参数 param["defaultPayType"] = "CSPay"; param["defaultBankNumber"] = order.BankCode; UPOPSrv.Config.securityKey = Config["unionpay_key"].Values.ToString(); //设置密钥 // 创建前台交易服务对象 var srv = new FrontPaySrv(param); HttpContext.Current.Response.ContentEncoding = srv.Charset; // 指定输出编码 HttpContext.Current.Response.Write(srv.CreateHtml()); HttpContext.Current.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //bool OnlinePay_Alipay_Status_ON = so["OnlinePay_Tenpay_Status_ON"].ToBoolean(false); Money = Shove._Convert.StrToDouble(Shove._Web.Utility.GetRequest("PayMoney"), 0); bankPay = Shove._Web.Utility.GetRequest("bankPay"); if (!IsPostBack) { //管理员和会员的充值的最低金额不一样 if (_User.Competences.CompetencesList.IndexOf(Competences.Administrator) > 0) { if (Money < 0.01) { Response.Write("<script type=\"text/javascript\">alert(\"请输入正确的充值金额!再提交,谢谢!\"); window.close();</script>"); return; } } else { if (Money < 1) { Response.Write("<script type=\"text/javascript\">alert(\"请输入正确的充值金额!再提交,谢谢!\"); window.close();</script>"); return; } } //Money = 0.01; //手续费用 double FormalitiesFeesScale = so["OnlinePay_ChinaUnion_CommissionScale"].ToDouble(0) / 100; double FormalitiesFees = Math.Round(Money * FormalitiesFeesScale, 2); //最后的充值额 Money += FormalitiesFees; //卖家商户号 bargainor_id = so["OnlinePay_ChinaUnion_UserName"].Value.ToString(); //卖家商户key key = so["OnlinePay_ChinaUnion_MD5"].Value.ToString(); //商品名称 desc = HttpUtility.UrlEncode("预付款", Encoding.GetEncoding("GBK")); //商品总金额,以分为单位(传过的是以元为单位). total_fee = long.Parse((Money * 100).ToString()); //买家帐号 purchaser_id = ""; //商户后台回调url return_url = Shove._Web.Utility.GetUrl() + "/Home/Room/OnlinePay/ChinaUnion/Receive.aspx"; //交易标识(用户ID+投注ID+充值方式编号) attach = Shove._Security.Encrypt.EncryptString(PF.GetCallCert(), _User.ID.ToString() + "|" + bankPay + "|" + Shove._Web.Utility.GetRequest("BuyID")); double PayMoney = Convert.ToDouble(Money.ToString()); long NewPayNumber = -1; string ReturnDescription = ""; //产生内部充值编号 if (DAL.Procedures.P_GetNewPayNumber(_Site.ID, _User.ID, "TENPAY_" + bankPay, (PayMoney - FormalitiesFees), FormalitiesFees, ref NewPayNumber, ref ReturnDescription) < 0) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if ((NewPayNumber < 0) || (ReturnDescription != "")) { PF.GoError(ErrorNumber.Unknow, ReturnDescription, this.GetType().BaseType.FullName); return; } //商户订单号(内部充值编号) sp_billno = NewPayNumber.ToString(); //財付通交易号,需保证此订单号每天唯一,切不能重复! transaction_id = CreatePayNumber(NewPayNumber); //用户IP(暂停) spbill_create_ip = "";// Page.Request.UserHostAddress; #region 验证参数是否齐全 if (string.IsNullOrEmpty(bankPay) || string.IsNullOrEmpty(desc) || string.IsNullOrEmpty(bargainor_id) || string.IsNullOrEmpty(transaction_id) || string.IsNullOrEmpty(sp_billno) || string.IsNullOrEmpty(return_url) || string.IsNullOrEmpty(attach)) { Response.Write("<script type=\"text/javascript\">alert(\"参数不齐全,无法充值!\"); window.close();</script>"); return; } #endregion //string url = ""; //if (!GetPayUrl(out url)) //{ // Response.Write("<script type=\"text/javascript\">alert(\"" + url + "\"); window.close();</script>"); // return; //} //else //{ // this.Response.Write("<script language='javascript'>window.top.location.href='" + url + "'</script>"); //} UPOPSrv.LoadConf(Server.MapPath("conf.xml.config")); var srv = new FrontPaySrv(GenParams()); Response.ContentEncoding = srv.Charset; Response.Write(srv.CreateHtml()); } }
/// <summary> /// 初始化银联支付url /// </summary> /// <param name="dingDanId">订单编号</param> /// <param name="biaoTi">标题</param> /// <param name="miaoShu">描述</param> /// <param name="jinE">总金额</param> /// <param name="cpName">产品名称</param> /// <param name="cpUrl">产品URL</param> /// <param name="dingDanLeiXing">订单类型</param> /// <returns></returns> private string InitUnionpay(string dingDanId, string biaoTi, string miaoShu, decimal jinE, string cpName, string cpUrl, int dingDanLeiXing, int dingDanIdentityId) { string returnValue = string.Empty; if (jinE > 10000000) //支付金额不能超过10000000.00RMB { Response.Write("支付金额不能超过10000000.00"); Response.End(); } // 用户IP string ip = HttpContext.Current.Request.UserHostAddress; // 交易类型,前台只支持CONSUME 和 PRE_AUTH string strTransType = UPOPSrv.TransType.CONSUME; cpName = Regex.Replace(cpName, @"[~!@#\$%\^&\*\(\)\+=\|\\\}\]\{\[:“”,。!()‘’''"";<,>\?\/" + "\"]+", " "); // 商品单价,分为单位 string commodityUnitPrice = Convert.ToInt32(jinE * 100).ToString(); // 商品数量 string shuLiang = "1"; // 订单号,必须唯一 //string orderID = dingDanId + "_" + dingDanLeiXing; // 交易金额 string orderAmount = Convert.ToInt32(jinE * 100).ToString(); // 币种 string orderCurrency = UPOPSrv.CURRENCY_CNY; // 前台回调URL string returnUrl = "http://" + YuMingInfo.YuMing + EyouSoft.Toolkit.ConfigHelper.ConfigClass.GetConfigString("UnionpayReturnUrl"); // 后台回调URL(前台请求时可为空) string notifyUrl = "http://" + YuMingInfo.YuMing + EyouSoft.Toolkit.ConfigHelper.ConfigClass.GetConfigString("UnionpayNotifyUrl"); // 要使用各种Srv必须先使用LoadConf载入配置 string configFilepath = EyouSoft.Toolkit.ConfigHelper.ConfigClass.GetConfigString("UnionpayConfigFilepath"); UPOPSrv.LoadConf(Server.MapPath(configFilepath)); // 使用Dictionary保存参数 System.Collections.Generic.Dictionary <string, string> param = new System.Collections.Generic.Dictionary <string, string>(); // 订单号,必须唯一 string orderID1 = DateTime.Now.ToString("yyyyMMddHHmmss") + dingDanLeiXing.ToString() + dingDanIdentityId.ToString(); // 填写参数 param["transType"] = strTransType; param["commodityUrl"] = cpUrl; param["commodityName"] = cpName.Trim(); param["commodityUnitPrice"] = commodityUnitPrice; param["commodityQuantity"] = shuLiang; param["orderNumber"] = orderID1; param["orderAmount"] = orderAmount; param["orderCurrency"] = orderCurrency; // 交易时间 param["orderTime"] = DateTime.Now.ToString("yyyyMMddHHmmss"); param["customerIp"] = ip; param["frontEndUrl"] = returnUrl; param["backEndUrl"] = notifyUrl; // 创建前台交易服务对象 FrontPaySrv srv = new FrontPaySrv(param); // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向 Response.ContentEncoding = srv.Charset; // 指定输出编码 returnValue = srv.CreateHtml(); return(returnValue); }