|
|
@ -26,6 +26,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
@ -70,13 +72,14 @@ public class WxPayController {
|
|
|
|
params.put("out_trade_no", PayKit.generateStr());
|
|
|
|
params.put("out_trade_no", PayKit.generateStr());
|
|
|
|
params.put("time_expire", timeExpire);
|
|
|
|
params.put("time_expire", timeExpire);
|
|
|
|
params.put("notify_url", wxPayConfig.getNotifyUrl());
|
|
|
|
params.put("notify_url", wxPayConfig.getNotifyUrl());
|
|
|
|
|
|
|
|
|
|
|
|
params.put("amount", new HashMap<String, Object>() {{
|
|
|
|
params.put("amount", new HashMap<String, Object>() {{
|
|
|
|
put("total", 0.01);
|
|
|
|
put("total", 1);
|
|
|
|
put("currency", "CNY");
|
|
|
|
put("currency", "CNY");
|
|
|
|
}});
|
|
|
|
}});
|
|
|
|
|
|
|
|
|
|
|
|
log.info("统一下单参数 {}", JSONUtil.toJsonStr(params));
|
|
|
|
log.info("统一下单参数 {}", JSONUtil.toJsonStr(params));
|
|
|
|
redisUtils.set(params.get("out_trade_no").toString(), params);
|
|
|
|
// redisUtils.set(params.get("out_trade_no").toString(), params);
|
|
|
|
IJPayHttpResponse response = WxPayApi.v3(
|
|
|
|
IJPayHttpResponse response = WxPayApi.v3(
|
|
|
|
RequestMethodEnum.POST,
|
|
|
|
RequestMethodEnum.POST,
|
|
|
|
WxDomainEnum.CHINA.toString(),
|
|
|
|
WxDomainEnum.CHINA.toString(),
|
|
|
@ -99,12 +102,12 @@ public class WxPayController {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = WxPayKit.appCreateSign(wxPayConfig.getAppId(), wxPayConfig.getMchId(), prepayId, wxPayConfig.getPrivateKeyPath());
|
|
|
|
Map<String, String> map = WxPayKit.appCreateSign(wxPayConfig.getAppId(), wxPayConfig.getMchId(), prepayId, wxPayConfig.getPrivateKeyPath());
|
|
|
|
log.info("唤起支付参数:{}", map);
|
|
|
|
log.info("唤起支付参数:{}", map);
|
|
|
|
return Result.success(map);
|
|
|
|
return Result.success(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Result.success(response);
|
|
|
|
return Result.success(response);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
return Result.failed(e.getMessage());
|
|
|
|
return Result.failed(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|