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:
Alva Swanson 2024-12-27 17:52:55 +00:00
parent f079e26e09
commit fb39babbac
No known key found for this signature in database
GPG key ID: 004760E77F753090
3 changed files with 51 additions and 19 deletions

View file

@ -37,6 +37,7 @@ import bisq.core.offer.OfferDirection;
import bisq.core.payment.AssetAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.payload.PaymentMethod;
import bisq.core.user.DontShowAgainLookup;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;
@ -67,6 +68,7 @@ import javafx.collections.FXCollections;
import javafx.util.StringConverter;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
@ -118,8 +120,13 @@ public abstract class PaymentMethodForm {
}
});
currencyComboBox.setOnAction(e -> {
paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
paymentAccount.setSingleTradeCurrency(selectedCurrency);
updateFromInputs();
if (isArgentinePesos(selectedCurrency)) {
maybeShowArgentinePesosBlueRatePopup();
}
});
}
@ -299,19 +306,32 @@ public abstract class PaymentMethodForm {
TradeCurrency e, PaymentAccount paymentAccount) {
CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
checkBox.setMouseTransparent(!isEditable);
checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e));
boolean isCurrencySelected = paymentAccount.getTradeCurrencies().contains(e);
checkBox.setSelected(isCurrencySelected);
checkBox.setMinWidth(60);
checkBox.setMaxWidth(checkBox.getMinWidth());
checkBox.setTooltip(new Tooltip(e.getName()));
checkBox.setOnAction(event -> {
if (checkBox.isSelected())
if (checkBox.isSelected()) {
paymentAccount.addCurrency(e);
else
if (isArgentinePesos(e)) {
maybeShowArgentinePesosBlueRatePopup();
}
} else {
paymentAccount.removeCurrency(e);
}
updateAllInputsValid();
});
flowPane.getChildren().add(checkBox);
if (isCurrencySelected && isArgentinePesos(e)) {
maybeShowArgentinePesosBlueRatePopup();
}
}
protected abstract void autoFillNameTextField();
@ -352,4 +372,22 @@ public abstract class PaymentMethodForm {
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();
}
}
}

View file

@ -126,19 +126,6 @@ class FiatAccountsDataModel extends ActivatableDataModel {
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
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) {

View file

@ -24,6 +24,7 @@ import bisq.desktop.components.BisqScrollPane;
import bisq.desktop.components.BisqTextArea;
import bisq.desktop.components.InfoAutoTooltipLabel;
import bisq.desktop.components.indicator.TxConfidenceIndicator;
import bisq.desktop.components.paymentmethods.PaymentMethodForm;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
@ -1103,8 +1104,14 @@ public class GUIUtil {
});
currencyComboBox.setDisable(true);
currencyComboBox.setOnAction(e ->
onTradeCurrencySelectedHandler.accept(currencyComboBox.getSelectionModel().getSelectedItem()));
currencyComboBox.setOnAction(e -> {
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
onTradeCurrencySelectedHandler.accept(selectedCurrency);
if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
}
});
return new Tuple2<>(currencyComboBox, gridRow);
}