mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 12:00:11 +08:00
update 汇付退款
This commit is contained in:
@@ -120,17 +120,12 @@ public class OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMemberInvoiceTitleService memberInvoiceTitleService;
|
private IMemberInvoiceTitleService memberInvoiceTitleService;
|
||||||
|
|
||||||
private List<String> stationIdList = Lists.newArrayList("1", "2");
|
|
||||||
|
|
||||||
@Value("${adapay.appId}")
|
@Value("${adapay.appId}")
|
||||||
private String ADAPAY_APP_ID;
|
private String ADAPAY_APP_ID;
|
||||||
|
|
||||||
@Value("${adapay.callback}")
|
@Value("${adapay.callback}")
|
||||||
private String ADAPAY_CALLBACK_URL;
|
private String ADAPAY_CALLBACK_URL;
|
||||||
|
|
||||||
@Value("${adapay.refundCallback}")
|
|
||||||
private String adapay_refund_callback_url;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成订单
|
* 生成订单
|
||||||
*
|
*
|
||||||
@@ -1333,11 +1328,11 @@ public class OrderService {
|
|||||||
String sign = request.getParameter("sign");
|
String sign = request.getParameter("sign");
|
||||||
//验签请参publicKey
|
//验签请参publicKey
|
||||||
String publicKey = AdapayCore.PUBLIC_KEY;
|
String publicKey = AdapayCore.PUBLIC_KEY;
|
||||||
log.info("汇付支付回调验签请参data={}, sign={}", data, sign);
|
log.info("汇付支付退款回调验签请参data={}, sign={}", data, sign);
|
||||||
//验签标记
|
//验签标记
|
||||||
boolean checkSign = AdapaySign.verifySign(data, sign, publicKey);
|
boolean checkSign = AdapaySign.verifySign(data, sign, publicKey);
|
||||||
if (!checkSign) {
|
if (!checkSign) {
|
||||||
log.info("汇付支付回调验签失败:{}", data);
|
log.info("汇付支付退款回调验签失败:{}", data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -129,6 +130,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPileMerchantInfoService pileMerchantInfoService;
|
private IPileMerchantInfoService pileMerchantInfoService;
|
||||||
|
|
||||||
|
@Value("${adapay.refundCallback}")
|
||||||
|
private String ADAPAY_REFUND_CALLBACK_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件查询订单基本信息
|
* 条件查询订单基本信息
|
||||||
*
|
*
|
||||||
@@ -1756,6 +1760,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
Map<String, Object> refundParams = Maps.newHashMap();
|
Map<String, Object> refundParams = Maps.newHashMap();
|
||||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(dto.getRefundAmount()));
|
refundParams.put("refund_amt", AdapayUtil.formatAmount(dto.getRefundAmount()));
|
||||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||||
|
refundParams.put("notify_url", ADAPAY_REFUND_CALLBACK_URL);
|
||||||
Map<String, Object> response = Refund.create(id, refundParams);
|
Map<String, Object> response = Refund.create(id, refundParams);
|
||||||
logger.info("创建退款对象:{}", JSON.toJSONString(response));
|
logger.info("创建退款对象:{}", JSON.toJSONString(response));
|
||||||
|
|
||||||
@@ -1763,6 +1768,20 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refundForBalanceWithAdapay(WeChatRefundDTO dto) {
|
public void refundForBalanceWithAdapay(WeChatRefundDTO dto) {
|
||||||
|
// 查会员余额
|
||||||
|
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||||
|
if (memberVO == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_MEMBER_NULL_ERROR);
|
||||||
|
}
|
||||||
|
// 校验退款金额
|
||||||
|
BigDecimal principalBalance = memberVO.getPrincipalBalance();
|
||||||
|
BigDecimal refundAmount = dto.getRefundAmount();
|
||||||
|
if (refundAmount.compareTo(principalBalance) > 0) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_MEMBER_BALANCE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户充值余额订单 过滤掉已经退款的充值订单
|
||||||
|
|
||||||
|
// 也许需要多笔支付订单才够退款
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user