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 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); }
/// <summary> /// 获取在线支付的URL字符串 /// </summary> /// <returns></returns> private string GetAliPayUrl() { string current_url = DNTRequest.GetUrl(); //forumurl = "http://124.207.144.194:8081/"; if (forumurl.ToLower().StartsWith("http://")) { current_url = forumurl + "tradenotify.aspx"; } else { if (current_url.IndexOf("/aspx/") > 0) { current_url = current_url.Substring(0, current_url.IndexOf("/aspx/") + 1) + "tradenotify.aspx"; } else { current_url = current_url.Substring(0, current_url.LastIndexOf("/") + 1) + "tradenotify.aspx"; } } IPayment _payment = AliPayment.GetService(); if (goodstradelog.Transport > 0) { //普通(实物)交易 NormalTrade normalTrade = new NormalTrade(); normalTrade.Body = goodstradelog.Subject; //goodsinfo.Message; normalTrade.Out_Trade_No = goodstradelog.Tradeno; string transportpay = ""; switch (goodstradelog.Transportpay) { case 1: transportpay = "SELLER_PAY"; break; //卖家承担运费 case 2: transportpay = "BUYER_PAY"; break; //买家承担运费 case 3: transportpay = "BUYER_PAY_AFTER_RECEIVE"; break; //买家收到货后直接支付给物流公司,费用不用计到总价中 } string transport = ""; switch (goodstradelog.Transport) { case 0: transport = "VIRTUAL"; break; //虚拟物品 case 1: transport = "POST"; break; //平邮 case 2: transport = "EMS"; break; //EMS case 3: transport = "EXPRESS"; break; //其他快递公司 } normalTrade.Logistics_Info = new LogisticsInfo[1] { new LogisticsInfo(transport, goodstradelog.Transportfee, transportpay) }; normalTrade.Notify_Url = current_url; normalTrade.Payment_Type = goodsinfo.Itemtype; normalTrade.Price = goodstradelog.Price; normalTrade.Quantity = goodstradelog.Number; normalTrade.Seller_Email = goodstradelog.Selleraccount; normalTrade.Show_Url = current_url.Replace("tradenotify.aspx", base.ShowGoodsAspxRewrite(goodstradelog.Goodsid)); normalTrade.Subject = goodstradelog.Subject; normalTrade.Buyer_Email = Users.GetShortUserInfo(goodstradelog.Buyerid).Email; return(_payment.CreateNormalGoodsTradeUrl((ITrade)normalTrade)); } else { //虚拟商品交易 DigitalTrade digitalTrade = new DigitalTrade(); digitalTrade.Body = goodstradelog.Subject; digitalTrade.Out_Trade_No = goodstradelog.Tradeno; digitalTrade.Notify_Url = current_url; digitalTrade.Payment_Type = goodsinfo.Itemtype; digitalTrade.Price = goodstradelog.Price; digitalTrade.Quantity = goodstradelog.Number; digitalTrade.Seller_Email = goodstradelog.Selleraccount; digitalTrade.Show_Url = current_url.Replace("tradenotify.aspx", base.ShowGoodsAspxRewrite(goodstradelog.Goodsid)); digitalTrade.Subject = goodstradelog.Subject; digitalTrade.Buyer_Email = Users.GetShortUserInfo(goodstradelog.Buyerid).Email; return(_payment.CreateDigitalGoodsTradeUrl((ITrade)digitalTrade)); } }