retrieveAllCharges property

Future<List<ChargeObject>> get retrieveAllCharges

Returns a list of the Charges associated with the Coinbase account

Implementation

Future<List<ChargeObject>> get retrieveAllCharges async {
  List<ChargeObject> coinbaseResponse;
  List data;
  Map response = await getFromDB(
    api: 'https://api.commerce.coinbase.com/charges',
    apiKey: _apiKey,
  );
  if (response.containsKey('error')) {
    data = response['error'];
  } else {
    data = response['data'];
  }

  coinbaseResponse = List.generate(
      data.length, (index) => ChargeObject().fromJson(data[index]));

  Logger(debug).displayLog(coinbaseResponse.toString());
  return coinbaseResponse;
}