mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 04:19:50 +00:00
fix: include destination parameter in payment method fetch request
This commit is contained in:
parent
b7473594cb
commit
4c160e5d9f
1 changed files with 11 additions and 3 deletions
|
@ -60,9 +60,15 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
||||
String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async {
|
||||
|
||||
final params = {'type': isBuyAction ? 'buy' : 'sell'};
|
||||
final normalizedCryptoCurrency =
|
||||
cryptoCurrency.title + _getNormalizeNetwork(cryptoCurrency);
|
||||
|
||||
final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$fiatCurrency', params);
|
||||
final sourceCurrency = (isBuyAction ? fiatCurrency : normalizedCryptoCurrency).toLowerCase();
|
||||
final destinationCurrency = (isBuyAction ? normalizedCryptoCurrency : fiatCurrency).toLowerCase();
|
||||
|
||||
final params = {'type': isBuyAction ? 'buy' : 'sell', 'destination' : destinationCurrency};
|
||||
|
||||
final url = Uri.https(_baseApiUrl, '$supported$paymentTypes/$sourceCurrency', params);
|
||||
|
||||
try {
|
||||
final response =
|
||||
|
@ -75,7 +81,9 @@ class OnRamperBuyProvider extends BuyProvider {
|
|||
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
} else {
|
||||
printV('Failed to fetch available payment types');
|
||||
final responseBody =
|
||||
jsonDecode(response.body) as Map<String, dynamic>;
|
||||
printV('Failed to fetch available payment types: ${responseBody['message']}');
|
||||
return [];
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue