package com.izouma.nineth.config;

import cn.com.sandpay.cashier.sdk.CertUtil;
import lombok.AllArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
@AllArgsConstructor
@EnableConfigurationProperties({SandPayProperties.class})
public class SandPayConfig {

    private final SandPayProperties sandPayProperties;

    @PostConstruct
    public void init() {
        try {
            CertUtil.init(sandPayProperties.getSandCertPath(), sandPayProperties.getSignCertPath(), sandPayProperties.getSignCertPwd());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
