mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
update 重试订单退款接口
This commit is contained in:
@@ -335,4 +335,10 @@ public interface IOrderBasicInfoService {
|
||||
* 2. 发送启动充电指令
|
||||
*/
|
||||
void payOrderSuccessCallback(PayOrderSuccessCallbackDTO dto);
|
||||
|
||||
/**
|
||||
* 重试订单退款
|
||||
* @param orderCode 订单编号
|
||||
*/
|
||||
void retryRefundOrder(String orderCode) throws BaseAdaPayException;
|
||||
}
|
||||
|
||||
@@ -96,4 +96,6 @@ public interface IPileMerchantInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<PileMerchantInfo> queryFirstLevelMerchant();
|
||||
|
||||
String queryAppIdByMerchantId(String merchantId);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.google.common.collect.Sets;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.Payment;
|
||||
import com.huifu.adapay.model.PaymentConfirm;
|
||||
import com.huifu.adapay.model.PaymentReverse;
|
||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
@@ -2412,7 +2413,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
memberAdapayRecordService.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2766,6 +2766,46 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryRefundOrder(String orderCode) throws BaseAdaPayException {
|
||||
// 查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
||||
if (orderBasicInfo == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_ORDER_INFO_IS_NULL);
|
||||
}
|
||||
// 如果该订单是订单完成状态,并且是微信支付 存在需要退款金额,则进行后续操作
|
||||
String orderStatus = orderBasicInfo.getOrderStatus();
|
||||
if (StringUtils.equals(orderStatus, OrderStatusEnum.ORDER_COMPLETE.getValue())) {
|
||||
throw new BusinessException("", "订单不是完成状态");
|
||||
}
|
||||
String payMode = orderBasicInfo.getPayMode();
|
||||
if (StringUtils.equals(payMode, OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||
throw new BusinessException("", "订单不是微信支付");
|
||||
}
|
||||
|
||||
// 查到原汇付支付id
|
||||
AdapayCallbackRecord adapayCallbackRecord = adapayCallbackRecordService.selectByOrderCode(orderCode);
|
||||
if (adapayCallbackRecord == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CALLBACK_IS_NULL_ERROR);
|
||||
}
|
||||
|
||||
// 获取appId
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(orderBasicInfo.getMerchantId());
|
||||
|
||||
// 通过支付id查询退款记录
|
||||
String paymentId = adapayCallbackRecord.getPaymentId();
|
||||
String memberId = orderBasicInfo.getMemberId();
|
||||
BigDecimal refundAmount = orderBasicInfo.getRefundAmount();
|
||||
List<PaymentReverse> paymentReverses = adapayMemberService.queryPaymentReverse(paymentId, wechatAppId);
|
||||
if (CollectionUtils.isEmpty(paymentReverses)) {
|
||||
// 如果没有退款过,重新执行一遍退款
|
||||
PaymentReverseResponse response = adapayMemberService.createPaymentReverseRequest(
|
||||
paymentId, refundAmount, wechatAppId, memberId, ScenarioEnum.ORDER.getValue(),
|
||||
orderCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用汇付支付
|
||||
*
|
||||
|
||||
@@ -344,6 +344,7 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
/**
|
||||
* 通过merchantId查询appId
|
||||
*/
|
||||
@Override
|
||||
public String queryAppIdByMerchantId(String merchantId) {
|
||||
/*
|
||||
一般情况下新建的运营商appId都是有值的,某些早前建的运营商appId可能为空
|
||||
|
||||
Reference in New Issue
Block a user