diff --git a/pom.xml b/pom.xml index 63a3aaafe..f06802e7e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.2 + 2.3.3 UTF-8 2.2.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index e6ed55306..3f640b5c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -44,6 +44,8 @@ public interface ClientMapper { @AutoSql(SqlType.SELECT) JSONObject findClientIgnoreInvalid(int clientId); + JSONObject findClientAprrovingStatus(@Param("client_id") int clientId); + @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") JSONObject findClientByMoniker(@Param("client_moniker") String clientMoniker); 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 b52df74a7..eb4585ffb 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 @@ -84,7 +84,7 @@ public interface ClientManager { @Transactional(noRollbackFor = EmailException.class) void auditClientGreenChannel(JSONObject manager, String clientMoniker); - void checkAndSendInitEmail(JSONObject manager, String clientMoniker); + void checkAndSendInitEmail(JSONObject manager, String clientMoniker,String type); void markApproveEmailSendStatus(String clientMoniker, JSONObject manager); 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 5645d1efe..15667f54d 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 @@ -1269,19 +1269,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } sendInitEmail(client, username.toLowerCase(), pwd, isUpayEmail); - // sendInitEmail(manager, client, username, pwd); } @Override - public void checkAndSendInitEmail(JSONObject manager, String clientMoniker) { + public void checkAndSendInitEmail(JSONObject manager, String clientMoniker, String type) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - int sendStatus = client.getIntValue("approve_email_send"); - if (sendStatus >= 3) { - throw new BadRequestException("Email validating... Wait for a moment"); - } int clientId = client.getIntValue("client_id"); clientModifySupport.processClientModify(new EmailModify(manager, clientMoniker, 4, null)); if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { @@ -1291,19 +1286,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } List accounts = clientAccountMapper.listAdminAccounts(clientId); + JSONObject cardProfile = clientMapper.findClientAprrovingStatus(clientId); + boolean cardApproving = cardProfile != null && StringUtils.equals("cardpayment", type); if (client.getIntValue("source") == 4) { JSONObject account = accounts.get(0); // sendInitEmail(manager, client, account.getString("username"), "*****"); - sendInitEmail(client, account.getString("username"), "*****", false); + sendInitEmail(client, account.getString("username"), "*****", cardApproving); } else { if (accounts.size() == 0) { - initAdminUserAndSendEmail(manager, clientMoniker, client, false); + initAdminUserAndSendEmail(manager, clientMoniker, client, cardApproving); } else { JSONObject account = accounts.get(0); String pwd = RandomStringUtils.random(8, true, true); resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd); // sendInitEmail(manager, client, account.getString("username"), pwd); - sendInitEmail(client, account.getString("username"), pwd, false); + sendInitEmail(client, account.getString("username"), pwd, cardApproving); } } } @@ -1348,42 +1345,39 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid emails.add(email); } } - new Thread() { - @Override - public void run() { - try { - String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content); - mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), - "", contentBd); - JSONObject clientUpdate = new JSONObject(); - if (isUpayAuditPass) { - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("upay_approve_email_send", 3); - clientUpdate.put("upay_approve_email_id", emailId); - sysClientUpayProfileMapper.update(clientUpdate); - } else { - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 3); - clientUpdate.put("approve_email_id", emailId); - clientMapper.update(clientUpdate); - } - } catch (Exception e) { - JSONObject clientUpdate = new JSONObject(); - if (isUpayAuditPass) { - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("upay_approve_email_send", 0); - clientUpdate.put("upay_approve_email_id", null); - sysClientUpayProfileMapper.update(clientUpdate); - } else { - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 0); - clientUpdate.put("approve_email_id", null); - clientMapper.update(clientUpdate); - } - throw new EmailException("Email Sending Failed", e); + new Thread(() -> { + try { + String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content); + mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), + "", contentBd); + JSONObject clientUpdate = new JSONObject(); + if (isUpayAuditPass) { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("upay_approve_email_send", 3); + clientUpdate.put("upay_approve_email_id", emailId); + sysClientUpayProfileMapper.update(clientUpdate); + } else { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("approve_email_send", 3); + clientUpdate.put("approve_email_id", emailId); + clientMapper.update(clientUpdate); } + } catch (Exception e) { + JSONObject clientUpdate = new JSONObject(); + if (isUpayAuditPass) { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("upay_approve_email_send", 0); + clientUpdate.put("upay_approve_email_id", null); + sysClientUpayProfileMapper.update(clientUpdate); + } else { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("approve_email_send", 0); + clientUpdate.put("approve_email_id", null); + clientMapper.update(clientUpdate); + } + throw new EmailException("Email Sending Failed", e); } - }.start(); + }).start(); } 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 516966b08..a0172d106 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 @@ -285,8 +285,8 @@ public class PartnerManageController { } @ManagerMapping(value = "/{clientMoniker}/audit/send_email", method = RequestMethod.PUT, role = {ManagerRole.BD_USER, ManagerRole.OPERATOR}) - public void resendEmail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) { - clientManager.checkAndSendInitEmail(manager, clientMoniker); + public void resendEmail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker,@RequestParam String type) { + clientManager.checkAndSendInitEmail(manager, clientMoniker,type); } @ManagerMapping(value = "/{clientMoniker}/audit/email_sending_status", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) 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 512b90b4b..c62c04184 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 @@ -321,6 +321,18 @@ and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4) + + OR c.client_id IN ( + SELECT client_id FROM sys_client_upay_profile scup + WHERE ((scup.upay_approve_result=4 and scup.upay_open_status is null) or scup.upay_open_status=1 or scup.upay_open_status=2 or scup.upay_open_status=4) + ) + + + AND c.client_id IN ( + SELECT client_id FROM sys_client_upay_profile scup + WHERE ((scup.upay_approve_result=4 and scup.upay_open_status is null) or scup.upay_open_status=1 or scup.upay_open_status=2 or scup.upay_open_status=4) + ) + and c.state=#{state} @@ -817,6 +829,10 @@ GROUP BY address + - + + AU Credit Card | AU 信用卡支付 @@ -1283,7 +1344,8 @@
- Destroy + Destroy check