resolveCharge method

Future<ChargeObject> resolveCharge(
  1. String code
)

Resolve a charge that has been previously marked as unresolved. Supply the unique charge code that was returned when the charge was created. Note: Only unresolved charges can be successfully resolved.

Implementation

Future<ChargeObject> resolveCharge(String code) async {
  ChargeObject coinbaseResponse;
  Map data;
  Map response = await postToDB(
    body: {},
    apiKey: _apiKey,
    api: 'https://api.commerce.coinbase.com/charges/$code/resolve',
  );
  if (response.containsKey('error')) {
    data = response['data'];
  } else {
    data = response['data'];
  }
  coinbaseResponse = ChargeObject().fromJson(data);
  Logger(debug).displayLog(coinbaseResponse.toString());
  return coinbaseResponse;
}