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