updateStatusAccount function
Implementation
Future<ApiBaseResponse<SetDefaultEnalbeDisable>> updateStatusAccount(
String encrypted,String refererKey) async {
// final url =
// isProduction == false ? envDemo().UrlCheckout : envPro().UrlCheckout;
// final url =
// "https://merchantapi-staging.bill24.io/instantpaymentsdk/payment_method/update_status";
final url = BaseUrl.baseUrl! + api().updateStatus;
final Map<String, dynamic> body = {"encrypted": encrypted};
final Map<String, String> headers = {
'token': envDemo().token,
'Content-Type': 'application/json',
'X-Referrer-Key': refererKey,
};
try {
final jsonData = await http.post(
Uri.parse(url),
body: jsonEncode(body),
headers: headers,
);
if (jsonData.statusCode == 200) {
final Map<String, dynamic> decodedJson = jsonDecode(jsonData.body);
final response = ApiBaseResponse<SetDefaultEnalbeDisable>.fromJson(
decodedJson,
(dataJson) => SetDefaultEnalbeDisable.fromJson(dataJson),
);
return response;
} else {
throw Exception('Failed to load data from API');
}
} catch (ex) {
throw Exception('Failed to load data from API ${ex.toString()}');
}
}