viewInvoice method
Returns an InvoiceObject for the invoice with the supplied Invoice code
Implementation
Future<InvoiceObject> viewInvoice(String code) async {
InvoiceObject coinbaseResponse;
Map data;
Map response = await getFromDB(
api: 'https://api.commerce.coinbase.com/invoices/$code',
apiKey: _apiKey,
);
if (response.containsKey('error')) {
data = response['error'];
} else {
data = response['data'];
}
coinbaseResponse = InvoiceObject.fromJson(data);
Logger(debug).displayLog(coinbaseResponse.toString());
return coinbaseResponse;
}