package com.sptg.pay.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.pay.api.entity.UserOrder;
import com.sptg.pay.api.feigns.WxPayFeign;
import com.sptg.pay.api.vo.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author zwx
 * @create 2020/6/20 18:36
 */
@Component
@Slf4j
public class WxPayFeignFallbackFactory implements FallbackFactory<WxPayFeign> {


    @Override
    public WxPayFeign create(Throwable throwable) {
        return new WxPayFeign() {
            @Override
            public AjaxResult appPay(Map<String, Object> map) {
                log.error(ResultEnum.ERROR.getCode(),throwable);
                return null;
            }

            @Override
            public AjaxResult orderQuery(UserOrder userOrder) {
                log.error(ResultEnum.ERROR.getCode(),throwable);
                return null;
            }

            @Override
            public Map<String, Object> refund(Map<String, String> map) {
                log.error(ResultEnum.ERROR.getCode(),throwable);
                return null;
            }
        };
    }
}
