//检查支付宝通知接口传递过来的参数是否合法
msg_id = newop.DelStr(Request["msg_id"]);
order_no = newop.DelStr(Request["order_no"]);
gross = newop.DelStr(Request["gross"]);
buyer_email = newop.DelStr(Request["buyer_email"]);
buyer_name = newop.DelStr(Request["buyer_name"]);
buyer_address = newop.DelStr(Request["buyer_address"]);
buyer_zipcode = newop.DelStr(Request["buyer_zipcode"]);
buyer_tel = newop.DelStr(Request["buyer_tel"]);
buyer_mobile = newop.DelStr(Request["buyer_mobile"]);
action = newop.DelStr(Request["action"]);
s_date = newop.DelStr(Request["date"]);
ac = newop.DelStr(Request["ac"]);
notify_type = newop.DelStr(Request["notify_type"]);
alipayNotifyURL = alipayNotifyURL + "msg_id=" + msg_id + "&email=" + myalipayEmail + "&order_no=" + order_no;
System.Net.WebClient isClient= new System.Net.WebClient();
Stream isStream = isClient.OpenRead(alipayNotifyURL);
StreamReader isReader = new StreamReader(isStream,System.Text.Encoding.GetEncoding("GB2312"));
ResponseTxt = isReader.ReadToEnd();
if(action == "test")//测试商户网站URL是否正确安装
{
returnTxt = "Y";
}
else if((action=="sendOff")&&(msg_id!=""))//发货通知
{
returnTxt = "N";
if((ResponseTxt == "true")||(ResponseTxt == "false"))
{
//更新数据在商户系统里的订单数据;如果已经发货,则将returnTxt置为Y,否则为N
}
else
{
//非法数据,不做更新
returnTxt="Error";
}
}
else if((action=="sendOff")&&(notify_type=="web"))
{
//检查是否已经付帐,并记录 }
else if((action=="checkOut")&&(msg_id!=""))//交易结束通知
{
returnTxt = "Y";
if((ResponseTxt=="true")||(ResponseTxt == "false"))
{
//更新数据在商户系统里的订单数据;如果数据更新成功,则将returnTxt置为Y,否则为N
//更新数据
//你的代码,更新你这边数据
returnTxt= "Y";
}
else
{
//非法数据,不做更新
returnTxt = "Error";
}
}
else
{
returnTxt="Error";
}
Response.Write(returnTxt);