diff --git a/mall-gateway/src/main/resources/application.yml b/mall-gateway/src/main/resources/application.yml
index fb7cf8f5..321a87a4 100644
--- a/mall-gateway/src/main/resources/application.yml
+++ b/mall-gateway/src/main/resources/application.yml
@@ -89,6 +89,7 @@ secure:
- "/admin/account/open/**"
- "/esProduct/**"
- "/admin/oss/upload/**"
+ - "/mobile/**/**/test/case"
universal:
urls:
- "/admin/account/account-user-base/info"
diff --git a/mall-pay/pom.xml b/mall-pay/pom.xml
index cd7f53e2..9923af8f 100644
--- a/mall-pay/pom.xml
+++ b/mall-pay/pom.xml
@@ -137,7 +137,9 @@
true
**/*.crt
+ **/*.pem
**/*.p12
+ **/*.cer
**/*.properties
application.yml
bootstrap.yml
@@ -151,6 +153,9 @@
org.springframework.boot
spring-boot-maven-plugin
+
+ true
+
com.spotify
diff --git a/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/LakalaServiceImpl.java b/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/LakalaServiceImpl.java
index a15d199f..ac372963 100644
--- a/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/LakalaServiceImpl.java
+++ b/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/LakalaServiceImpl.java
@@ -11,7 +11,7 @@ package com.suisung.mall.pay.service.impl;
import cn.hutool.json.JSONUtil;
import com.ijpay.core.kit.IpKit;
-import com.lkl.laop.sdk.Config;
+import com.lkl.laop.sdk.Config2;
import com.lkl.laop.sdk.LKLSDK;
import com.lkl.laop.sdk.exception.SDKException;
import com.lkl.laop.sdk.request.V3LabsTransPreorderRequest;
@@ -20,50 +20,51 @@ import com.lkl.laop.sdk.request.model.V3LabsTradePreorderWechatBus;
import com.suisung.mall.pay.service.LakalaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
@Slf4j
@Service
public class LakalaServiceImpl implements LakalaService {
private static volatile boolean init = false;
- @Value("${lakala.term_no}")
- private String termNo;
- @Value("${lakala.app_id}")
- private String appId; // 拉卡拉appId
- @Value("${lakala.serial_no}")
- private String serialNo; // 你的证书序列号
- @Value("${lakala.merchant_no}")
- private String merchantNo;
- /**
- * 商户私钥信息地址
- */
- @Value("${lakala.pri_key_path}")
- private String priKeyPath;
- /**
- * 拉卡拉支付平台证书地址
- */
-// @Value("${lakala.lkl_cer_path}")
- @Value("${lakala.lkl_notify_cer_path}")
- private String lklCerPath;
- /**
- * 拉卡拉支付平台证书地址2(用于拉卡拉通知验签)
- */
- @Value("${lakala.lkl_notify_cer_path}")
- private String lklNotifyCerPath;
- /**
- * 拉卡拉报文加密对称性密钥
- */
- @Value("${lakala.sm4_key}")
- private String sm4Key;
+
/**
* 服务地址
*/
@Value("${lakala.server_url}")
private String serverUrl;
+ @Value("${lakala.app_id}")
+ private String appId; // 拉卡拉appId
+ @Value("${lakala.merchant_no}")
+ private String merchantNo;
+ @Value("${lakala.serial_no}")
+ private String serialNo; // 你的证书序列号
+ @Value("${lakala.term_no}")
+ private String termNo;
+ /**
+ * 商户私钥信息地址
+ */
+ @Value("${lakala.api_pri_key_path}")
+ private String priKeyPath;
+ /**
+ * 拉卡拉支付平台证书地址
+ */
+ @Value("${lakala.lkl_platform_cer_path}")
+ private String lklCerPath;
+ /**
+ * 拉卡拉支付平台证书地址2(用于拉卡拉通知验签)
+ */
+ @Value("${lakala.lkl_platform_cer_path}")
+ private String lklNotifyCerPath;
+
/***
* @Description: 初始化设置商户公共参数(全局只需设置一次)
@@ -75,26 +76,38 @@ public class LakalaServiceImpl implements LakalaService {
}
}
+ private String getResourceFile(String fileName) {
+ StringBuilder stringBuilder = new StringBuilder();
+ try (InputStream inputStream = new ClassPathResource(fileName).getInputStream();
+ InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
+ BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
+ String line;
+ while ((line = bufferedReader.readLine()) != null) {
+ stringBuilder.append(line).append("\n");
+ }
+ } catch (IOException e) {
+ // 记录异常信息
+ log.error(e.getMessage());
+ }
+ String content = stringBuilder.toString();
+ log.info("证书内容:{}", content);
+ return content;
+ }
+
/**
* 初始化 拉卡拉 SDK
*
* @return
*/
public boolean initLKLSDK() {
- Config config = new Config();
+ Config2 config = new Config2();
config.setAppId(appId);
config.setSerialNo(serialNo);
- config.setPriKeyPath(priKeyPath);
- config.setLklCerPath(lklCerPath);
- config.setLklNotifyCerPath(lklNotifyCerPath);
+ config.setPriKey(getResourceFile(priKeyPath));
+ config.setLklCer(getResourceFile(lklCerPath));
+ config.setLklNotifyCer(getResourceFile(lklNotifyCerPath));
config.setServerUrl(serverUrl);
- config.setSm4Key(sm4Key);
- try {
- return LKLSDK.init(config);
- } catch (SDKException e) {
- log.error("doInit error", e);
- throw new RuntimeException(e);
- }
+ return LKLSDK.init(config);
}
@Override
diff --git a/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/PayUserPayServiceImpl.java b/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/PayUserPayServiceImpl.java
index 252f1838..dced6c35 100644
--- a/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/PayUserPayServiceImpl.java
+++ b/mall-pay/src/main/java/com/suisung/mall/pay/service/impl/PayUserPayServiceImpl.java
@@ -195,7 +195,7 @@ public class PayUserPayServiceImpl extends BaseServiceImpl 0 && !StrUtil.equals(payment_channel_code, "offline")) {
-
+ // 金额大于0且不是线下交易的情况
BigDecimal trade_payment_recharge_card = (BigDecimal) requestParams.get("trade_payment_recharge_card");
BigDecimal trade_payment_points = (BigDecimal) requestParams.get("trade_payment_points");
BigDecimal trade_payment_sp = (BigDecimal) requestParams.get("trade_payment_sp");
@@ -253,7 +253,7 @@ public class PayUserPayServiceImpl extends BaseServiceImpl