package com.ruoyi.web.core.config;
|
|
import com.lkl.laop.sdk.Config2;
|
import com.lkl.laop.sdk.LKLSDK;
|
import com.lkl.laop.sdk.exception.SDKException;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
@ConfigurationProperties(prefix = "lakala")
|
public class LakalaAlipayConfig {
|
|
public static String MerchantNo;
|
|
public static String TermNo;
|
|
public static String NotifyUrl;
|
|
|
|
public static String subAppId; // 微信商户appId
|
|
public static String appId; // 拉卡拉appId
|
|
public static String serialNo; // 你的证书序列号
|
|
/**
|
* 拉卡拉支付平台密钥
|
*/
|
public static String priKeyStr;
|
/**
|
* 拉卡拉支付平台证书
|
*/
|
|
public static String lklCerStr;
|
|
/**
|
* 拉卡拉支付平台证书2(用于拉卡拉通知验签)
|
*/
|
|
public static String lklNotifyCerStr;
|
|
/**
|
* 拉卡拉报文加密对称性密钥
|
*/
|
public static String sm4Key;
|
/**
|
* 服务地址
|
*/
|
public static String serverUrl;
|
|
public static String getMerchantNo() {
|
return MerchantNo;
|
}
|
|
public void setMerchantNo(String merchantNo) {
|
MerchantNo = merchantNo;
|
}
|
|
public static String getTermNo() {
|
return TermNo;
|
}
|
|
public void setTermNo(String termNo) {
|
TermNo = termNo;
|
}
|
|
public static String getNotifyUrl() {
|
return NotifyUrl;
|
}
|
|
public void setNotifyUrl(String notifyUrl) {
|
NotifyUrl = notifyUrl;
|
}
|
|
public static String getAppId() {
|
return appId;
|
}
|
|
public void setAppId(String appId) {
|
LakalaAlipayConfig.appId = appId;
|
}
|
|
public static String getSubAppId() {
|
return subAppId;
|
}
|
|
public void setSubAppId(String subAppId) {
|
LakalaAlipayConfig.subAppId = subAppId;
|
}
|
public static String getSerialNo() {
|
return serialNo;
|
}
|
|
public void setSerialNo(String serialNo) {
|
LakalaAlipayConfig.serialNo = serialNo;
|
}
|
|
public static String getPriKeyStr() {
|
return priKeyStr;
|
}
|
|
public void setPriKeyStr(String priKeyStr) {
|
LakalaAlipayConfig.priKeyStr = priKeyStr;
|
}
|
|
public static String getLklCerStr() {
|
return lklCerStr;
|
}
|
|
public void setLklCerStr(String lklCerStr) {
|
LakalaAlipayConfig.lklCerStr = lklCerStr;
|
}
|
|
public static String getLklNotifyCerStr() {
|
return lklNotifyCerStr;
|
}
|
|
public void setLklNotifyCerStr(String lklNotifyCerStr) {
|
LakalaAlipayConfig.lklNotifyCerStr = lklNotifyCerStr;
|
}
|
|
public static String getSm4Key() {
|
return sm4Key;
|
}
|
|
public void setSm4Key(String sm4Key) {
|
LakalaAlipayConfig.sm4Key = sm4Key;
|
}
|
|
public static String getServerUrl() {
|
return serverUrl;
|
}
|
|
public void setServerUrl(String serverUrl) {
|
LakalaAlipayConfig.serverUrl = serverUrl;
|
}
|
|
private static volatile boolean init = false;
|
|
/***
|
* @Description: 初始化设置商户公共参数(全局只需设置一次)
|
* @throws Exception
|
*/
|
public static void doInit() throws Exception {
|
if(!init) {
|
init = initByJava();
|
}
|
}
|
public static boolean initByJava() throws SDKException {
|
Config2 config = new Config2();
|
config.setAppId(appId);
|
config.setSerialNo(serialNo);
|
config.setPriKey(priKeyStr);
|
config.setLklCer(lklCerStr);
|
config.setLklNotifyCer(lklNotifyCerStr);
|
config.setServerUrl(serverUrl);
|
config.setSm4Key(sm4Key);
|
return LKLSDK.init(config);
|
|
}
|
}
|
|