订单支付请求

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="org.apache.commons.beanutils.BeanUtils"%>
<%@page import="java.security.*"%>
<%@page import="sun.misc.*"%>
<%@page import="java.security.spec.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>提交到富友交易系统</title>
</head>
<script type="text/javascript">
function submitForm(){
document.getElementById("form").submit();
}
</script>
<%
String xml ="";
try{
request.setCharacterEncoding("UTF-8");
String mchnt_cd = “富友分配商户号”;
String order_id = “订单号”;
String order_date = “订单日期”;
String order_amt = “订单金额”;
String page_notify_url = “前端通知地址,必须是商户交易系统的地址”
String back_notify_url = “后端通知地址,必须是商户交易系统的地址”
String goods_name = “商品名称”;
String rem = “自定义备注”;
String pri_key = “富友给商户分配的商户私钥”

String signDataStr =  back_notify_url + "|" + 
goods_name      + "|" + 
mchnt_cd             + "|" + 
order_amt            + "|" + 
order_id             + "|" +
                      page_notify_url    + "|" + 
rem;

byte[] bytesKey = (new BASE64Decoder()).decodeBuffer(pri_key.trim());
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(bytesKey);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec);
Signature signature = Signature.getInstance("MD5WithRSA");
signature.initSign(priKey);
signature.update(signDataStr.getBytes("GBK"));
String sign = (new BASE64Encoder()).encodeBuffer(signature.sign());

System.out.println("页面打印signDataStr==="+signDataStr);
System.out.println("页面打印sign ==="+ sign);
%>
<body onload="javascript:submitForm();">
<form name="pay" method="post" action="详情请咨询富友对接群" id = "form">
<input type="hidden" value = '<%=RSA%>' name="sign"/>
<input type="hidden" value = '<%=mchnt_cd%>' name="mchnt_cd"/>
<input type="hidden" value = '<%=order_date%>' name="order_date"/>
<input type="hidden" value = '<%=order_id%>' name="order_id"/>
<input type="hidden" value = '<%=order_amt%>' name="order_amt"/>
<input type="hidden" value = '<%=page_notify_url%>' name="page_notify_url"/>
<input type="hidden" value = '<%=back_notify_url%>' name="back_notify_url"/>
<input type="hidden" value = '<%=goods_name%>' name="goods_name"/>
<input type="hidden" value = '<%=rem%>' name="rem"/>
</form>
</body>
<%}catch(Exception e){
    e.printStackTrace();
    out.print(e.getMessage());
} %>
<body>
</body>
</html>

results matching ""

    No results matching ""