viewCharge method
Retrieves the details of a charge that has been previously created. Supply the unique charge code that was returned when the charge was created. This information is also returned when a charge is first created.
Implementation
Future<ChargeObject> viewCharge(String code) async {
ChargeObject coinbaseResponse;
Map data;
Map response = await getFromDB(
api: 'https://api.commerce.coinbase.com/charges/$code',
apiKey: _apiKey,
);
if (response.containsKey('error')) {
data = response['error'];
} else {
data = response['data'];
}
coinbaseResponse = ChargeObject.fromJson(data);
Logger(debug).displayLog(coinbaseResponse.toString());
return coinbaseResponse;
}