|
|
@ -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.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;
|
|
|
@ -11,6 +12,7 @@ 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;
|
|
|
@ -42,22 +44,24 @@ public class ClientSettleConfig {
|
|
|
|
@JSONField(name = "alipay_online_rate")
|
|
|
|
@JSONField(name = "alipay_online_rate")
|
|
|
|
private String alipayOnlineRate;
|
|
|
|
private String alipayOnlineRate;
|
|
|
|
@JSONField(name = "transaction_fee")
|
|
|
|
@JSONField(name = "transaction_fee")
|
|
|
|
private String transactionFee ="0.00";
|
|
|
|
private String transactionFee = "0.00";
|
|
|
|
@JSONField(name = "active_time")
|
|
|
|
@JSONField(name = "active_time")
|
|
|
|
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() 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())) {
|
|
|
|
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) {
|
|
|
|
if (swiftCode.length() > 12) {
|
|
|
@ -78,9 +82,11 @@ public class ClientSettleConfig {
|
|
|
|
throw new BadRequestException("PARAM_ERROR:Invalid Account Name format");
|
|
|
|
throw new BadRequestException("PARAM_ERROR:Invalid Account Name format");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bankQueryInfo = getBankInfo(bsbNo);
|
|
|
|
if (!sandboxMode) {
|
|
|
|
if (bankQueryInfo == null || bankQueryInfo.isEmpty() || !bankQueryInfo.getBooleanValue("valid")) {
|
|
|
|
bankQueryInfo = getBankInfo(bsbNo);
|
|
|
|
throw new BadRequestException("PARAM_ERROR:BSB No is invalid");
|
|
|
|
if (bankQueryInfo == null || bankQueryInfo.isEmpty() || !bankQueryInfo.getBooleanValue("valid")) {
|
|
|
|
|
|
|
|
throw new BadRequestException("PARAM_ERROR:BSB No is invalid");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
activeTimeDate = DateUtils.parseDate(activeTime, new String[]{"yyyy-MM-dd HH:mm:ss"});
|
|
|
|
activeTimeDate = DateUtils.parseDate(activeTime, new String[]{"yyyy-MM-dd HH:mm:ss"});
|
|
|
|