写道
/**
* 预支付订单 - 支付宝
*
* @param outTradeNo
* @param goodsDO
* @return
*/
private AliPrePayOrderReturnVO getAliPrepayOrder(String outTradeNo, GoodsDO goodsDO) throws IllegalAccessException, IntrospectionException, InvocationTargetException, IOException, JAXBException, AlipayApiException {
AliPrePayOrderParamVO aliPrePayOrderParamVO = new AliPrePayOrderParamVO();
AliPrePayOrderReturnVO aliPrePayOrderReturnVO = new AliPrePayOrderReturnVO();
// 接口名称
aliPrePayOrderParamVO.setService(config.getObject().getProperty("ali.pay.service"));
// 合作者身份ID
aliPrePayOrderParamVO.setPartner(config.getObject().getProperty("ali.pay.partner"));
// 服务器异步通知页面路径
aliPrePayOrderParamVO.setNotify_url(config.getObject().getProperty("ali.pay.notify_url"));
// TODO 客户端ip - 可空
//aliPrePayOrderParamVO.setApp_id("8.8.8.8");
// TODO 客户端来源 - 可空
//aliPrePayOrderParamVO.setAppenv("system=android^version=3.0.1.2");
//商户网站唯一订单号
aliPrePayOrderParamVO.setOut_trade_no(outTradeNo);
aliPrePayOrderParamVO.setSubject(goodsDO.getName());
//支付类型。默认值为:1(商品购买)。
aliPrePayOrderParamVO.setPayment_type("1");
aliPrePayOrderParamVO.setSeller_id(config.getObject().getProperty("ali.pay.partner"));
aliPrePayOrderParamVO.setTotal_fee(goodsDO.getCurrentPrice());
// 商品详情
aliPrePayOrderParamVO.setBody(goodsDO.getDescribe());
// 未付款交易的超时时间 30分钟
aliPrePayOrderParamVO.setIt_b_pay("30m");
// 签名
Map signMap = BeanMapUtil.convertBean(aliPrePayOrderParamVO);
//用自己的私钥签名要发送的信息。
String sign = AlipaySignature.rsaSign(signMap, config.getObject().getProperty("ali.pay.privateKey"), "UTF-8");
// 签名后url编码,sign和signtype放在最后。
String param = AlipaySignature.getSignContent(signMap)+"&sign="+URLEncoder.encode(sign,"UTF-8")+"&sign_type=RSA";
aliPrePayOrderReturnVO.setParam(param);
return aliPrePayOrderReturnVO;
}