mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 汇付退款
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||
import com.jsowell.pile.dto.IndexQueryDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
@@ -262,7 +256,7 @@ public interface IOrderBasicInfoService {
|
||||
* 汇付支付 订单退款
|
||||
* @param dto
|
||||
*/
|
||||
void refundForOrderWithAdapay(WeChatRefundDTO dto) throws BaseAdaPayException;
|
||||
void refundForOrderWithAdapay(WeChatRefundDTO dto);
|
||||
|
||||
/**
|
||||
* 汇付支付 余额退款
|
||||
|
||||
@@ -641,11 +641,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
if (StringUtils.equals(transactionRecord.getPaymentInstitutions(), PaymentInstitutionsEnum.WECHAT_PAY.getValue())) {
|
||||
this.weChatRefund(weChatRefundDTO);
|
||||
} else if (StringUtils.equals(transactionRecord.getPaymentInstitutions(), PaymentInstitutionsEnum.ADAPAY.getValue())) {
|
||||
try {
|
||||
this.refundForOrderWithAdapay(weChatRefundDTO);
|
||||
} catch (BaseAdaPayException e) {
|
||||
logger.error("汇付支付退款 param:{}", JSON.toJSONString(weChatRefundDTO), e);
|
||||
}
|
||||
this.refundForOrderWithAdapay(weChatRefundDTO);
|
||||
}
|
||||
// 订单支付记录
|
||||
OrderPayRecord orderPayRecord = payRecordList.get(0);
|
||||
@@ -1753,11 +1749,11 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refundForOrderWithAdapay(WeChatRefundDTO dto) throws BaseAdaPayException {
|
||||
public void refundForOrderWithAdapay(WeChatRefundDTO dto) {
|
||||
// 查出来原来的支付信息
|
||||
AdapayCallbackRecord record = adapayCallbackRecordService.selectByOrderCode(dto.getOrderCode());
|
||||
if (Objects.isNull(record)) {
|
||||
logger.error("orderCode:{}, 订单退款处理逻辑, 查询订单微信支付记录为空!", dto.getOrderCode());
|
||||
logger.error("汇付支付orderCode:{}, 订单退款处理逻辑, 查询订单微信支付记录为空!", dto.getOrderCode());
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_ORDER_CALLBACK_RECORD_ERROR);
|
||||
}
|
||||
|
||||
@@ -1765,7 +1761,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
BigDecimal refundAmount = dto.getRefundAmount();
|
||||
BigDecimal payAmt = record.getPayAmt();
|
||||
if (refundAmount.compareTo(payAmt) > 0) {
|
||||
logger.error("订单号:{}, 退款金额:{}(元),大于可退金额{}(元), 抛出异常", dto.getOrderCode(), refundAmount, payAmt);
|
||||
logger.error("汇付支付订单号:{}, 退款金额:{}(元),大于可退金额{}(元), 抛出异常", dto.getOrderCode(), refundAmount, payAmt);
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_ORDER_AMOUNT_ERROR);
|
||||
}
|
||||
|
||||
@@ -1775,9 +1771,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(dto.getRefundAmount()));
|
||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||
refundParams.put("notify_url", ADAPAY_REFUND_CALLBACK_URL);
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
logger.info("创建退款对象:{}", JSON.toJSONString(response));
|
||||
|
||||
try {
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
logger.info("汇付支付创建退款对象:{}", JSON.toJSONString(response));
|
||||
} catch (BaseAdaPayException e) {
|
||||
logger.error("汇付支付创建退款对象error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user