2.4.5: hotfix-transaction fee config fix

master
Yixian 3 years ago
parent 0bfbc8e5c9
commit cb32d9abb6

@ -102,6 +102,7 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.TransactionFee;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
@ -1990,6 +1991,8 @@ 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"));
rate.put("transaction_fee", transFee.displayValue());
}
} catch (Exception ignore) {
}
@ -2035,6 +2038,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);
configJson.put("transaction_fee", transFee.storeValue());
clientRateMapper.saveRate(configJson);
// clientMapper.updateCleanDays(clientId, config.getCleanDays());
}
@ -2059,7 +2065,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
config.put("update_time", new Date());
config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd"));
config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd"));
if (isAddCardPaymentRate(config, clientId)) {
return;
}
@ -2107,6 +2112,9 @@ 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 = paymentApi.channelCalculator(channel).convertTransactionFee(transactionFeeDecimal);
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;
}
@ -2164,6 +2172,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);
configJson.put("transaction_fee", transFee.storeValue());
JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
checkModifyRate(org, configJson, "Wechat", "min_wechat_rate");
checkModifyRate(org, configJson, "Alipay", "min_alipay_rate");
@ -2186,7 +2197,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id");
JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat");
int cleanDays = changeRate.getIntValue("clean_days");
if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) {
if (cleanDays != client.getIntValue("clean_days")) {
clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays));
}
}

Loading…
Cancel
Save