getBusiness method

Future<GetBusinessResponse> getBusiness()

Implementation

Future<GetBusinessResponse> getBusiness() async {
  try {
    _client = MyHttpClient(baseUrlTonder);
    Response? response = await _client?.get(
      Uri.parse('api/v1/payments/business/$apiKeyTonder'),
      headers: {'Authorization': 'Token $apiKeyTonder'},
    );


    if (response!.statusCode >= 200 ||response.statusCode < 300) {
      final jsonResponse = json.decode(response.body) as Map<String, dynamic>;
      return GetBusinessResponse.fromJson(jsonResponse);
    } else {
      throw Exception(response);
    }
  } catch (e) {
    throw Exception(e);
  }
}