package com.kmall.manager.manager.pay.global;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author Scott Chen
 * @since 1.0
 * 2018-09-27
 */
@Component
public class CommonWxGlobalPayPropertiesConfiguration {
    private static final String PROD = "prod";
    private static final String DEV = "dev";

    @Value("${pay.wx.global.env}")
    private String evn = PROD;

    @Autowired
    private CommonWxGlobalPayProdProperties commonWxGlobalPayProdProperties;

    @Autowired
    private CommonWxGlobalPayDevProperties commonWxGlobalPayDevProperties;

    @Bean
    public CommonWxGlobalPayProperties commonWxGlobalPayProperties(){
        if (evn.equalsIgnoreCase(PROD)) {
            return commonWxGlobalPayProdProperties;
        }else {
            return commonWxGlobalPayDevProperties;
        }
    }

}
