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 843565a9d..63d66f9c3 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 @@ -1991,7 +1991,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid convertExtRateValueDataVersion(rate, extRates, "overseas_rate_value"); rate.put("ext_rates", extRates); } - TransactionFee transFee = paymentApi.channelCalculator(rate.getString("rate_name")).convertTransactionFee(rate.getBigDecimal("transaction_fee")); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(rate.getString("rate_name"))) + .map(calculator -> calculator.convertTransactionFee(rate.getBigDecimal("transaction_fee"))) + .orElse(TransactionFee.ZERO); rate.put("transaction_fee", transFee.displayValue()); } } catch (Exception ignore) { @@ -2038,8 +2040,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configJson.put("manager_name", manager.getString("display_name")); configJson.put("create_time", new Date()); configJson.put("update_time", new Date()); - BigDecimal transactionFeeDecimal = config.getTransactionFee(); - TransactionFee transFee = paymentApi.channelCalculator(config.getRateName()).convertTransactionFee(transactionFeeDecimal); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(config.getRateName())) + .map(calculator -> calculator.convertTransactionFee(config.getTransactionFee())) + .orElse(TransactionFee.ZERO); configJson.put("transaction_fee", transFee.storeValue()); clientRateMapper.saveRate(configJson); // clientMapper.updateCleanDays(clientId, config.getCleanDays()); @@ -2113,7 +2116,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.put("rate_name", channel); newConfig.put("pay_type", config.getString("pay_type")); BigDecimal transactionFeeDecimal = config.getBigDecimal("transaction_fee"); - TransactionFee transFee = paymentApi.channelCalculator(channel).convertTransactionFee(transactionFeeDecimal); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(channel)) + .map(calculator -> calculator.convertTransactionFee(transactionFeeDecimal)) + .orElse(TransactionFee.ZERO); newConfig.put("transaction_fee", transFee.storeValue()); if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; @@ -2173,7 +2178,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject configJson = config.toJSON(); BigDecimal transactionFeeDecimal = config.getTransactionFee(); - TransactionFee transFee = paymentApi.channelCalculator(config.getRateName()).convertTransactionFee(transactionFeeDecimal); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(config.getRateName())) + .map(calculator->calculator.convertTransactionFee(transactionFeeDecimal)) + .orElse(TransactionFee.ZERO); configJson.put("transaction_fee", transFee.storeValue()); JSONObject org = orgMapper.findOne(client.getIntValue("org_id")); checkModifyRate(org, configJson, "Wechat", "min_wechat_rate"); diff --git a/src/main/ui/static/payment/partner/templates/rate_config_dialog.html b/src/main/ui/static/payment/partner/templates/rate_config_dialog.html index 64402eecd..2a8d4f4b5 100644 --- a/src/main/ui/static/payment/partner/templates/rate_config_dialog.html +++ b/src/main/ui/static/payment/partner/templates/rate_config_dialog.html @@ -72,7 +72,8 @@ -