|
@@ -2,34 +2,37 @@ package com.rongwei.zhsw.system.utils;
|
|
|
|
|
|
import com.wechat.pay.java.core.Config;
|
|
|
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
|
|
-import com.wechat.pay.java.core.exception.HttpException;
|
|
|
-import com.wechat.pay.java.core.exception.MalformedMessageException;
|
|
|
-import com.wechat.pay.java.core.exception.ServiceException;
|
|
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
|
|
-import com.wechat.pay.java.service.payments.jsapi.model.CloseOrderRequest;
|
|
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
|
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
|
|
-import com.wechat.pay.java.service.payments.jsapi.model.QueryOrderByIdRequest;
|
|
|
-import com.wechat.pay.java.service.payments.jsapi.model.QueryOrderByOutTradeNoRequest;
|
|
|
-import com.wechat.pay.java.service.payments.model.Transaction;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
|
|
|
public class WxApi {
|
|
|
- /** 商户号 */
|
|
|
+ /**
|
|
|
+ * 商户号
|
|
|
+ */
|
|
|
public String merchantId = "1711246421";
|
|
|
|
|
|
- /** 商户API私钥路径 */
|
|
|
- public String privateKeyPath = "D:\\code\\project\\zhsw\\zhsw_service\\zhsw-common\\src\\main\\resources\\cert\\apiclient_key.pem";
|
|
|
+ /**
|
|
|
+ * 商户API私钥路径
|
|
|
+ */
|
|
|
+ public String privateKeyPath = "D:\\PROJECT\\水务\\zhsw_service\\zhsw-server\\src\\main\\resources\\cert\\apiclient_key.pem";
|
|
|
|
|
|
- /** 商户证书序列号 */
|
|
|
+ /**
|
|
|
+ * 商户证书序列号
|
|
|
+ */
|
|
|
public String merchantSerialNumber = "6F46F471C22D410F9ECEDC8B197979A4CA42BC96";
|
|
|
|
|
|
- /** 商户APIV3密钥 */
|
|
|
- public String apiV3Key = "GBA67AVWJESPJ3TFJ3GT3NLQBEOTO1FW";
|
|
|
+ /**
|
|
|
+ * 商户APIV3密钥
|
|
|
+ */
|
|
|
+ public String apiV3Key = "GBA67AVWJESPJ3TFJ3GT3NLQBEOTO1FW";
|
|
|
|
|
|
public JsapiServiceExtension service;
|
|
|
|
|
|
public void initMerchant() {
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("cert/apiclient_key.pem");
|
|
|
Config config =
|
|
|
new RSAAutoCertificateConfig.Builder()
|
|
|
.merchantId(merchantId)
|
|
@@ -39,9 +42,9 @@ public class WxApi {
|
|
|
.apiV3Key(apiV3Key)
|
|
|
.build();
|
|
|
service = new JsapiServiceExtension.Builder()
|
|
|
- .config(config)
|
|
|
- .signType("RSA") // 不填默认为RSA
|
|
|
- .build();
|
|
|
+ .config(config)
|
|
|
+ .signType("RSA") // 不填默认为RSA
|
|
|
+ .build();
|
|
|
}
|
|
|
|
|
|
public PrepayWithRequestPaymentResponse prepayWithRequestPayment() {
|