diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 5836b9e72..951c65d0e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean; import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; import au.com.royalpay.payment.manage.notice.beans.NoticeInfo; import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; @@ -214,6 +215,8 @@ public interface RetailAppService { JSONObject getClientAuthFileStatus(JSONObject device); + JSONObject getClientAuthFileStatusAggregate(JSONObject device); + void getCBBankAggregateFile(JSONObject device, HttpServletResponse httpResponse); JSONObject getSourceAggregateFile(JSONObject device); @@ -222,10 +225,14 @@ public interface RetailAppService { List uploadGreenChannelAuthFiles(JSONObject device, ClientAuthFilesInfo filesInfo); + List uploadKycAuthFiles(JSONObject device, ClientKycFilesInfo filesInfo); + void deleteGreenChannelAuthFiles(JSONObject device, String filesInfo); void commitAuthFilesToCompliance(JSONObject device, JSONObject photoInfo); + void commitAuthFilesToKyc(JSONObject device); + JSONObject getClientSubManage(JSONObject device); JSONObject getCustomerInfo(JSONObject device); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index f09c96da7..a64b0d1c4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -15,6 +15,7 @@ import au.com.royalpay.payment.manage.cashback.core.CashbackService; 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.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.client.AuthAppMessageMapper; import au.com.royalpay.payment.manage.mappers.log.*; @@ -23,6 +24,7 @@ import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientManager; @@ -84,6 +86,7 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.slf4j.LoggerFactory; import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.MessageSource; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -211,6 +214,12 @@ public class RetailAppServiceImp implements RetailAppService { @Resource private MpClientAppWechatApiProvider mpClientAppWechatApiProvider; @Resource + private KycService kycService; + @Resource + private ClientComplianceCompanyMapper clientComplianceCompanyMapper; + @Resource + private MessageSource messageSource; + @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"; @@ -2448,6 +2457,76 @@ public class RetailAppServiceImp implements RetailAppService { return authFileStatus; } + @Override + public JSONObject getClientAuthFileStatusAggregate(JSONObject device) { + String clientType = device.getString("client_type"); + deviceSupport.findRegister(clientType); + JSONObject client = clientMapper.findClient(device.getIntValue("client_id")); + JSONObject account = clientAccountMapper.findById(device.getString("account_id")); + + JSONObject authFileStatus = new JSONObject(); + authFileStatus.put("title", messageSource.getMessage("client.auth.file.aggregate.title", null, RequestEnvironment.getLocale())); + authFileStatus.put("content", messageSource.getMessage("client.auth.file.title", null, RequestEnvironment.getLocale())); + + List supplement_array = new ArrayList<>(); + JSONObject complianceFilesNotice = complianceFilesNotice(client,account); + JSONObject kycFilesNotice = kycFilesNotice(client,account); + if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { + return null; + } + if(complianceFilesNotice != null){ + supplement_array.add(complianceFilesNotice); + } + if(kycFilesNotice != null){ + supplement_array.add(kycFilesNotice); + } + authFileStatus.put("supplement_array",supplement_array); + + return authFileStatus; + } + + public JSONObject complianceFilesNotice(JSONObject client,JSONObject account){ + + JSONObject complianceFilesNotice = new JSONObject(); + JSONObject complianceFileStatus = signInAccountService.checkAuthFileStatus(client); + if(!complianceFileStatus.getBoolean("client_less_file")){ + return null; + } + JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")); + + 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("client_less_file",complianceFileStatus.getBoolean("client_less_file")); + if(compliance != null){ + complianceFilesNotice.put("refused_reason",compliance.getString("description")); + complianceFilesNotice.put("status",compliance.getString("status")); + } + return complianceFilesNotice; + + } + + public JSONObject kycFilesNotice(JSONObject client,JSONObject account){ + JSONObject kycFilesNotice = new JSONObject(); + JSONObject kycFileStatus = signInAccountService.checkKycFileStatusForApp(client,account); + JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(account.getIntValue("client_id")); + + if(!kycFileStatus.getBoolean("client_less_file")){ + return null; + } + + 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("client_less_file",kycFileStatus.getBoolean("client_less_file")); + if(compliance != null){ + kycFilesNotice.put("refused_reason",compliance.getString("description")); + kycFilesNotice.put("status",compliance.getString("status")); + } + return kycFilesNotice; + } + + @Override public JSONObject getSourceAggregateFile(JSONObject device) { String clientType = device.getString("client_type"); @@ -2560,6 +2639,17 @@ public class RetailAppServiceImp implements RetailAppService { return clientManager.uploadAuthFilesForWaitCompliance(account, client.getString("client_moniker"), clientAuthFilesInfo); } + @Override + public List uploadKycAuthFiles(JSONObject device, ClientKycFilesInfo clientKycFilesInfo) { + 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")); + clientKycFilesInfo.setAuthStatus(0); + return clientManager.uploadKycFilesForWaitCompliance(account, client.getString("client_moniker"), clientKycFilesInfo); + } + + @Override public void deleteGreenChannelAuthFiles(JSONObject device, String fileId) { String clientType = device.getString("client_type"); @@ -2577,6 +2667,15 @@ public class RetailAppServiceImp implements RetailAppService { clientManager.commitAuthFilesToCompliance(client.getString("client_moniker"), account, "App"); } + @Override + public void commitAuthFilesToKyc(JSONObject device) { + 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")); + kycService.commitAuthKycFilesToCompliance(client.getString("client_moniker"), account, "App"); + } + public JSONObject getClientSubManage(JSONObject device) { JSONObject result = new JSONObject(); String clientType = device.getString("client_type"); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index b6916a91b..cff65aa35 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -15,6 +15,7 @@ import au.com.royalpay.payment.manage.bill.bean.QueryBillOrderBean; import au.com.royalpay.payment.manage.bill.core.BillOrderService; import au.com.royalpay.payment.manage.bill.core.BillService; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; import au.com.royalpay.payment.manage.riskbusiness.bean.RiskEventQuery; import au.com.royalpay.payment.manage.riskbusiness.core.RiskBusinessService; @@ -828,6 +829,11 @@ public class RetailAppController { return retailAppService.getClientAuthFileStatus(device); } + @GetMapping("/client/auth_file/status/aggregate") + public JSONObject getClientAuthFileStatusAggregate(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + return retailAppService.getClientAuthFileStatusAggregate(device); + } + /** * 原合同文件 * @@ -893,6 +899,26 @@ public class RetailAppController { retailAppService.commitAuthFilesToCompliance(device, photoInfo); } + /** + * 提交待审核KYC文件 + * + * @param device + */ + @PutMapping("/client/kyc_auth_file") + public List uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody ClientKycFilesInfo filesInfo) { + return retailAppService.uploadKycAuthFiles(device, filesInfo); + } + + /** + * 提交审核Kyc + * + * @param device + */ + @PostMapping("/client/auth_file/commit_to_kyc") + public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + retailAppService.commitAuthFilesToKyc(device); + } + @GetMapping("/client/sub_manage") public JSONObject getClientSubManage(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { return retailAppService.getClientSubManage(device); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java index db35822ae..7e44371cd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java @@ -70,4 +70,6 @@ public interface SignInAccountService { JSONObject checkKycFileStatus(JSONObject client,JSONObject account, String sourceType); + JSONObject checkKycFileStatusForApp(JSONObject client,JSONObject account); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 2bd7e3a45..fad677dc1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -783,6 +783,41 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati return result; } + @Override + public JSONObject checkKycFileStatusForApp(JSONObject client, JSONObject account) { + JSONObject result = new JSONObject(); + boolean lessKycFiles = true; + JSONObject kycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id")); + if(kycFilesAuth != null){ + lessKycFiles = false; + } + result.put("client_less_file", lessKycFiles); + if (lessKycFiles || account.containsKey("manager_id")) { + List 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 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; + } + private void whenClientLessFile(JSONObject client,JSONObject result) { JSONObject authFileCompliance = clientComplianceCompanyMapper.findFileByClientId(client.getIntValue("client_id")); if (authFileCompliance != null && StringUtils.isNotBlank(authFileCompliance.getString("description"))) { diff --git a/src/main/resources/i18n/msg_en.properties b/src/main/resources/i18n/msg_en.properties index 976d5a28c..3485144e7 100644 --- a/src/main/resources/i18n/msg_en.properties +++ b/src/main/resources/i18n/msg_en.properties @@ -115,4 +115,7 @@ contract.old.waring=Dear Valued Merchants ,to ensure we comply with the ATO, w sys.mondelay.cancel.waring=Are you sure to quit this activity? client.auth.file.title=RoyalPay is committed to providing a secure and safe platform for Chinese payments. As a part of this we regularly participate in communication with Austrac and China's Foreign Exchange Regulator. To ensure your business is fully compliant, we require certain documents from you by the 31st of October. If you believe you may not be able to submit these documents on time please get in touch with us as soon as possible. - +client.auth.file.aggregate.title=Notice Of Supplementary Files +client.auth.file.compliance.type=Compliance Files +client.auth.file.kyc.type=KYC Files +client.auth.file.aggregate.deadline=Deadline 2020-1-20 diff --git a/src/main/resources/i18n/msg_zh.properties b/src/main/resources/i18n/msg_zh.properties index ec1482ac6..c6925e128 100644 --- a/src/main/resources/i18n/msg_zh.properties +++ b/src/main/resources/i18n/msg_zh.properties @@ -108,3 +108,7 @@ contract.old.waring=尊敬的商户,RoyalPay于近期正式收到澳洲监管 sys.mondelay.cancel.waring=是否确认退出活动 client.auth.file.title=应澳洲政府反洗钱监管机构Austrac和中国外汇监管相关要求,需要您配合补充完善基本资料以完成合规流程,截止时间2019年10月31日前,超期未提交将可能会影响您的正常交易,谢谢您的配合。 +client.auth.file.aggregate.title=补充材料通知 +client.auth.file.compliance.type=合规材料 +client.auth.file.kyc.type=KYC材料 +client.auth.file.aggregate.deadline=截止时间 2020-1-20