protected void Page_Load(object sender, EventArgs e) { CommOrderBll obll = new CommOrderBll(); string orderId = Request.QueryString["orderId"]; CommOrderModel model = obll.GetModel(orderId); List<CommOrderItemModel> items = obll.GetOrderItems(orderId); string subject = String.Join(",", (from s in items select s.ProductName).ToArray()); int quantity = (from s in items select s.Quantity).Sum(); string paymethod = (model.ShipMethod == ShipMethodType.EMS?"EMS":"Express"); subject = String.IsNullOrEmpty(subject)?null:subject; string agent =null; string body = null; AliPay ap = new AliPay(); StandardGoods bp = new StandardGoods(PayServiceType.trade_create_by_buyer.Key, AlipaySetting.Partner, AlipaySetting.NotifyUrl,AlipaySetting.ReturnUrl, agent,AlipaySetting.EncodeType,AlipaySetting.Key,AlipaySetting.SignType,subject,body,model.OrderId, model.Paysum, quantity, null,AlipaySetting.SellerEmail, null,null,null,null, "POST", model.ShipFee, LogisticsPayment.SELLER_PAY.Key, "1"); bp.Notify_Url = AlipaySetting.NotifyUrl; bp.Return_Url = AlipaySetting.ReturnUrl; bp.Receive_Address = model.FullAddress; bp.Receive_Phone = model.RecieverPhone; bp.Receive_Zip = model.Postalcode; bp.Receive_Name = model.RecieverName; ap.CreateStandardTrade(AlipaySetting.PushUrl, bp, this); }
/// <summary> /// 创建标准交易,包含虚拟交易 /// </summary> /// <param name="gatewayUrl">提交支付宝的地址</param> /// <param name="standardGoods">交易参数</param> /// <param name="page">Page对象</param> public void CreateStandardTrade(string gatewayUrl, StandardGoods standardGoods, Page page) { //HttpResponse Response = page.Response; //Response.Redirect(gatewayUrl + "?" + Md5SignParam(standardGoods)); HttpResponse Response = page.Response; string t = gatewayUrl + "?" + Md5SignParam(standardGoods); string url = string.Format("<script language='javascript'>window.open(\"{0}\") </script>", t); Response.Write(url); }
/// <summary> /// ���������ף��������⽻�� /// </summary> /// <param name="gatewayUrl">�ύ֧�����ĵ�ַ</param> /// <param name="standardGoods">���ײ���</param> /// <param name="page">Page����</param> public void CreateStandardTrade(string gatewayUrl, StandardGoods standardGoods, Page page) { //HttpResponse Response = page.Response; //Response.Redirect(gatewayUrl + "?" + Md5SignParam(standardGoods)); HttpResponse Response = page.Response; string t = gatewayUrl + "?" + Md5SignParam(standardGoods); string url = string.Format("<script language='javascript'>window.open(\"{0}\") </script>", t); Response.Write(url); }