mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
校验支付确认是否撤销
This commit is contained in:
@@ -7,12 +7,10 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.common.AdaPayment;
|
||||
import com.jsowell.adapay.dto.QueryConfirmReverseDTO;
|
||||
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
|
||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.response.PaymentReverseResponse;
|
||||
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
|
||||
import com.jsowell.adapay.response.RefundResponse;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.adapay.vo.OrderSettleResult;
|
||||
import com.jsowell.adapay.vo.PaymentInfo;
|
||||
@@ -1354,7 +1352,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OrderSettleResult doBalancePaymentWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) {
|
||||
public OrderSettleResult doBalancePaymentWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) throws BaseAdaPayException {
|
||||
// 订单结算金额
|
||||
BigDecimal settleAmount = orderBasicInfo.getSettleAmount();
|
||||
// 订单编号
|
||||
@@ -1491,7 +1489,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
* @param orderBasicInfo 订单
|
||||
* @param adapayMemberAccount 结算账户
|
||||
*/
|
||||
public OrderSettleResult doPaymentConfirmWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) {
|
||||
public OrderSettleResult doPaymentConfirmWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) throws BaseAdaPayException {
|
||||
String orderCode = orderBasicInfo.getOrderCode();
|
||||
// 查询该笔订单的支付交易回调
|
||||
AdapayCallbackRecord adapayCallbackRecord = selectAdapayCallbackRecord(orderCode);
|
||||
@@ -1527,7 +1525,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
* @param orderCode 订单编号
|
||||
* @param settleAmount 结算金额
|
||||
*/
|
||||
private OrderSettleResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) {
|
||||
private OrderSettleResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException {
|
||||
// 分账金额
|
||||
BigDecimal totalConfirmAmt = BigDecimal.ZERO;
|
||||
// 手续费
|
||||
@@ -1542,6 +1540,11 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||||
if (CollectionUtils.isNotEmpty(confirms)) {
|
||||
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||||
// 校验分账是否撤销
|
||||
if (queryConfirmReverseStatus(confirm.getId(), wechatAppId)) {
|
||||
logger.info("支付确认id:" + confirm.getId() + "撤销了。。。");
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||||
if (StringUtils.equals(jsonObject.getString("orderCode"), orderCode)) {
|
||||
// 订单号对的上,累计分账金额
|
||||
@@ -1579,6 +1582,24 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账撤销状态
|
||||
*/
|
||||
private boolean queryConfirmReverseStatus(String paymentConfirmId, String wechatAppId) throws BaseAdaPayException {
|
||||
boolean result = false;
|
||||
|
||||
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
|
||||
.paymentConfirmId(paymentConfirmId)
|
||||
.wechatAppId(wechatAppId)
|
||||
.build();
|
||||
ConfirmReverseResponse confirmReverseResponse = adapayService.queryConfirmReverse(dto);
|
||||
if (confirmReverseResponse.isSuccess()) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* uniApp 发送停止充电订阅消息
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user