<!--#include file="../connshop.asp"-->
<!--#include file="../include/Lebi_config.asp"-->
<!--#include file="md5pay.asp"-->
<!--#include file="alipay_payto.asp"-->
<!--#include file="tenpay_md5.asp"-->
<!--#include file="tenpay_char.asp"-->
<!--#include file="bill_fun.asp"-->
<!--#include file="baofu_md5.asp"-->
<%
'**************************************
'* 最后更新 2014-08-29 by 56770.Kingdge
'* Copyright www.56770.com
'*************************************
Write_Lebi_Eshop(splits(skin_head))
Recharge = checknum(request("Recharge"),0)
pay_page = CLng(request("pay_page"))
pay_type = CLng(request("pay_type"))
rem 1 支付宝 2 快钱 3 paypal 4 网银 5 tenpay 即时到帐交易 6 tenpay 担保交易 7 贝宝 8 IPS 9 宝付
pro_id = CLng(Trim(request("pro_id")))
subject = Replace(Trim(request("subject")),"'","’")
trade_no = Replace(Trim(request("trade_no")),"'","’")
price = Replace(Trim(request("price")),"'","’")
md5char = Trim(request("md5char"))
paybackurl = Trim(request("paybackurl"))
isbooking = Trim(request("isbooking"))
'If md5(price) <> md5char Then
        'response.write ("Error")
		'response.End
'End If
price = Replace(price,",","")
IsSearch = False 
Agent = Request.ServerVariables("HTTP_USER_AGENT") 
botlist = "Yahoo!,Google,Isaac,Webdup,SurveyBot,Baiduspider,ia_archiver,P.Arthur,FAST-WebCrawler,Java,Microsoft-ATL-Native,TurnitinBot,WebGather,Sleipnir,Sogou web spider,JikeSpider,spider.html" 
botlist = Split(botlist, ",") 
For i = 0 To UBound(botlist) 
	If InStr(Agent, botlist(i)) > 0 Then 
		IsSearch = True 
		Exit For 
	End If
Next 
rem	<-{ 判断是否为含有预订商品，如有预订怎提示付款金额（全款，最低金额）2008-3-21 by 56770.WangLei
If isbooking = "" And Recharge = 0 Then
		Dim low_money, md5_low_money
		low_money = price
		Set rs = conn.execute("select id,advance_money,is_pay_advance,orderzt from [Lebi_orders] where order_number='"&trade_no&"' and is_booking=1")
		If Not rs.eof Then
				If Instr(rs(3),2)=0 Then
						low_money = rs(1)
						md5_low_money = ASP_MD5(low_money)
%>
						<SCRIPT LANGUAGE="JavaScript">
						<!--
							function reset_price(pricestr)
							{
								location.href='?pay_page=<%=pay_page%>&pay_type=<%=pay_type%>&pro_id=<%=pro_id%>&subject=<%=subject%>&trade_no=<%=trade_no%>&paybackurl=<%=paybackurl%>&isbooking=1&' + pricestr;
							}
						//-->
						</SCRIPT>
						<p>&nbsp;</p><p>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="BasketUserInfo">
							<tr>
								<td colspan="2" class="headmenu"><%=Lebi_cart(167)%></td>
							</tr>
							<%If rs(2) = 0 Then%>
							<tr>
								<td width="5%" align="right">
								<input type="radio" value="V1" name="R1" onclick="reset_price('price=<%=price%>&md5char=<%=md5char%>')"></td>
								<td width="95%"><%=Lebi_cart(168)%> (<%=price%>)</td>
							</tr>
							<tr>
								<td align="right">
								<input type="radio" value="V2" name="R1" onclick="reset_price('price=<%=low_money%>&md5char=<%=md5_low_money%>')"></td>
								<td ><%=Lebi_cart(169)%> (<%=low_money%>)</td>
							</tr>
							<%Else%>
							<tr>
								<td align="right">
								<input type="radio" value="V2" name="R1" onclick="reset_price('price=<%=price-rs(1)%>&md5char=<%=ASP_MD5(price-rs(1))%>')"></td>
								<td ><%=Lebi_cart(170)%> (<%=price-rs(1)%>)</td>
							</tr>
							<%End If%>
						</table>
<%
						response.End
				End If
		End If
		rs.close : Set rs = Nothing
End If
rem	}->
If Recharge = 0 Then 
		user_id = Replace(request.cookies(cookiesname&"_user")("user_id"),"'","’")
		If user_id = "" Then
				user_id = "Guest"
				user_name = "Guest"
		Else
				Set rs = conn.execute("select user_name,user_mobile,user_adds,user_postalcode,user_mail from [Lebi_user] where user_id = '"& user_id &"'")
				user_name = rs(0)
				user_mobile = rs(1)
				user_adds = rs(2)
				user_zip = rs(3)
				user_email = rs(4)
				rs.close : Set rs = Nothing
		End If
		If (pay_type <> "" And price <> "") And IsSearch = False Then
				If isbooking <> "1" Then isbooking = 0
				Set rs = server.CreateObject("adodb.recordset")
				sql = "select * from [Lebi_pay_log] where l_ordernum = '"& trade_no &"'"
				rs.open sql,conn,1,3
				If rs.eof Then
						rs.addnew
						rs("l_type") = pay_type
						rs("l_userid") = user_id
						rs("l_username") = user_name
						rs("l_usertel") = user_mobile
						rs("l_useradds") = user_adds
						rs("l_userzip") = user_zip
						rs("l_ordernum") = trade_no
						rs("l_pro_id") = pro_id
						rs("l_price") = price
						rs("l_time") = Now()
						rs("l_state") = 0
						rs("l_virify") = 0
						If pay_page = 0 Then
								rs("l_mes") = "在线支付页提交"
						ElseIf pay_page = 1 Then
								rs("l_mes") = "商品页支付"
						ElseIf pay_page = 2 Then
								rs("l_mes") = "订单页支付"
						End If
						rs("is_booking") = isbooking	' 2008-3-21 by 56770.WangLei
						rs.update
				Else
						rs("l_type") = pay_type
						rs("l_time") = Now()
						rs.update
				End If
				rs.close : Set rs = Nothing
		End If
End If 

If pay_type = "1" Then
		account = checknum(request("account"),0)
		If Pay_alipay(14) <> "2" Then
				Dim AliPay, AliPayUrl
				Set AliPay = New Qlwz_AliPay
				'**************以下部分建议在类中设置**************
				AliPay.PartnerID     = Pay_alipay(3)
				AliPay.SellerEmail   = Pay_alipay(1)
				AliPay.SignCode      = Pay_alipay(2)
				If request.ServerVariables("SERVER_PORT") <> 80 Then
						AliPay.NotifyUrl     =	"http://"& Request.ServerVariables("SERVER_NAME") &":"&request.ServerVariables("SERVER_PORT") & Eshop_url &"Plus/Alipay_Notify.asp"
				Else
						AliPay.NotifyUrl     =	"http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url &"Plus/Alipay_Notify.asp"
				End If
				AliPay.ReturnUrl     = Pay_alipay(6)
				Select Case Pay_alipay(14)
					   Case "0" AliPay.Service     = "create_direct_pay_by_user"  '即时到账
					   Case "1" AliPay.Service     = "trade_create_by_buyer"  '标准双接口
				End Select
				AliPay.Charset       = "UTF-8"
				AliPay.Subject       = "Item No:"& subject
				AliPay.Body          = "Item No:"& subject
				AliPay.Price         = price
				AliPay.Quantity      = "1"
				AliPay.Out_Trade_No  = trade_no
				AliPay.Discount      = "0"
				AliPay.Paymethod     = "directPay"     '赋值:bankPay(网银);cartoon(卡通); directPay(余额)
				Select Case pay_page
					   Case "2" 
								AliPay.logistics_fee = "0.00"			'物流配送费用
								AliPay.logistics_payment  =   "SELLER_PAY" 
								If account = 1 Then 
									AliPay.Service     = "create_direct_pay_by_user"
								End If 
					   Case Else
								AliPay.logistics_fee = Pay_alipay(4)
								AliPay.logistics_payment  =   "BUYER_PAY" 
								AliPay.logistics_type_1  =   "EMS"
								AliPay.logistics_fee_1   =   Pay_alipay(5)
								AliPay.logistics_payment_1  =   "BUYER_PAY"   '物流费用承担(买家付)
				End Select
'				AliPay.logistics_payment  =	"BUYER_PAY"	   '物流配送费用付款方式：SELLER_PAY(卖家支付)  BUYER_PAY(买家支付)  BUYER_PAY_AFTER_RECEIVE(货到付款)
				AliPay.logistics_type	    =	"EXPRESS"		'物流配送方式：POST(平邮)、EMS(EMS)  EXPRESS(其他快递)
				'如果需要多添加几组物流方式，可以增加第二组物流参数,如果不需要，可以为空
				'如果需要多添加几组物流方式，可以增加第三组物流参数,如果不需要，可以为空
				AliPay.logistics_fee_2    =	""			'物流配送费用  0.00
				AliPay.logistics_payment_2=	""	'物流配送费用付款方式：SELLER_PAY(卖家支付)  BUYER_PAY(买家支付)  BUYER_PAY_AFTER_RECEIVE(货到付款)
				AliPay.logistics_type_2	=	""		'物流配送方式：POST(平邮)  EMS(EMS)  EXPRESS(其他快递)
				'以下是可选的参数 如果没有可以为空。注意：姓名、联系地址和邮政编码 这三项要么都为空，要么都不能为空。
				AliPay.ShowUrl		   =	"http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url    '商品的演示地址
				AliPay.receive_name    =	""   '收货人姓名
				AliPay.receive_address =	""   '收货人地址
				AliPay.receive_zip     =	""   '邮编5 位戒6 位数字组成
				AliPay.receive_phone   =	""   '收货人电话
				AliPay.receive_mobile  =	""   '收货人手机 必须是11 位数字
				AliPay.buyer_email     =	""   '买家的支付宝账号
				Alipay.extra_common_param = request("extra_common_param")
				AliPayUrl = AliPay.GetUrl()
				Set AliPay = Nothing
				Response.Redirect AliPayUrl
				Response.End
		Else
				Select Case pay_page
					   Case "2" 
								logistics_fee = "0.00"			'物流配送费用
								logistics_payment  =   "SELLER_PAY"
					   Case Else
								logistics_fee = Pay_alipay(4)
								logistics_payment  =   "BUYER_PAY"
								logistics_type_1  =   "EMS"
								logistics_fee_1   =   Pay_alipay(5)
								logistics_payment_1  =   "BUYER_PAY"   '物流费用承担(买家付)
				End Select
				Set AlipayObj	= New creatAlipayItemURL
				itemUrl=AlipayObj.creatAlipayItemURL("https://www.alipay.com/cooperate/gateway.do?",Pay_alipay(11),Pay_alipay(11),"create_partner_trade_by_buyer","2088002027840018",Pay_alipay(3),"MD5","Item No:"& subject,"Item No:"& subject,trade_no,price,0,"http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url,1,1,"EXPRESS",logistics_fee,logistics_payment,logistics_type_1,logistics_fee_1,logistics_payment_1,Pay_alipay(1),Pay_alipay(2),0,paybackurl,extra_common_param)
				response.redirect itemUrl
				response.End
		End If
End If

If pay_type = "2" Then
		curdate=now()
		orderTime=year(curdate)&Right("0"& month(curdate),2)&Right("0"& day(curdate),2)&Right("0"& hour(curdate),2)&Right("0"& minute(curdate),2)&Right("0"& second(curdate),2)   '订单提交时间  14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
        merchantAcctId=Pay_bill(1)  '人民币网关账户号(01为人民币网关账户号)
        key=Pay_bill(2)  '人民币网关密钥
        inputCharset="1"  '字符集  1代表UTF-8; 2代表GBK; 3代表gb2312
        bgUrl=paybackurl  '状态返回地址
        pageUrl=""  '接受支付结果的页面地址  如果[bgUrl]为空，快钱将支付结果Post到[pageUrl]对应的地址
        version="v2.0"  '网关版本
        language="1"  '语言种类  1代表中文；2代表英文
        signType="1"  '签名类型  1代表MD5签名
        payerName=user_id  '支付人姓名
        payerContactType="1"   '支付人联系方式类型  1代表Email；2代表手机号
        payerContact=user_email   '支付人联系方式  '只能选择Email或手机号
        orderId=trade_no  '商户订单号  '由字母、数字、或[-][_]组成
        orderAmount=price*100  '订单金额
        productName=subject   '商品名称
        productNum="1"  '商品数量
        productId=""    '商品编号
        productDesc=""  '商品描述
        ext1=request("ext1")  '扩展字段1
        ext2=request("ext2")  '扩展字段2
        '支付方式.固定选择值  只能选择00、10、11、12、13、14
        '00：组合支付（网关支付页面显示快钱支持的各种支付方式，推荐使用）10：银行卡支付（网关支付页面只显示银行卡支付）.11：电话银行支付（网关支付页面只显示电话支付）.12：快钱账户支付（网关支付页面只显示快钱账户支付）.13：线下支付（网关支付页面只显示线下支付方式）.14：B2B支付（网关支付页面只显示B2B支付，但需要向快钱申请开通才能使用）
        payType="00"
        bankId=""  '银行代码  实现直接跳转到银行页面去支付,只在payType=10时才需设置参数
        redoFlag="0"  '同一订单禁止重复提交标志  1代表同一订单号只允许提交1次；0表示同一订单号在没有支付成功的前提下可重复提交多次。默认为0建议实物购物车结算类商户采用0；虚拟产品类商户采用1
        pid=""  '快钱的合作伙伴的账户号
        signMsg = BillSignMsg(inputCharset,pageUrl,bgUrl,version,language,signType,merchantAcctId,payerName,payerContactType,payerContact,orderId,orderAmount,orderTime,productName,productNum,productId,productDesc,ext1,ext2,payType,bankId,redoFlag,pid,key)
		Response.write("<div style=""display:none""><form name=""bill"" id=""bill"" action=""https://www.99bill.com/gateway/recvMerchantInfoAction.htm"" method=""post"">")
		Response.write("<input type=""hidden"" name=""inputCharset"" value="""&inputCharset&"""><input type=""hidden"" name=""bgUrl"" value="""&bgUrl&"""><input type=""hidden"" name=""pageUrl"" value="""&pageUrl&"""><input type=""hidden"" name=""version"" value="""&version&"""><input type=""hidden"" name=""language"" value="""&language&"""><input type=""hidden"" name=""signType"" value="""&signType&"""><input type=""hidden"" name=""signMsg"" value="""&signMsg&"""><input type=""hidden"" name=""merchantAcctId"" value="""&merchantAcctId&"""><input type=""hidden"" name=""payerName"" value="""&payerName&"""><input type=""hidden"" name=""payerContactType"" value="""&payerContactType&"""><input type=""hidden"" name=""payerContact"" value="""&payerContact&"""><input type=""hidden"" name=""orderId"" value="""&orderId&"""><input type=""hidden"" name=""orderAmount"" value="""&orderAmount&"""><input type=""hidden"" name=""orderTime"" value="""&orderTime&"""><input type=""hidden"" name=""productName"" value="""&productName&"""><input type=""hidden"" name=""productNum"" value="""&productNum&"""><input type=""hidden"" name=""productId"" value="""&productId&"""><input type=""hidden"" name=""productDesc"" value="""&productDesc&"""><input type=""hidden"" name=""ext1"" value="""&ext1&"""><input type=""hidden"" name=""ext2"" value="""&ext2&"""><input type=""hidden"" name=""payType"" value="""&payType&"""><input type=""hidden"" name=""bankId"" value="""&bankId&"""><input type=""hidden"" name=""redoFlag"" value="""&redoFlag&"""><input type=""hidden"" name=""pid"" value="""&pid&"""><input type=""submit"" name=""submit"" value=""点此支付"">")
		Response.write("</form></div>")
		Response.write("<script>document.getElementById('bill').submit.click()</script>")
        'itemUrl = "https://www.99bill.com/gateway/recvMerchantInfoAction.htm?inputCharset="&inputCharset&"&bgUrl="&bgUrl&"&pageUrl="&pageUrl&"&version="&version&"&language="&language&"&signType="&signType&"&signMsg="&signMsg&"&merchantAcctId="&merchantAcctId&"&payerName="&payerName&"&payerContactType="&payerContactType&"&payerContact="&payerContact&"&orderId="&orderId&"&orderAmount="&orderAmount&"&orderTime="&orderTime&"&productName="&productName&"&productNum="&productNum&"&productId="&productId&"&productDesc="&productDesc&"&ext1="&ext1&"&ext2="&ext2&"&payType="&payType&"&bankId="&bankId&"&redoFlag="&redoFlag&"&pid="&pid
		'response.redirect itemUrl
		'response.End
End If

If pay_type = "3" Then
		rem 测试地址 https://developer.paypal.com/
		rem 测试接口:https://www.sandbox.paypal.com/cgi-bin/webscr
		rem 支付接口:https://www.paypal.com/cgi-bin/webscr
		paypal_currency_code = safereplace(request("paypal_currency_code"))
		If CurrencyCode <> "" Then 
				paypal_currency_code = CurrencyCode
		End If 
		If CurrencyCode = "JPY" Then price = CLng(price)
		custom = safereplace(request("custom"))
        itemUrl="https://www.paypal.com/cgi-bin/webscr?business="& Pay_paypal(1) &"&item_name=Item No:"& subject &"&item_number="& trade_no &"&amount="& price &"&currency_code="& paypal_currency_code &"&return="& paybackurl &"&custom="& custom &"&cmd=_ext-enter&redirect_cmd=_xclick"
		response.redirect itemUrl
		response.End
End If

If pay_type = "7" Then
		rem 测试地址 https://developer.paypal.com/
		rem 测试接口:https://www.sandbox.paypal.com/cgi-bin/webscr
		rem 支付接口:https://www.paypal.com/cgi-bin/webscr
		custom = safereplace(request("custom"))
        itemUrl="https://www.paypal.com/cgi-bin/webscr?business="& Pay_paypal_cn(1) &"&item_name=Item No:"& subject &"&item_number="& trade_no &"&amount="& price &"&currency_code="& Pay_paypal_cn(2) &"&return="& paybackurl &"&custom="& custom &"&cmd=_ext-enter&redirect_cmd=_xclick"
		response.redirect itemUrl
		response.End
End If

If pay_type = "4" Then
        remark1 = safereplace(request("remark1"))
        remark2 = safereplace(request("remark2"))
        text = price&Pay_chinabank(3)&trade_no&Pay_chinabank(1)&paybackurl&Pay_chinabank(2)
        v_md5info=Ucase(trim(ASP_MD5(text)))
        itemUrl="https://pay3.chinabank.com.cn/PayGate?v_md5info="&v_md5info&"&v_mid="&Pay_chinabank(1)&"&v_oid="&trade_no&"&v_amount="&price&"&v_moneytype="&Pay_chinabank(3)&"&v_url="&paybackurl&"&style="&Pay_chinabank(3)&"&remark1="&remark1&"&remark2="&remark2
		response.redirect itemUrl
		response.End
End If
If pay_type = "5" Then 'tenpay禁止自动跳转 暂时停用 2011-01-20 by 56770.kingdge
	    rem 获取服务器日期，格式YYYYMMDD
	    Function CFTGetServerDate
		Dim strTmp, iYear,iMonth,iDate
		iYear = Year(Date)
		iMonth = Month(Date)
		iDate = Day(Date)

		strTmp = CStr(iYear)
		If iMonth < 10 Then
			strTmp = strTmp & "0" & Cstr(iMonth)
		Else
			strTmp = strTmp & Cstr(iMonth)
		End If
		If iDate < 10 Then
			strTmp = strTmp & "0" & Cstr(iDate)
		Else
			strTmp = strTmp & Cstr(iDate)
		End If
		CFTGetServerDate = strTmp
	    End Function
		Pay_tenpay_cmdno = "1"                  ' 财付通支付为"1"
		Pay_tenpay_billdate = CFTGetServerDate  ' 交易日期 (yyyymmdd)
		Pay_tenpay_banktype	= "0"				' 银行类型:	0		财付通
											'			1001	招商银行
											'			1002	中国工商银行
											'			1003	中国建设银行
											'			1004	上海浦东发展银行
											'			1005	中国农业银行
											'			1006	中国民生银行
											'			1008	深圳发展银行
											'			1009	兴业银行
		Pay_tenpay_desc = subject               ' 商品名称
		Pay_tenpay_billno = trade_no            ' 商户生成的订单号(最多32位)
	    ' 重要:
	    ' 交易单号(28位): 商户号(10位) + 日期(8位) + 流水号(10位), 必须按此格式生成, 且不能重复
	    ' 如果sp_billno超过10位, 则截取其中的流水号部分加到transaction_id后部(不足10位左补0)
	    ' 如果sp_billno不足10位, 则左补0, 加到transaction_id后部
		''密钥
		'Pay_tenpay(2) = "8934e7d15453e97507ef794cf7b0519d"
		''
		''商户号
		'Pay_tenpay(1) = "1900000109"
	    Pay_transaction_id = Pay_tenpay(1) & Pay_tenpay_billdate & Right(Pay_tenpay_billno,10)
        Pay_tenpay_fee = price*100
        Pay_tenpay_feetype = Pay_tenpay(3)
        Pay_tenpay_url = paybackurl
        Pay_tenpay_attach = request("Pay_tenpay_attach")	' 商户私有数据, 请求回调页面时原样返回
		spbill_create_ip = Request.ServerVariables("REMOTE_ADDR")
	    ' 生成MD5签名
	    Pay_tenpay_sign_text = "cmdno=" & Pay_tenpay_cmdno & "&date=" & Pay_tenpay_billdate & "&bargainor_id=" & Pay_tenpay(1) &"&transaction_id=" & Pay_transaction_id & "&sp_billno=" & Pay_tenpay_billno &"&total_fee=" & Pay_tenpay_fee & "&fee_type=" & Pay_tenpay_feetype & "&return_url=" & Pay_tenpay_url &"&attach=" & Pay_tenpay_attach &"&spbill_create_ip="& spbill_create_ip &"&key="& Pay_tenpay(2)
'		response.write Pay_tenpay_sign_text
'		response.End
	    Pay_tenpay_md5_sign = UCase(ASP_MD5(Pay_tenpay_sign_text))        ' 转换为大写
		Response.write("<div style=""display:none""><form name=""tenpay"" id=""tenpay"" action=""https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi"" method=""post"">")
		Response.write("<input type=""hidden"" name=""cmdno"" value="""&Pay_tenpay_cmdno&"""><input type=""hidden"" name=""date"" value="""&Pay_tenpay_billdate&"""><input type=""hidden"" name=""bank_type"" value="""&Pay_tenpay_banktype&"""><input type=""hidden"" name=""desc"" value="""&Pay_tenpay_desc&"""><input type=""hidden"" name=""bargainor_id"" value="""&Pay_tenpay(1)&"""><input type=""hidden"" name=""transaction_id"" value="""&Pay_transaction_id&"""><input type=""hidden"" name=""sp_billno"" value="""&Pay_tenpay_billno&"""><input type=""hidden"" name=""total_fee"" value="""&Pay_tenpay_fee&"""><input type=""hidden"" name=""fee_type"" value="""&Pay_tenpay_feetype&"""><input type=""hidden"" name=""return_url"" value="""&Pay_tenpay_url&"""><input type=""hidden"" name=""attach"" value="""&Pay_tenpay_attach&"""><input type=""hidden"" name=""sign"" value="""&Pay_tenpay_md5_sign&"""><input type=""hidden"" name=""spbill_create_ip"" value="""&spbill_create_ip&"""><input type=""submit"" name=""submit"" value=""点此支付"">")
		Response.write("</form></div>")
		Response.write("<script>document.getElementById('tenpay').submit.click()</script>")
'        itemUrl="http://service.tenpay.com/cgi-bin/v3.0/payservice.cgi?cmdno="&Pay_tenpay_cmdno&"&date="&Pay_tenpay_billdate&"&bank_type="&Pay_tenpay_banktype&"&desc="&Pay_tenpay_desc&"&bargainor_id="&Pay_tenpay(1)&"&transaction_id="&Pay_transaction_id&"&sp_billno="&Pay_tenpay_billno&"&total_fee="&Pay_tenpay_fee&"&fee_type=" & Pay_tenpay_feetype & "&return_url=" & Pay_tenpay_url &"&attach=" & Pay_tenpay_attach &"&sign="&Pay_tenpay_md5_sign &"&spbill_create_ip="& spbill_create_ip
'		response.redirect itemUrl
'		response.End
End If
If pay_type = "6" Then
        rem <-{财付通担保交易接口 2008-5-21 by 56770.kingdge
		seller				=Pay_tenpay2(1)  '卖家帐号
		sp_key				=Pay_tenpay2(2)	 '密钥
		domain				="http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url &""	'商户网站域名
		tenpay_dir			="/plus"  '财付通安装目录
		attach				="tencent_magichu"	'支付附加数据，非中文标准字符
		imgtitle			="财付通支付" '图片说明
		imgsrc				=tenpay_dir&"/image/tenpay_buy.gif"	'图片地址
		pay_url				="https://www.tenpay.com/cgi-bin/med/show_opentrans.cgi" 								'财付通支付网关地址
		need_buyerinfo="2"
		mch_returl		= paybackurl					'通知URL
		show_url			= paybackurl					'返回URL
		encode_type 	= "1"		'编码标准
		Pay_tenpay_attach = request("Pay_tenpay_attach")
		item_url = Tenpay.tenpay_interface_pay(encode_type,subject,price,"Tenpay","0",subject,"1",trade_no,Pay_tenpay_attach)
		response.redirect item_url
End If
If pay_type = "8" Then
        rem <-{IPS接口 2010-11-20 by 56770.kingdge
		Dim Billdate,SignMD5,OrderEncodeType
		Billdate=CStr(year(now())&right("0"&month(now()),2)&right("0"&day(now()),2))
		OrderEncodeType = 5
		'订单支付接口的Md5摘要，原文=订单号+金额+日期+支付币种+商户证书
'		SignMD5 = md5(trade_no & formatnumber(price,2) & BillDate & Pay_ips(3) & Pay_ips(2))
		SignMD5 = "billno" & trade_no & "currencytype" & Pay_ips(3) & "amount" & FormatNumber(price, 2, -1, , 0) &"date" & BillDate &"orderencodetype"& OrderEncodeType & Pay_ips(2)
		SignMD5 = ASP_MD5(SignMD5)
		attach = safereplace(request("attach"))
		REM 测试地址 http://pay.ips.net.cn/ipayment.aspx
		Response.write("<div style=""display:none""><form name=""ips"" id=""ips"" action=""https://pay.ips.com.cn/ipayment.aspx"" method=""post"">")
		Response.write("<input type=""hidden"" name=""Mer_code"" value="""&Pay_ips(1)&"""><input type=""hidden"" name=""SignMD5"" value="""&SignMD5&"""><input type=""hidden"" name=""Billno"" value="""&trade_no&"""><input type=""hidden"" name=""Amount"" value="""&FormatNumber(price, 2, -1, , 0)&"""><input type=""hidden"" name=""Date"" value="""&Billdate&"""><input type=""hidden"" name=""Currency_Type"" value="""&Pay_ips(3)&"""><input type=""hidden"" name=""Gateway_Type"" value="""&Pay_ips(12)&"""><input type=""hidden"" name=""Lang"" value="""&Pay_ips(13)&"""><input type=""hidden"" name=""Merchanturl"" value="""&paybackurl&"""><input type=""hidden"" name=""OrderEncodeType"" value="""& OrderEncodeType &"""><input type=""hidden"" name=""RetEncodeType"" value=""17""><input type=""hidden"" name=""Rettype"" value=""1""><input type=""hidden"" name=""attach"" value="""& attach &"""><input type=""hidden"" name=""DispAmount"" value="""&FormatNumber(price, 2, -1, , 0)&"""><input type=""submit"" name=""submit"" value=""点此支付"">")
		Response.write("</form></div>")
		Response.write("<script>document.getElementById('ips').submit.click()</script>")
End If
If pay_type = "9" Then
        rem <-{宝付接口 2013-10-17 by 56770.kingdge
		'随机数
		randomize timer
		kk=int(1000000*rnd)
		
		y=Year(now)
		m=month(now)
		if m<10 then m="0"&m
		d=day(now)
		if d<10 then d="0"&d
		h=hour(now)
		if h<10 then h="0"&h
		m2=minute(now)
		if m2<10 then m2="0"&m2
		s=second(now)
		if s<10 then s="0"&s
		''交易流水号
		'TransID=y&m&d&h&m2&s&right("000000"&kk,6)
		'交易时间
		TradeDate=y&m&d&h&m2&s
		'支付渠道
		PayID=Trim(Pay_baofu(3))
		'商户充值流水号
		TransID=trade_no 'y&m&d&h&m2&s&right("000000"&kk,6)
		'商户订单金额，单位为分
		OrderMoney=price*100
		'商户名称
		ProductName="" 'trade_no
		'商品数量
		Amount=1
		'充值用户名
		Username=user_name
		'备注信息
		AdditionalInfo=Request("AdditionalInfo")    
		'当前路径
		UrlPath="http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url &"Plus/"
		'前台通知地址
		PageUrl=UrlPath&"baofu_receive.asp?NoticeType=1"
		'后台通知地址
		ReturnUrl=UrlPath&"baofu_receive.asp?NoticeType=0"
		'通知方式
		NoticeType=1 
		MARK="|"
		'接口地址
		payUrl="http://gw.baofoo.com/payindex"
		MemberID=Trim(Pay_baofu(1))
		Md5key=Trim(Pay_baofu(2))
		TerminalID = Trim(Pay_baofu(12))
		InterfaceVersion = "4.0"
		KeyType = "1"
		'生成加密信息
		Md5Data=MemberID & MARK & PayID & MARK & TradeDate & MARK & TransID & MARK & OrderMoney & MARK & PageUrl & MARK & ReturnUrl & MARK & NoticeType & MARK & Md5key
		Signature=Baofu_MD5(Md5Data)
		'设置提交金额的Session
		session("OrderMoney")=OrderMoney
		Response.write("<div style=""display:none""><form name=""baofu"" id=""baofu"" action="""&payUrl&""" method=""post"">")
		Response.write("<input name='MemberID' type='hidden' value='"& MemberID &"'/><input name='TerminalID' type='hidden' value='"& TerminalID &"'/><input name='InterfaceVersion' type='hidden' value='"& InterfaceVersion &"'/><input name='KeyType' type='hidden' value='"& KeyType &"'/><input name='PayID' type='hidden' value='"& PayID &"'/><input name='TradeDate' type='hidden' value='"& TradeDate &"' /><input name='TransID' type='hidden' value='"& TransID &"' /><input name='OrderMoney' type='hidden' value='"& OrderMoney &"'/><input name='ProductName' type='hidden' value='"& ProductName &"'/><input name='Amount' type='hidden' value='"& Amount &"'/><input name='Username' type='hidden' value='"& Username &"'/><input name='AdditionalInfo' type='hidden' value='"& AdditionalInfo &"'/><input name='PageUrl' type='hidden' value='"& PageUrl &"'/><input name='ReturnUrl' type='hidden' value='"& ReturnUrl &"'/><input name='Signature' type='hidden' value='"& Signature &"'/><input name='NoticeType' type='hidden' value='"& NoticeType &"'/><input type=""submit"" name=""submit"" value=""点此支付"">")
		Response.write("</form></div>")
		Response.write("<script>document.getElementById('baofu').submit.click()</script>")
End If
%>