package com.mcwl.web.controller.rabbitmq.config;

import com.alipay.easysdk.kernel.Config;
import com.mcwl.common.config.BusinessConfig;
import com.mcwl.common.domain.AliPayProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**支付宝配置
 * @Author：ChenYan
 * @Project：McWl
 * @Package：com.mcwl.common.config
 * @Filename：AliPayConfig
 * @Description  支付宝配置
 * @Date：2025/1/3 18:45
 */
@Configuration
public class AliPayConfig {

    @Autowired
    private BusinessConfig businessConfig;

    @Bean
    public Config config() {
        AliPayProperties aliPayConfig = businessConfig.getAliPayConfig();
        Config config = new Config();
        config.protocol = aliPayConfig.getProtocol();
        config.gatewayHost = aliPayConfig.getGatewayHost();
        config.signType = aliPayConfig.getSignType();
        config.appId = aliPayConfig.getAppId();
        config.merchantPrivateKey = aliPayConfig.getPrivateKey();
        config.alipayPublicKey = aliPayConfig.getPublicKey();
        config.notifyUrl = aliPayConfig.getNotifyUrl();
        return config;
    }
}
