[fix]修改回调
This commit is contained in:
parent
40d8105e55
commit
81d6b0727f
@ -273,6 +273,7 @@ wechat:
|
||||
transfer-notify-url: https://wuzhongjie.com.cn/prod-api/trans/withdraw/callback # 转账回调地址
|
||||
app-id: wxebcdaea31881caab # 应用ID
|
||||
secret: 71826d76bad096ec5407897c6ed1391f # 应用密钥
|
||||
callback-url: https://wuzhongjie.com.cn/prod-api/app/pay/callback/WECHAT
|
||||
mini-program:
|
||||
# app-id: wx87a5db19138da60d
|
||||
# secret: 856ca8bae38ccaecc1353c9abedf6b41
|
||||
|
@ -55,4 +55,9 @@ public class WechatPaymentSetting {
|
||||
private String apiV3Key;
|
||||
|
||||
private String privateKeyPath;
|
||||
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
private String callbackUrl;
|
||||
}
|
||||
|
@ -117,52 +117,6 @@ public class WechatPlugin implements Payment {
|
||||
public R<Object> h5pay(HttpServletRequest request, HttpServletResponse response1, PayParam payParam) {
|
||||
|
||||
try {
|
||||
// CashierParam cashierParam = cashierSupport.cashierParam(payParam);
|
||||
//
|
||||
// //支付参数准备
|
||||
// SceneInfo sceneInfo = new SceneInfo();
|
||||
// sceneInfo.setPayer_client_ip(IpKit.getRealIp(request));
|
||||
// H5Info h5Info = new H5Info();
|
||||
// h5Info.setType("WAP");
|
||||
// sceneInfo.setH5_info(h5Info);
|
||||
//
|
||||
// //支付金额
|
||||
// Integer fen = CurrencyUtil.fen(cashierParam.getPrice());
|
||||
// //第三方付款订单
|
||||
// String outOrderNo = SnowFlake.getIdStr();
|
||||
// //过期时间
|
||||
// String timeExpire = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3);
|
||||
//
|
||||
// //回传数据
|
||||
// String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8);
|
||||
//
|
||||
//
|
||||
// WechatPaymentSetting setting = wechatPaymentSetting();
|
||||
// String appid = setting.getServiceAppId();
|
||||
// if (appid == null) {
|
||||
// throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
|
||||
// }
|
||||
// UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel()
|
||||
// .setAppid(appid)
|
||||
// .setMchid(setting.getMchId())
|
||||
// .setDescription(cashierParam.getDetail())
|
||||
// .setOut_trade_no(outOrderNo)
|
||||
// .setTime_expire(timeExpire)
|
||||
// .setAttach(attach)
|
||||
// .setNotify_url(notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.WECHAT))
|
||||
// .setAmount(new Amount().setTotal(fen)).setScene_info(sceneInfo);
|
||||
//
|
||||
// log.info("统一下单参数 {}", JSONUtil.toJsonStr(unifiedOrderModel));
|
||||
// PaymentHttpResponse response = WechatApi.v3(
|
||||
// RequestMethodEnums.POST,
|
||||
// WechatDomain.CHINA.toString(),
|
||||
// WechatApiEnum.H5_PAY.toString(),
|
||||
// setting.getMchId(),
|
||||
// setting.getSerialNumber(),
|
||||
// null,
|
||||
// setting.getApiclient_key(),
|
||||
// JSONUtil.toJsonStr(unifiedOrderModel)
|
||||
// );
|
||||
|
||||
return null;
|
||||
// return R.ok(JSONUtil.toJsonStr(response.getBody()));
|
||||
@ -176,68 +130,6 @@ public class WechatPlugin implements Payment {
|
||||
public R<Object> jsApiPay(HttpServletRequest request, PayParam payParam) {
|
||||
|
||||
try {
|
||||
// Connect connect = connectService.queryConnect(
|
||||
// ConnectQueryDTO.builder().userId(UserContext.getCurrentUser().getId()).unionType(ConnectEnum.WECHAT.name()).build()
|
||||
// );
|
||||
// if (connect == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// Payer payer = new Payer();
|
||||
// payer.setOpenid(connect.getUnionId());
|
||||
//
|
||||
// CashierParam cashierParam = cashierSupport.cashierParam(payParam);
|
||||
//
|
||||
// //支付金额
|
||||
// Integer fen = CurrencyUtil.fen(cashierParam.getPrice());
|
||||
// //第三方付款订单
|
||||
// String outOrderNo = SnowFlake.getIdStr();
|
||||
// //过期时间
|
||||
// String timeExpire = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3);
|
||||
//
|
||||
// String attach = URLEncoder.createDefault().encode(JSONUtil.toJsonStr(payParam), StandardCharsets.UTF_8);
|
||||
//
|
||||
// WechatPaymentSetting setting = wechatPaymentSetting();
|
||||
// String appid = setting.getServiceAppId();
|
||||
// if (appid == null) {
|
||||
// throw new ServiceException(ResultCode.WECHAT_PAYMENT_NOT_SETTING);
|
||||
// }
|
||||
// UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel()
|
||||
// .setAppid(appid)
|
||||
// .setMchid(setting.getMchId())
|
||||
// .setDescription(cashierParam.getDetail())
|
||||
// .setOut_trade_no(outOrderNo)
|
||||
// .setTime_expire(timeExpire)
|
||||
// .setAttach(attach)
|
||||
// .setNotify_url(notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.WECHAT))
|
||||
// .setAmount(new Amount().setTotal(fen))
|
||||
// .setPayer(payer);
|
||||
//
|
||||
// log.info("统一下单参数 {}", JSONUtil.toJsonStr(unifiedOrderModel));
|
||||
// PaymentHttpResponse response = WechatApi.v3(
|
||||
// RequestMethodEnums.POST,
|
||||
// WechatDomain.CHINA.toString(),
|
||||
// WechatApiEnum.JS_API_PAY.toString(),
|
||||
// setting.getMchId(),
|
||||
// setting.getSerialNumber(),
|
||||
// null,
|
||||
// setting.getApiclient_key(),
|
||||
// JSONUtil.toJsonStr(unifiedOrderModel)
|
||||
// );
|
||||
// //根据证书序列号查询对应的证书来验证签名结果
|
||||
// boolean verifySignature = WxPayKit.verifySignature(response, getPlatformCert());
|
||||
// log.info("verifySignature: {}", verifySignature);
|
||||
// log.info("统一下单响应 {}", response);
|
||||
//
|
||||
// if (verifySignature) {
|
||||
// String body = response.getBody();
|
||||
// JSONObject jsonObject = JSONUtil.parseObj(body);
|
||||
// String prepayId = jsonObject.getStr("prepay_id");
|
||||
// Map<String, String> map = WxPayKit.jsApiCreateSign(appid, prepayId, setting.getApiclient_key());
|
||||
// log.info("唤起支付参数:{}", map);
|
||||
//
|
||||
// return ResultUtil.data(map);
|
||||
// }
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
@ -280,7 +172,7 @@ public class WechatPlugin implements Payment {
|
||||
.setOut_trade_no(outOrderNo)
|
||||
.setTime_expire(timeExpire)
|
||||
.setAttach(attach)
|
||||
.setNotify_url("http://cjh.wuzhongjie.com.cn/app/payment/callback/" + PaymentMethodEnum.WECHAT)
|
||||
.setNotify_url(setting.getCallbackUrl())
|
||||
.setAmount(new Amount().setTotal(fen));
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user