diff --git a/pom.xml b/pom.xml index f83725f5f..b27108e1d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.4.27 + 1.4.28 UTF-8 1.8.0 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 b51b34a96..47c26e099 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 @@ -234,6 +234,8 @@ public interface ClientManager { void setClientTaxInSurcharge(JSONObject account, String clientMoniker, boolean taxInSurcharge); + void setClientPreSettle(JSONObject manager, String clientMoniker, boolean presettle); + void setClientCustomerTaxFree(JSONObject account, String clientMoniker, boolean customerTaxFree); List listClientsForSettlement(); @@ -560,4 +562,6 @@ public interface ClientManager { void queryModifyClientIds(int clientId, JSONObject params); boolean getMergeSettleStatus(JSONObject client); + + void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params); } 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 e37d42b31..e04a0300c 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 @@ -3443,6 +3443,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "tax_in_surcharge", taxInSurcharge)); } + @Override + public void setClientPreSettle(JSONObject account, String clientMoniker, boolean presettle) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "enable_presettle", presettle)); + } + @Override public void setClientCustomerTaxFree(JSONObject account, String clientMoniker, boolean customerTaxFree) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -6780,4 +6789,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + public void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params){ + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject clientConfig = clientConfigMapper.find(client.getInteger("client_id")); + JSONObject extParmas = JSONObject.parseObject(clientConfig.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")); + } + clientConfig.put("ext_params",extParmas.toString()); + clientConfigMapper.update(clientConfig); + } + } 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 44467674a..190f6d1aa 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 @@ -253,6 +253,11 @@ public class PartnerManageController { clientManager.setClientTaxInSurcharge(manager, clientMoniker, config.getBooleanValue("tax_in_surcharge")); } + @ManagerMapping(value = "/{clientMoniker}/presettle", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) + public void setClientPreSettle(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) { + clientManager.setClientPreSettle(manager, clientMoniker, config.getBooleanValue("enable_presettle")); + } + @ManagerMapping(value = "/{clientMoniker}/customer_tax_free", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void setClientCustomerTaxFree(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject config) { clientManager.setClientCustomerTaxFree(manager, clientMoniker, config.getBooleanValue("customer_tax_free")); @@ -868,4 +873,11 @@ public class PartnerManageController { public void switchClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ clientManager.changeSwitchIncrementalService(clientMoniker,incrementalService,manager); } + + @ManagerMapping(value = "/{clientMoniker}/ext_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void changeClientExtConfigs(@PathVariable("clientMoniker")String clientMoniker, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestBody JSONObject params){ + clientManager.changeExtParams(clientMoniker,manager,params); + } } diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 8995d673e..fa662776c 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1733,6 +1733,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }]); app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog', '$uibModal', '$sce', function ($scope, $http, $state, commonDialog, $uibModal, $sce) { + $scope.convertExtParams = []; $scope.copyHfLink = function () { var e = document.getElementById("cpbt"); e.select(); @@ -1765,7 +1766,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.loadPartnerPaymentInfo = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { + $scope.extParams = {}; $scope.paymentInfo = resp.data; + $scope.extParams = $scope.paymentInfo?JSON.parse($scope.paymentInfo.ext_params):null; + $scope.convertExtParams = $scope.extParamsEditFlags() $scope.ctrl.editSubMerchant = false; $scope.ctrl.editAliSubMerchant = false; $scope.ctrl.editMaxOrderAmount = false; @@ -1774,6 +1778,27 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.ctrl.editRefundCreditLine = false; }) }; + $scope.extParamsEditFlags = function(){ + var paramList = [] + if($scope.extParams != null){ + for(var key in $scope.extParams){ + var obj = {} + console.log(1) + if(typeof $scope.extParams[key] != 'boolean'){ + obj.name = key; + obj.value = $scope.extParams[key]; + obj.type = 'string'; + obj.flag =false; + }else{ + obj.name = key; + obj.value = $scope.extParams[key]; + obj.type = 'boolean' + } + paramList.push(obj) + } + } + return paramList; + }; $scope.qrConfig = {currency: 'AUD'}; $scope.reloadQRCode = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/qrcode', {params: $scope.qrConfig}).then(function (resp) { @@ -2462,6 +2487,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.extChangeParam = function(name,value){ + var flag = true; + $scope.convertExtParams.forEach(function (params) { + if(params.name == name && value=='' && params.type == 'string'){ + flag = false; + } + }) + if(flag){ + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ext_config',{key:name,value:value}).then(function () { + $scope.loadPartnerPaymentInfo(); + }) + } + + } + }]); app.controller('clientSubMerchantIdLogCtrl', ['$scope', '$http', 'logs', function ($scope, $http, logs) { $scope.logs = logs.data; @@ -2689,6 +2729,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.getBankAccount(); }) }; + + $scope.switchPreSettle = function (presettle) { + if (!$scope.init.enable_presettle) { + $scope.init.enable_presettle = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/presettle', {enable_presettle: presettle}).then(function (resp) { + $scope.getBankAccount(); + }) + }; + $scope.customerTaxFree = function (customerTaxFree) { if (!$scope.init.customer_tax_free) { $scope.init.customer_tax_free = true; diff --git a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html index 3f061f11b..8a88b7b27 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -65,6 +65,13 @@ switch-change="skipClearing(partner.skip_clearing)"> +
+ +
+ +
+
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 2c2f3bd80..3944afdee 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 @@ -553,7 +553,7 @@ class="fa fa-edit">

- +
+
+
Ext Config
+
+
+ +
+ +
+
+ +
+ +
+

+ {{param.value}} + +

+
+ +
+ +
+
+ +
+
+
+
+
+
+
+