getAllProviders method
dynamic
getAllProviders({})
Implementation
getAllProviders({
context,
required String transactionId,
required String transactionAmount,
required String transactionCallBackUrl,
required String merchandUserName,
required String merchandPassword,
required String xApiKey,
required String mode,
required Function actionAfterProccess,
}) async {
try {
var jsonResponse;
var url = Uri.parse(
"${constant.baseUrl}/gateway/gateways?t_id=$transactionId&t_sum=$transactionAmount&t_url=$transactionCallBackUrl");
var response =
await http.get(url, headers: getGlobalHeader(xApiKey, "$merchandUserName:$merchandPassword", mode));
jsonResponse = json.decode(response.body);
if (response.statusCode == 200) {
print("This is /getAllProviders response : $jsonResponse");
if (jsonResponse != null) {
return json.decode(response.body)['data'];
}
} else {
if (jsonResponse != null) {
print("Response : : $jsonResponse");
Navigator.of(context).pop();
actionAfterProccess(transactionId, "FAILED");
return [];
}
}
} catch (e) {
print("Error : $e");
Navigator.of(context).pop();
actionAfterProccess(transactionId, "FAILED");
showInfoDialog(context, "Something went wrong , please try again or later");
}
}