mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-23 10:31:52 +08:00
银联基础完成
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.egzosn.pay.common.api;
|
||||
|
||||
import com.egzosn.pay.common.bean.MsgType;
|
||||
import com.egzosn.pay.common.bean.result.PayException;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
import com.egzosn.pay.common.util.sign.CertDescriptor;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -15,11 +18,19 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
|
||||
/**
|
||||
* 证书管理器
|
||||
*/
|
||||
private volatile CertDescriptor certDescriptor;
|
||||
|
||||
/**
|
||||
* 应用私钥,rsa_private pkcs8格式 生成签名时使用
|
||||
*/
|
||||
private volatile String keyPrivate;
|
||||
/**
|
||||
* 应用私钥,rsa_private pkcs8格式 生成签名时使用
|
||||
*/
|
||||
private volatile String keyPrivateCertPwd;
|
||||
/**
|
||||
* 支付平台公钥(签名校验使用)
|
||||
*/
|
||||
@@ -70,6 +81,21 @@ public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
*/
|
||||
private boolean isTest = false;
|
||||
|
||||
/**
|
||||
* 是否为证书签名
|
||||
*/
|
||||
private boolean isCertSign = false;
|
||||
|
||||
|
||||
public CertDescriptor getCertDescriptor() {
|
||||
if (!isCertSign){
|
||||
throw new PayErrorException(new PayException("certDescriptor fail", "isCertSign is false"));
|
||||
}
|
||||
if(null == certDescriptor){
|
||||
certDescriptor = new CertDescriptor();
|
||||
}
|
||||
return certDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyPrivate() {
|
||||
@@ -80,6 +106,14 @@ public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
this.keyPrivate = keyPrivate;
|
||||
}
|
||||
|
||||
public String getKeyPrivateCertPwd() {
|
||||
return keyPrivateCertPwd;
|
||||
}
|
||||
|
||||
public void setKeyPrivateCertPwd(String keyPrivateCertPwd) {
|
||||
this.keyPrivateCertPwd = keyPrivateCertPwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyPublic() {
|
||||
return keyPublic;
|
||||
@@ -207,4 +241,15 @@ public abstract class BasePayConfigStorage implements PayConfigStorage{
|
||||
public void setTest(boolean test) {
|
||||
isTest = test;
|
||||
}
|
||||
|
||||
public boolean isCertSign() {
|
||||
return isCertSign;
|
||||
}
|
||||
|
||||
public void setCertSign(boolean certSign) {
|
||||
isCertSign = certSign;
|
||||
if (certSign){
|
||||
certDescriptor = new CertDescriptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.egzosn.pay.common.api;
|
||||
|
||||
import com.egzosn.pay.common.bean.MsgType;
|
||||
import com.egzosn.pay.common.util.sign.CertDescriptor;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
@@ -14,6 +15,17 @@ import java.util.concurrent.locks.Lock;
|
||||
*/
|
||||
public interface PayConfigStorage {
|
||||
|
||||
/**
|
||||
* 获取证书解释器
|
||||
* @return 证书解释器
|
||||
*/
|
||||
CertDescriptor getCertDescriptor();
|
||||
|
||||
/**
|
||||
* 获取私钥证书密码
|
||||
* @return 私钥证书密码
|
||||
*/
|
||||
String getKeyPrivateCertPwd();
|
||||
/**
|
||||
* 应用id
|
||||
* @return 应用id
|
||||
|
||||
Reference in New Issue
Block a user