checkInvoiceCompliance method
Reports an invoice using the provided signed XML string, invoice hash, and EGS UUID.
Implementation
Future<dynamic> checkInvoiceCompliance({
required String signedXmlString,
required String invoiceHash,
required String egsUuid,
}) async {
final headers = {
"Accept-Version": API.settings["API_VERSION"]!,
"Accept-Language": "en",
'Content-Type': 'application/json',
...authHeaders,
};
final response = await http.post(
Uri.parse('$baseUrl/compliance/invoices'),
headers: headers,
body: jsonEncode({
"invoiceHash": invoiceHash,
"uuid": egsUuid,
"invoice": base64Encode(utf8.encode(signedXmlString)),
}),
);
if (response.statusCode != 200 && response.statusCode != 202) {
print("Response: ${response.statusCode}, Body: ${response.body}");
throw Exception("Error in compliance check.");
}
return jsonDecode(response.body);
}