2.4.5: hotfix-transaction fee config fix

master
Yixian 3 years ago
parent cb32d9abb6
commit 64cdada5c4

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

Loading…
Cancel
Save