From b5e932c6e190a3e07d50c305a145b64939a95714 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 23 Jul 2019 09:34:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20CBBank=E6=89=8B=E7=BB=AD=E8=B4=B9?= =?UTF-8?q?=E5=BC=80=E5=85=B3=20&&=20=E5=A2=9E=E5=8A=A0clientconfig?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E9=85=8D=E7=BD=AE=E6=96=B9=E6=B3=95=20boolea?= =?UTF-8?q?n=20onlyModifyConfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/merchants/core/ClientManager.java | 4 +++ .../merchants/core/ClientModifySupport.java | 2 ++ .../core/impls/ClientManagerImpl.java | 26 ++++++++++++++++++- .../core/impls/ClientModifySupportImpl.java | 6 +++++ .../merchants/entity/ClientConfigModify.java | 14 ++++++++++ .../web/PartnerManageController.java | 5 ++++ .../merchants/web/PartnerViewController.java | 6 +++++ .../static/payment/partner/partner-manage.js | 15 +++++++++++ src/main/ui/static/payment/partner/partner.js | 14 ++++++++++ .../templates/client_payment_info.html | 6 +++++ .../templates/partner_payment_info.html | 6 +++++ 11 files changed, 103 insertions(+), 1 deletion(-) 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 8130e20e7..80fd0479f 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 @@ -213,6 +213,8 @@ public interface ClientManager { void setClientRetailPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge); + void setClientCBBankPaySurCharge(JSONObject account,String clientMoniker, boolean paySurcharge); + void setClientTaxInSurcharge(JSONObject account,String clientMoniker, boolean taxInSurcharge); void setClientCustomerTaxFree(JSONObject account,String clientMoniker, boolean customerTaxFree); @@ -267,6 +269,8 @@ public interface ClientManager { void changeRetailPaySurcharge(JSONObject account, boolean paySurcharge); + void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge); + void changeRequireCustinfo(JSONObject account, boolean requireCustinfo); void changeRequireRemark(JSONObject account, boolean requireRemark); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java index c27c697c6..8d32edf4e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java @@ -13,5 +13,7 @@ public interface ClientModifySupport { void processClientConfigModify(ClientConfigModify clientConfigModify); + void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig); + void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify); } 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 fea78aecf..29012451f 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 @@ -2899,6 +2899,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } + @Override + public void setClientCBBankPaySurCharge(JSONObject account, String clientMoniker, boolean paySurcharge) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "cbbank_surcharge", paySurcharge), true); + + } + @Override public void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -2906,7 +2916,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "tax_in_surcharge", taxInSurcharge)); - } @Override @@ -3434,6 +3443,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid .processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "retail_surcharge", paySurcharge)); } + @Override + public void changeCBBankPaySurcharge(JSONObject account, boolean paySurcharge) { + int clientId = account.getIntValue("client_id"); + JSONObject client = getClientInfo(clientId); + if (client == null) { + throw new InvalidShortIdException(); + } + if (account.getIntValue("role") == 3) { + // cashier cannot change this config + throw new ForbiddenException("Cashier has no permission to switch retail surcharge"); + } + clientModifySupport + .processClientConfigModify(new SwitchPermissionModify(account, client.getString("client_moniker"), "cbbank_surcharge", paySurcharge),true); + } + @Override public void changeRequireCustinfo(JSONObject account, boolean requireCustinfo) { int clientId = account.getIntValue("client_id"); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java index 06b629aa9..f1a1b002b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java @@ -45,6 +45,12 @@ public class ClientModifySupportImpl implements ClientModifySupport { clientInfoCacheSupport.clearClientCache(clientId); } + @Override + public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) { + int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig); + clientInfoCacheSupport.clearClientConfigCache(clientId); + } + @Override public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) { int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java index 0320aa2c5..18c50176c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java @@ -50,6 +50,20 @@ public abstract class ClientConfigModify { return clientId; } + public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) { + JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker); + JSONObject modifyResult = getModifyResult(); + try { + saveModifyHistory(clientConfig, modifyResult, mongoTemplate); + }catch (Exception e){ + + } + int clientId = clientConfig.getIntValue("client_id"); + modifyResult.put("client_id", clientId); + clientConfigMapper.update(modifyResult); + return clientId; + } + private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) { if (account == null) { return; 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 8d7ddadfa..1fb19d5d2 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 @@ -230,6 +230,11 @@ public class PartnerManageController { clientManager.setClientRetailPaySurCharge(manager,clientMoniker, config.getBooleanValue("retail_surcharge")); } + @ManagerMapping(value = "/{clientMoniker}/cbbank_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void setClientCBBankPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { + clientManager.setClientCBBankPaySurCharge(manager,clientMoniker, config.getBooleanValue("cbbank_surcharge")); + } + @ManagerMapping(value = "/{clientMoniker}/tax_in_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public void setClientTaxPayer(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { clientManager.setClientTaxInSurcharge(manager,clientMoniker, config.getBooleanValue("tax_in_surcharge")); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java index be7823494..58d389800 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerViewController.java @@ -419,6 +419,12 @@ public class PartnerViewController { clientManager.changeRetailPaySurcharge(account, pass.getBooleanValue("retail_surcharge")); } + @PartnerMapping(value = "/cbbank_surcharge", method = RequestMethod.PUT) + @ResponseBody + public void changeCBBankPaySurCharge(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { + clientManager.changeCBBankPaySurcharge(account, pass.getBooleanValue("cbbank_surcharge")); + } + @PartnerMapping(value = "/require_custinfo", method = RequestMethod.PUT) @ResponseBody public void changeRequireCustinfo(@RequestBody JSONObject pass, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject account) { diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 2893d7854..67764f20a 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1659,6 +1659,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); }; + $scope.updateClientCBBankPaySurCharge = function () { + if (!$scope.paymentInfo) { + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () { + // $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'failed to change Customer Pay for Surcharge for Retail', + content: resp.data.message, + type: 'error' + }) + }) + } + $scope.updateClientApiSurCharge = function () { if (!$scope.paymentInfo) { return; diff --git a/src/main/ui/static/payment/partner/partner.js b/src/main/ui/static/payment/partner/partner.js index 3c6b279d4..b13eab1ba 100644 --- a/src/main/ui/static/payment/partner/partner.js +++ b/src/main/ui/static/payment/partner/partner.js @@ -999,6 +999,20 @@ define(['angular', 'decimal', 'uiRouter', 'ngBootSwitch', 'ngFileUpload','uiBoot }) }) } + $scope.updateClientCBBankPaySurCharge = function () { + if (!$scope.paymentInfo) { + return; + } + $http.put('/client/partner_info/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then(function () { + // $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'failed to change Customer Pay for Surcharge for Retail', + content: resp.data.message, + type: 'error' + }) + }) + } $scope.toggleRequireCustInfo = function () { if (!$scope.paymentInfo) { return; diff --git a/src/main/ui/static/payment/partner/templates/client_payment_info.html b/src/main/ui/static/payment/partner/templates/client_payment_info.html index f5efdb855..62752c87d 100644 --- a/src/main/ui/static/payment/partner/templates/client_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/client_payment_info.html @@ -444,6 +444,12 @@

+
+ +
+ +
+
diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index 212398f7f..b3637e7a8 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -426,6 +426,12 @@
+
+ +
+ +
+
From cf78550b992c17ab231cc89cc3aa2906889e3bdb Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Tue, 23 Jul 2019 21:00:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[Y]=20=E9=80=9A=E7=9F=A5=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=95=86=E6=88=B7=E5=90=8D=E5=8D=95=E4=B8=BA30=E5=A4=A9?= =?UTF-8?q?=E5=86=85=E6=B4=BB=E8=B7=83=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../payment/manage/mappers/system/ClientMapper.java | 2 ++ .../manage/notice/core/impls/NoticeManageImpl.java | 7 +++---- .../payment/manage/mappers/system/ClientMapper.xml | 11 +++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index ddbda2b3a..47d670924 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.0.22 + 1.0.23 UTF-8 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 df5996629..d5d58734c 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 @@ -26,6 +26,8 @@ public interface ClientMapper { List listValidClient(); + List listValidClientFor30Days(); + List listGreenChannel(JSONObject params); @AutoSql(type = SqlType.SELECT) diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java index 4b76f34ab..65e7f0769 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java @@ -108,7 +108,7 @@ public class NoticeManageImpl implements NoticeManage { notice.put("create_name", manager.getString("display_name")); if (!notice.getBoolean("merchants_type")){ StringBuilder sendClients = new StringBuilder(); - List clients = clientMapper.listValidClient(); + List clients = clientMapper.listValidClientFor30Days(); clients.forEach(c -> { if (c.getInteger("parent_client_id")==null || c.getInteger("parent_client_id")!=9){ String p = c.getString("client_moniker")+","; @@ -146,7 +146,7 @@ public class NoticeManageImpl implements NoticeManage { if (!notice.getBoolean("merchants_type")){ StringBuilder sendClients = new StringBuilder(); - List clients = clientMapper.listValidClient(); + List clients = clientMapper.listValidClientFor30Days(); clients.forEach(c -> { if (c.getInteger("parent_client_id")==null || c.getInteger("parent_client_id")!=9){ String p = c.getString("client_moniker")+","; @@ -292,8 +292,7 @@ public class NoticeManageImpl implements NoticeManage { public int listNoticeClients(String noticeId) { JSONObject params = new JSONObject(); params.put("notice_id", noticeId); - int clients = noticePartnerMapper.countClientsByNoticeId(params); - return clients; + return noticePartnerMapper.countClientsByNoticeId(params); } 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 2835f44e2..cd0e4c957 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 @@ -5,6 +5,17 @@ SELECT client_id,client_moniker,parent_client_id FROM sys_clients WHERE is_valid=1 and (approve_result = 1 or approve_result = 2) +