diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java index 9ebfae667..c277cfa4b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java @@ -20,5 +20,5 @@ public interface ClientAuditProcessMapper { int update(JSONObject partner); @AutoSql(SqlType.SELECT) - PageList getAuditLog(@Param("client_id") int client_id, PageBounds pagination); + PageList getAuditLog(@Param("client_id") int client_id, @Param("type") int type, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java new file mode 100644 index 000000000..485ef152c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientCardFlowMapper.java @@ -0,0 +1,31 @@ +package au.com.royalpay.payment.manage.mappers.system; + +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import com.github.miemiedev.mybatis.paginator.domain.PageList; +import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; +import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; +import com.yixsoft.support.mybatis.autosql.annotations.SqlType; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator; + +import java.util.Date; +import java.util.List; + +/** + * Created by dulingling on 2020-04-26. + */ +@AutoMapper(tablename = "sys_clients_card_flow", pkName = "client_id", keyGenerator = Jdbc3KeyGenerator.class) +public interface ClientCardFlowMapper { + @AutoSql(SqlType.SELECT) + JSONObject findClient(@Param("client_id") int clientId); + + @AutoSql(SqlType.INSERT) + void save(JSONObject partner); + + @AutoSql(SqlType.UPDATE) + int update(JSONObject partner); + +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java index 56e39c370..4f2503bbd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java @@ -51,6 +51,7 @@ public class PartnerQuery { private boolean bd_upload_material = false; private boolean is_valid = false; private String merchant_id; + private boolean card_approving = false; public String getClient_moniker() { return StringUtils.isEmpty(client_moniker) ? null : client_moniker; @@ -120,6 +121,9 @@ public class PartnerQuery { if (approving) { param.put("approving", true); } + if(card_approving){ + param.put("card_approving",true); + } if (org_id != null) { param.put("org_id", org_id); } @@ -472,4 +476,12 @@ public class PartnerQuery { public void setSuburb(String suburb) { this.suburb = suburb; } + + public boolean isCard_approving() { + return card_approving; + } + + public void setCard_approving(boolean card_approving) { + this.card_approving = card_approving; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 18eca9b1c..d95488795 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -81,6 +81,9 @@ public interface ClientManager { @Transactional(noRollbackFor = EmailException.class) void auditClient(JSONObject manager, String clientMoniker, int pass); + @Transactional(noRollbackFor = EmailException.class) + void auditCardClient(JSONObject manager, String clientMoniker, int pass); + @Transactional(noRollbackFor = EmailException.class) void auditClientGreenChannel(JSONObject manager, String clientMoniker); @@ -299,6 +302,13 @@ public interface ClientManager { void commitToDoAgreeFile(String clientMoniker, JSONObject manager); + /** + * 提交资料,申请卡支付 + * @param clientMoniker + * @param manager + */ + void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager); + void commitToGreenChannel(String clientMoniker, JSONObject manager); void changePaymentPage(JSONObject manager, String clientMoniker, String paypad_version); @@ -335,6 +345,8 @@ public interface ClientManager { void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + JSONArray getAllClientIds(int clientId); void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index b77ff85ce..3295258dc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -328,6 +328,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private RPayMerchantMapper rPayMerchantMapper; @Resource private SysClientUpayProfileMapper sysClientUpayProfileMapper; + @Resource + private ClientCardFlowMapper clientCardFlowMapper; + + @Resource private SmsSender smsSender; private static final String SOURCE_AGREE_FILE = "source_agree_file"; @@ -434,7 +438,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.putAll(clientConfig); JSONObject upayInfo = sysClientUpayProfileMapper.findInfo(client.getIntValue("client_id")); - client.putAll(upayInfo); + if(null != upayInfo){ + client.putAll(upayInfo); + } client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true); client.put("show_all_permission", true); int role = manager != null ? manager.getIntValue("role") : 0; @@ -488,12 +494,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("min_customer_surcharge_rate", client.getBigDecimal("rate_value").add(new BigDecimal("0.1"))); } - // 商户审核过程日志 - PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"), + // 商户跨境支付审核过程日志 + PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"),1, new PageBounds(Order.formString("create_time"))); if (audit_logs != null && !audit_logs.isEmpty()) { client.put("audit_logs", audit_logs); } + //商户卡支付审核过程日志 + PageList audit_card_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"),2, + new PageBounds(Order.formString("create_time"))); + if (audit_card_logs != null && !audit_card_logs.isEmpty()) { + client.put("audit_card_logs", audit_card_logs); + } + + //插入卡支付审核状态 + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id")); + if(null != cardFlowInfo){ + client.put("card_flow_info",cardFlowInfo); + } //HF支付链接二维码 if (client.getString("hf_pay_url") != null) { @@ -568,6 +586,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid partner.put("expiry_time", DateUtils.addDays(partner.getDate("approve_time"), authDays)); partner.put("pass_timeout", DateUtils.addDays(partner.getDate("approve_time"), authDays).compareTo(new Date()) < 0); } + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(partner.getInteger("client_id")); + if(null != cardFlowInfo){ + partner.put("card_approve_flow_info",cardFlowInfo); + } } return PageListUtils.buildPageListResult(partners); } @@ -1161,30 +1183,71 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientModify(auditModify); sendCommissionWechatMessage(client);// wxMessage if (pass == 1) { - createKycAuthStatus(manager,client); + createKycAuthStatus(manager, client); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); if (client.getIntValue("source") == 4 || client.getIntValue("source") == 5) { List accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); JSONObject account = accounts.get(0); sendInitEmail(client, account.getString("username"), "*****"); // sendInitEmail(manager, client, account.getString("username"), "*****"); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "common_sub_merchant_id", false)); gatewayMerchantApply.notifyOrgMerchantStatus(client); } else if (checkGreenChannel && client.getIntValue("open_status") == 5) { // 绿色通道通过后不发邮件 logger.info("PASS 绿色通道:" + clientMoniker); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); } else { initAdminUserAndSendEmail(manager, clientMoniker, client); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); } } clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } - private void createKycAuthStatus(JSONObject manager,JSONObject client){ + @Override + public void auditCardClient(JSONObject manager, String clientMoniker, int pass) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //检查商户是否进入平台黑名单 + int clientId = client.getIntValue("client_id"); + isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0)); + + if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) { + throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); + } + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId); + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + Integer open_status_to = cardFlowInfo != null? cardFlowInfo.getIntValue("open_status") : null; + cardFlowInfo.put("open_status",5); + cardFlowInfo.put("approve_result",1); + clientCardFlowMapper.update(cardFlowInfo); + sendCardCommissionWechatMessage(client);// wxMessage + if (pass == 1) { + createKycAuthStatus(manager, client); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); + if (client.getIntValue("source") == 4 || client.getIntValue("source") == 5) { + List accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); + JSONObject account = accounts.get(0); + //TODO 发送卡支付开通邮件 1.判断商户是否已开通跨境支付,若没有开通,init账号 +// sendInitEmail(client, account.getString("username"), "*****"); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_to, 5, "合规通过", manager,2); + + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); +// gatewayMerchantApply.notifyOrgMerchantStatus(client); + } else { + //TODO 发送卡支付开通邮件 1.判断商户是否已开通跨境支付,若没有开通,init账号 +// initAdminUserAndSendEmail(manager, clientMoniker, client); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_to, 5, "合规通过", manager,2); + } + } + clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); + } + + private void createKycAuthStatus(JSONObject manager, JSONObject client) { JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); if (compliance != null) { compliance.put("client_id", client.getIntValue("client_id")); @@ -1227,7 +1290,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); } clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id"))); - saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager,1); sendCommissionWechatMessage(client); initAdminUserAndSendEmail(manager, clientMoniker, client); } @@ -2051,7 +2114,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientRateMapper.updateConfig(rateLog); } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { - JSONObject extRateParams = new JSONObject(){{ + JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); put("overseas_rate_value", config.getJSONObject("ext_rates").getBigDecimal("international_rate_value")); }}; @@ -2088,7 +2151,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int clientId = client.getIntValue("client_id"); JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); int cleanDays = changeRate.getIntValue("clean_days"); - if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat",config.getRateName())) { + if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) { clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); } // clientMapper.updateCleanDays(clientId, config.getCleanDays()); @@ -2127,7 +2190,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); List listChildClients = clientMapper.listChildClients(client.getIntValue("client_id")); JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id")); - if(mchConfig.getBooleanValue("hide_sub_mch")){ + if (mchConfig.getBooleanValue("hide_sub_mch")) { return new ArrayList<>(); } if (mchConfig.getBooleanValue("level3_mch_config")) { @@ -2145,7 +2208,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,String searchText, int page) { + public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker, String searchText, int page) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -2153,7 +2216,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); PageBounds pageBounds; - pageBounds= new PageBounds(page, 20, Order.formString("create_time.desc")); + pageBounds = new PageBounds(page, 20, Order.formString("create_time.desc")); JSONObject params = new JSONObject() {{ put("parent_client_id", client.getIntValue("client_id")); }}; @@ -2753,7 +2816,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client_ids != null) { params.put("client_ids", Arrays.asList(client_ids)); params.remove("client_id"); - }else { + } else { queryModifyClientIds(client.getIntValue("client_id"), params); } List deviceIds = clientDeviceMapper.listClientDeviceIds(params); @@ -3304,7 +3367,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } if (manager != null) { - saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager,1); } } } @@ -3321,7 +3384,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 3); clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 3)); - saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager,1); // sendAgreeFileMsgToBD(client,null); sendCommissionWechatMessage(client); } @@ -3514,7 +3577,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientModify( new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); + clientModifySupport.processClientModify(new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); } @Override @@ -3567,7 +3630,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } params.put("display_name", manager.getString("display_name")); - clientApproveIdInfo(params,client); + clientApproveIdInfo(params, client); } @Override @@ -3659,7 +3722,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); - String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file","kyc_utility_bill_file"}; + String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file", "kyc_utility_bill_file"}; if (client == null) { throw new InvalidShortIdException(); } @@ -3714,7 +3777,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); JSONObject fileJson = new JSONObject(); JSONObject companyFile = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); - fileJson.put("companyFile",companyFile); + fileJson.put("companyFile", companyFile); if (clientFiles != null && clientFiles.size() > 0) { for (String fileKey : fileKeys) { List clientFileUrl = clientFiles.stream() @@ -3925,7 +3988,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @Transactional - public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType) { + public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo, String fileType) { JSONObject client = getClientInfoByMoniker(clientMoniker); List fileResult = new ArrayList<>(); if (client == null) { @@ -3933,7 +3996,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateFilesForWaitAuditWithoutRepeatForApp(account,clientId, fileType, filesInfo.getString("url"),fileResult); + updateFilesForWaitAuditWithoutRepeatForApp(account, clientId, fileType, filesInfo.getString("url"), fileResult); } catch (Exception e) { logger.error("上传KYC文件失败", e); throw new BadRequestException("上传KYC文件失败" + e.getMessage()); @@ -3942,7 +4005,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - @Override @Transactional public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source) { @@ -4521,14 +4583,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager,1); if (manager != null) { // sendMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); } } - private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager) { + private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager,int type) { JSONObject log = new JSONObject(); try { log.put("client_id", client_id); @@ -4539,6 +4601,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid log.put("operator_id", StringUtils.isNotEmpty(manager.getString("manager_id")) ? manager.getString("manager_id") : manager.getString("account_id")); log.put("operator", manager.getString("display_name")); log.put("create_time", new Date()); + log.put("type",type); log.put("remark", remark); clientAuditProcessMapper.save(log); } catch (Exception e) { @@ -4554,6 +4617,54 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + + beforeCommitToDoAgreeValid(client, manager); + + OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); + openStatusModify.setApprove_result(4); + openStatusModify.setApprove_time(new Date()); + clientModifySupport.processClientModify(openStatusModify); + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Card Payment Compliance制作合同", manager,1); + if (manager != null) { + // sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); + sendCommissionWechatMessage(client); + } + } + + @Override + @Transactional + public void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + int clientId = client.getIntValue("client_id"); + client.putAll(clientConfigService.find(clientId)); + beforeCommitToDoAgreeValid(client, manager); + + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId); + if(null != cardFlowInfo){ + JSONObject cardFlow = new JSONObject(){{ + put("client_id",clientId); + put("approve_result",4); + put("open_status",1); + put("approve_time",new Date()); + }}; + clientCardFlowMapper.update(cardFlow); + }else{ + JSONObject cardFlow = new JSONObject(){{ + put("client_id",clientId); + put("open_status",1); + put("approve_result",4); + put("approve_time",new Date()); + }}; + clientCardFlowMapper.save(cardFlow); + } + + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager,2); + } + + private void beforeCommitToDoAgreeValid(JSONObject client, JSONObject manager) { if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); if (bdOperatClientRole <= 0) { @@ -4570,15 +4681,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (account == null || account.size() <= 0) { throw new BadRequestException("The Partner's Bank Account is not config!"); } - OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); - openStatusModify.setApprove_result(4); - openStatusModify.setApprove_time(new Date()); - clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager); - if (manager != null) { - // sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); - sendCommissionWechatMessage(client); - } } @Override @@ -4610,7 +4712,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid openStatusModify.setApprove_result(4); openStatusModify.setApprove_time(new Date()); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager,1); if (manager != null) { // sendGreenChannelMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); @@ -4900,7 +5002,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (refuse_remark != null && !refuse_remark.isEmpty()) { auditModify.setRefuse_remark(refuse_remark); } - saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager,1); clientModifySupport.processClientModify(auditModify); try { @@ -4925,6 +5027,55 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + public void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + Integer clientId = client.getInteger("client_id"); + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(clientId); + Integer open_status = null; + if(null != cardFlowInfo){ + open_status = cardFlowInfo.getIntValue("open_status"); + if (open_status == 1) { + cardFlowInfo.put("open_status",null); + } else { + cardFlowInfo.put("open_status",open_status - 1); + } + if ( cardFlowInfo.getIntValue("approve_result") == 4 || client.getIntValue("source") == 4) { + cardFlowInfo.put("approve_result",5); + } + if (refuse_remark != null && !refuse_remark.isEmpty()) { + cardFlowInfo.put("refuse_remark",refuse_remark); + } + }else{ + cardFlowInfo.put("open_status",null); + } + saveClientAuditProcess(client.getIntValue("client_id"), open_status, cardFlowInfo.getIntValue("open_status"), "打回," + refuse_remark, manager,2); + clientCardFlowMapper.update(cardFlowInfo); + + try { + if (client.getIntValue("source") == 4) { + String contact_phone = client.getString("contact_phone"); + if (contact_phone.startsWith("+61")) { + ArrayList param = new ArrayList<>(); + param.add(refuse_remark); + try { + smsSender.getSender().sendWithParam("61", contact_phone.replace("+61", ""), REFUSE_CLIENT_TEMPLID, param, "RoyalPay", "", ""); + } catch (Exception ignore) { + throw new ServerErrorException("Phone number is wrong :" + contact_phone); + } + } + } + if (client.getIntValue("source") == 5) { + gatewayMerchantApply.notifyOrgMerchantStatus(client); + } + } catch (Exception e) { + logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage()); + } + } + @Override @Cacheable(value = ":all_clients:", key = "''+#clientId") public JSONArray getAllClientIds(int clientId) { @@ -5442,6 +5593,94 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } + private void sendCardCommissionWechatMessage(JSONObject client) { + String bd_user_name = client.getString("bd_user_name"); + String client_moniker = "[" + client.getString("client_moniker") + "]"; + String short_name = client.getString("short_name"); + JSONObject cardFlowInfo = clientCardFlowMapper.findClient(client.getInteger("client_id")); + if(null == cardFlowInfo){ + return; + } + if (cardFlowInfo.getIntValue("open_status") == 1) { + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作卡支付合同" + client_moniker, + bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("open_status") == 3) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "卡支付合同制作完成", + "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=3" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid)); + + } + } + + } + return; + } + if (cardFlowInfo.getIntValue("open_status") == 4) { + if (client.getIntValue("source") == 4 && !StringUtils.isNotEmpty(bd_user_name)) { + bd_user_name = "自助开通商户"; + } + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "卡支付合规材料已提交", + bd_user_name, "审核材料", "已提交合规材料,等待审核"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } catch (Exception e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("open_status") == 5) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", ""); + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=5" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid)); + } + } + } + return; + } + } + @Override @Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public List listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { @@ -6048,7 +6287,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account,1); if (params != null) { params.put("display_name", client_account.getString("display_name")); @@ -6648,7 +6887,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject isLessFiles(JSONObject partner){ + public JSONObject isLessFiles(JSONObject partner) { JSONObject client = clientMapper.findClientByMoniker(partner.getString("client_moniker")); if (client == null) { throw new InvalidShortIdException(); @@ -6656,7 +6895,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if ((client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10 || client.getIntValue("approve_result") == 1 || client.getIntValue("open_status") == 5)) { boolean lessKycFiles = isPartnerKycfilesComplete(partner.getString("client_moniker")); partner.put("lessKycFiles", lessKycFiles); - partner.put("lessComplianceFiles",signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); + partner.put("lessComplianceFiles", signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); } partner.put("lessKycFiles", false); partner.put("lessComplianceFiles", false); @@ -6679,14 +6918,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } JSONObject KycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id")); - if(KycFilesAuth != null){ + if (KycFilesAuth != null) { lessKycFiles = false; } return lessKycFiles; } @Override - public JSONObject partnerIncrementalServiceInfo(String clientMoniker,String channel){ + public JSONObject partnerIncrementalServiceInfo(String clientMoniker, String channel) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6700,16 +6939,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getClientIncrementalServiceLoginToken(JSONObject account,String sourceCode){ + public JSONObject getClientIncrementalServiceLoginToken(JSONObject account, String sourceCode) { JSONObject client = clientMapper.findClient(account.getIntValue("client_id")); if (client == null) { throw new InvalidShortIdException(); } JSONObject clientConfig = clientConfigMapper.find(account.getIntValue("client_id")); - if(!clientConfig.getBooleanValue("geek_shop_status")){ + if (!clientConfig.getBooleanValue("geek_shop_status")) { throw new BadRequestException("Merchant service not opened"); } - return retailRSvcService.getGeekSsoTokenInfo(sourceCode,client.getString("client_moniker")); + return retailRSvcService.getGeekSsoTokenInfo(sourceCode, client.getString("client_moniker")); } @Override @@ -6913,18 +7152,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params){ + public void changeExtParams(String clientMoniker, JSONObject manager, JSONObject params) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } JSONObject extParmas = JSONObject.parseObject(client.getString("ext_params")); - if("true".equals(params.getString("value"))||"false".equals(params.getString("value"))){ - extParmas.put(params.getString("key"),params.getBoolean("value")); - }else{ - extParmas.put(params.getString("key"),params.getString("value")); + if ("true".equals(params.getString("value")) || "false".equals(params.getString("value"))) { + extParmas.put(params.getString("key"), params.getBoolean("value")); + } else { + extParmas.put(params.getString("key"), params.getString("value")); } - client.put("ext_params",extParmas.toString()); + client.put("ext_params", extParmas.toString()); clientMapper.update(client); } @@ -6970,7 +7209,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version){ + public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6981,26 +7220,26 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void exportLetterOfferPDF(String clientMoniker,HttpServletResponse response) { + public void exportLetterOfferPDF(String clientMoniker, HttpServletResponse response) { JSONObject info = convertClientLetterOfferInfo(clientMoniker); String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/letter_of_offer.pdf"; - String fileName = clientMoniker+"_Letter_of_Offer.pdf"; - publishExcelCardPDFFile(fileName,pdfPath,info,response); + String fileName = clientMoniker + "_Letter_of_Offer.pdf"; + publishExcelCardPDFFile(fileName, pdfPath, info, response); } - private JSONObject convertClientLetterOfferInfo(String clientMoniker){ + private JSONObject convertClientLetterOfferInfo(String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } //合规状态 - if(client.getIntValue("approve_result")!=1 && client.getIntValue("approve_result")==3){ + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { throw new BadRequestException("The merchant failed the audit!"); } //获取数据源 int clientId = client.getInteger("client_id"); JSONObject clientRate = clientRateMapper.latestChannelCleanDays("rpaypmt_card", clientId); - if(clientRate == null){ + if (clientRate == null) { throw new BadRequestException("rpaypmt_card rate Not configured"); } JSONObject cardRate = clientRate.getJSONObject("ext_rates"); @@ -7008,84 +7247,84 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid //装在数据 JSONObject info = new JSONObject(); - info.put("down_date",convertDateEnglish(new Date()));//下载文件日期 - info.put("bussiness_name",client.getString("business_name")+" ABN");//商圈类型 - info.put("partner_address",client.getString("address"));//商家店铺地址 - info.put("partner_country",client.getString("country"));//国家 - info.put("partner_state",client.getString("state"));//洲 - info.put("partner_bussiness_name",client.getString("business_name"));//商户商用名称 - info.put("clean_days",client.getInteger("clean_days"));//T+规则清算天数 - info.put("partner_industry_mcc",client.getInteger("industry"));//商户行业编码 - info.put("legal_bussiness",client.getString("contact_person")+" AS "+client.getString("business_name") + " ABN "+client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 - info.put("annual_rate","0");//年费率 - info.put("cost_per_transaction",clientRate.getString("transaction_fee"));//每次交易成本 - info.put("domestic_fee",cardRate.getString("domestic_rate_value"));//国内服务费 - info.put("international_fee",cardRate.getString("overseas_rate_value"));//国际服务费 - info.put("account_reserve","1000");//账户储备金 + info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + info.put("bussiness_name", client.getString("business_name") + " ABN");//商圈类型 + info.put("partner_address", client.getString("address"));//商家店铺地址 + info.put("partner_country", client.getString("country"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("clean_days", client.getInteger("clean_days"));//T+规则清算天数 + info.put("partner_industry_mcc", client.getInteger("industry"));//商户行业编码 + info.put("legal_bussiness", client.getString("contact_person") + " AS " + client.getString("business_name") + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("annual_rate", "0");//年费率 + info.put("cost_per_transaction", clientRate.getString("transaction_fee"));//每次交易成本 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 + info.put("account_reserve", "1000");//账户储备金 //银行账号信息 - info.put("account_name",bankAccountInfo.getString("account_name"));// - info.put("bsb",bankAccountInfo.getString("bsb_no")); - info.put("account_no",bankAccountInfo.getString("account_no")); - info.put("card_acceptor_name","xxxxxxxxxxxxx"); + info.put("account_name", bankAccountInfo.getString("account_name"));// + info.put("bsb", bankAccountInfo.getString("bsb_no")); + info.put("account_no", bankAccountInfo.getString("account_no")); + info.put("card_acceptor_name", "xxxxxxxxxxxxx"); return info; } @Override public void exportPromotionalOfferPDF(String clientMoniker, String date, HttpServletResponse response) { - JSONObject info = convertPromotionalOfferInfo(clientMoniker,date); + JSONObject info = convertPromotionalOfferInfo(clientMoniker, date); String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/promotional_offer.pdf"; - String fileName = clientMoniker+"_Promotional_Offer.pdf"; - publishExcelCardPDFFile(fileName,pdfPath,info,response); + String fileName = clientMoniker + "_Promotional_Offer.pdf"; + publishExcelCardPDFFile(fileName, pdfPath, info, response); } - private JSONObject convertPromotionalOfferInfo(String clientMoniker,String date){ + private JSONObject convertPromotionalOfferInfo(String clientMoniker, String date) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } //合规状态 - if(client.getIntValue("approve_result")!=1 && client.getIntValue("approve_result")==3){ + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { throw new BadRequestException("The merchant failed the audit!"); } int clientId = client.getInteger("client_id"); JSONObject clientRate = clientRateMapper.latestChannelCleanDays("rpaypmt_card", clientId); - if(clientRate == null){ + if (clientRate == null) { throw new BadRequestException("rpaypmt_card rate Not configured"); } JSONObject cardRate = clientRate.getJSONObject("ext_rates"); JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0); JSONObject info = new JSONObject(); - info.put("down_date",convertDateEnglish(new Date()));//下载文件日期 - info.put("bussiness_name",client.getString("business_name")+" ABN");//商圈类型 - info.put("partner_address",client.getString("address"));//商家店铺地址 - info.put("partner_country",client.getString("country"));//国家 - info.put("partner_state",client.getString("state"));//洲 - info.put("partner_bussiness_name",client.getString("business_name"));//商户商用名称 - info.put("letter_offer_sub_time",date); - info.put("legal_bussiness",client.getString("contact_person")+" AS "+client.getString("business_name") + " ABN "+client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 - info.put("domestic_fee",cardRate.getString("domestic_rate_value"));//国内服务费 - info.put("international_fee",cardRate.getString("overseas_rate_value"));//国际服务费 - info.put("promotional_effective_date","xxxxxxxxx"); - info.put("promotional_period","xxxxxxxxx"); + info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + info.put("bussiness_name", client.getString("business_name") + " ABN");//商圈类型 + info.put("partner_address", client.getString("address"));//商家店铺地址 + info.put("partner_country", client.getString("country"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("letter_offer_sub_time", date); + info.put("legal_bussiness", client.getString("contact_person") + " AS " + client.getString("business_name") + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 + info.put("promotional_effective_date", "xxxxxxxxx"); + info.put("promotional_period", "xxxxxxxxx"); return info; } @Override - public void exportTermsConditionsPDF(String clientMoniker,HttpServletResponse response) { + public void exportTermsConditionsPDF(String clientMoniker, HttpServletResponse response) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - if(client.getIntValue("approve_result")!=1 && client.getIntValue("approve_result")==3){ + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { throw new BadRequestException("The merchant failed the audit!"); } String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/terms_and_conditions.pdf"; - String fileName = clientMoniker+"_Terms_And_Conditions.pdf"; - publishExcelCardPDFFile(fileName,pdfPath,new JSONObject(),response); + String fileName = clientMoniker + "_Terms_And_Conditions.pdf"; + publishExcelCardPDFFile(fileName, pdfPath, new JSONObject(), response); } - private void publishExcelCardPDFFile (String fileName,String pdfPath,JSONObject info,HttpServletResponse response){ + private void publishExcelCardPDFFile(String fileName, String pdfPath, JSONObject info, HttpServletResponse response) { response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); try { @@ -7105,14 +7344,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - private String convertDateEnglish(Date date){ - String[] months= {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec"}; + private String convertDateEnglish(Date date) { + String[] months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Spt", "Oct", "Nov", "Dec"}; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DAY_OF_MONTH); - return day+" "+ months[month]+" "+ year; + return day + " " + months[month] + " " + year; } public void saveLegalAndMarketingInfo(JSONObject partner) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 6da1c017c..8fc8d8cce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -280,6 +280,11 @@ public class PartnerManageController { clientManager.auditClient(manager, clientMoniker, pass.getIntValue("pass")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void auditCardPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject pass) { + clientManager.auditCardClient(manager, clientMoniker, pass.getIntValue("pass")); + } + @ManagerMapping(value = "/{clientMoniker}/aduit/green_channel", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) public void auditPartnerGreenChannel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) { clientManager.auditClientGreenChannel(manager, clientMoniker); @@ -300,6 +305,11 @@ public class PartnerManageController { clientManager.refusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit/refuse", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void cardRefusePartner(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject refuse) { + clientManager.cardRefusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); + } + @ManagerMapping(value = "/{clientMoniker}/common_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void switchCommonSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchPermission(manager, clientMoniker, "common_sub_merchant_id", pass.getBooleanValue("allow")); @@ -629,6 +639,17 @@ public class PartnerManageController { clientManager.commitToDoAgreeFile(clientMoniker, manager); } + //TODO BD提交申请卡合规 + /** + * 提交资料,申请卡支付 + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/make_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToDoCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToDoCardAgreeFile(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/compliance/green_channel", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToGreenChannel(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToGreenChannel(clientMoniker, manager); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index 79ccd5e88..086d71004 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -133,6 +133,24 @@ c.open_status=1 or c.open_status=2 or c.open_status=4) + + OR (c.client_id NOT IN ( + SELECT client_id FROM sys_clients_card_flow + ) + OR c.client_id IN ( + SELECT client_id FROM sys_clients_card_flow AS cardFlow + WHERE cardFlow.approve_result = 4 or approve_result = 1 + )) + + + AND (c.client_id NOT IN ( + SELECT client_id FROM sys_clients_card_flow + ) + OR c.client_id IN ( + SELECT client_id FROM sys_clients_card_flow AS cardFlow + WHERE cardFlow.approve_result = 4 or approve_result = 1 + )) + and c.source=4 diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 6f74bc965..20874bac1 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -533,6 +533,72 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }); }; + $scope.passCardClient = function () { + if (!$rootScope.complianceCheck) { + alert("please check first"); + return; + } + if (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); + return; + } + if (!$rootScope.complianceCheck.clientInfo) { + alert("Partner Detail not checked"); + return; + } + if (!$rootScope.complianceCheck.bankAccount) { + alert("Bank Account not checked"); + return; + } + var title = 'Audit Partner Card'; + var content = 'Are you sure to mark partner ' + $scope.partner.company_name + ' audited?'; + var choises = ''; + var contentHtml = ''; + if ($scope.isComplianceOfCompanyName || $scope.isComplianceOfShortName + || $scope.isComplianceOfBusinessStructure) { + var info = []; + if ($scope.isComplianceOfCompanyName) { + info.push('Company Name'); + } + if ($scope.isComplianceOfShortName) { + info.push('Short Name'); + } + if ($scope.isComplianceOfBusinessStructure) { + info.push('Business Structure'); + } + title = 'Warning'; + contentHtml = $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],' + info.toString() + '存在微信渠道不合规信息'); + choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true}, + {label: '确认提交', className: 'btn-success', key: '1'}]; + content = ''; + } + commonDialog.confirm({ + title: title, + content: content, + choises: choises, + contentHtml: contentHtml + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/card_audit', {pass: 1}).then(function () { + if ($scope.partner.approve_result == 2 && ($scope.partner.source == 1 || $scope.partner.source == 2)) { + commonDialog.alert({ + title: 'Success', + content: 'Comply Passed!', + type: 'success' + }); + } else { + commonDialog.alert({ + title: 'Success', + content: 'Comply Passed! Email will send to contact email address soon.', + type: 'success' + }); + } + delete $rootScope.complianceCheck; + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }); + }; $scope.pass2GreenChannel = function () { commonDialog.confirm({ title: 'Green Channel Audit Partner', @@ -648,6 +714,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.cardRefuse = function(){ + commonDialog.inputText({title: 'refuse cause'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/card_audit/refuse', {refuse_remark: text}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Card Audit application has been refused.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + } + $scope.deleteClient = function () { commonDialog.confirm({ title: 'Delete Partner', @@ -712,6 +793,20 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter ); }; + $scope.apply2makeCardAgreeFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_card_agree_file').then(function () { + commonDialog.alert({ + title: 'Success!', + content: '已提交制作合同!', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + } + ); + }; + $scope.commit2GreenChannel = function () { commonDialog.confirm({ title: 'Audit Partner', diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 5514efada..f36ca7470 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -58,11 +58,11 @@
  • Partner Detail
  • -
    +
    -

    Compliance Compliance (Refused :{{partner.refuse_remark}}) @@ -95,6 +95,8 @@
    -
    下载合同 - + Notify BD @@ -155,14 +157,12 @@

    - -
    -

    Operation +

    + + RP Operation (Refused :{{partner.refuse_remark}} )

    + + + +
    +
    +

    + Compliance (Refused + :{{partner.refuse_remark}}) + (The Partner Using Green Channel Now!) + 【目前状态】- + + (自助申请)资料完善中 + (自助申请)已开通 + (自助申请)快速开通等待提交合规材料 + (自助申请)待审核(材料已提交) + + + 资料完善中 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + + (已禁用) +

    + +
    +
    +
    + + + + 制作全支付合同 + + 上传合同 (通用合同请选择制作合同,非通用合同模板请人工制作合同后上传) +
    +
    + + +
    + 下载合同 + + + Notify BD + +
    +
    +
    + +
    + +
    +
    + + +
    + + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Card Payment Operation + (Refused + :{{partner.card_flow_info.refuse_remark}} + )(The Partner Using Green Channel Now!) + 【目前状态】- + 资料完善中 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + 绿色通道申请中 +

    +
    +
    + + 下载合同 +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + + +
    + + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Solved

    +
    +
    +
    Make sure you have send the email to client.
    +
    + +
    +
    +
    + +
    diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index 34b0bfea2..c6ca05969 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -370,6 +370,16 @@ + + + + @@ -476,19 +486,37 @@ - - 通过({{partner.approve_time}}) - 资料完善中 - (自助开通)资料完善中 - 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) - 不通过({{partner.approve_time}}) - 申请打回({{partner.refuse_remark|limitTo:15}}) - 等待合规 - 自助开通(等待合规) - 合同制作完成 - 等待BD上传材料审核 - 绿色通道申请中 - 等待合规 + +
    + + 通过({{partner.approve_time}}) + 资料完善中 + (自助开通)资料完善中 + 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) + 不通过({{partner.approve_time}}) + 申请打回({{partner.refuse_remark|limitTo:15}}) + 等待合规 + 自助开通(等待合规) + 合同制作完成 + 等待BD上传材料审核 + 绿色通道申请中 + 等待合规 +
    +
    + 等待BD上传材料审核 +
    +
    + + 通过({{partner.card_approve_flow_info.approve_time}}) + 资料完善中 + (自助开通)资料完善中 + 不通过({{partner.card_approve_flow_info.approve_time}}) + 申请打回({{partner.card_approve_flow_info.refuse_remark|limitTo:15}}) + 等待合规 + 合同制作完成 + 等待BD上传材料审核 + 等待合规 +