skip bsb check on sandbox mode

master
yixian 3 years ago
parent 023883c585
commit 6e16f2730f

@ -44,7 +44,7 @@ public class ClientRegisterInfo {
private static String[] WHITE_LIST = {"parentPartnerCode", "notifyUrl"}; private static String[] WHITE_LIST = {"parentPartnerCode", "notifyUrl"};
public void checkParamsInvalid() { public void checkParamsInvalid(boolean sandboxMode) {
try { try {
for (Field field : getClass().getDeclaredFields()) { for (Field field : getClass().getDeclaredFields()) {
field.setAccessible(true); field.setAccessible(true);
@ -56,7 +56,7 @@ public class ClientRegisterInfo {
contactConfig.checkParamsInvalid(); contactConfig.checkParamsInvalid();
legalConfig.checkParamsInvalid(); legalConfig.checkParamsInvalid();
payConfig.checkParamsInvalid(); payConfig.checkParamsInvalid();
settleConfig.checkParamsInvalid(); settleConfig.checkParamsInvalid(sandboxMode);
complianceFileConfig.checkParamsInvalid(); complianceFileConfig.checkParamsInvalid();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
logger.error("gateway api register client error : {}", e.getMessage()); logger.error("gateway api register client error : {}", e.getMessage());

@ -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.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; 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 au.com.royalpay.payment.tools.exceptions.BadRequestException;
import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult; import cn.yixblog.platform.http.HttpRequestResult;
@ -12,7 +11,6 @@ import lombok.Data;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import java.io.IOException; import java.io.IOException;
@ -49,15 +47,13 @@ public class ClientSettleConfig {
private String activeTime; private String activeTime;
@JSONField(name = "expire_time") @JSONField(name = "expire_time")
private String expireTime; private String expireTime;
@Value("${app.sandbox:false}")
private boolean sandboxMode;
private JSONObject bankQueryInfo; private JSONObject bankQueryInfo;
private Date activeTimeDate; private Date activeTimeDate;
private static String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"}; private static String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"};
private static Pattern ACCOUNT_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9 &]+$"); 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()) { for (Field field : getClass().getDeclaredFields()) {
field.setAccessible(true); field.setAccessible(true);
if (field.get(this) == null && !Arrays.asList(WHITE_LIST).contains(field.getName())) { if (field.get(this) == null && !Arrays.asList(WHITE_LIST).contains(field.getName())) {

@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -65,6 +66,8 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
private ClientManager clientManager; private ClientManager clientManager;
@Resource @Resource
private SysConfigManager sysConfigManager; private SysConfigManager sysConfigManager;
@Value("${app.sandbox:false}")
private boolean sandboxMode;
@Resource @Resource
private RoyalThreadPoolExecutor royalThreadPoolExecutor; private RoyalThreadPoolExecutor royalThreadPoolExecutor;
@Resource @Resource
@ -84,7 +87,7 @@ public class GatewayMerchantApplyImpl implements GatewayMerchantApply {
@Transactional @Transactional
public JSONObject applicationMerchant(JSONObject org, JSONObject registerInfo) { public JSONObject applicationMerchant(JSONObject org, JSONObject registerInfo) {
ClientRegisterInfo registerBean = JSON.toJavaObject(registerInfo, ClientRegisterInfo.class); ClientRegisterInfo registerBean = JSON.toJavaObject(registerInfo, ClientRegisterInfo.class);
registerBean.checkParamsInvalid(); registerBean.checkParamsInvalid(sandboxMode);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
JSONObject manager = managerMapper.findAvailableByLoginIdAndOrgId(registerBean.getApplyId(), org.getString("org_id")); JSONObject manager = managerMapper.findAvailableByLoginIdAndOrgId(registerBean.getApplyId(), org.getString("org_id"));
if (manager == null) { if (manager == null) {

Loading…
Cancel
Save