skip bsb check on sandbox mode

master
yixian 3 years ago
parent e02ae9cca7
commit 2269b995fd

@ -2,6 +2,7 @@ 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;
@ -11,6 +12,7 @@ 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;
@ -42,22 +44,24 @@ public class ClientSettleConfig {
@JSONField(name = "alipay_online_rate")
private String alipayOnlineRate;
@JSONField(name = "transaction_fee")
private String transactionFee ="0.00";
private String transactionFee = "0.00";
@JSONField(name = "active_time")
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 String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"};
private static Pattern ACCOUNT_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9 &]+$");
public void checkParamsInvalid() throws IllegalAccessException {
for (Field field : getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(this) == null && !Arrays.asList(WHITE_LIST).contains(field.getName())) {
throw new ParamInvalidException(field.getName(), "Required Param " + field.getName() +" not found");
throw new ParamInvalidException(field.getName(), "Required Param " + field.getName() + " not found");
}
}
if (swiftCode.length() > 12) {
@ -78,9 +82,11 @@ public class ClientSettleConfig {
throw new BadRequestException("PARAM_ERROR:Invalid Account Name format");
}
bankQueryInfo = getBankInfo(bsbNo);
if (bankQueryInfo == null || bankQueryInfo.isEmpty() || !bankQueryInfo.getBooleanValue("valid")) {
throw new BadRequestException("PARAM_ERROR:BSB No is invalid");
if (!sandboxMode) {
bankQueryInfo = getBankInfo(bsbNo);
if (bankQueryInfo == null || bankQueryInfo.isEmpty() || !bankQueryInfo.getBooleanValue("valid")) {
throw new BadRequestException("PARAM_ERROR:BSB No is invalid");
}
}
try {
activeTimeDate = DateUtils.parseDate(activeTime, new String[]{"yyyy-MM-dd HH:mm:ss"});

Loading…
Cancel
Save