|
|
|
@ -6,9 +6,11 @@ import au.com.royalpay.payment.manage.kyc.core.KycService;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientComplianceCompanyMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.notice.core.MailService;
|
|
|
|
|
import au.com.royalpay.payment.manage.signin.core.SignInAccountService;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage;
|
|
|
|
@ -56,6 +58,10 @@ public class KycServiceImpl implements KycService {
|
|
|
|
|
private RoyalThreadPoolExecutor royalThreadPoolExecutor;
|
|
|
|
|
@Resource
|
|
|
|
|
private MpWechatApiProvider mpWechatApiProvider;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientFilesMapper clientFilesMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private SignInAccountService signInAccountService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject listProgressClients(JSONObject manager, KycPartnersQuery query) {
|
|
|
|
@ -207,6 +213,64 @@ public class KycServiceImpl implements KycService {
|
|
|
|
|
return clientManager.getKycFilesForBD(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void commitAuthKycFilesToCompliance(String clientMoniker, JSONObject account, String source) {
|
|
|
|
|
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
|
|
|
|
|
int sourceEnum = 2;
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> clientAllAuthFiles = clientFilesMapper.findAllClientFile(client.getIntValue("client_id"));
|
|
|
|
|
if (clientAllAuthFiles == null || clientAllAuthFiles.size() == 0) {
|
|
|
|
|
throw new BadRequestException("Please check the information is uploaded completely");
|
|
|
|
|
}
|
|
|
|
|
String[] fileKeys = {"client_bank_file", "client_id_file"};
|
|
|
|
|
String[] fileNames = {"ASIC File", "ID"};
|
|
|
|
|
if(StringUtils.equalsIgnoreCase("passport",account.getString("id_type")) ){
|
|
|
|
|
String[] fileKeysPassport = {"client_bank_file", "kyc_utility_bill_file", "client_id_file"};
|
|
|
|
|
String[] fileNamesPassport = {"ASIC File", "Utility Bill Files", "ID"};
|
|
|
|
|
fileKeys = fileKeysPassport;
|
|
|
|
|
fileNames = fileNamesPassport;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < fileKeys.length; i++) {
|
|
|
|
|
String fileKey = fileKeys[i];
|
|
|
|
|
if (clientAllAuthFiles.stream().noneMatch(fileJson -> fileKey.equals(fileJson.getString("file_name")))) {
|
|
|
|
|
throw new BadRequestException("Please check the " + fileNames[i] + " is uploaded completely");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("app".equals(source.toLowerCase())) {
|
|
|
|
|
sourceEnum = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONObject fileComp = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id"));
|
|
|
|
|
if (fileComp == null) {
|
|
|
|
|
fileComp = new JSONObject();
|
|
|
|
|
fileComp.put("client_id", client.getIntValue("client_id"));
|
|
|
|
|
fileComp.put("submit_time", new Date());
|
|
|
|
|
fileComp.put("status", 0);
|
|
|
|
|
fileComp.put("source", sourceEnum);
|
|
|
|
|
fileComp.put("commit_by_id", account.containsKey("account_id") ? account.getString("account_id") : account.getString("manager_id"));
|
|
|
|
|
fileComp.put("type", 2);
|
|
|
|
|
fileComp.put("id_type", account.getString("idType"));
|
|
|
|
|
clientComplianceCompanyMapper.save(fileComp);
|
|
|
|
|
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
|
|
|
|
|
} else if (fileComp.getIntValue("status") == 2 || fileComp.getIntValue("status") == 9) {
|
|
|
|
|
fileComp.put("status", 0);
|
|
|
|
|
fileComp.put("submit_time", new Date());
|
|
|
|
|
fileComp.put("source", sourceEnum);
|
|
|
|
|
fileComp.put("commit_by_id", account.containsKey("account_id") ? account.getString("account_id") : account.getString("manager_id"));
|
|
|
|
|
fileComp.put("id_type", account.getString("idType"));
|
|
|
|
|
fileComp.put("bd_handle", account.getString("bd_handle"));
|
|
|
|
|
clientComplianceCompanyMapper.update(fileComp);
|
|
|
|
|
clientFilesMapper.updateBeforeCompliance(client.getIntValue("client_id"));
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException("please do not repeat submission!");
|
|
|
|
|
}
|
|
|
|
|
if (account.containsKey("account_id")) {
|
|
|
|
|
signInAccountService.clearAccountCache(account.getString("account_id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkManagerPermission(JSONObject manager, JSONObject params, KycPartnersQuery query) {
|
|
|
|
|
//todo 可支持bdleader查看组内bd商户kyc情况
|
|
|
|
|
// if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
|
|
|
|
|