mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
fix: include destination parameter in payment method fetch request (#2254)
This commit is contained in:
parent
c6f9d12a8e
commit
a9e05073a5
1 changed files with 11 additions and 3 deletions
|
@ -60,9 +60,15 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
||||||
String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async {
|
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 {
|
try {
|
||||||
final response =
|
final response =
|
||||||
|
@ -75,7 +81,9 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
|
.map((item) => PaymentMethod.fromOnramperJson(item as Map<String, dynamic>))
|
||||||
.toList();
|
.toList();
|
||||||
} else {
|
} 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 [];
|
return [];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue