sort providers by KYC

This commit is contained in:
Serhii 2024-10-16 14:27:07 +03:00
parent e8d0ecdc47
commit 1c29d5adc0
2 changed files with 9 additions and 8 deletions

View file

@ -268,11 +268,12 @@ class TrocadorExchangeProvider extends ExchangeProvider {
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
final providersJsonList = responseJSON['list'] as List<dynamic>;
return providersJsonList
final filteredProvidersList = providersJsonList
.map((providerJson) => TrocadorPartners.fromJson(providerJson as Map<String, dynamic>))
.where((provider) => provider.rating != 'D')
.toList();
filteredProvidersList.sort((a, b) => a.rating.compareTo(b.rating));
return filteredProvidersList;
}
String _networkFor(CryptoCurrency currency) {
@ -333,7 +334,7 @@ class TrocadorExchangeProvider extends ExchangeProvider {
class TrocadorPartners {
final String name;
final String? rating;
final String rating;
final double? insurance;
final bool? enabledMarkup;
final double? eta;
@ -349,7 +350,7 @@ class TrocadorPartners {
factory TrocadorPartners.fromJson(Map<String, dynamic> json) {
return TrocadorPartners(
name: json['name'] as String? ?? '',
rating: json['rating'] as String?,
rating: json['rating'] as String? ?? 'N/A',
insurance: json['insurance'] as double?,
enabledMarkup: json['enabledmarkup'] as bool?,
eta: json['eta'] as double?,

View file

@ -30,7 +30,7 @@ abstract class TrocadorProvidersViewModelBase with Store {
providerRatings = {
for (var provider in providers)
provider.name: provider.rating ?? 'N/A'
provider.name: provider.rating
};
return _settingsStore