getZainboxVirtualAccountsBalances method

Future<ZainboxVirtualAccountsBalancesResponse?> getZainboxVirtualAccountsBalances()

Executes network call to initiate transactions

Implementation

Future<ZainboxVirtualAccountsBalancesResponse?> getZainboxVirtualAccountsBalances() async {

  ZainboxVirtualAccountsBalancesResponse? zainboxVirtualAccountsBalancesResponse = ZainboxVirtualAccountsBalancesResponse();

  final url = "${Utils.getBaseUrl(isTest)}/${Utils.zainboxVirtualAccountsBalanceUrl}/$zainboxCode";

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

  final responseBody = jsonDecode(response.body);
  zainboxVirtualAccountsBalancesResponse = ZainboxVirtualAccountsBalancesResponse.fromJson(responseBody);

  return zainboxVirtualAccountsBalancesResponse;
}