update 订单逻辑改造工厂模式

This commit is contained in:
2023-09-01 17:33:32 +08:00
parent 45af011278
commit 32597db1ba
2 changed files with 7 additions and 15 deletions

View File

@@ -521,22 +521,14 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
BigDecimal deductionAmount = vo.getDeductionAmount();
// 调汇付的交易撤销接口
// PaymentReverseResponse paymentReverseRequest = adapayService.createPaymentReverseRequest(paymentId, deductionAmount, dto.getWechatAppId(),
// dto.getMemberId(), ScenarioEnum.BALANCE.getValue(), null);
PaymentReverseResponse request = adapayService.createPaymentReverseRequest(paymentId, deductionAmount,
dto.getWechatAppId(), dto.getMemberId(), ScenarioEnum.BALANCE.getValue(), null);
PaymentReverseOperation operation = new PaymentReverseOperation();
operation.setPaymentId(paymentId);
operation.setReverseAmt(deductionAmount);
operation.setMerchantKey(dto.getWechatAppId());
operation.setMemberId(dto.getMemberId());
operation.setScenarioType(ScenarioEnum.BALANCE.getValue());
PaymentReverseResponse paymentReverseRequest = adapayService.createPaymentReverseRequest(operation);
if (paymentReverseRequest != null && paymentReverseRequest.isNotFailed()) {
if (request != null && request.isNotFailed()) {
memberAdapayRecordService.updateRefundAmount(paymentId, deductionAmount);
// 放缓存
redisCache.setCacheObject(redisKey, paymentReverseRequest, CacheConstants.cache_expire_time_30m);
redisCache.setCacheObject(redisKey, request, CacheConstants.cache_expire_time_30m);
}
}
}

View File

@@ -493,14 +493,14 @@ public class NotDelayMerchantOrderLogic extends AbstractOrderLogic{
BigDecimal deductionAmount = vo.getDeductionAmount();
// 调汇付的交易退款接口
RefundResponse refundRequest = adapayService.createRefundRequest(paymentId, refundAmount,
RefundResponse response = adapayService.createRefundRequest(paymentId, refundAmount,
dto.getWechatAppId(), dto.getMemberId(), ScenarioEnum.ORDER.getValue(), dto.getOrderCode());
if (refundRequest != null && refundRequest.isNotFailed()) {
if (response != null && response.isNotFailed()) {
memberAdapayRecordService.updateRefundAmount(paymentId, deductionAmount);
// 放缓存
redisCache.setCacheObject(redisKey, refundRequest, CacheConstants.cache_expire_time_30m);
redisCache.setCacheObject(redisKey, response, CacheConstants.cache_expire_time_30m);
}
}
}