Open asim009 opened 1 year ago
I would recommend just look into the XML and understand why it is not valid... it can be that XML is not properly generated for multiple line items, that is why you are getting the "generic error"
p.s. if you have your XML, you can send it to me and I can try to find what is wrong with line items... You can send me only line items
part btw
Below is the xml which is getting passed in sandbox and not failed while sending it with API. Recently, on 19th of this month they have released new changes with some amendments and added principals like advance invoice. I assume there is a change in coding of zatca which might be cause of this errors.
`<?xml version="1.0" encoding="UTF-8"?>
Because of truncated input, I cannot understand if it is a simplified invoice or ordinary invoice. I can see that customer party is present, therefore I can assume it is Invoice (388) with subtype (01).
Could you elaborate and send exactly what kind of error you are getting from API when you are trying to submit it?
EDIT: also for this part:
<cac:Price>
<cbc:PriceAmount currencyID="SAR">1250</cbc:PriceAmount>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason></cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">0</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
I can think that Zatca can raise the validation error or any error as in their specification they have this business rule (BR-KSA-F-03) and you have empty element cbc:AllowanceChargeReason
. But probably they will just ignore it:
Business rules - KSA formats (BR-KSA-F):
- BR-KSA-F-01: A date MUST be formatted YYYY-MM-DD
- BR-KSA-F-02: Allowance Indicator value MUST equal to 'false'
- BR-KSA-F-03: Document MUST not contain empty elements
- BR-KSA-F-04: All the document amounts and quantities must be positive
Please note: the second line item in your example does not have this "EMPTY" discount
Because of truncated input, I cannot understand if it is a simplified invoice or ordinary invoice. I can see that customer party is present, therefore I can assume it is Invoice (388) with subtype (01).
Could you elaborate and send exactly what kind of error you are getting from API when you are trying to submit it?
EDIT: also for this part:
<cac:Price> <cbc:PriceAmount currencyID="SAR">1250</cbc:PriceAmount> <cac:AllowanceCharge> <cbc:ChargeIndicator>false</cbc:ChargeIndicator> <cbc:AllowanceChargeReason></cbc:AllowanceChargeReason> <cbc:Amount currencyID="SAR">0</cbc:Amount> </cac:AllowanceCharge> </cac:Price>
I can think that Zatca can raise the validation error or any error as in their specification they have this business rule (BR-KSA-F-03) and you have empty element
cbc:AllowanceChargeReason
. But probably they will just ignore it:Business rules - KSA formats (BR-KSA-F):
- BR-KSA-F-01: A date MUST be formatted YYYY-MM-DD
- BR-KSA-F-02: Allowance Indicator value MUST equal to 'false'
- BR-KSA-F-03: Document MUST not contain empty elements
- BR-KSA-F-04: All the document amounts and quantities must be positive
Please note: the second line item in your example does not have this "EMPTY" discount
Hi, I did try the with the non empty elements as well and I the following error in my application and XML test
@mustafa9229 from the zatca test submission I can see they return 500 error, meaning they have bugs on their side and it is just the unhandled exception on their end.
Regarding the errors on the browser console, you should just go through every error reported and check/fix it. Seems that your line_amount calculation is incorrect (I do not know your payload). Regarding the first error, it is generic error meaning that your XML is not valid somewhere...
@mustafa9229 from the zatca test submission I can see they return 500 error, meaning they have bugs on their side and it is just the unhandled exception on their end.
Regarding the errors on the browser console, you should just go through every error reported and check/fix it. Seems that your line_amount calculation is incorrect (I do not know your payload). Regarding the first error, it is generic error meaning that your XML is not valid somewhere...
The XML I used is for a Simplified Invoice
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cb
c="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionURI>urn:oasis:names:specification:ubl:dsig:enveloped:xades</ext:ExtensionURI>
<ext:ExtensionContent>
<sig:UBLDocumentSignatures xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specifi
cation:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
<sac:SignatureInformation>
<cbc:ID>urn:oasis:names:specification:ubl:signature:1</cbc:ID>
<sbc:ReferencedSignatureID>urn:oasis:names:specification:ubl:signature:Invoice</sbc:ReferencedSignatureID>
<ds:Signature Id="signature" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"></ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"></ds:SignatureMethod>
<ds:Reference Id="invoiceSignedData" URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<ds:XPath>not(//ancestor-or-self::ext:UBLExtensions)</ds:XPath>
</ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<ds:XPath>not(//ancestor-or-self::cac:Signature)</ds:XPath>
</ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<ds:XPath>not(//ancestor-or-self::cac:AdditionalDocumentReference[cbc:ID='QR'])</ds:XPath>
</ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod>
<ds:DigestValue>1mzGx4dpkvgENAvTrIz+RBOco9cur8UuxkMz+pNuyjw=</ds:DigestValue>
</ds:Reference>
<ds:Reference Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties" URI="#xadesSignedProperties">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod>
<ds:DigestValue>NzUxMTI3ZjQ0Mjk3ZDJmMGRlZjRhOGViMGQ0ZWE1NDU0Y2I5NDljYTI0MmQ3N2M1MTY3MWVkNWM5MDRjMmFlMg==</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>MEYCIQDqEn/c30ro8fszuDVabn6i7TeJ9xN4pes/wlK8dCIcSgIhAOQ8cuyoipjxFZFbRo9hLkVP17BDU6Q41ICkVLW3dn37</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>MIICRjCCAeygAwIBAgIGAYgz0WV7MAoGCCqGSM49BAMCMBUxEzARBgNVBAMMCmVJbnZvaWNpbmcwHhcNMjMwNTE5MTE0MjE2WhcNMjgwNTE4M
jEwMDAwWjBXMRcwFQYDVQQDDA5FR1MxLTg4NjQzMTE0NzEXMBUGA1UECwwORmluaXNoZWQgR29vZHMxFjAUBgNVBAoMDURpZ2l0YWwgQ2xvdWQxCzAJBgNVBAYTAlNBMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE/WQ1MT
wXSH3j+3jt2iOzK7JjDOwPIf612N+8Trqk9zHbGvxVNnMTo0eSWc561phTJAX4Gb6mh5oz0UvtiI8kmKOB6DCB5TAMBgNVHRMBAf8EAjAAMIHUBgNVHREEgcwwgcmkgcYwgcMxPTA7BgNVBAQMNDEtRS1CSVp8Mi1JT1N
8My1lN2JjNTg4OS1kN2E4LTQyNmItODVlOC0yMjZlNmZiM2JlMDAxHzAdBgoJkiaJk/IsZAEBDA8zMTAxNzUzOTc0MDAwMDMxDTALBgNVBAwMBDExMDAxQjBABgNVBBoMOTAwMDAgV2Fzc2VsIDI0MzMgLSBSaXlhZGgg
MTE0NjEtNzA3MiBTYXVkaSBBcmFiaWEsIFJpeWFkaDEOMAwGA1UEDwwFR29vZHMwCgYIKoZIzj0EAwIDSAAwRQIhAN4Sv4qnyEBWx/jFdYyurBxPe/ajHHtkpLzs/REaKCz7AiAsEtM06S7p6qx5n5TObWveeo6msa455
PfjqkbXfvZBXw==</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
<ds:Object>
<xades:QualifyingProperties Target="signature" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#">
<xades:SignedProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Id="xadesSignedProperties">
<xades:SignedSignatureProperties>
<xades:SigningTime>2023-05-29T14:07:13Z</xades:SigningTime>
<xades:SigningCertificate>
<xades:Cert>
<xades:CertDigest>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod>
<ds:DigestValue>MDk1NTk2M2EzMWZhN2IwYTZkNTI1ODAwNmUyMDNkYWIyYTM5MWI1MTRjOThhN2M5MTg2YTRjNzQ5NWE3Mzg2Mw==</ds:Dige
stValue>
</xades:CertDigest>
<xades:IssuerSerial>
<ds:X509IssuerName>CN=eInvoicing</ds:X509IssuerName>
<ds:X509SerialNumber>1684496541051</ds:X509SerialNumber>
</xades:IssuerSerial>
</xades:Cert>
</xades:SigningCertificate>
</xades:SignedSignatureProperties>
</xades:SignedProperties>
</xades:QualifyingProperties>
</ds:Object>
</ds:Signature>
</sac:SignatureInformation>
</sig:UBLDocumentSignatures>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:ProfileID>reporting:1.0</cbc:ProfileID>
<cbc:ID>SMPINV-14_22-23</cbc:ID>
<cbc:UUID>96596b82-875e-4d38-9f4c-12bc40e41209</cbc:UUID>
<cbc:IssueDate>2023-05-29</cbc:IssueDate>
<cbc:IssueTime>02:05:32</cbc:IssueTime>
<cbc:InvoiceTypeCode name="0200000">388</cbc:InvoiceTypeCode>
<cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
<cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
<cac:AdditionalDocumentReference>
<cbc:ID>ICV</cbc:ID>
<cbc:UUID>1</cbc:UUID>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
<cbc:ID>PIH</cbc:ID>
<cac:Attachment>
<cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==</cbc:Emb
eddedDocumentBinaryObject>
</cac:Attachment>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference>
<cbc:ID>QR</cbc:ID>
<cac:Attachment>
<cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">AQ1EaWdpdGFsIENsb3VkAg8zMTAxNzUzOTc0MDAwMDMDFDIwMjMtMDUtMjlUMDI6MDU6MzJaBAc0MDAwOC41BQY1MjE4LjUGL
DFtekd4NGRwa3ZnRU5BdlRySXorUkJPY285Y3VyOFV1eGtNeitwTnV5anc9B2BNRVlDSVFEcUVuL2MzMHJvOGZzenVEVmFibjZpN1RlSjl4TjRwZXMvd2xLOGRDSWNTZ0loQU9ROGN1eW9pcGp4RlpGYlJvOWhMa1ZQMT
dCRFU2UTQxSUNrVkxXM2RuMzcIWDBWMBAGByqGSM49AgEGBSuBBAAKA0IABP1kNTE8F0h94/t47dojsyuyYwzsDyH+tdjfvE66pPcx2xr8VTZzE6NHklnOetaYUyQF+Bm+poeaM9FL7YiPJJgJRzBFAiEA3hK/iqfIQFb
H+MV1jK6sHE979qMce2SkvOz9ERooLPsCICwS0zTpLunqrHmflM5ta956jqaxrjnk9+OqRtd+9kFf</cbc:EmbeddedDocumentBinaryObject>
</cac:Attachment>
</cac:AdditionalDocumentReference>
<cac:Signature>
<cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
<cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
</cac:Signature>
<cac:AccountingSupplierParty>
<cac:Party>
<cac:PartyIdentification>
<cbc:ID schemeID="CRN">7458961265</cbc:ID>
</cac:PartyIdentification>
<cac:PostalAddress>
<cbc:StreetName>Wassel 2433 - Riyadh 11461-7072 Saudi Arabia</cbc:StreetName>
<cbc:BuildingNumber>0000</cbc:BuildingNumber>
<cbc:PlotIdentification>0000</cbc:PlotIdentification>
<cbc:CitySubdivisionName>Riyadh</cbc:CitySubdivisionName>
<cbc:CityName>Riyadh</cbc:CityName>
<cbc:PostalZone>11461</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>SA</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>710125397478943</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>Analog Cloud</cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cac:PartyIdentification>
<cbc:ID schemeID="CRN">454634645645654</cbc:ID>
</cac:PartyIdentification>
<cac:PostalAddress>
<cbc:StreetName>Eastern Ring Road</cbc:StreetName>
<cbc:AdditionalStreetName>98245637222</cbc:AdditionalStreetName>
<cbc:BuildingNumber>18</cbc:BuildingNumber>
<cbc:PlotIdentification>0000</cbc:PlotIdentification>
<cbc:CitySubdivisionName>Riyadh</cbc:CitySubdivisionName>
<cbc:CityName>53000</cbc:CityName>
<cbc:PostalZone>92879</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>SA</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>710125397478943</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>Asim Global Motors</cbc:RegistrationName>
</cac:PartyLegalEntity>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">5218.5</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">12250</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">1837.5</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">22540</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">3381</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">5218.5</cbc:TaxAmount>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="SAR">34790</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="SAR">34790</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="SAR">40008.5</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
<cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
<cbc:PayableAmount currencyID="SAR">40008.5</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="PCE">10</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">12250</cbc:LineExtensionAmount>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">1837.5</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">14087.50</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>Alloy wheels</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">1250</cbc:PriceAmount>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason></cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">250</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
<cbc:Amount currencyID="SAR">460</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
</Invoice>
lets taka a single line calculation : below is my xml from one line item
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="PCE">10</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">12250.00</cbc:LineExtensionAmount>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">1837.50</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">14087.50</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>Alloy wheels</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">1250.00</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="PCE">10</cbc:BaseQuantity>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason></cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">250.00</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
For the above xml i am getting the following error..
`category
:
"KSA"
code
:
"BR-KSA-EN16931-11"
message
:
"Invoice line net amount (BT-131) must equal (Invoiced quantity (BT-130) * (Item net price (BT-146) / item price base quantity (BT-149))-))- Sum of invoice line allowance amount (BT-136)"
status
:
"ERROR"
type
:
"ERROR"`
@mustafa9229
Hello for your first message, I briefly look into it and noticed that inside the VAT Breakdown (TaxTotal/TaxSubtotal
) you have the same group specified twice, I mean the TaxCategory/ID = "S"
.
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">5218.5</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">12250</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">1837.5</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">22540</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">3381</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
According to the documentation every Breakdown should be specified only once and the amount should be a SUM
Regarding the second one:
Price/BaseQuantity
is not the same as quantity of item in the InvoiceLine
, do not be confused please.
This is the payload provided from their sandbox:
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="PCE">44.000000</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">968.00</cbc:LineExtensionAmount>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">145.20</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">1113.20</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>dsd</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">22.00</cbc:PriceAmount>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">2.00</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
As you can see TaxTotal/RoundingAmount == LineExtensionAmount + TaxTotal/TaxAmount
Also LineExtensionAmount == Price/PriceAmount * InvoicedQuantity
I wanted to inform you all that XML is getting validated on the sandbox test xml site. However, the same data is not accepted by Zatca. The strange part is that when I add only one line item, Zatca is accepting the invoice . On the other hand, when I add more than one line item, Zatca is throwing me some general business rules error. Fortunately, the XML for the same invoice which has multiple line items is accepted by the sandbox test portal xml validator.
Please let me know if anyone is facing the same problem. The problem is clear – for one line item invoices I am getting the response perfectly, but for multiple line items it is not accepting and throwing the business rules errors