Use general "(required minimum)" label with BTC value if min value is used

This commit is contained in:
Christoph Atteneder 2020-01-07 18:20:33 +01:00
parent af4994534a
commit 166d38f1e9
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
6 changed files with 16 additions and 23 deletions

View File

@ -170,7 +170,6 @@ shared.viewContractAsJson=View contract in JSON format
shared.contract.title=Contract for trade with ID: {0}
shared.paymentDetails=BTC {0} payment details
shared.securityDeposit=Security deposit
shared.securityDepositLowerCase=security deposit
shared.yourSecurityDeposit=Your security deposit
shared.contract=Contract
shared.messageArrived=Message arrived.
@ -215,7 +214,6 @@ shared.arbitrator=Arbitrator
shared.refundAgent=Arbitrator
shared.refundAgentForSupportStaff=Refund agent
shared.delayedPayoutTxId=Refund collateral transaction ID
shared.tradeFee=trading fee
####################################################################
@ -2741,7 +2739,7 @@ URL: \"{0}\"
guiUtil.openWebBrowser.doOpen=Open the web page and don't ask again
guiUtil.openWebBrowser.copyUrl=Copy URL and cancel
guiUtil.ofTradeAmount=of trade amount
guiUtil.minValue=minimum {0} is used
guiUtil.requiredMinimum=(required minimum)
####################################################################
# Component specific

View File

@ -975,8 +975,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
return btcFormatter.formatCoinWithCode(dataModel.getSecurityDeposit()) +
GUIUtil.getPercentageOfTradeAmount(dataModel.getSecurityDeposit(),
dataModel.getAmount().get(),
Restrictions.getMinBuyerSecurityDepositAsCoin(),
Res.get("shared.securityDepositLowerCase"));
Restrictions.getMinBuyerSecurityDepositAsCoin());
}
public String getSecurityDepositWithCode() {
@ -989,8 +988,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
final String makerFee = getFormatterForMakerFee().formatCoinWithCode(makerFeeAsCoin);
if (dataModel.isCurrencyForMakerFeeBtc())
return makerFee + GUIUtil.getPercentageOfTradeAmount(makerFeeAsCoin, dataModel.getAmount().get(),
FeeService.getMinMakerFee(dataModel.isCurrencyForMakerFeeBtc()),
Res.get("shared.tradeFee"));
FeeService.getMinMakerFee(dataModel.isCurrencyForMakerFeeBtc()));
else
return makerFee + " (" + Res.get("shared.tradingFeeInBsqInfo", btcFormatter.formatCoinWithCode(makerFeeAsCoin)) + ")";
}
@ -1026,7 +1024,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
public String getTxFee() {
Coin txFeeAsCoin = dataModel.getTxFee();
return btcFormatter.formatCoinWithCode(txFeeAsCoin) +
GUIUtil.getPercentageOfTradeAmount(txFeeAsCoin, dataModel.getAmount().get(), Coin.ZERO, "");
GUIUtil.getPercentageOfTradeAmount(txFeeAsCoin, dataModel.getAmount().get(), Coin.ZERO);
}

View File

@ -711,8 +711,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
return btcFormatter.formatCoinWithCode(dataModel.getSecurityDeposit()) +
GUIUtil.getPercentageOfTradeAmount(dataModel.getSecurityDeposit(),
dataModel.getAmount().get(),
Restrictions.getMinBuyerSecurityDepositAsCoin(),
Res.get("shared.securityDepositLowerCase"));
Restrictions.getMinBuyerSecurityDepositAsCoin());
}
public String getSecurityDepositWithCode() {
@ -725,8 +724,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
final String takerFee = getFormatterForTakerFee().formatCoinWithCode(takerFeeAsCoin);
if (dataModel.isCurrencyForTakerFeeBtc())
return takerFee + GUIUtil.getPercentageOfTradeAmount(takerFeeAsCoin, dataModel.getAmount().get(),
FeeService.getMinTakerFee(dataModel.isCurrencyForTakerFeeBtc()),
Res.get("shared.tradeFee"));
FeeService.getMinTakerFee(dataModel.isCurrencyForTakerFeeBtc()));
else
return takerFee + " (" + Res.get("shared.tradingFeeInBsqInfo", btcFormatter.formatCoinWithCode(takerFeeAsCoin)) + ")";
}
@ -751,7 +749,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
Coin txFeeAsCoin = dataModel.getTotalTxFee();
return btcFormatter.formatCoinWithCode(txFeeAsCoin) +
GUIUtil.getPercentageOfTradeAmount(txFeeAsCoin, dataModel.getAmount().get(),
Coin.ZERO, "");
Coin.ZERO);
}

View File

@ -294,7 +294,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
if (trade != null && trade.getTradeAmount() != null) {
Coin txFee = dataModel.getTxFee();
String percentage = GUIUtil.getPercentageOfTradeAmount(txFee, trade.getTradeAmount(),
Coin.ZERO, "");
Coin.ZERO);
return btcFormatter.formatCoinWithCode(txFee) + percentage;
} else {
return "";
@ -312,7 +312,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
FeeService.getMinTakerFee(true);
String percentage = GUIUtil.getPercentageOfTradeAmount(tradeFeeInBTC, trade.getTradeAmount(),
minTradeFee, Res.get("shared.tradeFee"));
minTradeFee);
return btcFormatter.formatCoinWithCode(tradeFeeInBTC) + percentage;
} else {
return bsqFormatter.formatCoinWithCode(dataModel.getTradeFeeAsBsq());
@ -336,8 +336,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
String percentage = GUIUtil.getPercentageOfTradeAmount(securityDeposit,
trade.getTradeAmount(),
minSecurityDeposit,
Res.get("shared.securityDepositLowerCase"));
minSecurityDeposit);
return btcFormatter.formatCoinWithCode(securityDeposit) + percentage;
} else {
return "";

View File

@ -662,12 +662,12 @@ public class GUIUtil {
}
}
public static String getPercentageOfTradeAmount(Coin fee, Coin tradeAmount, Coin minFee, String feeType) {
public static String getPercentageOfTradeAmount(Coin fee, Coin tradeAmount, Coin minFee) {
String result = " (" + getPercentage(fee, tradeAmount) +
" " + Res.get("guiUtil.ofTradeAmount") + ")";
if (!fee.isGreaterThan(minFee)) {
result += " - " + Res.get("guiUtil.minValue", feeType);
result = " " + Res.get("guiUtil.requiredMinimum");
}
return result;

View File

@ -118,7 +118,7 @@ public class GUIUtilTest {
Coin fee = make(a(CoinMaker.Coin).but(with(satoshis, 20000L)));
Coin min = make(a(CoinMaker.Coin).but(with(satoshis, 10000L)));
assertEquals(" (0.02% of trade amount)", GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, min, Res.get("shared.tradeFee")));
assertEquals(" (0.02% of trade amount)", GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, min));
}
@Test
@ -127,8 +127,8 @@ public class GUIUtilTest {
Coin fee = make(a(CoinMaker.Coin).but(with(satoshis, 10000L)));
Coin min = make(a(CoinMaker.Coin).but(with(satoshis, 10000L)));
assertEquals(" (0.01% of trade amount) - minimum trading fee is used",
GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, min, Res.get("shared.tradeFee")));
assertEquals(" (required minimum)",
GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, min));
}
@Test
@ -137,6 +137,6 @@ public class GUIUtilTest {
Coin fee = make(a(CoinMaker.Coin).but(with(satoshis, 10000L)));
assertEquals(" (0.01% of trade amount)",
GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, Coin.ZERO, ""));
GUIUtil.getPercentageOfTradeAmount(fee, oneBitcoin, Coin.ZERO));
}
}