From 1650f513962eb8d13788716c99aaea66a5e6bc7f Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Tue, 19 Jun 2018 12:04:27 +0800 Subject: [PATCH] =?UTF-8?q?add=201=E3=80=81gateway=5Falipay=5Fonline?= =?UTF-8?q?=E5=BC=80=E5=85=B3,2=E3=80=81ali=5Fsub=5Fmerchant=5Fid=20=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/merchants/core/ClientManager.java | 5 +++ .../core/impls/ClientManagerImpl.java | 24 ++++++++++++++ .../web/PartnerManageController.java | 9 +++++ .../static/payment/partner/partner-manage.js | 33 ++++++++++++++++++- .../templates/partner_payment_info.html | 29 ++++++++++++++++ 5 files changed, 99 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 ef0ac79e8..28b1d03c2 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 @@ -60,6 +60,9 @@ public interface ClientManager { @Transactional void updateClientPaymentConfig(JSONObject manager, String clientMoniker, JSONObject subMerchantInfo); + @Transactional + void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); + @Transactional(noRollbackFor = EmailException.class) void auditClient(JSONObject manager, String clientMoniker, int pass); @@ -258,6 +261,8 @@ public interface ClientManager { void enableGatewayUpgrade(JSONObject account,String clientMoniker, boolean gatewayUpgrade); + void enableGatewayAlipayOnline(JSONObject account,String clientMoniker, boolean gatewayAlipayOnline); + void setCustomerSurchargeRate(JSONObject account,String clientMoniker, BigDecimal customer_surcharge_rate); void setOrderExpiryConfig(JSONObject account,String clientMoniker, String orderExpiryConfig); 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 a7bf6ff4d..32771d85a 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 @@ -711,6 +711,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(clientId); } + @Override + public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + JSONObject update = new JSONObject(); + int clientId = client.getIntValue("client_id"); + update.put("client_id", clientId); + update.put("ali_sub_merchant_id", aliSubMerchantInfo.getString("ali_sub_merchant_id")); + clientMapper.update(update); + clientInfoCacheSupport.clearClientCache(clientId); + } + private void recordSubMerchantLog(JSONObject client, JSONObject subMerchantInfo, JSONObject manager) { JSONObject log = new JSONObject(); log.put("sub_merchant_id_after", subMerchantInfo.getString("sub_merchant_id")); @@ -3050,6 +3065,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "gateway_upgrade", gatewayUpgrade)); } + @Override + public void enableGatewayAlipayOnline(JSONObject account, String clientMoniker, boolean gatewayAlipayOnline) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "gateway_alipay_online", gatewayAlipayOnline)); + } + private void sendMessagetoCompliance(JSONObject client, String bd_user_name) { List complianceList = managerMapper.getOnlyCompliance(); if (complianceList != null && complianceList.size() > 0) { 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 df6203b1a..57c66375d 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 @@ -154,6 +154,10 @@ public class PartnerManageController { public void updatePartnerPaymentConfig(@PathVariable String clientMoniker, @RequestBody JSONObject subMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.updateClientPaymentConfig(manager, clientMoniker, subMerchantInfo); } + @ManagerMapping(value = "/{clientMoniker}/ali_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) + public void updateAliSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject aliSubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo); + } @ManagerMapping(value = "/{clientMoniker}/qrcode_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT}) public void setClientPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { @@ -165,6 +169,11 @@ public class PartnerManageController { clientManager.enableGatewayUpgrade(manager,clientMoniker, config.getBooleanValue("gateway_upgrade")); } + @ManagerMapping(value = "/{clientMoniker}/gateway_alipay_online", method = RequestMethod.PUT, role = {ManagerRole.DEVELOPER}) + public void enableGatewayAlipayOnline(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { + clientManager.enableGatewayAlipayOnline(manager,clientMoniker, config.getBooleanValue("gateway_alipay_online")); + } + @ManagerMapping(value = "/{clientMoniker}/api_surcharge", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.SERVANT}) public void setClientApiPaySurCharge(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable String clientMoniker, @RequestBody JSONObject config) { clientManager.setClientApiPaySurCharge(manager,clientMoniker, config.getBooleanValue("api_surcharge")); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 0ae5a8464..2153f9788 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1079,6 +1079,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { $scope.paymentInfo = resp.data; $scope.ctrl.editSubMerchant = false; + $scope.ctrl.editAliSubMerchant = false; $scope.ctrl.editMaxOrderAmount = false; $scope.ctrl.editOrderExpiryConfig = false; }) @@ -1209,6 +1210,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); }; + $scope.saveAliSubMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', {ali_sub_merchant_id: $scope.paymentInfo.ali_sub_merchant_id}).then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Ali Sub Merchant ID successfully', + type: 'success' + }); + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; $scope.refreshCredential = function () { commonDialog.confirm({ title: 'Warning', @@ -1221,7 +1234,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }) }; - $scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {}}; + $scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false}; $scope.switchCommonSubMerchantId = function () { if (!$scope.paymentInfo) { return; @@ -1315,6 +1328,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }) }; + $scope.toggleGatewayAlipayOnline = function () { + if (!$scope.paymentInfo) { + return; + } + if (!$scope.init.gateway_alipay_online) { + $scope.init.gateway_alipay_online = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_alipay_online', {gateway_alipay_online: $scope.paymentInfo.gateway_alipay_online}).then(function () { + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'failed to change Gateway Alipay Online status', + content: resp.data.message, + type: 'error' + }) + }) + }; $scope.toggleRefund = function () { if (!$scope.paymentInfo) { return; 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 7e792cbc9..4ef0ef886 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 @@ -39,6 +39,29 @@ +
+ +
+

+ {{paymentInfo.ali_sub_merchant_id||'Not Configure'}} + +

+
+ +
+ +
+
+ +
+
+
+
@@ -255,6 +278,12 @@
+
+ +
+ +
+