mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update huifu
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.jsowell.api.uniapp;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.huifu.adapay.core.AdapayCore;
|
||||
import com.huifu.adapay.core.util.AdapaySign;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
@@ -81,6 +84,7 @@ public class PayController extends BaseController {
|
||||
/**
|
||||
* 会员充值余额
|
||||
* http://localhost:8080/uniapp/pay/rechargeBalance
|
||||
*
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
@@ -166,6 +170,7 @@ public class PayController extends BaseController {
|
||||
/**
|
||||
* adapay支付订单
|
||||
* http://localhost:8080/uniapp/pay/payOrderWithAdapay
|
||||
*
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
@@ -256,6 +261,7 @@ public class PayController extends BaseController {
|
||||
|
||||
/**
|
||||
* 微信退款回调接口
|
||||
*
|
||||
* @param request
|
||||
* @param body
|
||||
* @return
|
||||
@@ -305,4 +311,33 @@ public class PayController extends BaseController {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇付支付回调
|
||||
*/
|
||||
@PostMapping("/adapayCallback")
|
||||
public void callback(HttpServletRequest request) {
|
||||
try {
|
||||
//验签请参data
|
||||
String data = request.getParameter("data");
|
||||
//验签请参sign
|
||||
String sign = request.getParameter("sign");
|
||||
//验签标记
|
||||
boolean checkSign;
|
||||
//验签请参publicKey
|
||||
String publicKey = AdapayCore.PUBLIC_KEY;
|
||||
logger.info("汇付支付回调验签请参:data={}sign={}", data, sign);
|
||||
//验签
|
||||
checkSign = AdapaySign.verifySign(data, sign, publicKey);
|
||||
if (checkSign) {
|
||||
//验签成功逻辑
|
||||
System.out.println("汇付支付回调成功返回数据data:" + data);
|
||||
} else {
|
||||
//验签失败逻辑
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("汇付支付回调失败 request:{}", JSON.toJSONString(request));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -420,6 +420,7 @@ public class MemberService {
|
||||
try {
|
||||
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
|
||||
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
|
||||
log.info("创建汇付支付参数反参:{}", JSONObject.toJSONString(response));
|
||||
if (response != null && !response.isEmpty()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
||||
JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
||||
|
||||
@@ -1248,4 +1248,7 @@ public class OrderService {
|
||||
.build();
|
||||
}
|
||||
|
||||
public void adapayCallback(HttpServletRequest request, WechatPayNotifyParameter body) {
|
||||
log.info("");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user