<!--#include file="../../inc/payconn.asp"-->
<!--#include file="asp_md5.asp"-->
<!--#include file="../payss.asp"-->
<%
Call ConnectionDatabase()
Set Res = GrateRs("Select * From [L_pay] Where ptype='95588'",1)




PayOrderNo=Trim(Request("PayOrderNo"))

MerchantID=Trim(Request("MerchantID"))

MerOrderNo=Trim(Request("MerOrderNo"))

CardNo=Trim(Request("CardNo"))

CardType=Trim(Request("CardType"))

FactMoney=Trim(Request("FactMoney"))

result=Trim(Request("PayResult"))

CustomizeA=Trim(Request("CustomizeA"))

CustomizeB=Trim(Request("CustomizeB"))

CustomizeC=Trim(Request("CustomizeC"))

PayTime=Trim(Request("PayTime"))

ErrorMsg=Trim(Request("ErrorMsg"))

sign=Trim(Request("sign"))

if ErrorMsg="" then ErrorMsg="支付失败"

'商户在的交易密钥
sp_key=Res("sKey")
Res.close


'生成MD5签名

'sign_text = PayOrderNo &  MerchantID &  MerOrderNo  & CardNo &  CardType &  FactMoney & result  & PayTime & sp_key


sign_text = PayOrderNo & MerchantID & MerOrderNo & CardNo & CardType & FactMoney & result & CustomizeA & CustomizeB & CustomizeC & PayTime & sp_key



signtmp = UCase(MD5(sign_text)) ' 转换为大写



If sign=signtmp Then
	'检测到状态为成功
Set Res = GrateRs("select * from mobile1 Where num = '"&MerOrderNo&"'",3)

	If result="true" Then
		'商户业务数据成功处理
		    if not res.bof or not res.eof then
			res("stat")=1	
			res("Okprice")=FactMoney	
			res("des")="支付成功"
			res.update
			end if
					Dim myPay
					Set myPay = New PayResult
					myPay.TruePrice = FactMoney
					myPay.PayOK(MerOrderNo)
	Else
		'商户业务数据失败处理
		if not res.bof or not res.eof then
			res("stat")=2  '2表示失败	
			res("des")=ErrorMsg	
			res.update
			end if
	End If
	'处理完后返回接收到标识为ok
	'只要商户接到通知，不管订单状态如何
	'都只需要返回接收到标识为ok
	Response.Write("OK")
Else
End If

%>
