| | |
| | | |
| | | @Component |
| | | public class WxV3PayConfig { |
| | | // 服务商AppId |
| | | |
| | | // AppId |
| | | private String appIdValue = "wx41d32f362ba0f911"; |
| | | public static String APP_ID= "wx41d32f362ba0f911"; |
| | | |
| | |
| | | private String mchIdValue= "1681873607"; |
| | | public static String Mch_ID= "1681873607"; |
| | | |
| | | // 平台收款商户号 todo 待申请 |
| | | // 平台收款商户号 弃用 |
| | | public static String smidVx= "2088330203191220"; |
| | | private String smidVxValue= "2088330203191220"; |
| | | |
| | |
| | | private String apiV3KeyValue= "1skiujh28376shznxmslwosiusytersq"; |
| | | public static String apiV3Key= "1skiujh28376shznxmslwosiusytersq"; |
| | | // 证书序列号 |
| | | |
| | | private String mchSerialNoValue= "55714944F7A7E52526F708280B176DCC838F371A"; |
| | | public static String mchSerialNo= "55714944F7A7E52526F708280B176DCC838F371A"; |
| | | |
| | | // 证书路径 |
| | | private String privateKeyPathValue= "/usr/playpai/server/wxV3/1681873607_20250424_cert/apiclient_key.pem"; |
| | | public static String privateKeyPath= "/usr/playpai/server/wxV3/1681873607_20250424_cert/apiclient_key.pem"; |
| | | |
| | |
| | | apiV3Key = this.apiV3KeyValue; |
| | | mchSerialNo = this.mchSerialNoValue; |
| | | privateKeyPath = this.privateKeyPathValue; // WXPaySignatureCertificateUtil 会用到这个路径 |
| | | |
| | | |
| | | // 可以在这里加一些非空检查 |
| | | if (APP_ID == null || Mch_ID == null || apiV3Key == null || mchSerialNo == null || privateKeyPath == null) { |
| | | System.err.println("微信支付V3配置加载不完整,请检查配置文件!"); |
| | |
| | | System.out.println("微信支付V3配置加载完成。"); |
| | | } |
| | | } |
| | | |
| | | // 注意: WXPaySignatureCertificateUtil 中的 getPrivateKey() 方法现在应该使用 WxV3PayConfig.privateKeyPath |
| | | // 你需要稍微修改 WXPaySignatureCertificateUtil.getPrivateKey() 方法: |
| | | /* |
| | | public static PrivateKey getPrivateKey() { |
| | | if (cachedPrivateKey != null) { |
| | | return cachedPrivateKey; |
| | | } |
| | | try { |
| | | String filePath = WxV3PayConfig.privateKeyPath; // 使用配置类中的路径 |
| | | // ... rest of the method ... |
| | | } // ... catch blocks ... |
| | | } |
| | | */ |
| | | } |