🎨 格式化代码,增加部分注释

This commit is contained in:
xucun
2025-06-11 19:02:01 +08:00
parent a4fa017cec
commit 62eaf468fb
4 changed files with 12 additions and 12 deletions

View File

@@ -186,10 +186,7 @@ public class SignatureProvider {
* @return the boolean
*/
public boolean responseSignVerify(ResponseSignVerifyParams params) {
log.debug("responseSignVerify: {}", params);
log.debug("wechatpaySerial: {}", params.getWechatpaySerial());
boolean verifyResult= params.getWechatpaySerial().startsWith(PUBLIC_KYE_ID_PREFIX)?
responseSignVerifyWithWeChatPublicKeyInfo(params):
responseSignVerifyWithX509WechatCertificate(params);
@@ -197,10 +194,12 @@ public class SignatureProvider {
return verifyResult;
}
/***
*通过平台证书进行验签
*/
private boolean responseSignVerifyWithX509WechatCertificate(ResponseSignVerifyParams params){
log.debug("responseSignVerifyWithX509WechatCertificate: {}", params);
String wechatpaySerial = params.getWechatpaySerial();
X509WechatCertificateInfo certificate = CERTIFICATE_SET.stream()
.filter(cert -> Objects.equals(wechatpaySerial, cert.getWechatPaySerial()))
.findAny()
@@ -223,13 +222,12 @@ public class SignatureProvider {
}
}
/***
*通过微信支付公钥进行验签
*/
private boolean responseSignVerifyWithWeChatPublicKeyInfo(ResponseSignVerifyParams params){
log.debug("responseSignVerifyWithWeChatPublicKeyInfo: {}", params);
String wechatpaySerial = params.getWechatpaySerial();
log.debug("wechatpaySerial: {}", wechatpaySerial);
if (wechatpaySerial.startsWith(PUBLIC_KYE_ID_PREFIX)){
WeChatPublicKeyInfo info = PUBLIC_KEY_SET.stream()
.filter(key -> Objects.equals(wechatpaySerial, key.getPublicKeyId()))

View File

@@ -14,11 +14,9 @@ public class WeChatPublicKeyInfo {
private String tenantId;
public WeChatPublicKeyInfo(RSAPublicKey publicKey, String publicKeyId, String tenantId) {
this.publicKeyId = publicKeyId;
this.tenantId = tenantId;
this.publicKey = publicKey;
}
public WeChatPublicKeyInfo() {

View File

@@ -56,6 +56,12 @@ public class WechatDirectPayApi extends AbstractApi {
super(wechatPayClient, tenantId);
}
/**
* 付款码支付API
*
* @param payParams the pay params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> codePay(PayParams payParams) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.CODE, payParams)

View File

@@ -224,8 +224,6 @@ public class WechatPayClient {
String tenantId = Objects.requireNonNull(headers.get("Pay-TenantId")).get(0);
String authorization = signatureProvider.requestSign(tenantId, httpMethod.name(), canonicalUrl, body);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addAll(headers);
httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));