From d8d41906084d2ee6ef0bcc1e5fcd18da024eeac1 Mon Sep 17 00:00:00 2001 From: Serhii Date: Thu, 28 Nov 2024 21:02:10 +0200 Subject: [PATCH] prevent calling unsupported payment method (#1836) --- lib/buy/robinhood/robinhood_buy_provider.dart | 3 ++- lib/view_model/buy/buy_sell_view_model.dart | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/buy/robinhood/robinhood_buy_provider.dart b/lib/buy/robinhood/robinhood_buy_provider.dart index e8de5a59c..a64c9d736 100644 --- a/lib/buy/robinhood/robinhood_buy_provider.dart +++ b/lib/buy/robinhood/robinhood_buy_provider.dart @@ -145,7 +145,7 @@ class RobinhoodBuyProvider extends BuyProvider { if (paymentType != null && paymentType != PaymentType.all) { paymentMethod = normalizePaymentMethod(paymentType); - if (paymentMethod == null) paymentMethod = paymentType.name; + if (paymentMethod == null) return null; } final action = isBuyAction ? 'buy' : 'sell'; @@ -185,6 +185,7 @@ class RobinhoodBuyProvider extends BuyProvider { return null; } + // Supported payment methods: // ● buying_power // ● crypto_balance // ● debit_card diff --git a/lib/view_model/buy/buy_sell_view_model.dart b/lib/view_model/buy/buy_sell_view_model.dart index 4d7151fac..d16307134 100644 --- a/lib/view_model/buy/buy_sell_view_model.dart +++ b/lib/view_model/buy/buy_sell_view_model.dart @@ -155,13 +155,11 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S final hasSelectedPaymentMethod = selectedPaymentMethod != null; final isPaymentMethodLoaded = paymentMethodState is PaymentMethodLoaded; final isBuySellQuotLoaded = buySellQuotState is BuySellQuotLoaded; - final isBuySellQuotFailed = buySellQuotState is BuySellQuotFailed; return hasSelectedQuote && hasSelectedPaymentMethod && isPaymentMethodLoaded && - isBuySellQuotLoaded && - !isBuySellQuotFailed; + isBuySellQuotLoaded; } @computed