package com.yuchen.saas.payment.api.feign.setting;

import com.yuchen.saas.payment.api.entity.setting.SaasPaymentApplyWalletConfig;
import com.yuchen.saas.payment.api.entity.setting.SaasPaymentSiteConfig;
import com.yuchen.saas.payment.api.util.PayFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhouhanwei
 * @create 2024/7/24 15:20
 */
@Component
public class PaymentSettingFeignFallBack implements FallbackFactory<PaymentSettingFeign> {
    @Override
    public PaymentSettingFeign create(Throwable throwable) {
        return new PaymentSettingFeign() {

            @Override
            public R<List<SaasPaymentSiteConfig>> getPaymentSiteConfigList(Long siteId, String collectFeeModel) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<SaasPaymentSiteConfig>> getPaymentSiteConfigListBySiteIdList(List<Long> siteIdList) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<SaasPaymentApplyWalletConfig>> getPaymentApplyWalletConfigList(Long applyId) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
