readAccount method
Retrieves a specified BankAccount object.
Implementation
Future<BankAccount> readAccount({
required String bankAccountId,
required String customerId,
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/customers/$customerId/bank-accounts/$bankAccountId");
//print (endpoint.toString());
var response = await
http.get(endpoint, headers: headers,);
if (response.statusCode == 200) {
return BankAccount.fromJson(jsonDecode(response.body));
}
else {
throw BankAccountException(statusCode: response.statusCode, message: response.body);
}
}