diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 1f2684509..8ecf5793a 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -2784,10 +2784,20 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } else { $scope.partner = {timezone: 'Australia/Melbourne'}; } + $scope.initMerchantCode = function () { + $http.get('/sys/partners/init/merchant_code').then(function (response) { + $scope.partner.client_moniker = response.data; + $scope.merchantCodeChecked = true; + $scope.merchantIsValid = true; + }); + }; + $scope.initMerchantCode(); $scope.partner.company_phone_c = 61; $scope.partner.contact_phone_c = 61; $scope.partner.client_pay_type = []; $scope.partner.client_pay_desc = []; + $scope.merchantIsValid = false; + $scope.merchantCodeChecked = false; var resetClientPayDescByTpey = function (type) { type = parseInt(type); if (type == 1) { @@ -2914,6 +2924,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.timezones = timezone.configs(); $scope.states = stateMap.configs(); $scope.countries = countryMap.configs(); + $scope.checkMerchantCodeIsValid = function (code) { + if (code.length != 4) { + $scope.merchantCodeChecked = false; + $scope.merchantIsValid = false; + return; + } + $http.get('/sys/partners/init/check_code_isvalid',{params:{clientMoniker:code}}).then(function (response) { + $scope.merchantIsValid = response.data; + $scope.merchantCodeChecked = true; + }); + }; $scope.saveSubPartner = function (form) { if (form.$invalid) { angular.forEach(form, function (item, key) { diff --git a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html index 537a23227..17bb61475 100644 --- a/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html +++ b/src/main/ui/static/payment/partner/templates/add_sub_partner_dialog.html @@ -25,8 +25,14 @@