package com.heyu.api.config;

import com.heyu.api.jsapi.JsapiPrepay;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class JSAPIConfig {

    @Bean
    public JsapiPrepay jsapiPrepay(@Value("${eb.config.weixin.pay.mchid}") String mchid,
                                   @Value("${eb.config.weixin.pay.certificateSerialNo}") String certificateSerialNo,
                                   @Value("${eb.config.weixin.pay.privateKeyFilePath}") String privateKeyFilePath,
                                   @Value("${eb.config.weixin.pay.wechatPayPublicKeyId}") String wechatPayPublicKeyId,
                                   @Value("${eb.config.weixin.pay.wechatPayPublicKeyFilePath}") String wechatPayPublicKeyFilePath) {

        log.info("JSAPIConfig jsapiPrepay init mchid:{}," +
                        "certificateSerialNo:{}," +
                        "privateKeyFilePath:{}," +
                        "wechatPayPublicKeyId:{}," +
                        "wechatPayPublicKeyFilePath:{}",
                mchid, certificateSerialNo, privateKeyFilePath, wechatPayPublicKeyId, wechatPayPublicKeyFilePath);
        return new JsapiPrepay(mchid, certificateSerialNo, privateKeyFilePath, wechatPayPublicKeyId, wechatPayPublicKeyFilePath);
    }




}
