mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
🎨 weixin-java-pay模块去除jackson依赖,调整相关代码
This commit is contained in:
parent
1eec0f4bfa
commit
fd58b3f212
@ -70,12 +70,6 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- 待优化去掉 -->
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.0.pr1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
@ -1,16 +1,17 @@
|
||||
package com.github.binarywang.wxpay.v3.auth;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.binarywang.wxpay.v3.Credentials;
|
||||
import com.github.binarywang.wxpay.v3.Validator;
|
||||
import com.github.binarywang.wxpay.v3.WxPayV3HttpClientBuilder;
|
||||
import com.github.binarywang.wxpay.v3.util.AesUtils;
|
||||
import com.github.binarywang.wxpay.v3.util.PemUtils;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxRuntimeException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
@ -158,15 +159,15 @@ public class AutoUpdateCertificatesVerifier implements Verifier {
|
||||
*/
|
||||
private List<X509Certificate> deserializeToCerts(byte[] apiV3Key, String body) throws GeneralSecurityException, IOException {
|
||||
AesUtils aesUtils = new AesUtils(apiV3Key);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode dataNode = mapper.readTree(body).get("data");
|
||||
final JsonObject json = GsonParser.parse(body);
|
||||
final JsonArray dataNode = json.getAsJsonArray("data");
|
||||
if (dataNode == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<X509Certificate> newCertList = new ArrayList<>();
|
||||
for (int i = 0, count = dataNode.size(); i < count; i++) {
|
||||
JsonNode encryptCertificateNode = dataNode.get(i).get("encrypt_certificate");
|
||||
final JsonObject encryptCertificateNode = ((JsonObject) dataNode.get(i)).getAsJsonObject("encrypt_certificate");
|
||||
//解密
|
||||
String cert = aesUtils.decryptToString(
|
||||
encryptCertificateNode.get("associated_data").toString().replaceAll("\"", "")
|
||||
|
Loading…
Reference in New Issue
Block a user