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 b3b9a7b10..ca6a84e24 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 @@ -243,6 +243,8 @@ public interface ClientManager { void changePaymentSuccessPage(JSONObject manager, String clientMoniker, String paysuccess_version); + void switchChildEachRefund(JSONObject manager, String clientMoniker, boolean childEachRefund); + void changePaymentPage(JSONObject account, String paypad_version); void changeManualSettle(JSONObject account , int client_id, boolean manual_settle,String operator_id,int type,String operation); 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 c89858280..5ed719bc9 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 @@ -16,6 +16,7 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentChannelApi; import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; +import au.com.royalpay.payment.core.mappers.SysClientMapper; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; @@ -271,6 +272,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private FinancialSurchargeAccountDetailMapper financialSurchargeAccountDetailMapper; @Resource + private SysClientMapper sysClientMapper; + @Resource private Locker locker; @@ -414,6 +417,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("client_pay_type",client.getString("client_pay_type").split(",")); client.put("client_pay_desc",client.getString("client_pay_desc").split(",")); } + if (StringUtils.isNotBlank(client.getString("parent_client_id")) + && sysClientMapper.childClientId(client.getIntValue("client_id")).size() > 0) { + client.put("level2_client", 1); + } return client; } @@ -3216,6 +3223,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientMapper.update(client); } + @Override + public void switchChildEachRefund(JSONObject manager, String clientMoniker, boolean childEachRefund) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + checkOrgPermission(manager, client); + JSONObject clientConfig = clientConfigMapper.find(client.getIntValue("client_id")); + clientConfig.put("child_each_refund", childEachRefund); + clientConfigMapper.update(clientConfig); + clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); + } + @Override public void changePaymentPage(JSONObject account, String paypad_version) { int clientId = account.getIntValue("client_id"); 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 bb2f39f80..03fd08425 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 @@ -275,6 +275,11 @@ public class PartnerManageController { clientManager.switchPermission(manager, clientMoniker, "sub_manage", pass.getBooleanValue("allow")); } + @ManagerMapping(value = "/{clientMoniker}/child_each_refund", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) + public void switchChildEachRefund(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.switchChildEachRefund(manager, clientMoniker, pass.getBooleanValue("allow")); + } + @ManagerMapping(value = "/{clientMoniker}/channels/{channel}/permission", method = RequestMethod.PUT, role = {ManagerRole.SERVANT, ManagerRole.DEVELOPER}) public void switchChannelPermission(@PathVariable String clientMoniker, @PathVariable String channel, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchChannelPermission(manager, clientMoniker, channel, pass.getBooleanValue("allow")); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 5b662825e..42ac50671 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -2183,6 +2183,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }]); app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { $scope.toShow = false; + $scope.init = { + child_each_refund : false, + sub_manage : false + } + $scope.newSubClient = function () { $uibModal.open({ templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html', @@ -2221,7 +2226,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.init.sub_manage = true; return; } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.paymentInfo.sub_manage}).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.partner.sub_manage}).then(function () { //$scope.loadPartnerPaymentInfo(); }, function (resp) { commonDialog.alert({ @@ -2232,6 +2237,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.switchChildEachRefund = function () { + if (!$scope.partner) { + return; + } + if (!$scope.init.child_each_refund) { + $scope.init.child_each_refund = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/child_each_refund', {allow: $scope.partner.child_each_refund}).then(function () { + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'Failed to change Sub Partners Manage status', + content: resp.data.message, + type: 'error' + }) + }) + }; + $scope.showClient = function (sub_client) { if ($scope.sub_client_id == sub_client.client_id) { return; diff --git a/src/main/ui/static/payment/partner/templates/sub_partners.html b/src/main/ui/static/payment/partner/templates/sub_partners.html index 5d74e5dac..145b5bce9 100644 --- a/src/main/ui/static/payment/partner/templates/sub_partners.html +++ b/src/main/ui/static/payment/partner/templates/sub_partners.html @@ -48,23 +48,35 @@ } +
+
配置子商户权限
+
+
+
+ +
+
+ +
+ +
+
+
+ -
- -
-
- Sub Partners Manage +
+ +

开启后,父商户具有帮子商户新建账户、退款等管理权限

+
+
- 开启后,父商户具有帮子商户新建账户、退款等管理权限
- -
- -
-
+