|
|
@@ -76,6 +76,9 @@ public class PaymentService implements PaymentServiceInterface {
|
|
|
@Value("${wechat.notify-url}")
|
|
|
private String notifyUrl;
|
|
|
|
|
|
+ @Value("${wechat.test-mode:false}")
|
|
|
+ private boolean testMode;
|
|
|
+
|
|
|
private PrivateKey privateKey;
|
|
|
private final OkHttpClient httpClient;
|
|
|
|
|
|
@@ -89,6 +92,10 @@ public class PaymentService implements PaymentServiceInterface {
|
|
|
|
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
+ if (testMode) {
|
|
|
+ log.info("微信支付使用测试模式,跳过私钥加载");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (privateKeyPath != null && !privateKeyPath.isEmpty()) {
|
|
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
|
|
|
new FileInputStream(privateKeyPath), StandardCharsets.UTF_8))) {
|