|
|
@@ -31,6 +31,7 @@ import com.wechat.pay.java.core.notification.RequestParam;
|
|
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
|
|
import com.wechat.pay.java.service.payments.jsapi.model.*;
|
|
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
|
|
+import com.wechat.pay.java.service.payments.nativepay.NativePayService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
@@ -2410,7 +2411,7 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
public CommonResult payOrderPrice(HouseOrderPriceDto houseOrderPriceDto) {
|
|
|
Double price = houseOrderPriceDto.getPrice();
|
|
|
|
|
|
- if (price<0) {
|
|
|
+ if (price<=0) {
|
|
|
return CommonResult.fail("金额异常");
|
|
|
}
|
|
|
|
|
|
@@ -2419,10 +2420,30 @@ public class HouseOrderController implements HouseOrderAPI {
|
|
|
LambdaQueryWrapper<HouseOrder> wrapper=new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(HouseOrder::getOrderNumber,orderNumber);
|
|
|
HouseOrder one = houseOrderService.getOne(wrapper);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
+ Config config =
|
|
|
+ new RSAAutoCertificateConfig.Builder()
|
|
|
+ .merchantId(wxPayV3Config.getMchId())
|
|
|
+ .privateKeyFromPath(wxPayV3Config.getKeyPath())
|
|
|
+ .merchantSerialNumber(wxPayV3Config.getSerialNum())
|
|
|
+ .apiV3Key(wxPayV3Config.getApiKey3())
|
|
|
+ .build();
|
|
|
+ // 构建service
|
|
|
+ NativePayService service = new NativePayService.Builder().config(config).build();
|
|
|
+ // request.setXxx(val)设置所需参数,具体参数可见Request定义
|
|
|
+ com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest request = new com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest();
|
|
|
+ com.wechat.pay.java.service.payments.nativepay.model.Amount amount = new com.wechat.pay.java.service.payments.nativepay.model.Amount();
|
|
|
+ request.setAppid(wxPayV3Config.getAppId());
|
|
|
+ request.setMchid(wxPayV3Config.getMchId());
|
|
|
+ request.setDescription("测试商品标题");
|
|
|
+ amount.setTotal((int) (price*100));
|
|
|
+ request.setAmount(amount);
|
|
|
+ request.setOutTradeNo(orderNumber);
|
|
|
+ request.setNotifyUrl(wxPayV3Config.getDomain()+"/auto/house-order/returnPay");
|
|
|
+ // 调用下单方法,得到应答
|
|
|
+ com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = service.prepay(request);
|
|
|
+
|
|
|
+
|
|
|
+ return CommonResult.ok(response);
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|