Repository navigation
Add invoicing period (BG-14) and invoice line period (BG-26) - #12
alexbabintsev wants to merge 1 commit into
Conversation
embewee
left a comment
There was a problem hiding this comment.
Thanks for your PR and the detailed issue, we appreciate your contribution! (I've added a contributing note to the README to make clear that PRs are welcome.)
Sorry, another PR was merged in the meantime and now conflicts with this one. Could you rebase onto master? The implementation looks good, I added some comments to address prior to merging
| * If the period is given, at least one of the two dates must be set (BR-CO-19, BR-CO-20), and the end date must not | ||
| * be before the start date (BR-29, BR-30). | ||
| */ | ||
| public class InvoicingPeriod { |
There was a problem hiding this comment.
The BGs have different names, we should reflect this here. Suggested name: InvoicingOrInvoiceLinePeriod. The actual property names in Invoice and Item can remain unchanged.
| Element specifiedSettlement = builder.createElement(NS_RAM, "SpecifiedLineTradeSettlement"); | ||
| tradeLineItem.appendChild(specifiedSettlement); | ||
| specifiedSettlement.appendChild(createTax(builder, lineItem.getVat())); | ||
| if (hasDate(lineItem.getInvoiceLinePeriod())) { // BG-26 |
There was a problem hiding this comment.
| if (hasDate(lineItem.getInvoiceLinePeriod())) { // BG-26 | |
| if (lineItem.getInvoiceLinePeriod() != null) { // BG-26 |
If the element shall not be written, the value must be set to null. That's how it's already done in other parts of the code
| for (Vat totalVat : invoice.getVatTotals()) { | ||
| tradeSettlement.appendChild(createTax(builder, totalVat)); | ||
| } | ||
| if (hasDate(invoice.getInvoicingPeriod())) { // BG-14 |
There was a problem hiding this comment.
| if (hasDate(invoice.getInvoicingPeriod())) { // BG-14 | |
| if (lineItem.getInvoiceLinePeriod() != null) { // BG-14 |
| private static boolean hasDate(InvoicingPeriod period) { | ||
| return period != null && (period.getStartDate() != null || period.getEndDate() != null); | ||
| } | ||
|
|
There was a problem hiding this comment.
| private static boolean hasDate(InvoicingPeriod period) { | |
| return period != null && (period.getStartDate() != null || period.getEndDate() != null); | |
| } |
| "deliveryInfo": { | ||
| "name": "Frida Fehlerfinder", | ||
| "deliveryAddress": { | ||
| "addressLineOne": "Problemstraße", | ||
| "addressLineTwo": null, | ||
| "addressLineThree": null, | ||
| "city": "Fehlstadt", | ||
| "zipCode": "10004", | ||
| "countryIsoCode": "DE" | ||
| }, | ||
| "actualDeliveryDate": null | ||
| }, |
There was a problem hiding this comment.
| "deliveryInfo": { | |
| "name": "Frida Fehlerfinder", | |
| "deliveryAddress": { | |
| "addressLineOne": "Problemstraße", | |
| "addressLineTwo": null, | |
| "addressLineThree": null, | |
| "city": "Fehlstadt", | |
| "zipCode": "10004", | |
| "countryIsoCode": "DE" | |
| }, | |
| "actualDeliveryDate": null | |
| }, | |
| "deliveryInfo": null, |
We should test that the period alone satisfies the business rule
| "quantity": 13, | ||
| "unitCode": "XPP", | ||
| "itemTotalNetAmount": 8193.28, | ||
| "name": "Hauptprodukt mit erweiterten Preisen", |
There was a problem hiding this comment.
| "name": "Hauptprodukt mit erweiterten Preisen", | |
| "name": "Subscription", |
nit
| "charges": [ | ||
| { | ||
| "netAmount": 0.00, | ||
| "vatCategory": "S", | ||
| "vatRate": 19, | ||
| "reason": "Versandkosten" | ||
| } | ||
| ] |
There was a problem hiding this comment.
| "charges": [ | |
| { | |
| "netAmount": 0.00, | |
| "vatCategory": "S", | |
| "vatRate": 19, | |
| "reason": "Versandkosten" | |
| } | |
| ] | |
| "charges": [] |
nit: subscription has no shipping costs
| "meansType": "68", | ||
| "meansText": null, | ||
| "remittanceInfo": null, | ||
| "paymentTerms": "Die Ware bleibt, bis zur vollständigen Bezahlung, unser Eigentum.\nLeistungsdatum entspricht Rechnungsdatum", |
There was a problem hiding this comment.
| "paymentTerms": "Die Ware bleibt, bis zur vollständigen Bezahlung, unser Eigentum.\nLeistungsdatum entspricht Rechnungsdatum", | |
| "paymentTerms": "Zahlbar innerhalb von 14 Tagen ohne Abzug.", |
nit: "Leistungsdatum entspricht Rechnungsdatum" doesn't fit an invoice that has a service period
a1f5f14 to
655b13f
Compare
|
Thanks for the review! Rebased onto master and addressed the comments:
|
Closes #11.
Adds the invoicing period (BG-14) and the invoice line period (BG-26), so an XRechnung for services or subscriptions can state the period of supply and no longer gets KoSIT's BR-DE-TMP-32 warning.
InvoicingPeriodwithstartDate(BT-73 / BT-134) andendDate(BT-74 / BT-135), used byInvoice.invoicingPeriod(...)andItem.invoiceLinePeriod(...), in the same builder style as the other model classes.CIIXMLEInvoiceWriterwritesram:BillingSpecifiedPeriodinApplicableHeaderTradeSettlementafter theram:ApplicableTradeTaxelements, and inSpecifiedLineTradeSettlementafter the line'sram:ApplicableTradeTax, as the CII schema orders them. Only the dates that are set are written; a period with neither date is left out, so no empty element appears.order_with_invoicing_period(the PayPal order with a November 2024 period on the invoice and on its line), for XRECHNUNG and EN16931_CORE, plus two null-safety tests.Checked:
./gradlew testpasses (69 tests, Java 17). Both expected files of the new scenario pass the XRechnung 3.0.2 and EN 16931 CII Schematron without findings.I left the version number and the changelog to you. BT-72 without a deliver-to party, the third point in the issue, is not part of this PR.