getAccountBalance method

Future<GetAccountBalanceResponse> getAccountBalance(
  1. String accountId
)

Implementation

Future<GetAccountBalanceResponse> getAccountBalance(String accountId) async {
  final url = Uri.parse('${_wepinBaseUrl}accountbalance/$accountId/balance');
  final response = await http.get(
    url,
    headers: headers,
  );

  if (response.statusCode >= 200 && response.statusCode < 300) {
    final responseBody = jsonDecode(response.body);
    return GetAccountBalanceResponse.fromJson(responseBody);
  } else {
    throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
  }
}