|
|
|
@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.appclient.core.impls;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.core.PaymentApi;
|
|
|
|
|
import au.com.royalpay.payment.core.exceptions.EmailException;
|
|
|
|
|
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
|
|
|
|
|
import au.com.royalpay.payment.manage.activities.app_index.core.AppActService;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
|
|
|
|
@ -16,6 +17,7 @@ import au.com.royalpay.payment.manage.customers.core.CouponValidateService;
|
|
|
|
|
import au.com.royalpay.payment.manage.device.core.DeviceManager;
|
|
|
|
|
import au.com.royalpay.payment.manage.fund.core.impls.XPlanFundConfigServiceImpl;
|
|
|
|
|
import au.com.royalpay.payment.manage.kyc.core.KycService;
|
|
|
|
|
import au.com.royalpay.payment.manage.kyc.enums.FilesAuthTypeEnum;
|
|
|
|
|
import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.log.*;
|
|
|
|
@ -107,6 +109,7 @@ import java.util.*;
|
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yishuqian on 28/03/2017.
|
|
|
|
@ -219,6 +222,8 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
@Resource
|
|
|
|
|
private MessageSource messageSource;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientFilesMapper clientFilesMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceManager deviceManager;
|
|
|
|
|
private final String CBBANK_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/08/05/1564972204689_uwZvpTBjtLUMcN8c540xcZvux1Rd3O.pdf";
|
|
|
|
|
private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2019/10/22/1571723034726_5xK6A0FGv5aQPbMIDJzXJrUPKHFutv.pdf";
|
|
|
|
@ -2529,6 +2534,61 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return authFileStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getKycFiles(JSONObject device) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
JSONObject client = clientMapper.findClient(device.getIntValue("client_id"));
|
|
|
|
|
|
|
|
|
|
if (client == null) {
|
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
|
}
|
|
|
|
|
JSONObject file = checkKycFileStatusForApp(client);
|
|
|
|
|
JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(device.getIntValue("client_id"));
|
|
|
|
|
file.put("file_company", compliance);
|
|
|
|
|
return file;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONObject checkKycFileStatusForApp(JSONObject client) {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
boolean lessKycFiles = true;
|
|
|
|
|
JSONObject kycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id"));
|
|
|
|
|
if(kycFilesAuth != null
|
|
|
|
|
|| !("PINE".equals(client.getString("client_moniker"))
|
|
|
|
|
|| "LEOH".equals(client.getString("client_moniker")))){
|
|
|
|
|
lessKycFiles = false;
|
|
|
|
|
}
|
|
|
|
|
result.put("help_confirm", messageSource.getMessage("client.auth.file.help_confirm", null, RequestEnvironment.getLocale()));
|
|
|
|
|
result.put("help_success", messageSource.getMessage("client.auth.file.help_success", null, RequestEnvironment.getLocale()));
|
|
|
|
|
|
|
|
|
|
result.put("client_less_file", lessKycFiles);
|
|
|
|
|
if (lessKycFiles) {
|
|
|
|
|
List<JSONObject> kycFiles = new ArrayList<>();
|
|
|
|
|
kycFiles = clientFilesMapper.findKycClientFileByClient(client.getIntValue("client_id"));
|
|
|
|
|
for (JSONObject file : kycFiles) {
|
|
|
|
|
result.put(file.getString("file_name"), file.getString("file_value"));
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> clientFileUrl = kycFiles.stream()
|
|
|
|
|
.filter(json -> ("kyc_utility_bill_file".equals(json.getString("file_name"))))
|
|
|
|
|
.sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date")))
|
|
|
|
|
.map(json -> {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("file_id", json.getString("file_id"));
|
|
|
|
|
params.put("status", json.getString("status"));
|
|
|
|
|
params.put("file_value", json.getString("file_value"));
|
|
|
|
|
return params;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (clientFileUrl.size() > 0) {
|
|
|
|
|
result.put("kyc_utility_bill_file", clientFileUrl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject complianceFilesNotice(JSONObject client,JSONObject account){
|
|
|
|
|
|
|
|
|
|
JSONObject complianceFilesNotice = new JSONObject();
|
|
|
|
@ -2538,9 +2598,10 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id"));
|
|
|
|
|
|
|
|
|
|
complianceFilesNotice.put("auth_type",FilesAuthTypeEnum.COMPLIANCE.getAuthType());
|
|
|
|
|
complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale()));
|
|
|
|
|
complianceFilesNotice.put("deadline", messageSource.getMessage("client.auth.file.aggregate.deadline", null, RequestEnvironment.getLocale()));
|
|
|
|
|
complianceFilesNotice.put("root_url","111");
|
|
|
|
|
complianceFilesNotice.put("deadline","2020-01-31");
|
|
|
|
|
/* complianceFilesNotice.put("root_url","111");*/
|
|
|
|
|
complianceFilesNotice.put("client_less_file",complianceFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if(compliance != null){
|
|
|
|
|
complianceFilesNotice.put("refused_reason",compliance.getString("description"));
|
|
|
|
@ -2559,9 +2620,10 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kycFilesNotice.put("auth_type",FilesAuthTypeEnum.KYC.getAuthType());
|
|
|
|
|
kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale()));
|
|
|
|
|
kycFilesNotice.put("deadline", messageSource.getMessage("client.auth.file.aggregate.deadline", null, RequestEnvironment.getLocale()));
|
|
|
|
|
kycFilesNotice.put("root_url","111");
|
|
|
|
|
kycFilesNotice.put("deadline", "2020-01-31");
|
|
|
|
|
/* kycFilesNotice.put("root_url","111");*/
|
|
|
|
|
kycFilesNotice.put("client_less_file",kycFileStatus.getBoolean("client_less_file"));
|
|
|
|
|
if(compliance != null){
|
|
|
|
|
kycFilesNotice.put("refused_reason",compliance.getString("description"));
|
|
|
|
@ -2693,6 +2755,15 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return clientManager.uploadKycFilesForWaitCompliance(account, client.getString("client_moniker"), clientKycFilesInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void uploadKycAuthFilesForApp(JSONObject device, JSONObject filesInfo, String fileType) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
|
clientManager.uploadKycFilesForWaitComplianceForApp(account, client.getString("client_moniker"), filesInfo,fileType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteGreenChannelAuthFiles(JSONObject device, String fileId) {
|
|
|
|
@ -2712,11 +2783,12 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void commitAuthFilesToKyc(JSONObject device) {
|
|
|
|
|
public void commitAuthFilesToKyc(JSONObject device,String idType) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
deviceSupport.findRegister(clientType);
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(device.getIntValue("client_id"));
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
|
account.put("id_type", idType);
|
|
|
|
|
kycService.commitAuthKycFilesToCompliance(client.getString("client_moniker"), account, "App");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|