usability fixes
This commit is contained in:
@@ -35,6 +35,7 @@ abstract class PaymentProcessor with _$PaymentProcessor {
|
||||
required String accountFieldName,
|
||||
required String accountFieldLabel,
|
||||
required String label,
|
||||
required String currency,
|
||||
required String authType,
|
||||
}) = _PaymentProcessor;
|
||||
|
||||
@@ -176,15 +177,22 @@ class PayController extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<ApiResponse<List<PaymentProcessor>>> getPaymentProcessors() async {
|
||||
Future<ApiResponse<List<PaymentProcessor>>> getPaymentProcessors(
|
||||
String currency,
|
||||
) async {
|
||||
try {
|
||||
model.isLoading = true;
|
||||
model.paymentProcessors = getFakePaymentProcessors();
|
||||
notifyListeners();
|
||||
|
||||
List<dynamic> response = await http.get('/public/payment-processors');
|
||||
model.paymentProcessors = response
|
||||
.map((e) => PaymentProcessor.fromJson(e))
|
||||
final response = await http.get(
|
||||
'/public/payment-processors?currency=$currency',
|
||||
);
|
||||
final List<dynamic> content = response is List
|
||||
? response
|
||||
: (response['content'] ?? []);
|
||||
model.paymentProcessors = content
|
||||
.map((e) => PaymentProcessor.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
model.isLoading = false;
|
||||
@@ -238,6 +246,7 @@ class PayController extends ChangeNotifier {
|
||||
accountFieldLabel: "EcoCash Phone Number",
|
||||
label: "ECOCASH",
|
||||
authType: "REMOTE",
|
||||
currency: "USD",
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user