|
|
@@ -9,6 +9,7 @@ import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
+import com.izouma.nineth.config.WxPayProperties;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -32,9 +33,10 @@ import java.io.IOException;
|
|
|
@RestController
|
|
|
@RequestMapping("/wx")
|
|
|
public class WxController {
|
|
|
- private WxMpService wxMpService;
|
|
|
- private WxPayService wxPayService;
|
|
|
- private Environment env;
|
|
|
+ private WxMpService wxMpService;
|
|
|
+ private WxPayService wxPayService;
|
|
|
+ private WxPayProperties wxPayProperties;
|
|
|
+ private Environment env;
|
|
|
|
|
|
@RequestMapping("/testMp")
|
|
|
public ModelAndView testPay(@RequestParam(required = false) String code, HttpServletRequest request,
|
|
|
@@ -65,10 +67,10 @@ public class WxController {
|
|
|
request.setOutTradeNo(RandomStringUtils.randomAlphanumeric(32));
|
|
|
request.setTotalFee(totalFee);
|
|
|
request.setSpbillCreateIp("180.102.110.170");
|
|
|
- request.setNotifyUrl(env.getProperty("wx.pay.notifyUrl"));
|
|
|
request.setTradeType(WxPayConstants.TradeType.JSAPI);
|
|
|
request.setOpenid(openId);
|
|
|
request.setSignType("MD5");
|
|
|
+ request.setNotifyUrl(wxPayProperties.getNotifyUrl());
|
|
|
try {
|
|
|
return wxPayService.createOrder(request);
|
|
|
} catch (WxPayException e) {
|