/// <summary> /// 定位到支付宝支付界面 /// </summary> public void RedirectToAlipay() { DigitalTrade alipayTrade = new DigitalTrade(); alipayTrade.Subject = string.Format("{0} 论坛积分充值({1}:{2}{3}),用户:{4}", config.Forumtitle, creditstransname, creditsamount, creditstransunit, username); if (Utils.IsValidEmail(config.Alipayaccout))//如果用户保存在配置文件里面的支付宝帐号格式是email的话 { alipayTrade.Seller_Email = config.Alipayaccout; } else { alipayTrade.Seller_Id = config.Alipayaccout; } alipayTrade.Return_Url = Utils.GetRootUrl(forumpath) + "tools/notifypage.aspx"; alipayTrade.Notify_Url = Utils.GetRootUrl(forumpath) + "tools/notifypage.aspx"; alipayTrade.Quantity = 1; decimal price = decimal.Round(((decimal)creditsamount / (decimal)config.Cashtocreditrate), 2); alipayTrade.Price = price > 0.1M ? price : 0.1M; //限定每个订单的最低价格是0.1元 alipayTrade.Payment_Type = 1; alipayTrade.PayMethod = "bankPay"; //跳转到支付宝时默认支付类型是网上银行 string payUrl = ""; alipayTrade.Partner = config.Alipaypartnerid; alipayTrade.Sign = config.Alipaypartnercheckkey; payUrl = StandardAliPayment.GetService().CreateDigitalGoodsTradeUrl(alipayTrade); CreditOrders.CreateCreditOrder(userid, username, creditstrans, creditsamount, 1, alipayTrade.Out_Trade_No); //创建积分充值订单 HttpContext.Current.Response.Redirect(payUrl); //跳转到支付宝即时到帐支付页面 }
public void TestAccout(string accout) { int openPartner = DNTRequest.GetInt("openpartner", 0); string partnerId = DNTRequest.GetString("partnerid"); string partnerKey = DNTRequest.GetString("partnerKey"); DigitalTrade virtualTrade = new DigitalTrade(); virtualTrade.Subject = "测试支付宝充值功能"; if (Utils.IsValidEmail(accout))//如果传递的帐号类型是email { virtualTrade.Seller_Email = accout; } else { virtualTrade.Seller_Id = accout; } virtualTrade.Return_Url = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/notifypage.aspx"; virtualTrade.Notify_Url = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/notifypage.aspx"; virtualTrade.Quantity = 1; virtualTrade.Price = 0.1M; virtualTrade.Payment_Type = 1; virtualTrade.PayMethod = "bankPay"; string payUrl = ""; if (openPartner == 1) { virtualTrade.Partner = partnerId; virtualTrade.Sign = partnerKey; payUrl = StandardAliPayment.GetService().CreateDigitalGoodsTradeUrl(virtualTrade); } else { payUrl = AliPayment.GetService().CreateDigitalGoodsTradeUrl(virtualTrade); } HttpContext.Current.Response.Redirect(payUrl); }
public void RedirectToAlipay() { DigitalTrade digitalTrade = new DigitalTrade(); digitalTrade.Subject = string.Format("{0} 论坛积分充值({1}:{2}{3}),用户:{4}", new object[] { this.config.Forumtitle, this.creditstransname, this.creditsamount, this.creditstransunit, this.username }); if (Utils.IsValidEmail(this.config.Alipayaccout)) { digitalTrade.Seller_Email = this.config.Alipayaccout; } else { digitalTrade.Seller_Id = this.config.Alipayaccout; } digitalTrade.Return_Url = Utils.GetRootUrl(this.forumpath) + "tools/notifypage.aspx"; digitalTrade.Notify_Url = Utils.GetRootUrl(this.forumpath) + "tools/notifypage.aspx"; digitalTrade.Quantity = 1; decimal num = decimal.Round(this.creditsamount / this.config.Cashtocreditrate, 2); digitalTrade.Price = ((num > 0.1m) ? num : 0.1m); digitalTrade.Payment_Type = 1; digitalTrade.PayMethod = "bankPay"; digitalTrade.Partner = this.config.Alipaypartnerid; digitalTrade.Sign = this.config.Alipaypartnercheckkey; string url = StandardAliPayment.GetService().CreateDigitalGoodsTradeUrl(digitalTrade); //CreditOrders.CreateCreditOrder(this.userid, this.username, this.creditstrans, this.creditsamount, 1, digitalTrade.Out_Trade_No); Order.Create(userid, username, creditstrans, creditsamount, 1, digitalTrade.Out_Trade_No); HttpContext.Current.Response.Redirect(url); }
public void TestAccout(string accout) { int @int = DNTRequest.GetInt("openpartner", 0); string @string = Request["partnerid"]; string string2 = Request["partnerKey"]; DigitalTrade digitalTrade = new DigitalTrade(); digitalTrade.Subject = "测试支付宝充值功能"; if (Utils.IsValidEmail(accout)) { digitalTrade.Seller_Email = accout; } else { digitalTrade.Seller_Id = accout; } digitalTrade.Return_Url = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/notifypage.aspx"; digitalTrade.Notify_Url = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/notifypage.aspx"; digitalTrade.Quantity = 1; digitalTrade.Price = 0.1m; digitalTrade.Payment_Type = 1; digitalTrade.PayMethod = "bankPay"; string url; if (@int == 1) { digitalTrade.Partner = @string; digitalTrade.Sign = string2; url = StandardAliPayment.GetService().CreateDigitalGoodsTradeUrl(digitalTrade); } else { url = AliPayment.GetService().CreateDigitalGoodsTradeUrl(digitalTrade); } HttpContext.Current.Response.Redirect(url); }