Invalid child element 'classificationType'
Closed this issue · 1 comments
Hello, thanks for the effort you put in this package!
I started playing around, in order to send an invoice, and sent the following to AADE
Example XML
The following xml was send to AADE<?xml version="1.0"?>
<InvoicesDoc xmlns="http://www.aade.gr/myDATA/invoice/v1.0">
<invoice>
<issuer>
<vatNumber>111111</vatNumber>
<country>GR</country>
<branch>0</branch>
</issuer>
<counterpart>
<vatNumber>222222</vatNumber>
<country>GR</country>
<branch>0</branch>
</counterpart>
<invoiceHeader>
<series/>
<aa/>
<issueDate>2022-06-09</issueDate>
<invoiceType>1.1</invoiceType>
<currency>EUR</currency>
<dispatchDate>2022-06-09</dispatchDate>
<dispatchTime>08:57:03</dispatchTime>
</invoiceHeader>
<paymentMethods>
<paymentMethodDetails>
<type>3</type>
<amount>13.37</amount>
<paymentMethodInfo/>
</paymentMethodDetails>
</paymentMethods>
<invoiceDetails>
<lineNumber>1</lineNumber>
<quantity>2</quantity>
<measurementUnit>2</measurementUnit>
<invoiceDetailType>1</invoiceDetailType>
<netValue>15</netValue>
<vatCategory>1</vatCategory>
<vatAmount>2</vatAmount>
<incomeClassification>
<classificationType>E3_561_003</classificationType>
<classificationCategory>category1_3</classificationCategory>
<amount>16</amount>
</incomeClassification>
</invoiceDetails>
<invoiceSummary>
<totalNetValue>0</totalNetValue>
<totalVatAmount>0</totalVatAmount>
<totalWithheldAmount>0</totalWithheldAmount>
<totalFeesAmount>0</totalFeesAmount>
<totalStampDutyAmount>0</totalStampDutyAmount>
<totalOtherTaxesAmount>0</totalOtherTaxesAmount>
<totalDeductionsAmount>0</totalDeductionsAmount>
<totalGrossValue>0</totalGrossValue>
</invoiceSummary>
</invoice>
</InvoicesDoc>
One of the errors I got in the response was that the income classification had the wrong namespace and that the icls
namespace was missing as an attribute.
Code:101 - Message:Line:1.Position:871.
The element 'incomeClassification' in namespace 'http://www.aade.gr/myDATA/invoice/v1.0' has invalid child element 'classificationType' in namespace 'http://www.aade.gr/myDATA/invoice/v1.0'.
List of possible elements expected: 'classificationType, classificationCategory' in namespace 'https://www.aade.gr/myDATA/incomeClassificaton/v1.0'.
Now, I've never really used xml before, so not sure if what I understood is correct. I noticed that the incomeClassification namespace was missing as an attribute, and that the names of the fields had the name space icls
in front.
From source example
<InvoicesDoc xmlns="http://www.aade.gr/myDATA/invoice/v1.0" xmlns:icls="https://www.aade.gr/myDATA/incomeClassificaton/v1.0">
and
<incomeClassification>
<icls:classificationType>E3_561_001</icls:classificationType>
<icls:classificationCategory>category1_2</icls:classificationCategory>
<icls:amount>1000.00</icls:amount>
</incomeClassification>
After, I added the icls
attribute and changed the IncomeClassificationType
struct to
type IncomeClassificationType struct {
ClassificationType string `xml:"icls:classificationType"`
ClassificationCategory string `xml:"icls:classificationCategory"`
Amount string `xml:"icls:amount"`
ID *byte `xml:"icls:id"`
}
I managed to send an invoice.
If this is something acceptable, I could draft up a PR. How does that sound?
Ps: Is there a reason the Amount field in IncomeClassificationType
is string instead of float64 like the rest?
@stefpap please do submit a PR 👍🏾 what you described in the ticket makes total sense to me