All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taotao.cloud.pay.wxpay.wx.WxPayAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 2024.09
Show newest version
package com.taotao.cloud.pay.wxpay.wx;

import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @author lingting 2021/1/25 11:30
 */
@AutoConfiguration
@ConditionalOnClass(WxPay.class)
@EnableConfigurationProperties(WxPayProperties.class)
public class WxPayAutoConfiguration {

	@Bean
	@ConditionalOnMissingBean(WxPay.class)
	public WxPay wxPay(WxPayProperties properties) {
		// 获取配置
		WxPayProperties.Config config =
			properties.isSandbox() ? properties.getDev() : properties.getProd();

		WxPay wxPay = new WxPay(config.getAppId(), config.getMchId(), config.getMckKey(),
			properties.isSandbox());

		wxPay.setReturnUrl(config.getReturnUrl());
		wxPay.setNotifyUrl(config.getNotifyUrl());
		return wxPay;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy