无关风月
2024-09-26 9a1173507d06c59a7c02e92ad083073e0036eadc
ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/factory/WxPaymentFallbackFactory.java
@@ -6,6 +6,8 @@
import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody;
import com.ruoyi.payment.api.vo.PaymentOrder;
import com.ruoyi.payment.api.vo.WxRefundNotifyResp;
import io.seata.core.exception.TransactionException;
import io.seata.tm.api.GlobalTransactionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@@ -31,12 +33,24 @@
    
            @Override
            public R<NotifyV3PayDecodeRespBody> queryOrderInfo(String orderId) {
                throw new RuntimeException("查询支付订单信息失败:" + throwable.getMessage());
                // 手动进行全局事务回滚
                try {
                    GlobalTransactionContext.getCurrent().rollback();
                } catch (TransactionException e) {
                    throw new RuntimeException(e);
                }
                return R.fail("查询支付订单信息失败:" + throwable.getMessage());
            }
    
            @Override
            public R<Map<String, Object>> orderPay(PaymentOrder paymentOrder) {
                throw new RuntimeException("调起微信支付失败:" + throwable.getMessage());
                // 手动进行全局事务回滚
                try {
                    GlobalTransactionContext.getCurrent().rollback();
                } catch (TransactionException e) {
                    throw new RuntimeException(e);
                }
                return R.fail("调起微信支付失败:" + throwable.getMessage());
            }
    
            @Override
@@ -51,13 +65,24 @@
            @Override
            public void close(String outTradeNo) {
                throw new RuntimeException("关闭支付订单失败:" + throwable.getMessage());
                // 手动进行全局事务回滚
                try {
                    GlobalTransactionContext.getCurrent().rollback();
                } catch (TransactionException e) {
                    throw new RuntimeException(e);
                }
                R.fail("关闭支付订单失败:" + throwable.getMessage());
            }
            @Override
            public R<String> refundOrderR(WxPaymentRefundModel model) {
                // 手动进行全局事务回滚
                try {
                    GlobalTransactionContext.getCurrent().rollback();
                } catch (TransactionException e) {
                    throw new RuntimeException(e);
                }
                return R.fail("微信退款失败:" + throwable.getMessage());
            }
    
            @Override