@param httpRequest
@throws Exception
*/
Public static String makeOrderAlipayUrl(HttpServletRequest httpRequest, Order order) throws Exception {
HashMap hm = new HashHap();
hm. put(“_input_charset”, httpRequest.getCharacterEncoding()); //采用相同的编码方式
hm.put(“body”, “你在www.xxx.com上的订单”); //填写在跳到支付宝页面上显示的付款内容信息
hm.put(“discount”, “-5”); //填写折扣信息,-5表示抵扣5元
hm.put(“logistics_fee”, “10”); //物流费用
hm.put(“logistics_payment”, “BUYER_PAY”); //物流费用支付人,BUYER_PAY = 买家支付物流费用
hm.put(“logistics_type”, “EXPRESS”); //物流方式
hm.put(“notify_url”, “http://www.xxx.com/notifyurl.jsp”); //客户付款后,支付宝调用的页面
hm.put(“out_trade_no”, “order.getId()); //外部交易号,最好具有唯一性,在获取支付宝发来的付款信息时使用
hm.put(“partner”, partnerId); //partnerId(合作伙伴ID)
hm.put(“agent”, partnerId); //partnerId(合作伙伴ID)
hm.put(“payment_type”, “1”); //支付类型,l = 商品购买,2 = 服务购买,…
hm.put(“price”, “105.30”); //订单金额信息
hm.put(“quantity”, “1”); //订单商品数量,一般都写1,即按照整个订单包来计算
hm.put(“return_url”, “http://www.xxx.com/ReturnUrl.jsp”); //客户付款成功后,显示给客户的页面
hm.put(“seller_email”, “alipay@xxx.com”); //你的支付宝账户E-mail
hm.put(“service”, “create_direct_pay_by_user”); //create_direct_pay by_user = 直接付款,trade_create_by_buyer = 担保付款
hm.put(“subject”, “www.xxx.com的订单”); //填写跳到支付宝页面上后显示的付款标题信息
String payGateway = “https://www.alipay.com/cooperate/gateway.do?”; //跳转到支付宝的url头
return makeUrl(hm, securityCode, httpRequest.getCharacterEncoding(), payGateway); //securityCode(安全码)
}
/*
/*
代码的格式,没有办法看。
你还是使用编辑中的 </> 格式化一下代码吧
是一段调用第三方的支付接口的代码。
makeOrderAlipayUrl是组装请求信息,然后发送给三方的接口,并返回对方的回应数据。并且在数据发送之前先进行MD5加密了。
太乱,自己先整理下吧
看到第二个if我都不知道是不是嵌套了0 0