getAllZainboxAccounts method

Future<ZainboxAccountResponse?> getAllZainboxAccounts()

Executes network call to initiate transactions

Implementation

Future<ZainboxAccountResponse?> getAllZainboxAccounts() async {

  ZainboxAccountResponse? zainboxAccountsResponse = ZainboxAccountResponse();

  final url = "${Utils.getBaseUrl(isTest)}/${Utils.getAllZainboxAccountsUrl}/$zainboxCodeName";

  final response = await http.get(Uri.parse(url),
      headers: {
        "Authorization" : "Bearer $publicKey",
        "Content-Type" : "application/json"
      }
  );

  final responseBody = jsonDecode(response.body);
  zainboxAccountsResponse = ZainboxAccountResponse.fromJson(responseBody);

  return zainboxAccountsResponse;
}