运营端充值

This commit is contained in:
张松
2025-10-27 13:43:26 +08:00
parent 423b6f303f
commit 7bb6198798
9 changed files with 109 additions and 17 deletions

View File

@@ -34,6 +34,7 @@ import java.io.ByteArrayInputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Base64;
@@ -101,7 +102,7 @@ public class WxServiceImpl implements WxService {
private static String platformCertPath;
private static String platformCertNo;
private static String mchId;
private static String apiV3Key;
public static String apiV3Key;
private static String apiV2Key;
private static String notifyUrl;
private static String refundNotifyUrl;
@@ -322,6 +323,20 @@ public class WxServiceImpl implements WxService {
log.info(publicKey);
}
@Override
public String decryptToString(String associatedData, String nonceStr, String ciphertext) {
AesUtil aesUtil = new AesUtil(apiV3Key.getBytes(StandardCharsets.UTF_8));
try {
return aesUtil.decryptToString(
associatedData.getBytes(StandardCharsets.UTF_8),
nonceStr.getBytes(StandardCharsets.UTF_8),
ciphertext
);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
@Override
public Map<String, String> v3Pay(String openId, BigDecimal amount, String desc, String tradeNo, String type) {
if (desc == null) desc = "订单支付";
@@ -338,7 +353,7 @@ public class WxServiceImpl implements WxService {
String payInfo = JSONObject.toJSONString(model);
log.info("统一下单参数: {}", payInfo);
IJPayHttpResponse resp = null;
IJPayHttpResponse resp;
try {
resp = WxPayApi.v3(
RequestMethodEnum.POST,