Merge branch 'hotfix-citypartner_rate' into develop

master
Yixian 3 years ago
commit f0f712a9c8

@ -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");

@ -72,7 +72,8 @@
<input type="number" name="transaction_fee" class="form-control"
ng-model="rate.transaction_fee"
min="0" step="0.1" max="1" id="transaction_fee_input" required>
<div class="input-group-addon">$</div>
<div class="input-group-addon" ng-if="rate.rate_name != 'ApsInStore' && rate.rate_name != 'ApsCashier'">$</div>
<div class="input-group-addon" ng-if="rate.rate_name == 'ApsInStore' || rate.rate_name == 'ApsCashier'">%</div>
</div>
<div ng-messages="rate_form.transaction_fee.$error" ng-if="rate_form.transaction_fee.$dirty">
<div class="small text-danger" ng-message="min">

Loading…
Cancel
Save