<!--#include file="alipay/alipay_payto.asp"-->
<!--#include file="../../conn.asp"-->
<!--#include file="../../config.asp"-->

<body bgcolor=#FCFCFC leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<% dim  goods,sum,opayid
goods=saferequest("paygood",1)
sum=saferequest("paysum",1)
opayid=1
Function GetLocationURL() 
Dim Url 
Dim ServerPort,ServerName,ScriptName,QueryString 
ServerName = Request.ServerVariables("SERVER_NAME") 
ServerPort = Request.ServerVariables("SERVER_PORT") 
ScriptName = Request.ServerVariables("SCRIPT_NAME") 
QueryString = Request.ServerVariables("QUERY_STRING") 
Url="http://"&ServerName 
If ServerPort <> "80" Then Url = Url & ":" & ServerPort 
Url=Url&ScriptName 
Url=replace(Url,"index.asp","")
GetLocationURL=Url 
End Function 


action=FormatSQL(SafeRequest("action",0))

set rs=server.CreateObject("adodb.recordset")
rs.open "select opayid,opayname,opaypassword,opayrturl,opayparter from sdx_opay where opayid="&opayid,conn,1,1
payid=rs("opayname")
paypwd=rs("opaypassword")
payurl=GetLocationURL()&rs("opayrturl")
payparter=rs("opayparter")
rs.close
set rs=nothing
payurl_notify=GetLocationURL()&"notify_url.asp"

payurl_return=GetLocationURL()&"return_url.asp"
select case action
Case "1"
%> 

<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 align="center" >
       
     <TBODY>
    <TR bgcolor=#ECECEC>
          <TD  height="20" colspan="2"></TD>
        </TR>
   <TR >
          <TD  height="30" colspan="2">&nbsp&nbsp&nbsp</TD>
        </TR>
    

   </TBODY>
  </TABLE>
  <TABLE cellSpacing=1 cellPadding=0 width="600" border=0 align="center" >
       
     <TBODY>
    <TR bgcolor=#FFffff>
          <TD  height="50"><IMG src="images/alipayment.gif" border=0></TD>
        </TR>

   
   </TBODY>
  </TABLE>

   <TABLE cellSpacing=1 cellPadding=0 width="600" border=0 align="center" >
       
     <TBODY>
    <TR bgcolor=#FFffff>
          <TD bgcolor=#FF5900 height="28" colspan="2"><IMG src="images/alif.gif" border=0></TD>
        </TR>

   
   </TBODY>
  </TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="600" border=0 align="center" >
       
     <TBODY>
     <TR bgcolor=#FFD350>
          <TD  height="30" colspan="2">&nbsp&nbsp&nbsp您现在[<%=webname%>]在线支付给<%=payid %>网址:(<%=weburl%>)</TD>
        </TR>

   
   </TBODY>
  </TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="600" border=0 align="center" bgcolor=#f1f1f1>
       
     <TBODY>
      <form name="alipayment" method="post" action="index.asp?action=2">
         
       
          <TR bgcolor=#ffffff>
          
          <TD height="30">&nbsp 商品订单：</TD>
          <TD height="30"><%=goods%>
          <input type="hidden" name="shopname"  size="30" value="<%=goods%>">

    </TD>
      </TR>
      
          
        <TR bgcolor=#ffffff>
          
         
          <TD  height="30">&nbsp 付款金额：</TD>
         <TD height="30"> <%=FormatNumber(sum)%>元
          <input type="hidden" name="shopsum"  size="30" value="<%=sum%>">

        </TD>
         </TR>           
         
        <TR bgcolor=#ffffff>
          
          <TD  height="30"> &nbsp 客户留言：</TD>
          <TD height="30"> <input type="text" name="shopbody"  size="50" value="<%=shopbody%>">
                <br>（如说明等。50汉字内）
         </TD>
        </TR>

         <TR bgcolor=#F5F5B8>
         
          <TD height="30" colspan="2">&nbsp &nbsp <input type="Submit" name="aliorder"  size="30" value="确   认"  onClick="return CheckForm();"></TD></TR>
   </FORM>
   </TBODY>

</TABLE>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 align="center" >
       
     <TBODY>

   <TR >
          <TD  height="60" colspan="2">&nbsp&nbsp&nbsp</TD>
        </TR>
     <TR bgcolor=#ECECEC>
          <TD  height="5" colspan="2"></TD>
        </TR>

      <TR >
          <TD  height="40" colspan="2" align="center"><IMG src="images/alipaylogo.gif" border=0>	</TD>
        </TR>
   </TBODY>
  </TABLE>
<%
Case "2"
dim shopsum,shopname,shopbody
dim service,agent,partner,sign_type,subject,body,out_trade_no,price,discount,show_url,quantity,payment_type,logistics_type,logistics_fee,logistics_payment,logistics_type_1,logistics_fee_1,logistics_payment_1,seller_email,notify_url,return_url
dim t1,t4,t5,key
dim AlipayObj,itemUrl
        shopname      =     sqlCheckstr(request.form("shopname")) 
        shopsum       =     sqlCheckstr(request.form("shopsum"))
        shopbody      =     sqlCheckstr(request.form("shopbody"))
	t1	       =     "https://www.alipay.com/cooperate/gateway.do?"	'支付接口
	t4	       =     "images/alipay_bwrx.gif"		'支付宝按钮图片
	t5	       =     "使用支付宝付款"						'按钮悬停说明
	
	service         =   "create_partner_trade_by_buyer"  'create_direct_pay_by_user  (即时到账) ，  trade_create_by_buyer 标准双接口 ,create_partner_trade_by_buyer (纯担保接口)
	agent           =   "2088002002956503" '合作厂商id
	partner		=    payparter		'partner合作伙伴ID(必须填)
	sign_type       =   "MD5"
	subject		=   shopname		'商品名称
	body		=   shopbody		'body			商品描述
	out_trade_no    =   Replace(Now(),"-","")           '客户网站订单号，（现取系统时间，可改成网站自己的变量）
	out_trade_no    =   Trim(Replace(shopname,":","")) '客户网站订单号，（现取系统时间，可改成网站自己的变量）
	price		=    shopsum				'price商品单价			0.01～50000.00
    discount            =   "0"               '商品折扣
    show_url            =   weburl       '商品展示地址（可以直接写网站首页网址）
    quantity            =   "1"               '商品数量
    payment_type        =   "1"                '支付类型，（1代表商品购买）
    logistics_type      =   "EXPRESS"          '物流种类（快递）
    logistics_fee       =   "0"                '物流费用
    logistics_payment   =   "SELLER_PAY"    '物流费用承担(卖家付)
    logistics_type_1    =   "EMS"
    logistics_fee_1     =   "0"
    logistics_payment_1  =   "BUYER_PAY"   '物流费用承担(买家付)
    seller_email    =    payid   '(必须填)
    key             =    paypwd  '(必须填)
    notify_url=  notify_url   '服务器通知url（不使用，请不要注释或者删除此参数，不用传递给支付宝系统，Alipay_Notify.asp文件所在路经） 
    return_url=  payurl_return    '服务器通知url（不使用，请不要注释或者删除此参数，不用传递给支付宝系统，Alipay_Notify.asp文件所在路经） 

	Set AlipayObj	= New creatAlipayItemURL
	itemUrl=AlipayObj.creatAlipayItemURL(t1,t4,t5,service,agent,partner,sign_type,subject,body,out_trade_no,price,discount,show_url,quantity,payment_type,logistics_type,logistics_fee,logistics_payment,logistics_type_1,logistics_fee_1,logistics_payment_1,seller_email,notify_url,return_url,key)

%>



<table border="0" cellspacing="1" cellpadding="0" align="center" valign=absmiddle width=450>
<tr><td align=center width=50% height=120>
<%=itemUrl%>
</td>

</tr>
<tr><td colspan=2 align=center>本站使用支付宝支付平台，在线实时支付<br><br>
<a href='http://www.alipay.com'  target="_blank"><img src='https://img.alipay.com/pimg/logo.gif' border=0></a>
</td></tr>
</table>
</body>
<% 
end select  %>	