mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-01 01:32:17 +01:00
Show ARS Blue Rate popup during payment account creation
At the moment, we show the ARS Blue Rate popup when the user saves a single currency payment account (PR #7122). This misses many payment accounts that support ARS. The new behaviour is to show the ARS Blue Rate popup when ARS is selected during account generation (either pre-selected or later selected by the user). Payment accounts supporting ARS: - CashByMail - CashDeposit - F2F - MoneyGram - National bank - OKPayAccount (deprecated) - Same bank - Specific bank - Transferwise - Uphold - Western Union
This commit is contained in:
parent
f079e26e09
commit
fb39babbac
3 changed files with 51 additions and 19 deletions
|
@ -37,6 +37,7 @@ import bisq.core.offer.OfferDirection;
|
||||||
import bisq.core.payment.AssetAccount;
|
import bisq.core.payment.AssetAccount;
|
||||||
import bisq.core.payment.PaymentAccount;
|
import bisq.core.payment.PaymentAccount;
|
||||||
import bisq.core.payment.payload.PaymentMethod;
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
|
import bisq.core.user.DontShowAgainLookup;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ import javafx.collections.FXCollections;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -118,8 +120,13 @@ public abstract class PaymentMethodForm {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
currencyComboBox.setOnAction(e -> {
|
currencyComboBox.setOnAction(e -> {
|
||||||
paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
|
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||||
|
paymentAccount.setSingleTradeCurrency(selectedCurrency);
|
||||||
updateFromInputs();
|
updateFromInputs();
|
||||||
|
|
||||||
|
if (isArgentinePesos(selectedCurrency)) {
|
||||||
|
maybeShowArgentinePesosBlueRatePopup();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,19 +306,32 @@ public abstract class PaymentMethodForm {
|
||||||
TradeCurrency e, PaymentAccount paymentAccount) {
|
TradeCurrency e, PaymentAccount paymentAccount) {
|
||||||
CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
|
CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
|
||||||
checkBox.setMouseTransparent(!isEditable);
|
checkBox.setMouseTransparent(!isEditable);
|
||||||
checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e));
|
|
||||||
|
boolean isCurrencySelected = paymentAccount.getTradeCurrencies().contains(e);
|
||||||
|
checkBox.setSelected(isCurrencySelected);
|
||||||
|
|
||||||
checkBox.setMinWidth(60);
|
checkBox.setMinWidth(60);
|
||||||
checkBox.setMaxWidth(checkBox.getMinWidth());
|
checkBox.setMaxWidth(checkBox.getMinWidth());
|
||||||
checkBox.setTooltip(new Tooltip(e.getName()));
|
checkBox.setTooltip(new Tooltip(e.getName()));
|
||||||
checkBox.setOnAction(event -> {
|
checkBox.setOnAction(event -> {
|
||||||
if (checkBox.isSelected())
|
if (checkBox.isSelected()) {
|
||||||
paymentAccount.addCurrency(e);
|
paymentAccount.addCurrency(e);
|
||||||
else
|
|
||||||
|
if (isArgentinePesos(e)) {
|
||||||
|
maybeShowArgentinePesosBlueRatePopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
paymentAccount.removeCurrency(e);
|
paymentAccount.removeCurrency(e);
|
||||||
|
}
|
||||||
|
|
||||||
updateAllInputsValid();
|
updateAllInputsValid();
|
||||||
});
|
});
|
||||||
flowPane.getChildren().add(checkBox);
|
flowPane.getChildren().add(checkBox);
|
||||||
|
|
||||||
|
if (isCurrencySelected && isArgentinePesos(e)) {
|
||||||
|
maybeShowArgentinePesosBlueRatePopup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void autoFillNameTextField();
|
protected abstract void autoFillNameTextField();
|
||||||
|
@ -352,4 +372,22 @@ public abstract class PaymentMethodForm {
|
||||||
|
|
||||||
void addAcceptedCountry(String countryCode) {
|
void addAcceptedCountry(String countryCode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isArgentinePesos(TradeCurrency tradeCurrency) {
|
||||||
|
FiatCurrency arsCurrency = new FiatCurrency("ARS");
|
||||||
|
return tradeCurrency.equals(arsCurrency);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void maybeShowArgentinePesosBlueRatePopup() {
|
||||||
|
String key = "arsBlueMarketNotificationPopup";
|
||||||
|
if (DontShowAgainLookup.showAgain(key)) {
|
||||||
|
new Popup()
|
||||||
|
.headLine(Res.get("popup.arsBlueMarket.title"))
|
||||||
|
.information(Res.get("popup.arsBlueMarket.info"))
|
||||||
|
.actionButtonText(Res.get("shared.iUnderstand"))
|
||||||
|
.hideCloseButton()
|
||||||
|
.dontShowAgainId(key)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,19 +126,6 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
||||||
|
|
||||||
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
|
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
|
||||||
accountAgeWitnessService.signAndPublishSameNameAccounts();
|
accountAgeWitnessService.signAndPublishSameNameAccounts();
|
||||||
|
|
||||||
if (paymentAccount.getSingleTradeCurrency().getCode().equals("ARS")) {
|
|
||||||
String key = "arsBlueMarketNotificationPopup";
|
|
||||||
if (DontShowAgainLookup.showAgain(key)) {
|
|
||||||
new Popup()
|
|
||||||
.headLine(Res.get("popup.arsBlueMarket.title"))
|
|
||||||
.information(Res.get("popup.arsBlueMarket.info"))
|
|
||||||
.actionButtonText(Res.get("shared.iUnderstand"))
|
|
||||||
.hideCloseButton()
|
|
||||||
.dontShowAgainId(key)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdateAccount(PaymentAccount paymentAccount) {
|
public void onUpdateAccount(PaymentAccount paymentAccount) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import bisq.desktop.components.BisqScrollPane;
|
||||||
import bisq.desktop.components.BisqTextArea;
|
import bisq.desktop.components.BisqTextArea;
|
||||||
import bisq.desktop.components.InfoAutoTooltipLabel;
|
import bisq.desktop.components.InfoAutoTooltipLabel;
|
||||||
import bisq.desktop.components.indicator.TxConfidenceIndicator;
|
import bisq.desktop.components.indicator.TxConfidenceIndicator;
|
||||||
|
import bisq.desktop.components.paymentmethods.PaymentMethodForm;
|
||||||
import bisq.desktop.main.MainView;
|
import bisq.desktop.main.MainView;
|
||||||
import bisq.desktop.main.account.AccountView;
|
import bisq.desktop.main.account.AccountView;
|
||||||
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
|
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
|
||||||
|
@ -1103,8 +1104,14 @@ public class GUIUtil {
|
||||||
});
|
});
|
||||||
currencyComboBox.setDisable(true);
|
currencyComboBox.setDisable(true);
|
||||||
|
|
||||||
currencyComboBox.setOnAction(e ->
|
currencyComboBox.setOnAction(e -> {
|
||||||
onTradeCurrencySelectedHandler.accept(currencyComboBox.getSelectionModel().getSelectedItem()));
|
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||||
|
onTradeCurrencySelectedHandler.accept(selectedCurrency);
|
||||||
|
|
||||||
|
if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
|
||||||
|
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return new Tuple2<>(currencyComboBox, gridRow);
|
return new Tuple2<>(currencyComboBox, gridRow);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue