readRefund method
Retrieves the details of an ECheck refund transaction that has been previously created. The id of a previously created ECheck refund must be provided.
Implementation
Future<ECheck> readRefund({
required String echeckId,
required String refundId,
String? realmId,
String? authToken,
}) async {
authToken ??= authenticationService.getCachedToken()?.access_token;
realmId ??= authenticationService.getCachedRealmId();
Map<String, String> headers = {
"Authorization": "Bearer ${authToken ?? ""}",
'Content-Type': 'application/json',
//'Accept': 'application/json',
};
Uri endpoint =
Uri.https(baseUrl, "/quickbooks/v4/payments/echecks/$echeckId/refunds/$refundId");
//print(endpoint.toString());
var response = await http.get(
endpoint,
headers: headers,
);
if (response.statusCode == 200) {
return ECheck.fromJson(jsonDecode(response.body));
} else {
throw ECheckException(
statusCode: response.statusCode, message: response.body);
}
}