mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-29 04:49:51 +00:00
fix(tor): onramper request fix
This commit is contained in:
parent
0acab899ed
commit
a7db61080a
1 changed files with 4 additions and 3 deletions
|
@ -71,9 +71,10 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
clearnetUri: url,
|
clearnetUri: url,
|
||||||
headers: {'Authorization': _apiKey, 'accept': 'application/json'},
|
headers: {'Authorization': _apiKey, 'accept': 'application/json'},
|
||||||
);
|
);
|
||||||
|
final responseString = await response.transform(utf8.decoder).join();
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final Map<String, dynamic> data = jsonDecode(response.body) as Map<String, dynamic>;
|
final Map<String, dynamic> data = jsonDecode(responseString) as Map<String, dynamic>;
|
||||||
final recommended = data['message']['recommended'] as Map<String, dynamic>;
|
final recommended = data['message']['recommended'] as Map<String, dynamic>;
|
||||||
|
|
||||||
final recommendedPaymentType = recommended['paymentMethod'] as String?;
|
final recommendedPaymentType = recommended['paymentMethod'] as String?;
|
||||||
|
@ -81,7 +82,7 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
return recommendedPaymentType ;
|
return recommendedPaymentType ;
|
||||||
} else {
|
} else {
|
||||||
final responseBody =
|
final responseBody =
|
||||||
jsonDecode(response.body) as Map<String, dynamic>;
|
jsonDecode(responseString) as Map<String, dynamic>;
|
||||||
printV('Failed to fetch available payment types: ${responseBody['message']}');
|
printV('Failed to fetch available payment types: ${responseBody['message']}');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -120,7 +121,7 @@ class OnRamperBuyProvider extends BuyProvider {
|
||||||
return allAvailablePaymentMethods;
|
return allAvailablePaymentMethods;
|
||||||
} else {
|
} else {
|
||||||
final responseBody =
|
final responseBody =
|
||||||
jsonDecode(response.body) as Map<String, dynamic>;
|
jsonDecode(responseString) as Map<String, dynamic>;
|
||||||
printV('Failed to fetch available payment types: ${responseBody['message']}');
|
printV('Failed to fetch available payment types: ${responseBody['message']}');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue