getInvoice method
Get invoice details
Implementation
Future<Invoice> getInvoice(String invoiceId) async {
try {
final response = await _client.authenticatedRequest<Map<String, dynamic>>(
'/rest/V1/invoices/$invoiceId',
);
if (response.statusCode == 200) {
return Invoice.fromJson(response.data!);
} else {
throw Exception('Failed to get invoice: ${response.statusMessage}');
}
} on DioException catch (e) {
throw Exception('Failed to get invoice: ${e.message}');
} catch (e) {
throw Exception('Failed to get invoice: $e');
}
}