mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-07 19:46:15 +08:00
移除已废弃的字段与方法
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package com.egzosn.pay.union.api;
|
||||
|
||||
import com.egzosn.pay.common.api.BasePayConfigStorage;
|
||||
import com.egzosn.pay.common.bean.CertStoreType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.egzosn.pay.common.api.BasePayConfigStorage;
|
||||
import com.egzosn.pay.common.bean.CertStoreType;
|
||||
|
||||
|
||||
/**
|
||||
* @author Actinia
|
||||
* <p>
|
||||
* <pre>
|
||||
* <p>
|
||||
* <pre>
|
||||
* email hayesfu@qq.com
|
||||
* create 2017 2017/11/4 0004
|
||||
* </pre>
|
||||
@@ -64,17 +64,18 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
* 设置私钥证书
|
||||
*
|
||||
* @param certificate 私钥证书地址 或者证书内容字符串
|
||||
* 私钥证书密码 {@link #setKeyPrivateCertPwd(String)}
|
||||
* 私钥证书密码 {@link #setKeyPrivateCertPwd(String)}
|
||||
*/
|
||||
public void setKeyPrivateCert(String certificate) {
|
||||
super.setKeyPrivate(certificate);
|
||||
this.keyPrivateCert = certificate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置私钥证书
|
||||
*
|
||||
* @param keyPrivateCert 私钥证书信息流
|
||||
* 私钥证书密码 {@link #setKeyPrivateCertPwd(String)}
|
||||
* 私钥证书密码 {@link #setKeyPrivateCertPwd(String)}
|
||||
*/
|
||||
public void setKeyPrivateCert(InputStream keyPrivateCert) {
|
||||
this.keyPrivateCert = keyPrivateCert;
|
||||
@@ -92,6 +93,7 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
public void setAcpMiddleCert(String acpMiddleCert) {
|
||||
this.acpMiddleCert = acpMiddleCert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置中级证书
|
||||
*
|
||||
@@ -109,6 +111,7 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
public void setAcpRootCert(String acpRootCert) {
|
||||
this.acpRootCert = acpRootCert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置根证书
|
||||
*
|
||||
@@ -125,6 +128,7 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
public String getAcpRootCert() {
|
||||
return (String) acpRootCert;
|
||||
}
|
||||
|
||||
public InputStream getAcpMiddleCertInputStream() throws IOException {
|
||||
return certStoreType.getInputStream(acpMiddleCert);
|
||||
}
|
||||
@@ -135,6 +139,7 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
|
||||
/**
|
||||
* 获取私钥证书密码
|
||||
*
|
||||
* @return 私钥证书密码
|
||||
*/
|
||||
public String getKeyPrivateCertPwd() {
|
||||
@@ -144,11 +149,23 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
public void setKeyPrivateCertPwd(String keyPrivateCertPwd) {
|
||||
this.keyPrivateCertPwd = keyPrivateCertPwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppid() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用id
|
||||
* 纠正名称
|
||||
*
|
||||
* @return 应用id
|
||||
*/
|
||||
@Override
|
||||
public String getAppId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 合作者id
|
||||
* @see #getPid()
|
||||
@@ -214,6 +231,7 @@ public class UnionPayConfigStorage extends BasePayConfigStorage {
|
||||
|
||||
/**
|
||||
* 证书存储类型
|
||||
*
|
||||
* @return 证书存储类型
|
||||
*/
|
||||
public CertStoreType getCertStoreType() {
|
||||
|
||||
@@ -1,8 +1,37 @@
|
||||
package com.egzosn.pay.union.api;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.cert.CertPathBuilder;
|
||||
import java.security.cert.CertStore;
|
||||
import java.security.cert.CertificateExpiredException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.CollectionCertStoreParameters;
|
||||
import java.security.cert.PKIXBuilderParameters;
|
||||
import java.security.cert.TrustAnchor;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.egzosn.pay.common.api.BasePayService;
|
||||
import com.egzosn.pay.common.bean.*;
|
||||
import com.egzosn.pay.common.bean.MethodType;
|
||||
import com.egzosn.pay.common.bean.PayMessage;
|
||||
import com.egzosn.pay.common.bean.PayOrder;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.bean.RefundOrder;
|
||||
import com.egzosn.pay.common.bean.TransactionType;
|
||||
import com.egzosn.pay.common.bean.outbuilder.PayTextOutMessage;
|
||||
import com.egzosn.pay.common.bean.result.PayException;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
@@ -20,19 +49,6 @@ import com.egzosn.pay.union.bean.UnionPayMessage;
|
||||
import com.egzosn.pay.union.bean.UnionRefundResult;
|
||||
import com.egzosn.pay.union.bean.UnionTransactionType;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Actinia
|
||||
* <pre>
|
||||
@@ -95,7 +111,8 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
certDescriptor.initPrivateSignCert(payConfigStorage.getKeyPrivateCertInputStream(), payConfigStorage.getKeyPrivateCertPwd(), "PKCS12");
|
||||
certDescriptor.initPublicCert(payConfigStorage.getAcpMiddleCertInputStream());
|
||||
certDescriptor.initRootCert(payConfigStorage.getAcpRootCertInputStream());
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
|
||||
@@ -192,7 +209,6 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
* @param sign 签名原文
|
||||
* @return 签名校验 true通过
|
||||
*/
|
||||
@Override
|
||||
public boolean signVerify(Map<String, Object> params, String sign) {
|
||||
SignUtils signUtils = SignUtils.valueOf(payConfigStorage.getSignType());
|
||||
|
||||
@@ -214,17 +230,6 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝需要,微信是否也需要再次校验来源,进行订单查询
|
||||
* 校验数据来源
|
||||
*
|
||||
* @param id 业务id, 数据的真实性.
|
||||
* @return true通过
|
||||
*/
|
||||
@Override
|
||||
public boolean verifySource(String id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单超时时间。
|
||||
@@ -371,11 +376,14 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
/*PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult)*/
|
||||
builder.build(pkixParams);
|
||||
return cert;
|
||||
} catch (java.security.cert.CertPathBuilderException e) {
|
||||
}
|
||||
catch (java.security.cert.CertPathBuilderException e) {
|
||||
LOG.error("verify certificate chain fail.", e);
|
||||
} catch (CertificateExpiredException e) {
|
||||
}
|
||||
catch (CertificateExpiredException e) {
|
||||
LOG.error(e);
|
||||
} catch (GeneralSecurityException e) {
|
||||
}
|
||||
catch (GeneralSecurityException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
return null;
|
||||
@@ -403,7 +411,8 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(UnionTransactionType.WEB);
|
||||
} else if (UnionTransactionType.WEB != order.getTransactionType() && UnionTransactionType.WAP != order.getTransactionType() && UnionTransactionType.B2B != order.getTransactionType()) {
|
||||
}
|
||||
else if (UnionTransactionType.WEB != order.getTransactionType() && UnionTransactionType.WAP != order.getTransactionType() && UnionTransactionType.B2B != order.getTransactionType()) {
|
||||
throw new PayErrorException(new PayException("-1", "错误的交易类型:" + order.getTransactionType()));
|
||||
}
|
||||
|
||||
@@ -456,7 +465,8 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
InputStream tIn = new ByteArrayInputStream(x509CertString.getBytes("ISO-8859-1"));
|
||||
x509Cert = (X509Certificate) cf.generateCertificate(tIn);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new PayErrorException(new PayException("证书加载失败", "gen certificate error:" + e.getLocalizedMessage()));
|
||||
}
|
||||
return x509Cert;
|
||||
@@ -675,19 +685,6 @@ public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param tradeNoOrBillDate 支付平台订单号或者账单类型, 具体请
|
||||
* 类型为{@link String }或者 {@link Date },类型须强制限制,类型不对应则抛出异常{@link PayErrorException}
|
||||
* @param outTradeNoBillType 商户单号或者 账单类型
|
||||
* @param transactionType 交易类型
|
||||
* @return 返回支付方对应接口的结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> secondaryInterface(Object tradeNoOrBillDate, String outTradeNoBillType, TransactionType transactionType) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建消息
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user