googlePayment static method
Implementation
static Future googlePayment({
required String encrypt_string}) async {
final url = Uri.parse("${ApiEndPoint.googlePay}");
final headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
};
// final url = Uri.parse(googlePayURL);
// Map<String, dynamic> body = {"encryptData": encodedString};
// //List<int> body = utf8.encode("encryptData=$encodedString");
// var result = await http.post(url, body: body);
final body = json.encode({"encrypt_string": encrypt_string});
try {
final result = await http.post(url, headers: headers, body: body);
if (result.statusCode == 200) {
var test = jsonDecode(result.body);
return test;
} else {
final errorResponse = ErrorResponse.fromJson(json.decode(result.body));
// Extract the error message
final errorMessage = errorResponse.error.message;
print('Error Message: $errorMessage');
// Return the error details as a map
return {
'statusCode': errorResponse.error.statusCode,
'name': errorResponse.error.name,
'message': errorMessage,
};
}
} catch (e) {
}
}