prevent calling unsupported payment method (#1836)
Serhii committed
Nov 28, 2024 at 21:02 UTC
d8d41906084d2ee6ef0bcc1e5fcd18da024eeac1
2 files changed
+3
-4
lib/buy/robinhood/robinhood_buy_provider.dart
+2
-1
@@ -145,7 +145,7 @@ class RobinhoodBuyProvider extends BuyProvider {
145
146
if (paymentType != null && paymentType != PaymentType.all) {
147
paymentMethod = normalizePaymentMethod(paymentType);
148
- if (paymentMethod == null) paymentMethod = paymentType.name;
148
+ if (paymentMethod == null) return null;
149
}
150
151
final action = isBuyAction ? 'buy' : 'sell';
@@ -185,6 +185,7 @@ class RobinhoodBuyProvider extends BuyProvider {
185
return null;
186
}
187
188
+ // Supported payment methods:
189
// ● buying_power
190
// ● crypto_balance
191
// ● debit_card
lib/view_model/buy/buy_sell_view_model.dart
+1
-3
@@ -155,13 +155,11 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
155
final hasSelectedPaymentMethod = selectedPaymentMethod != null;
156
final isPaymentMethodLoaded = paymentMethodState is PaymentMethodLoaded;
157
final isBuySellQuotLoaded = buySellQuotState is BuySellQuotLoaded;
158
- final isBuySellQuotFailed = buySellQuotState is BuySellQuotFailed;
158
159
return hasSelectedQuote &&
160
hasSelectedPaymentMethod &&
161
isPaymentMethodLoaded &&
163
- isBuySellQuotLoaded &&
164
- !isBuySellQuotFailed;
162
+ isBuySellQuotLoaded;
163
}
164
165
@computed