Skip to content

Commit

Permalink
fix: select payment methods bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sergdeus committed Jan 17, 2024
1 parent b90a7b3 commit dd46024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/features/ads/data/services/ads_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:agoradesk/features/ads/data/models/country_code_model.dart';
import 'package:agoradesk/features/ads/data/models/currency_model.dart';
import 'package:agoradesk/features/ads/data/models/payment_method_model.dart';
import 'package:agoradesk/features/ads/data/models/trade_type.dart';
import 'package:flutter/material.dart';

class AdsService {
AdsService({
Expand Down Expand Up @@ -71,18 +72,24 @@ class AdsService {
request += '/$country';
}
final resp = await _api.client.get(request);

if (resp.statusCode == 200) {
Map<String, dynamic> respMap = jsonDecode(jsonEncode(resp.data['data']['methods']));
List<OnlineProvider> result = [];
for (var e in respMap.entries) {
result.add(OnlineProvider.fromJson(e));
try {
result.add(OnlineProvider.fromJson(e));
} catch (e) {
debugPrint('++++getCountryCodes parsing mpayment method error - $e');
}
}
return Either.right(result);
} else {
ApiError apiError = ApiError(statusCode: resp.statusCode!, message: resp.data! as Map<String, dynamic>);
return Either.left(apiError);
}
} catch (e) {
debugPrint('++++getCountryCodes error - $e');
ApiError apiError = ApiHelper.parseErrorToApiError(e, '[$runtimeType]');
return Either.left(apiError);
}
Expand Down
1 change: 1 addition & 0 deletions lib/features/market/models/market_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class MarketViewModel extends ViewModel
if (worldwideMethods.contains(val?.code)) {
changeSelectedCountryCode(kAnyCountryCode);
}
indicatorKey.currentState?.show();
}

void clearFilter() {
Expand Down

0 comments on commit dd46024

Please sign in to comment.