支付订单错误码枚举类变量添加 PAY_ 前缀和交易订单区分开避免冲突

This commit is contained in:
puhui999 2023-09-10 00:48:30 +08:00
parent 50354462fe
commit 51dab96889
9 changed files with 72 additions and 65 deletions

View File

@ -34,6 +34,9 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功");
ErrorCode ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS = new ErrorCode(1011000024, "交易订单发货失败,发货类型不是快递");
ErrorCode ORDER_CANCEL_FAIL_STATUS_NOT_UNPAID = new ErrorCode(1011000025, "交易订单取消失败,订单不是【待支付】状态");
ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1011000026, "支付订单调价失败,原因:支付订单已付款,不能调价");
ErrorCode ORDER_UPDATE_PRICE_FAIL_EQUAL = new ErrorCode(1011000027, "支付订单调价失败,原因:价格没有变化");
ErrorCode ORDER_UPDATE_PRICE_FAIL_NOT_ITEM = new ErrorCode(1011000028, "支付订单调价失败,原因:订单项不存在");
// ========== After Sale 模块 1011000100 ==========
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在");

View File

@ -21,19 +21,17 @@ public interface ErrorCodeConstants {
ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001004, "已存在相同的渠道");
// ========== ORDER 模块 1007002000 ==========
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
ErrorCode ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
ErrorCode ORDER_STATUS_IS_SUCCESS = new ErrorCode(1007002002, "订单已支付,请刷新页面");
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价");
ErrorCode ORDER_UPDATE_PRICE_FAIL_EQUAL = new ErrorCode(1007002007, "支付订单调价失败,原因:价格没有变化");
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
ErrorCode PAY_ORDER_STATUS_IS_SUCCESS = new ErrorCode(1007002002, "订单已支付,请刷新页面");
ErrorCode PAY_ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
ErrorCode PAY_ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
// ========== ORDER 模块(拓展单) 1007003000 ==========
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
ErrorCode ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
ErrorCode ORDER_EXTENSION_IS_PAID = new ErrorCode(1007003002, "订单已支付,请等待支付结果");
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
ErrorCode PAY_ORDER_EXTENSION_IS_PAID = new ErrorCode(1007003002, "订单已支付,请等待支付结果");
// ========== 支付模块(退款) 1007006000 ==========
ErrorCode REFUND_PRICE_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");

View File

@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_EXTENSION_NOT_FOUND;
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.PAY_ORDER_EXTENSION_NOT_FOUND;
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.REFUND_NOT_FOUND;
/**
@ -99,8 +99,8 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> {
PayOrderExtensionDO orderExtension = orderService.getOrderExtensionByNo(outTradeNo);
// 支付交易拓展单不存在 返回关闭状态
if (orderExtension == null) {
return PayOrderRespDTO.closedOf(String.valueOf(ORDER_EXTENSION_NOT_FOUND.getCode()),
ORDER_EXTENSION_NOT_FOUND.getMsg(), outTradeNo, "");
return PayOrderRespDTO.closedOf(String.valueOf(PAY_ORDER_EXTENSION_NOT_FOUND.getCode()),
PAY_ORDER_EXTENSION_NOT_FOUND.getMsg(), outTradeNo, "");
}
// 关闭状态
if (PayOrderStatusEnum.isClosed(orderExtension.getStatus())) {

View File

@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import static cn.hutool.core.util.ObjectUtil.*;
import static cn.hutool.core.util.ObjectUtil.notEqual;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
@ -156,7 +156,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService {
PayOrderRespDTO payOrder = payOrderApi.getOrder(payOrderId);
if (payOrder == null) {
log.error("[validateDemoOrderCanPaid][order({}) payOrder({}) 不存在,请进行处理!]", id, payOrderId);
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
// 2.2 校验支付单已支付
if (!PayOrderStatusEnum.isSuccess(payOrder.getStatus())) {

View File

@ -160,7 +160,7 @@ public class PayOrderServiceImpl implements PayOrderService {
getSelf().notifyOrder(channel, unifiedOrderResp);
// 如有渠道错误码则抛出业务异常提示用户
if (StrUtil.isNotEmpty(unifiedOrderResp.getChannelErrorCode())) {
throw exception(ORDER_SUBMIT_CHANNEL_ERROR, unifiedOrderResp.getChannelErrorCode(),
throw exception(PAY_ORDER_SUBMIT_CHANNEL_ERROR, unifiedOrderResp.getChannelErrorCode(),
unifiedOrderResp.getChannelErrorMsg());
}
// 此处需要读取最新的状态
@ -172,16 +172,16 @@ public class PayOrderServiceImpl implements PayOrderService {
private PayOrderDO validateOrderCanSubmit(Long id) {
PayOrderDO order = orderMapper.selectById(id);
if (order == null) { // 是否存在
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
if (PayOrderStatusEnum.isSuccess(order.getStatus())) { // 校验状态发现已支付
throw exception(ORDER_STATUS_IS_SUCCESS);
throw exception(PAY_ORDER_STATUS_IS_SUCCESS);
}
if (!PayOrderStatusEnum.WAITING.getStatus().equals(order.getStatus())) { // 校验状态必须是待支付
throw exception(ORDER_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
}
if (LocalDateTimeUtils.beforeNow(order.getExpireTime())) { // 校验是否过期
throw exception(ORDER_IS_EXPIRED);
throw exception(PAY_ORDER_IS_EXPIRED);
}
// 重要校验是否支付拓展单已支付只是没有回调或者数据不正常
@ -202,7 +202,7 @@ public class PayOrderServiceImpl implements PayOrderService {
if (PayOrderStatusEnum.isSuccess(orderExtension.getStatus())) {
log.warn("[validateOrderCanSubmit][order({}) 的 extension({}) 已支付,可能是数据不一致]",
id, orderExtension.getId());
throw exception(ORDER_EXTENSION_IS_PAID);
throw exception(PAY_ORDER_EXTENSION_IS_PAID);
}
// 情况二调用三方接口查询支付单状态是不是已支付
PayClient payClient = payClientFactory.getPayClient(orderExtension.getChannelId());
@ -214,7 +214,7 @@ public class PayOrderServiceImpl implements PayOrderService {
if (respDTO != null && PayOrderStatusRespEnum.isSuccess(respDTO.getStatus())) {
log.warn("[validateOrderCanSubmit][order({}) 的 PayOrderRespDTO({}) 已支付,可能是回调延迟]",
id, toJsonString(respDTO));
throw exception(ORDER_EXTENSION_IS_PAID);
throw exception(PAY_ORDER_EXTENSION_IS_PAID);
}
});
}
@ -254,9 +254,10 @@ public class PayOrderServiceImpl implements PayOrderService {
* 通知并更新订单的支付结果
*
* @param channel 支付渠道
* @param notify 通知
* @param notify 通知
*/
@Transactional(rollbackFor = Exception.class) // 注意如果是方法内调用该方法需要通过 getSelf().notifyPayOrder(channel, notify) 调用否则事务不生效
@Transactional(rollbackFor = Exception.class)
// 注意如果是方法内调用该方法需要通过 getSelf().notifyPayOrder(channel, notify) 调用否则事务不生效
public void notifyOrder(PayChannelDO channel, PayOrderRespDTO notify) {
// 情况一支付成功的回调
if (PayOrderStatusRespEnum.isSuccess(notify.getStatus())) {
@ -295,21 +296,21 @@ public class PayOrderServiceImpl implements PayOrderService {
// 1. 查询 PayOrderExtensionDO
PayOrderExtensionDO orderExtension = orderExtensionMapper.selectByNo(notify.getOutTradeNo());
if (orderExtension == null) {
throw exception(ORDER_EXTENSION_NOT_FOUND);
throw exception(PAY_ORDER_EXTENSION_NOT_FOUND);
}
if (PayOrderStatusEnum.isSuccess(orderExtension.getStatus())) { // 如果已经是成功直接返回不用重复更新
log.info("[updateOrderExtensionSuccess][orderExtension({}) 已经是已支付,无需更新]", orderExtension.getId());
return orderExtension;
}
if (ObjectUtil.notEqual(orderExtension.getStatus(), PayOrderStatusEnum.WAITING.getStatus())) { // 校验状态必须是待支付
throw exception(ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
// 2. 更新 PayOrderExtensionDO
int updateCounts = orderExtensionMapper.updateByIdAndStatus(orderExtension.getId(), orderExtension.getStatus(),
PayOrderExtensionDO.builder().status(PayOrderStatusEnum.SUCCESS.getStatus()).channelNotifyData(toJsonString(notify)).build());
if (updateCounts == 0) { // 校验状态必须是待支付
throw exception(ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
log.info("[updateOrderExtensionSuccess][orderExtension({}) 更新为已支付]", orderExtension.getId());
return orderExtension;
@ -318,17 +319,17 @@ public class PayOrderServiceImpl implements PayOrderService {
/**
* 更新 PayOrderDO 支付成功
*
* @param channel 支付渠道
* @param channel 支付渠道
* @param orderExtension 支付拓展单
* @param notify 通知回调
* @param notify 通知回调
* @return 是否之前已经成功回调
*/
private Boolean updateOrderSuccess(PayChannelDO channel, PayOrderExtensionDO orderExtension,
PayOrderRespDTO notify) {
PayOrderRespDTO notify) {
// 1. 判断 PayOrderDO 是否处于待支付
PayOrderDO order = orderMapper.selectById(orderExtension.getOrderId());
if (order == null) {
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
if (PayOrderStatusEnum.isSuccess(order.getStatus()) // 如果已经是成功直接返回不用重复更新
&& Objects.equals(order.getExtensionId(), orderExtension.getId())) {
@ -336,7 +337,7 @@ public class PayOrderServiceImpl implements PayOrderService {
return true;
}
if (!PayOrderStatusEnum.WAITING.getStatus().equals(order.getStatus())) { // 校验状态必须是待支付
throw exception(ORDER_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
}
// 2. 更新 PayOrderDO
@ -346,10 +347,10 @@ public class PayOrderServiceImpl implements PayOrderService {
.successTime(notify.getSuccessTime()).extensionId(orderExtension.getId()).no(orderExtension.getNo())
.channelOrderNo(notify.getChannelOrderNo()).channelUserId(notify.getChannelUserId())
.channelFeeRate(channel.getFeeRate())
.channelFeePrice(MoneyUtils.calculateRatePrice(order.getPrice(), channel.getFeeRate()))
.channelFeePrice(MoneyUtils.calculateRatePrice(order.getPrice(), channel.getFeeRate()))
.build());
if (updateCounts == 0) { // 校验状态必须是待支付
throw exception(ORDER_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
}
log.info("[updateOrderExtensionSuccess][order({}) 更新为已支付]", order.getId());
return false;
@ -363,7 +364,7 @@ public class PayOrderServiceImpl implements PayOrderService {
// 1. 查询 PayOrderExtensionDO
PayOrderExtensionDO orderExtension = orderExtensionMapper.selectByNo(notify.getOutTradeNo());
if (orderExtension == null) {
throw exception(ORDER_EXTENSION_NOT_FOUND);
throw exception(PAY_ORDER_EXTENSION_NOT_FOUND);
}
if (PayOrderStatusEnum.isClosed(orderExtension.getStatus())) { // 如果已经是关闭直接返回不用重复更新
log.info("[updateOrderExtensionClosed][orderExtension({}) 已经是支付关闭,无需更新]", orderExtension.getId());
@ -375,7 +376,7 @@ public class PayOrderServiceImpl implements PayOrderService {
return;
}
if (ObjectUtil.notEqual(orderExtension.getStatus(), PayOrderStatusEnum.WAITING.getStatus())) { // 校验状态必须是待支付
throw exception(ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
// 2. 更新 PayOrderExtensionDO
@ -383,7 +384,7 @@ public class PayOrderServiceImpl implements PayOrderService {
PayOrderExtensionDO.builder().status(PayOrderStatusEnum.CLOSED.getStatus()).channelNotifyData(toJsonString(notify))
.channelErrorCode(notify.getChannelErrorCode()).channelErrorMsg(notify.getChannelErrorMsg()).build());
if (updateCounts == 0) { // 校验状态必须是待支付
throw exception(ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
throw exception(PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
log.info("[updateOrderExtensionClosed][orderExtension({}) 更新为支付关闭]", orderExtension.getId());
}
@ -392,10 +393,10 @@ public class PayOrderServiceImpl implements PayOrderService {
public void updateOrderRefundPrice(Long id, Integer incrRefundPrice) {
PayOrderDO order = orderMapper.selectById(id);
if (order == null) {
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
if (!PayOrderStatusEnum.isSuccessOrRefund(order.getStatus())) {
throw exception(ORDER_REFUND_FAIL_STATUS_ERROR);
throw exception(PAY_ORDER_REFUND_FAIL_STATUS_ERROR);
}
if (order.getRefundPrice() + incrRefundPrice > order.getPrice()) {
throw exception(REFUND_PRICE_EXCEED);
@ -407,16 +408,21 @@ public class PayOrderServiceImpl implements PayOrderService {
.setStatus(PayOrderStatusEnum.REFUND.getStatus());
int updateCount = orderMapper.updateByIdAndStatus(id, order.getStatus(), updateObj);
if (updateCount == 0) {
throw exception(ORDER_REFUND_FAIL_STATUS_ERROR);
throw exception(PAY_ORDER_REFUND_FAIL_STATUS_ERROR);
}
}
@Override
public void updatePayOrderPriceById(Long payOrderId, Integer payPrice) {
// TODO @puhui999不能直接这样修改哈应该只有未支付状态的订单才可以改另外如果价格如果没变可以直接 return
PayOrderDO order = orderMapper.selectById(payOrderId);
public void updatePayOrderPrice(Long id, Integer payPrice) {
PayOrderDO order = orderMapper.selectById(id);
if (order == null) {
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
if (ObjectUtil.notEqual(PayOrderStatusEnum.WAITING.getStatus(), order.getStatus())) {
throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING);
}
if (ObjectUtil.equal(order.getPrice(), payPrice)) {
return;
}
order.setPrice(payPrice);

View File

@ -160,11 +160,11 @@ public class PayRefundServiceImpl implements PayRefundService {
private PayOrderDO validatePayOrderCanRefund(PayRefundCreateReqDTO reqDTO) {
PayOrderDO order = orderService.getOrder(reqDTO.getAppId(), reqDTO.getMerchantOrderId());
if (order == null) {
throw exception(ORDER_NOT_FOUND);
throw exception(PAY_ORDER_NOT_FOUND);
}
// 校验状态必须是已支付或者已退款
if (!PayOrderStatusEnum.isSuccessOrRefund(order.getStatus())) {
throw exception(ORDER_REFUND_FAIL_STATUS_ERROR);
throw exception(PAY_ORDER_REFUND_FAIL_STATUS_ERROR);
}
// 校验金额退款金额不能大于原定的金额

View File

@ -74,7 +74,7 @@ public class PayWalletServiceImpl implements PayWalletService {
// 1. 判断支付交易拓展单是否存
PayOrderExtensionDO orderExtension = orderService.getOrderExtensionByNo(outTradeNo);
if (orderExtension == null) {
throw exception(ORDER_EXTENSION_NOT_FOUND);
throw exception(PAY_ORDER_EXTENSION_NOT_FOUND);
}
// 2. 扣减余额
return reduceWalletBalance(userId, userType, orderExtension.getOrderId(), PAYMENT, price);

View File

@ -261,7 +261,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
String userIp = randomString();
// 调用, 并断言异常
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), ORDER_NOT_FOUND);
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), PAY_ORDER_NOT_FOUND);
}
@Test
@ -274,7 +274,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
String userIp = randomString();
// 调用, 并断言异常
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), ORDER_STATUS_IS_NOT_WAITING);
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), PAY_ORDER_STATUS_IS_NOT_WAITING);
}
@Test
@ -287,7 +287,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
String userIp = randomString();
// 调用, 并断言异常
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), ORDER_STATUS_IS_SUCCESS);
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), PAY_ORDER_STATUS_IS_SUCCESS);
}
@Test
@ -301,7 +301,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
String userIp = randomString();
// 调用, 并断言异常
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), ORDER_IS_EXPIRED);
assertServiceException(() -> orderService.submitOrder(reqVO, userIp), PAY_ORDER_IS_EXPIRED);
}
@Test
@ -366,7 +366,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.submitOrder(reqVO, userIp),
ORDER_SUBMIT_CHANNEL_ERROR, "001", "模拟异常");
PAY_ORDER_SUBMIT_CHANNEL_ERROR, "001", "模拟异常");
// 断言数据记录PayOrderExtensionDO
PayOrderExtensionDO orderExtension = orderExtensionMapper.selectOne(null);
assertNotNull(orderExtension);
@ -450,7 +450,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.validateOrderActuallyPaid(id),
ORDER_EXTENSION_IS_PAID);
PAY_ORDER_EXTENSION_IS_PAID);
}
@Test
@ -469,7 +469,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.validateOrderActuallyPaid(id),
ORDER_EXTENSION_IS_PAID);
PAY_ORDER_EXTENSION_IS_PAID);
}
@Test
@ -519,7 +519,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_EXTENSION_NOT_FOUND);
PAY_ORDER_EXTENSION_NOT_FOUND);
}
@Test
@ -537,7 +537,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
@Test
@ -555,7 +555,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_NOT_FOUND);
PAY_ORDER_NOT_FOUND);
// 断言 PayOrderExtensionDO 数据更新被回滚
assertPojoEquals(orderExtension, orderExtensionMapper.selectOne(null));
}
@ -588,7 +588,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_STATUS_IS_NOT_WAITING);
PAY_ORDER_STATUS_IS_NOT_WAITING);
// 断言 PayOrderExtensionDO 数据未更新因为它是 SUCCESS
assertPojoEquals(orderExtension, orderExtensionMapper.selectOne(null));
}
@ -673,7 +673,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_EXTENSION_NOT_FOUND);
PAY_ORDER_EXTENSION_NOT_FOUND);
}
@Test
@ -729,7 +729,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.notifyOrder(channel, notify),
ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING);
}
@Test
@ -762,7 +762,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.updateOrderRefundPrice(id, incrRefundPrice),
ORDER_NOT_FOUND);
PAY_ORDER_NOT_FOUND);
}
@Test
@ -786,7 +786,7 @@ public class PayOrderServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> orderService.updateOrderRefundPrice(id, incrRefundPrice),
ORDER_REFUND_FAIL_STATUS_ERROR);
PAY_ORDER_REFUND_FAIL_STATUS_ERROR);
}
@Test

View File

@ -219,7 +219,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> refundService.createPayRefund(reqDTO),
ORDER_NOT_FOUND);
PAY_ORDER_NOT_FOUND);
}
@Test
@ -245,7 +245,7 @@ public class PayRefundServiceTest extends BaseDbAndRedisUnitTest {
// 调用并断言异常
assertServiceException(() -> refundService.createPayRefund(reqDTO),
ORDER_REFUND_FAIL_STATUS_ERROR);
PAY_ORDER_REFUND_FAIL_STATUS_ERROR);
}
@Test