readRefund method
Retrieve dull or partial refund.
Implementation
Future<Charge> readRefund({
required String chargeId,
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/charges/$chargeId/refunds/$refundId");
//print(endpoint.toString());
var response = await http.get(
endpoint,
headers: headers,
);
if (response.statusCode == 200) {
return Charge.fromJson(jsonDecode(response.body));
} else {
throw ChargeException(
statusCode: response.statusCode, message: response.body);
}
}