mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Merge pull request #1557 from ManfredKarrer/remove-venmo-cashapp
Remove venmo cashapp
This commit is contained in:
commit
c013130bb1
6 changed files with 32 additions and 8 deletions
|
@ -40,6 +40,8 @@ import static bisq.desktop.util.FormBuilder.addLabelInputTextField;
|
|||
import static bisq.desktop.util.FormBuilder.addLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
// Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public class CashAppForm extends PaymentMethodForm {
|
||||
private final CashAppAccount account;
|
||||
private final CashAppValidator validator;
|
||||
|
|
|
@ -40,6 +40,8 @@ import static bisq.desktop.util.FormBuilder.addLabelInputTextField;
|
|||
import static bisq.desktop.util.FormBuilder.addLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
// Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public class VenmoForm extends PaymentMethodForm {
|
||||
private final VenmoAccount account;
|
||||
private final VenmoValidator validator;
|
||||
|
|
|
@ -44,7 +44,9 @@ import javafx.collections.ObservableList;
|
|||
import javafx.collections.SetChangeListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class FiatAccountsDataModel extends ActivatableDataModel {
|
||||
|
@ -79,6 +81,22 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
|||
protected void activate() {
|
||||
user.getPaymentAccountsAsObservable().addListener(setChangeListener);
|
||||
fillAndSortPaymentAccounts();
|
||||
|
||||
final Set<PaymentAccount> paymentAccounts = user.getPaymentAccounts();
|
||||
if (paymentAccounts != null) {
|
||||
|
||||
paymentAccounts.stream()
|
||||
.filter(paymentAccount -> paymentAccount.getPaymentMethod().getId().equals(PaymentMethod.VENMO_ID) ||
|
||||
paymentAccount.getPaymentMethod().getId().equals(PaymentMethod.CASH_APP_ID))
|
||||
.forEach(paymentAccount -> {
|
||||
// We try to clean up Venmo and CashApp accounts to be able to remove the code for those in
|
||||
// later releases without breaking the persisted protobuffer data base files.
|
||||
if (onDeleteAccount(paymentAccount)) {
|
||||
log.info("We deleted a blocked Venmo or CashApp account. paymentAccount name={}",
|
||||
paymentAccount.getAccountName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void fillAndSortPaymentAccounts() {
|
||||
|
@ -87,7 +105,7 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
|||
.filter(paymentAccount -> !paymentAccount.getPaymentMethod().getId().equals(PaymentMethod.BLOCK_CHAINS_ID))
|
||||
.collect(Collectors.toList());
|
||||
paymentAccounts.setAll(list);
|
||||
paymentAccounts.sort((o1, o2) -> o1.getCreationDate().compareTo(o2.getCreationDate()));
|
||||
paymentAccounts.sort(Comparator.comparing(PaymentAccount::getCreationDate));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,14 +147,10 @@ class FiatAccountsDataModel extends ActivatableDataModel {
|
|||
|
||||
public boolean onDeleteAccount(PaymentAccount paymentAccount) {
|
||||
boolean isPaymentAccountUsed = openOfferManager.getObservableList().stream()
|
||||
.filter(o -> o.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()))
|
||||
.findAny()
|
||||
.isPresent();
|
||||
.anyMatch(o -> o.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()));
|
||||
isPaymentAccountUsed = isPaymentAccountUsed || tradeManager.getTradableList().stream()
|
||||
.filter(t -> t.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()) ||
|
||||
paymentAccount.getId().equals(t.getTakerPaymentAccountId()))
|
||||
.findAny()
|
||||
.isPresent();
|
||||
.anyMatch(t -> t.getOffer().getMakerPaymentAccountId().equals(paymentAccount.getId()) ||
|
||||
paymentAccount.getId().equals(t.getTakerPaymentAccountId()));
|
||||
if (!isPaymentAccountUsed)
|
||||
user.removePaymentAccount(paymentAccount);
|
||||
return isPaymentAccountUsed;
|
||||
|
|
|
@ -353,6 +353,8 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
|||
paymentMethodComboBox.setPrefWidth(250);
|
||||
List<PaymentMethod> list = PaymentMethod.getAllValues().stream()
|
||||
.filter(paymentMethod -> !paymentMethod.getId().equals(PaymentMethod.BLOCK_CHAINS_ID))
|
||||
.filter(paymentMethod -> !paymentMethod.getId().equals(PaymentMethod.VENMO_ID))
|
||||
.filter(paymentMethod -> !paymentMethod.getId().equals(PaymentMethod.CASH_APP_ID))
|
||||
.collect(Collectors.toList());
|
||||
paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));
|
||||
paymentMethodComboBox.setConverter(new StringConverter<PaymentMethod>() {
|
||||
|
|
|
@ -20,6 +20,8 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
// Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public final class CashAppValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,8 @@ package bisq.desktop.util.validation;
|
|||
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
// Removed due too high chargeback risk
|
||||
@Deprecated
|
||||
public final class VenmoValidator extends InputValidator {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue