<!--#include file="Alipay_md5.asp"-->
<%

Class creatAlipayItemURL
	'获得最终的购买url
	
	Public Function creatAlipayItemURL(t1,t2,t3,t4,t5,cmd,subject,body,order_no,prices,rurl,types,number,transport,ordinary_fee,express_fee,readonly,buyer_msg,buyer,buyer_name,buyer_address,buyer_zipcode,buyer_tel,buyer_mobile,partner)
		Dim itemURL,str2CreateAc,acCode
		dim INTERFACE_URL,sellerEmail,keyCode,imgsrc,imgtitle
		'初始化各必要变量
		INTERFACE_URL	= t1+t2		'支付接口
		sellerEmail		= t2		'商户支付宝账户（改成你自己的）
		keyCode			= t3		'安全校验码（改成你自己的）
		imgsrc			= t4		'支付宝按钮图片
		imgtitle		= t5		'按钮悬停说明
		
		str2CreateAc	=	"cmd" & cmd & "subject" & subject
		str2CreateAc	=	str2CreateAc & "body" & body
		str2CreateAc	=	str2CreateAc & "order_no" & order_no
		str2CreateAc	=	str2CreateAc & "price" & prices
		str2CreateAc	=	str2CreateAc & "url" & rurl
		str2CreateAc	=	str2CreateAc & "type" & types
		str2CreateAc	=	str2CreateAc & "number" & number
		str2CreateAc	=	str2CreateAc & "transport" & transport
		str2CreateAc	=	str2CreateAc & "ordinary_fee" & ordinary_fee
		str2CreateAc	=	str2CreateAc & "express_fee" & express_fee
		str2CreateAc	=	str2CreateAc & "readonly" & readonly
		str2CreateAc	=	str2CreateAc & "buyer_msg" & buyer_msg
		str2CreateAc	=	str2CreateAc & "seller" & sellerEmail
		str2CreateAc	=	str2CreateAc & "buyer" & buyer
		str2CreateAc	=	str2CreateAc & "buyer_name" & buyer_name
		str2CreateAc	=	str2CreateAc & "buyer_address" & buyer_address
		str2CreateAc	=	str2CreateAc & "buyer_zipcode" & buyer_zipcode
		str2CreateAc	=	str2CreateAc & "buyer_tel" & buyer_tel
		str2CreateAc	=	str2CreateAc & "buyer_mobile" & buyer_mobile
		str2CreateAc	=	str2CreateAc & "partner" & partner
		str2CreateAc	=	str2CreateAc & keyCode
		
		acCode			= 	MD5(str2CreateAc)

		itemURL			= 	INTERFACE_URL & "?cmd=" & cmd
		itemURL			= 	itemURL & "&subject=" & Server.HTMLEncode(subject)
		itemURL			= 	itemURL & "&body=" & Server.HTMLEncode(body)
		itemURL			= 	itemURL & "&order_no=" & order_no
		itemURL			= 	itemURL & "&price=" & prices
		itemURL			= 	itemURL & "&url=" & rurl
		itemURL			= 	itemURL & "&type=" & types
		itemURL			= 	itemURL & "&number=" & number
		itemURL			= 	itemURL & "&transport=" & transport
		itemURL			= 	itemURL & "&ordinary_fee=" & ordinary_fee
		itemURL			= 	itemURL & "&express_fee=" & express_fee
		itemURL			= 	itemURL & "&readonly=" & readonly
		itemURL			= 	itemURL & "&buyer_msg=" & Server.HTMLEncode(buyer_msg)
		itemURL			= 	itemURL & "&buyer=" & Server.HTMLEncode(buyer)
		itemURL			= 	itemURL & "&buyer_name=" & Server.HTMLEncode(buyer_name)
		itemURL			= 	itemURL & "&buyer_address=" & Server.HTMLEncode(buyer_address)
		itemURL			= 	itemURL & "&buyer_zipcode=" & buyer_zipcode
		itemURL			= 	itemURL & "&buyer_tel=" & buyer_tel
		itemURL			= 	itemURL & "&buyer_mobile=" & buyer_mobile
		itemURL			= 	itemURL & "&partner=" & partner
		itemURL			= 	itemURL & "&ac=" & acCode
		creatAlipayItemURL	=	get_AlipayButtonURL(itemURL,imgtitle,imgsrc)
	End Function
	
	Public Function get_AlipayButtonURL(itemURL,imgtitle,imgsrc)
		dim responseText1
		responseText1	=	responseText1 & "<a href='" & itemURL & "' target='_blank'>"		'购买网址
		responseText1	=	responseText1 & "<img alt='" & imgtitle & "' src='"				'图片说明
		responseText1	=	responseText1 & imgsrc											'图片地址
		responseText1	=	responseText1 & "' align='absmiddle' border='0'/></a>"
		get_AlipayButtonURL=responseText1
	End Function

End Class
%>