<!--#include file="./util/hex_md5.asp"-->
<!--#include file="./classes/class.asp"-->

<%
response.End()

function FillZero(str)
  if len(str)=1 then
  	FillZero = "0"&str
  else
  	FillZero=str
 end if
end function

time_start=year(now)&FillZero(month(now))&FillZero(day(now))&FillZero(hour(now))&FillZero(minute(now))&FillZero(second(now))


Dim orderId,body1,orderAmount

orderId=Request("orderId")
body1=Request("body1")
orderAmount=Request("orderAmount")
mch_id="101570007830"
key="1d42ee6b20fec0a0958443162621fcfa"
nonce_str="buy"
notify_url="http://184.ik.28ye.com/00/weifutongali/notify_url.asp"

orderId="ik0008"
body1="ik0008爱卡"
orderAmount=0.1


Set packageParams = CreateObject("Scripting.Dictionary")  'Server.CreateObject("Scripting.Dictionary")

packageParams.Add "attach", nonce_str       '随机字符串，商户可自定义
packageParams.Add "body", body1                     '商品描述
packageParams.Add "charset", "UTF-8" 
'packageParams.Add "device_info", ""       
'packageParams.Add "goods_tag", goods_tag 
packageParams.Add "mch_create_ip", Request.ServerVariables("REMOTE_ADDR")                     '终端 IP
packageParams.Add "mch_id", mch_id              '商户号
packageParams.Add "nonce_str", nonce_str 
packageParams.Add "notify_url", notify_url         '通知回调地址，目前默认是空格，商户在测试支付和上线时必须改为自己的，且保证外网能访问到
'packageParams.Add "op_user_id", op_user_id 
packageParams.Add "out_trade_no", orderId          '商户订单号
'packageParams.Add "product_id", product_id 
packageParams.Add "service", "pay.alipay.nativev2"                     '接口类型  微信 pay.weixin.scancode  手q：pay.qq.jspay
packageParams.Add "sign_type", "MD5" 
'packageParams.Add "time_expire", time_expire 
packageParams.Add "time_start", time_start 
packageParams.Add "total_fee", orderAmount*100                   '总金额 ，以分为单位
packageParams.Add "version", "2.0" 



strsign = createSHA1Sign(packageParams) & "&key="&key

sign = UCase(hex_md5(strsign))

packageParams.Add "sign", sign
para = parseXML(packageParams)

   Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
    http.Option(4) = 13056
    http.Option(6) = False
    surl = "https://pay.swiftpass.cn/pay/gateway"
    http.SetTimeouts 5000, 10000, 10000, 10000
    http.Open "POST", surl, False
    http.SetRequestHeader "Connection", "Keep-Alive"
    http.SetRequestHeader "User-Agent", "Mozilla/4.0"
    http.SetRequestHeader "Content-Length", Len(data)
    http.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    http.Send para
	  body = BytesToBstr(http.ResponseBody)

        '1.记录日志
		'2.对已经相应的body进行参数判断
				If http.Status <> 200 Then
					'1.记录日志提交网络异常
					response.End 
				Else



				Status = mysubstr(body, "<status><![CDATA[", "]]></status>")
				If Status = 0 Then
				result_code = mysubstr(body, "<result_code><![CDATA[", "]]></result_code>")
				End If




				If result_code = 0 Then
				
				
				
				
				code_img_url = mysubstr(body, "<code_img_url><![CDATA[", "]]></code_img_url>")
				

				
				
				Else
				   err_msg = mysubstr(body, "<err_msg><![CDATA[", "]]></err_msg>")
				End If
					'1.分析返回的xml
					'2.判断是否提交成功，做自己系统提交状态等信息的修改以及获取支付的二维码地址待系统下一步处理
					
				End if
'End If 

'End if

response.Write trim(code_img_url)&"<br>"


code_img_url=replace(code_img_url,"https://pay.swiftpass.cn/pay/qrcode?uuid="," ")


response.Write trim(code_img_url)&"<br>"
%>

<img src="/inc/erweima.php?m=4&d=<%=trim(code_img_url)%>" width="148" height="148" />




