voidECheck method
Full or partial refund an existing ECheck transaction. Refund requests made on the same day as the associated debit request may result in the transaction being voided. Refunds cannot be issued unless the original debit has succeeded (this process typically takes approximately three business days).
Implementation
Future<ECheck> voidECheck({
required String requestId,
required String echeckId,
String? realmId,
String? authToken,
}) async {
authToken ??= authenticationService.getCachedToken()?.access_token;
realmId ??= authenticationService.getCachedRealmId();
Map<String, String> headers = {
"Request-ID": requestId,
"Authorization": "Bearer ${authToken ?? ""}",
'Content-Type': 'application/json',
//'Accept': 'application/json',
};
Uri endpoint = Uri.https(
baseUrl, "/quickbooks/v4/payments/echecks/$echeckId/refunds");
//print(endpoint.toString());
var response = await http.post(endpoint, headers: headers);
if (response.statusCode == 200 || response.statusCode == 201) {
return ECheck.fromJson(jsonDecode(response.body));
} else {
throw ECheckException(
statusCode: response.statusCode, message: response.body);
}
}