From 6e16f2730ff40b662eec0265c5e0093ce66c85d4 Mon Sep 17 00:00:00 2001 From: yixian Date: Fri, 9 Jul 2021 13:39:22 +0800 Subject: [PATCH] skip bsb check on sandbox mode --- .../payment/manage/gateway/beans/ClientRegisterInfo.java | 4 ++-- .../payment/manage/gateway/beans/ClientSettleConfig.java | 6 +----- .../manage/gateway/core/impls/GatewayMerchantApplyImpl.java | 5 ++++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java index 6919c7ecc..da3c6907d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java @@ -44,7 +44,7 @@ public class ClientRegisterInfo { private static String[] WHITE_LIST = {"parentPartnerCode", "notifyUrl"}; - public void checkParamsInvalid() { + public void checkParamsInvalid(boolean sandboxMode) { try { for (Field field : getClass().getDeclaredFields()) { field.setAccessible(true); @@ -56,7 +56,7 @@ public class ClientRegisterInfo { contactConfig.checkParamsInvalid(); legalConfig.checkParamsInvalid(); payConfig.checkParamsInvalid(); - settleConfig.checkParamsInvalid(); + settleConfig.checkParamsInvalid(sandboxMode); complianceFileConfig.checkParamsInvalid(); } catch (IllegalAccessException e) { logger.error("gateway api register client error : {}", e.getMessage()); diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java index 35a832bb4..f8dbe7768 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java @@ -2,7 +2,6 @@ package au.com.royalpay.payment.manage.gateway.beans; import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; -import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestResult; @@ -12,7 +11,6 @@ import lombok.Data; import org.apache.commons.lang3.time.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMethod; import java.io.IOException; @@ -49,15 +47,13 @@ public class ClientSettleConfig { private String activeTime; @JSONField(name = "expire_time") private String expireTime; - @Value("${app.sandbox:false}") - private boolean sandboxMode; private JSONObject bankQueryInfo; private Date activeTimeDate; private static String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"}; private static Pattern ACCOUNT_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9 &]+$"); - public void checkParamsInvalid() throws IllegalAccessException { + public void checkParamsInvalid(boolean sandboxMode) throws IllegalAccessException { for (Field field : getClass().getDeclaredFields()) { field.setAccessible(true); if (field.get(this) == null && !Arrays.asList(WHITE_LIST).contains(field.getName())) { diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/core/impls/GatewayMerchantApplyImpl.java b/src/main/java/au/com/royalpay/payment/manage/gateway/core/impls/GatewayMerchantApplyImpl.java index 18be11791..9d1a767a2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/core/impls/GatewayMerchantApplyImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/core/impls/GatewayMerchantApplyImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMethod; @@ -65,6 +66,8 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply { private ClientManager clientManager; @Resource private SysConfigManager sysConfigManager; + @Value("${app.sandbox:false}") + private boolean sandboxMode; @Resource private RoyalThreadPoolExecutor royalThreadPoolExecutor; @Resource @@ -84,7 +87,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply { @Transactional public JSONObject applicationMerchant(JSONObject org, JSONObject registerInfo) { ClientRegisterInfo registerBean = JSON.toJavaObject(registerInfo, ClientRegisterInfo.class); - registerBean.checkParamsInvalid(); + registerBean.checkParamsInvalid(sandboxMode); JSONObject result = new JSONObject(); JSONObject manager = managerMapper.findAvailableByLoginIdAndOrgId(registerBean.getApplyId(), org.getString("org_id")); if (manager == null) {