Commit dcda5cee authored by jiaorz's avatar jiaorz

支付宝支付

parent e3d2e597
......@@ -62,9 +62,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
@Autowired
MQServiceBiZ mqServiceBiZ;
@Value("${universal.url}")
static String weixinHost;
String weixinHost;
private static final String notifyUrl = weixinHost + "/api/universal/pay/app/unauth/notify/alipay";
public JSONObject preparepay(OrderPayVo orderPayVo) {
if (null == orderPayVo) {
......@@ -97,6 +96,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
Integer type = orderPayVo.getType() == null ? 1 : orderPayVo.getType();
String jsParam = "";
String notify_url = weixinHost + "/api/universal/pay/app/unauth/notify";
String notifyUrl = weixinHost + "/api/universal/pay/app/unauth/notify/alipay";
log.info("报名费回调路径notify_url:" + notify_url);
Integer payWay = orderPayVo.getPayWay() == null ? 1 : orderPayVo.getPayWay();
String sellerAccount = null;
......@@ -108,7 +108,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
jsParam = WXPay.apppay(amount + "", orderPayVo.getBody(), notify_url, trade_no, orderPayVo.getBuyerIp(), 0);
} else if (type == 1 && payWay == 2) {
sellerAccount = SystemConfig.ALIPAY_PID;
jsParam = generateAliPayment(orderPayVo);
jsParam = generateAliPayment(orderPayVo, notifyUrl);
}
log.info("报名费回调路径jsParam:" + jsParam);
if (!StringUtils.isBlank(jsParam)) {
......@@ -276,7 +276,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
* @return
*/
@SuppressWarnings("rawtypes")
private String generateAliPayment(OrderPayVo orderPayVo) {
private String generateAliPayment(OrderPayVo orderPayVo, String notifyUrl) {
//实例化客户端
AlipayClient alipayClient = new DefaultAlipayClient(SystemConfig.ALIPAY_PAY_BASE_URL + "/gateway.do",
......@@ -285,7 +285,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
try {
return appOrderPay(alipayClient, orderPayVo);
return appOrderPay(alipayClient, orderPayVo, notifyUrl);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -294,7 +294,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
}
//支付宝APP支付方法
public String appOrderPay(AlipayClient alipayClient, OrderPayVo orderPayVo) {
public String appOrderPay(AlipayClient alipayClient, OrderPayVo orderPayVo, String notifyUrl) {
BigDecimal realAmount = new BigDecimal(orderPayVo.getAmount().toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP);
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
......@@ -318,7 +318,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
//预授权冻结
public String fundAuthOrderAppFreeze(AlipayClient alipayClient, OrderPayVo orderPayVo) throws AlipayApiException {
public String fundAuthOrderAppFreeze(AlipayClient alipayClient, OrderPayVo orderPayVo, String notifyUrl) throws AlipayApiException {
AlipayFundAuthOrderAppFreezeRequest request = new AlipayFundAuthOrderAppFreezeRequest();
AlipayFundAuthOrderAppFreezeModel model = new AlipayFundAuthOrderAppFreezeModel();
BigDecimal realAmount = new BigDecimal(orderPayVo.getAmount().toString()).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_UP);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment