<!--#include file="../inc/conn.asp"-->
<!--#include file="buyconfig.asp"-->
<%
	If app_user = 0 Then writeE "会员系统关闭中"
	if isN(session("userid")) then writeE "非法操作"
	
	DIM CmdId,MerId,RespCode,TrxId,OrdAmt,CurCode,Pid,OrdId,MerPriv,RetType,DivDetails,GateId,ChkValue,MsgData
	MerId = trim(request.Form("MerId")) 	 		'商户号
	RespCode = trim(request.Form("RespCode")) 		'应答返回码
	TrxId = trim(request.Form("TrxId"))  			'钱管家交易唯一标识
	OrdAmt = trim(request.Form("OrdAmt"))  			'金额
	CurCode = trim(request.Form("CurCode"))  		'币种
	Pid = trim(request.Form("Pid"))  				'商品编号
	OrdId = trim(request.Form("OrdId"))  			'订单号
	MerPriv = trim(request.Form("MerPriv"))  		'商户私有域
	RetType = trim(request.Form("RetType"))  		'返回类型
	DivDetails = trim(request.Form("DivDetails"))  	'分账明细
	GateId = trim(request.Form("GateId"))  			'银行ID
	ChkValue = trim(request.Form("ChkValue")) 		'签名信息
	MsgData = trim(request.Form("MsgData")) 		'数据信息
	
	'验证签名
	Dim url,SignData,point
    url="http://pay.yinshengvip.com/versign/?MsgData="&MsgData&"&ChkValue="&ChkValue
	SignData = getPage(url,"utf-8")
	
	IF SignData = "0" THEN
		IF RespCode = "000000" THEN
			'交易成功
			'根据订单号 进行相应业务操作
			'在些插入代码
			point = app_buyexc * clng(OrdAmt)
 			objdb.db "update {pre}user set u_points=u_points+"& point&" where u_id = "& session("userid"),"exe"
			alertUrl "充值成功","index.asp"
		ELSE
			'交易失败
			'根据订单号 进行相应业务操作
			'在些插入代码
			alertUrl "支付失败请重试","index.asp?action=pay2"
		END IF
	ELSE
		'验签失败
		alertUrl "验签失败请重试["&SignData&"]","index.asp?action=pay2"
	END IF
%>