mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-09 12:30:07 +08:00
update huifu
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package com.jsowell.api.uniapp;
|
package com.jsowell.api.uniapp;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.common.collect.ImmutableMap;
|
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.annotation.Anonymous;
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
@@ -81,6 +84,7 @@ public class PayController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 会员充值余额
|
* 会员充值余额
|
||||||
* http://localhost:8080/uniapp/pay/rechargeBalance
|
* http://localhost:8080/uniapp/pay/rechargeBalance
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
@@ -166,6 +170,7 @@ public class PayController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* adapay支付订单
|
* adapay支付订单
|
||||||
* http://localhost:8080/uniapp/pay/payOrderWithAdapay
|
* http://localhost:8080/uniapp/pay/payOrderWithAdapay
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
@@ -256,6 +261,7 @@ public class PayController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信退款回调接口
|
* 微信退款回调接口
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param body
|
* @param body
|
||||||
* @return
|
* @return
|
||||||
@@ -305,4 +311,33 @@ public class PayController extends BaseController {
|
|||||||
}
|
}
|
||||||
return response;
|
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 {
|
try {
|
||||||
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
|
log.info("创建汇付支付参数:{}", JSONObject.toJSONString(createAdaPaymentParam));
|
||||||
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
|
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
|
||||||
|
log.info("创建汇付支付参数反参:{}", JSONObject.toJSONString(response));
|
||||||
if (response != null && !response.isEmpty()) {
|
if (response != null && !response.isEmpty()) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
||||||
JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
||||||
|
|||||||
@@ -1248,4 +1248,7 @@ public class OrderService {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void adapayCallback(HttpServletRequest request, WechatPayNotifyParameter body) {
|
||||||
|
log.info("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user