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 63d66f9c3..ebe774bfc 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 @@ -2115,11 +2115,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); newConfig.put("pay_type", config.getString("pay_type")); - BigDecimal transactionFeeDecimal = config.getBigDecimal("transaction_fee"); - 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; } @@ -2149,10 +2144,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientRateMapper.saveRate(newConfig); } } else if ("ApsInStore".equalsIgnoreCase(channel)) { - newConfig.put("transaction_fee", newConfig.getFloatValue("retail_service_fee_value")); + BigDecimal transactionFeeDecimal = config.getBigDecimal("retail_service_fee_value"); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator("ApsInStore")) + .map(calculator -> calculator.convertTransactionFee(transactionFeeDecimal)) + .orElse(TransactionFee.ZERO); + newConfig.put("transaction_fee", transFee.storeValue()); clientRateMapper.saveRate(newConfig); } else if ("ApsCashier".equalsIgnoreCase(channel)) { - newConfig.put("transaction_fee", newConfig.getFloatValue("online_service_fee_value")); + BigDecimal transactionFeeDecimal = config.getBigDecimal("online_service_fee_value"); + TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator("ApsCashier")) + .map(calculator -> calculator.convertTransactionFee(transactionFeeDecimal)) + .orElse(TransactionFee.ZERO); + newConfig.put("transaction_fee", transFee.storeValue()); clientRateMapper.saveRate(newConfig); } else { clientRateMapper.saveRate(newConfig);