diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java index e6d7d0dbe..e7764f981 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java @@ -3,7 +3,6 @@ package au.com.royalpay.payment.manage.merchants.beans; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; -import org.apache.commons.lang3.StringUtils; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Pattern; @@ -115,8 +114,6 @@ public class ClientRegisterInfo { private String client_pay_desc; @JSONField(name = "it_contact_person_email") private String itContactPersonEmail; - @JSONField(name = "client_type") - private String clientType; @JSONField(name = "acceptor_name") private String acceptorName; @JSONField(name = "expected_card_revenue") @@ -127,7 +124,10 @@ public class ClientRegisterInfo { private String mwIndustry; @JSONField(name = "enable_international_card") private boolean enableInternaltionCard; - + @JSONField(name = "enable_cross_payment") + private boolean enableCrossPayment; + @JSONField(name = "enable_card_payment") + private boolean enableCardPayment; public JSONObject insertObject() { if (industry == null) { @@ -140,10 +140,6 @@ public class ClientRegisterInfo { return res; } - public boolean enableCardPayment() { - return StringUtils.equalsIgnoreCase("card-payment", clientType) || StringUtils.equalsIgnoreCase("all", clientType); - } - public JSONObject updateObject() { JSONObject obj = insertObject(); obj.remove("client_moniker"); @@ -622,11 +618,19 @@ public class ClientRegisterInfo { this.mwIndustry = mwIndustry; } - public String getClientType() { - return clientType; + public boolean isEnableCardPayment() { + return enableCardPayment; + } + + public boolean isEnableCrossPayment() { + return enableCrossPayment; + } + + public void setEnableCardPayment(boolean enableCardPayment) { + this.enableCardPayment = enableCardPayment; } - public void setClientType(String clientType) { - this.clientType = clientType; + public void setEnableCrossPayment(boolean enableCrossPayment) { + this.enableCrossPayment = enableCrossPayment; } } 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 2c0dda9b0..0a6955bca 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 @@ -836,11 +836,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfig.put("client_pay_type", partner.getString("client_pay_type")); clientConfig.put("client_pay_desc", partner.get("client_pay_desc")); + clientConfig.put("enable_cross_payment", partner.get("enable_cross_payment")); + clientConfig.put("enable_card_payment", partner.get("enable_card_payment")); clientConfigService.save(clientConfig); permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"), partner.getString("client_moniker")); saveLegalAndMarketingInfo(partner); - if (registery.enableCardPayment()) { + if (registery.isEnableCardPayment()) { sysClientUpayProfileMapper.save(partner); } } catch (Exception e) { @@ -919,7 +921,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid sysClientLegalPersonMapper.save(representativeInfo); } - if (info.enableCardPayment()) { + if (info.isEnableCardPayment()) { JSONObject upay = sysClientUpayProfileMapper.findInfo(clientId); if (upay == null) { sysClientUpayProfileMapper.save(updateInfo); @@ -944,6 +946,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", clientId); clientConfig.put("client_moniker", client.getString("client_moniker")); + clientConfig.put("enable_cross_payment", updateInfo.getBooleanValue("enable_cross_payment")); + clientConfig.put("enable_card_payment", updateInfo.getBooleanValue("enable_card_payment")); if (StringUtils.isNotBlank(updateInfo.getString("client_pay_type")) && StringUtils.isNotBlank(updateInfo.getString("client_pay_desc"))) { clientConfig.put("client_pay_type", updateInfo.getString("client_pay_type")); clientConfig.put("client_pay_desc", updateInfo.getString("client_pay_desc")); diff --git a/src/main/ui/static/payment/partner/add-partner.js b/src/main/ui/static/payment/partner/add-partner.js index 8f2e8ae34..821e49bd0 100644 --- a/src/main/ui/static/payment/partner/add-partner.js +++ b/src/main/ui/static/payment/partner/add-partner.js @@ -38,7 +38,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } else { $scope.partner = {timezone: 'Australia/Melbourne'}; } - $scope.partner.client_type = 'cross-border'; + $scope.partner.enable_cross_payment = true; + $scope.partner.enable_cross_payment = false; $scope.initMerchantCode = function () { $http.get('/sys/partners/init/merchant_code').then(function (response) { $scope.partner.client_moniker = response.data.partner_code; @@ -61,6 +62,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }; $scope.partner.sameAsContactPerson = false; + + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; $scope.checkboxOnclick = function (){ $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); if($scope.partner.sameAsContactPerson) { @@ -490,6 +495,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; } + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + function hasRole() { var rolenum; switch (sessionStorage.getItem('role')) { diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 8cdacf735..45deacc9b 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -40,14 +40,11 @@