<!--#include file="../../inc/payconn.asp"-->
<!--#include file="asp_md5.asp"-->
<!--#include file="inc.asp"-->
<%
on error resume next
mysp_billno = request.QueryString("num")
cardNo = request.QueryString("cardNo")
cardPwd = request.QueryString("cardPwd")
cardid = request.QueryString("ka_type")


If cardid = "" or mysp_billno ="" or cardNo="" or cardPwd=""  Then
Response.Write("缺少参数！")
Response.End()
End If


Call ConnectionDatabase()
Set Res = GrateRs("Select * From [L_pay] Where ptype='kbpay'",1)
'商户在互赢支付网关上的商户号
user_id=Res("sId")
'商户流水号
sp_billno = mysp_billno
sp_id = cardid
'点卡卡号
sp_cardnumber=cardNo
'点卡密码
sp_cardpassword=cardPwd
'后台通知地址，商户系统后台接收互赢支付订单结果的地址
sp_returnurl="http://"&Request.ServerVariables("SERVER_NAME")&"/Pay/kbpay_card/receive.asp"
'商户备注信息
remarks="banana"
'商户自定义
sp_extdata="test"
'商户密钥，请登陆商户后台查询
sp_key=Res("sKey")
res.close
'组合字符串
sign_text = "user_id=" & user_id & "&sp_id=" & sp_id &"&sp_billno=" & sp_billno & "&sp_key=" & sp_key & "&sp_returnurl=" & sp_returnurl & "&sp_extdata=" & sp_extdata
'生成MD5签名
sign = UCase(ASP_MD5(sign_text))        ' 转换为大写

url1="http://pay.kbpay.cn"
url2="http://pay.kbpay.com"

if Trim(GetXml(url1)) ="ok" then
url=url1
else
url=url2
end if

TOSPPost = url&"/gate/index.asp?user_id=" & user_id & "&sp_billno=" & sp_billno & "&sp_id=" & sp_id & "&sp_cardnumber=" & sp_cardnumber & "&sp_cardpassword=" & sp_cardpassword & "&sp_returnurl=" & sp_returnurl & "&sp_extdata=" & sp_extdata & "&sign=" & sign

'response.Write(TOSPPost)
'response.End()

HttpPageStr = Trim(GetXml(TOSPPost))

If HttpPageStr = "OK" Then  '成功返回声讯面值，此处写成功处理代码 调试时请加上1元面值
	show_str = "OK"
Else	'验证失败，此处写失败处理代码	
	show_str = "失败"
end if


response.write show_str
%>


