代码修改后的版本,全部提交
This commit is contained in:
123
Mtxfw.VipSite/pay/alipay.aspx.cs
Normal file
123
Mtxfw.VipSite/pay/alipay.aspx.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Text;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
public partial class alipay : System.Web.UI.Page
|
||||
{
|
||||
private Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||||
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
||||
public string IFApp = "0", responseBody="";
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string str_u = Request.ServerVariables["HTTP_USER_AGENT"].Trim().ToLower();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
////////////////////////////////////////////请求参数////////////////////////////////////////////
|
||||
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["PayID"]))
|
||||
{
|
||||
string PayID = Request.QueryString["PayID"].ToString();
|
||||
Mtxfw.Model.user_Results ReModel = daoResults.GetModel2(2, PayID);
|
||||
if (ReModel != null)
|
||||
{
|
||||
if (ReModel.Seef == 0)
|
||||
{
|
||||
|
||||
|
||||
|
||||
//商户订单号
|
||||
string out_trade_no = ReModel.ListNumber;
|
||||
//商户网站订单系统中唯一订单号,必填
|
||||
|
||||
//订单名称
|
||||
string subject = "购买商品";
|
||||
//必填
|
||||
|
||||
//付款金额
|
||||
string total_fee = ReModel.Totalmoney.ToString();
|
||||
//必填
|
||||
|
||||
|
||||
string body = ReModel.conent;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string ReturnUrl = config.webUrl + "/mobile/";
|
||||
string URL = config.aliURL;
|
||||
string APP_ID = config.aliAPP_ID;
|
||||
string APP_PRIVATE_KEY = config.aliAPP_PRIVATE_KEY;
|
||||
string CHARSET = "UTF-8";
|
||||
string notifyUrl = config.aliPAY_notify_url;
|
||||
Aop.Api.CertParams certParams = new Aop.Api.CertParams
|
||||
{
|
||||
AlipayPublicCertPath = Server.MapPath("/App_Data/alipaygyzs.crt"),
|
||||
AppCertPath = Server.MapPath("/App_Data/alipayyygyzs.crt"),
|
||||
RootCertPath = Server.MapPath("/App_Data/alipaygzs.crt")
|
||||
};
|
||||
Aop.Api.IAopClient client = new Aop.Api.DefaultAopClient(URL, APP_ID, APP_PRIVATE_KEY, "json", "1.0", "RSA2", CHARSET, false, certParams);
|
||||
//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
|
||||
//if (Mtxfw.Utility.Common.IsMobile(str_u))
|
||||
//{
|
||||
|
||||
string product_code = "QUICK_WAP_WAY";
|
||||
Aop.Api.Request.AlipayTradeWapPayRequest request = new Aop.Api.Request.AlipayTradeWapPayRequest();
|
||||
Aop.Api.Domain.AlipayTradeWapPayModel dmodel = new Aop.Api.Domain.AlipayTradeWapPayModel();
|
||||
dmodel.Body = body;
|
||||
dmodel.Subject = subject;
|
||||
dmodel.TotalAmount = total_fee;
|
||||
dmodel.ProductCode = product_code;
|
||||
dmodel.OutTradeNo = out_trade_no;
|
||||
dmodel.TimeoutExpress = "30m";
|
||||
request.SetNotifyUrl(notifyUrl);
|
||||
request.SetReturnUrl(ReturnUrl);
|
||||
request.SetBizModel(dmodel);
|
||||
//这里和普通的接口调用不同,使用的是pageExecute
|
||||
Aop.Api.Response.AlipayTradeWapPayResponse response = client.pageExecute(request);
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/alipayresponse.txt", response.Body);
|
||||
responseBody = response.Body;
|
||||
/*}
|
||||
else
|
||||
{
|
||||
|
||||
string product_code = "FAST_INSTANT_TRADE_PAY";
|
||||
Aop.Api.Request.AlipayTradePagePayRequest request = new Aop.Api.Request.AlipayTradePagePayRequest();
|
||||
Aop.Api.Domain.AlipayTradePagePayModel dmodel = new Aop.Api.Domain.AlipayTradePagePayModel();
|
||||
dmodel.Body = body;
|
||||
dmodel.Subject = subject;
|
||||
dmodel.TotalAmount = total_fee;
|
||||
dmodel.ProductCode = product_code;
|
||||
dmodel.OutTradeNo = out_trade_no;
|
||||
dmodel.TimeoutExpress = "30m";
|
||||
request.SetNotifyUrl(notifyUrl);
|
||||
request.SetReturnUrl(ReturnUrl);
|
||||
request.SetBizModel(dmodel);
|
||||
//这里和普通的接口调用不同,使用的是pageExecute
|
||||
Aop.Api.Response.AlipayTradePagePayResponse response = client.pageExecute(request);
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/response.txt", response.Body);
|
||||
responseBody = response.Body;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin1.txt", err.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user