Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader shows BR-49 error when no cac:PaymentMeans is present, but cac:PaymentTerms is #56

Open
yulkusal opened this issue Jun 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@yulkusal
Copy link

yulkusal commented Jun 9, 2024

Hello,

I received an invoice that shows BusinessRuleId BR-49, even if no cac:PaymentMeans is in the invoice.
I played a little with several eInvoices and it looks like the presence of cac:PaymentTerms when cac:PaymentMeans is missing triggers the issue.

@josemmo
Copy link
Owner

josemmo commented Jun 23, 2024

Hello @yulkusal,

Could you provide an XML example? I don't fully understand what the issue is.

@yulkusal
Copy link
Author

Example (names, descriptions, VATid modified from the original)
<?xml version="1.0" encoding="utf-8"?> <Invoice xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"> <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1</cbc:CustomizationID> <cbc:ID>75366203</cbc:ID> <cbc:IssueDate>2024-06-19</cbc:IssueDate> <cbc:DueDate>2024-08-18</cbc:DueDate> <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode> <cbc:Note>RO25 INGB 5001 0088 2833 0610 (EUR)</cbc:Note> <cbc:Note>RO76 INGB 5001 0088 2833 8710 (RON)</cbc:Note> <cbc:Note>RO68 INGB 5001 0088 2833 4710 (USD)</cbc:Note> <cbc:Note>DAP</cbc:Note> <cbc:DocumentCurrencyCode>RON</cbc:DocumentCurrencyCode> <cac:OrderReference> <cbc:ID>7059287935</cbc:ID> <cbc:SalesOrderID>7059287935</cbc:SalesOrderID> </cac:OrderReference> <cac:AccountingSupplierParty> <cac:Party> <cac:PostalAddress> <cbc:StreetName>Soseaua Bucuresti-Tunari nr.8</cbc:StreetName> <cbc:CityName>SECTOR1</cbc:CityName> <cbc:PostalZone>010000</cbc:PostalZone> <cbc:CountrySubentity>RO-B</cbc:CountrySubentity> <cac:Country> <cbc:IdentificationCode>RO</cbc:IdentificationCode> </cac:Country> </cac:PostalAddress> <cac:PartyTaxScheme> <cbc:CompanyID>RO123456789</cbc:CompanyID> <cac:TaxScheme> <cbc:ID>VAT</cbc:ID> </cac:TaxScheme> </cac:PartyTaxScheme> <cac:PartyLegalEntity> <cbc:RegistrationName>XYZ Romania SRL</cbc:RegistrationName> <cbc:CompanyID>J40/xxxx/xxxx</cbc:CompanyID> </cac:PartyLegalEntity> <cac:Contact> <cbc:ElectronicMail>credit@xyz.com.ro</cbc:ElectronicMail> </cac:Contact> </cac:Party> </cac:AccountingSupplierParty> <cac:AccountingCustomerParty> <cac:Party> <cac:PartyIdentification> <cbc:ID>J40/YYYY/ZZZZ</cbc:ID> </cac:PartyIdentification> <cac:PostalAddress> <cbc:StreetName>Str. Verde, Nr. 65</cbc:StreetName> <cbc:CityName>SECTOR1</cbc:CityName> <cbc:PostalZone>020000</cbc:PostalZone> <cbc:CountrySubentity>RO-B</cbc:CountrySubentity> <cac:Country> <cbc:IdentificationCode>RO</cbc:IdentificationCode> </cac:Country> </cac:PostalAddress> <cac:PartyTaxScheme> <cbc:CompanyID>RO987654321</cbc:CompanyID> <cac:TaxScheme> <cbc:ID>VAT</cbc:ID> </cac:TaxScheme> </cac:PartyTaxScheme> <cac:PartyLegalEntity> <cbc:RegistrationName>CUSTOMER SRL</cbc:RegistrationName> <cbc:CompanyID>J40/YYYY/ZZZZ</cbc:CompanyID> </cac:PartyLegalEntity> <cac:Contact> <cbc:Telephone>0311000100</cbc:Telephone> <cbc:ElectronicMail>sales@customer.ro</cbc:ElectronicMail> </cac:Contact> </cac:Party> </cac:AccountingCustomerParty> <cac:Delivery> <cbc:ActualDeliveryDate>2024-06-19</cbc:ActualDeliveryDate> <cac:DeliveryLocation> <cac:Address> <cbc:StreetName>Str. Testului 20, Warehouse Bucuresti</cbc:StreetName> <cbc:CityName>SECTOR1</cbc:CityName> <cbc:PostalZone>020001</cbc:PostalZone> <cbc:CountrySubentity>RO-B</cbc:CountrySubentity> <cac:AddressLine> <cbc:Line>012978</cbc:Line> </cac:AddressLine> <cac:Country> <cbc:IdentificationCode>RO</cbc:IdentificationCode> </cac:Country> </cac:Address> </cac:DeliveryLocation> <cac:DeliveryParty> <cac:PartyName> <cbc:Name>Warehouse Bucuresti</cbc:Name> </cac:PartyName> </cac:DeliveryParty> </cac:Delivery> <cac:PaymentTerms> <cbc:Note>I060</cbc:Note> </cac:PaymentTerms> <cac:TaxTotal> <cbc:TaxAmount currencyID="RON">166.42</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="RON">875.88</cbc:TaxableAmount> <cbc:TaxAmount currencyID="RON">166.42</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID>S</cbc:ID> <cbc:Percent>19.00</cbc:Percent> <cac:TaxScheme> <cbc:ID>VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal> <cac:LegalMonetaryTotal> <cbc:LineExtensionAmount currencyID="RON">875.88</cbc:LineExtensionAmount> <cbc:TaxExclusiveAmount currencyID="RON">875.88</cbc:TaxExclusiveAmount> <cbc:TaxInclusiveAmount currencyID="RON">1042.30</cbc:TaxInclusiveAmount> <cbc:AllowanceTotalAmount currencyID="RON">0.00</cbc:AllowanceTotalAmount> <cbc:ChargeTotalAmount currencyID="RON">0.00</cbc:ChargeTotalAmount> <cbc:PrepaidAmount currencyID="RON">0.00</cbc:PrepaidAmount> <cbc:PayableRoundingAmount currencyID="RON">0.00</cbc:PayableRoundingAmount> <cbc:PayableAmount currencyID="RON">1042.30</cbc:PayableAmount> </cac:LegalMonetaryTotal> <cac:InvoiceLine> <cbc:ID>00001</cbc:ID> <cbc:Note>55418 / 0.18</cbc:Note> <cbc:InvoicedQuantity unitCode="H87">2.000</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="RON">875.88</cbc:LineExtensionAmount> <cac:OrderLineReference> <cbc:LineID>7059287935</cbc:LineID> </cac:OrderLineReference> <cac:AllowanceCharge> <cbc:ChargeIndicator>true</cbc:ChargeIndicator> <cbc:AllowanceChargeReason>Allowance</cbc:AllowanceChargeReason> <cbc:Amount currencyID="RON">0.18</cbc:Amount> <cbc:BaseAmount currencyID="RON">0.00</cbc:BaseAmount> </cac:AllowanceCharge> <cac:Item> <cbc:Name>XXXXXXXXXXXXXXXXXXXXXXXXXX</cbc:Name> <cac:SellersItemIdentification> <cbc:ID>0000000000YYYYYYYYYYYY</cbc:ID> </cac:SellersItemIdentification> <cac:ClassifiedTaxCategory> <cbc:ID>S</cbc:ID> <cbc:Percent>19</cbc:Percent> <cac:TaxScheme> <cbc:ID>VAT</cbc:ID> </cac:TaxScheme> </cac:ClassifiedTaxCategory> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="RON">437.94</cbc:PriceAmount> </cac:Price> </cac:InvoiceLine> </Invoice>
The issue seems to be /src/Traits/InvoiceValidationTrait.php, line 170
if ($inv->getPayment() !== null && $inv->getPayment()->getMeansCode() === null)
My solution was to modify to
if ($inv->getPayment() !== null) { if ($inv->getPayment()->getTerms() !== null) return; if (($inv->getPayment()->getMeansCode() === null) && ($inv->getPayment()->getTerms() === null)) { return "A Payment instruction (BG-16) shall specify the Payment means type code (BT-81)"; } }

@josemmo
Copy link
Owner

josemmo commented Jun 30, 2024

Got it, thanks! I'm preparing a fix.

josemmo added a commit that referenced this issue Jun 30, 2024
- Updated InvoiceValidationTrait

> Fixes #56
@josemmo josemmo added the bug Something isn't working label Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants