getMerchantTransactions method

Future<MerchantTransactionResponse?> getMerchantTransactions()

Executes network call to initiate transactions

Implementation

Future<MerchantTransactionResponse?> getMerchantTransactions() async {

  MerchantTransactionResponse? merchantTransactionResponse = MerchantTransactionResponse();

  final url = count != null ? "${Utils.getBaseUrl(isTest)}/${Utils.merchantTransactionsUrl}?count=$count"
      : "${Utils.getBaseUrl(isTest)}/${Utils.merchantTransactionsUrl}";

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

  final responseBody = jsonDecode(response.body);
  merchantTransactionResponse = MerchantTransactionResponse.fromJson(responseBody);

  return merchantTransactionResponse;
}