修改微信封装
This commit is contained in:
@@ -55,7 +55,7 @@ public class WxJsPayAbility {
|
||||
/**
|
||||
* 小程序id
|
||||
*/
|
||||
@Value("${app.wx.app_id}")
|
||||
@Value("${wx_pay.app_id}")
|
||||
private String appId;
|
||||
|
||||
|
||||
|
||||
@@ -26,18 +26,31 @@ public class WxNativePayAbility {
|
||||
*/
|
||||
@Value("${wx_pay.notify_domain}")
|
||||
private String notifyDomain;
|
||||
/**
|
||||
* 商户号
|
||||
*/
|
||||
@Value("${wx_pay.merchant_id}")
|
||||
private String merchantId;
|
||||
/**
|
||||
* 应用id(与商户号绑定的appId,用于微信支付)
|
||||
*/
|
||||
@Value("${wx_pay.app_id}")
|
||||
private String appId;
|
||||
|
||||
|
||||
/**
|
||||
* 预支付
|
||||
* @param request 请求头
|
||||
* @return
|
||||
* 预支付(自动填充appId、merchantId、notifyUrl)
|
||||
*
|
||||
* @param paramRequest 请求参数(调用方只需设置业务字段:description、outTradeNo、amount等)
|
||||
* @return codeUrl 二维码链接
|
||||
*/
|
||||
public String prepay(PrepayRequest request) {
|
||||
public String prepay(PrepayRequest paramRequest) {
|
||||
try {
|
||||
request.setNotifyUrl(notifyDomain+"/public/wxNotify/pay");
|
||||
log.info("以默认设置支付回调地址为:{}",request.getNotifyUrl());
|
||||
PrepayResponse prepay = nativePayService.prepay(request);
|
||||
paramRequest.setNotifyUrl(notifyDomain + "/public/wxNotify/pay");
|
||||
log.info("以默认设置支付回调地址为:{}", paramRequest.getNotifyUrl());
|
||||
paramRequest.setAppid(appId);
|
||||
paramRequest.setMchid(merchantId);
|
||||
PrepayResponse prepay = nativePayService.prepay(paramRequest);
|
||||
return prepay.getCodeUrl();
|
||||
} catch (Exception e) {
|
||||
log.error("nativePay支付下单出现异常,错误信息:{}", e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user