@@ -40,7 +40,7 @@ Add Gallop to your project via [Maven Central](https://central.sonatype.com/arti
4040
4141``` groovy
4242dependencies {
43- implementation 'de.codebarista:gallop:1 .0.1 '
43+ implementation 'de.codebarista:gallop:2 .0.0 '
4444}
4545```
4646
@@ -51,120 +51,99 @@ dependencies {
5151<dependency >
5252 <groupId >de.codebarista</groupId >
5353 <artifactId >gallop</artifactId >
54- <version >1 .0.1 </version >
54+ <version >2 .0.0 </version >
5555</dependency >
5656```
5757
5858### Code example
5959
60- ``` java
61- import de.codebarista.gallop.xrechnung.model.Invoice ;
62- import de.codebarista.gallop.xrechnung.model.Item ;
63- import de.codebarista.gallop.xrechnung.model.InvoiceNote ;
64- import de.codebarista.gallop.XmlDocumentBuilder ;
65-
66- import java.math.BigDecimal ;
67- import java.time.OffsetDateTime ;
68- import java.util.List ;
60+ You find this code in the ` BuildInvoiceTest ` class.
6961
62+ ``` java
7063public class InvoiceGenerator {
7164
72- public byte [] generateInvoice () throws Exception {
73- Invoice invoice = Invoice . builder ()
65+ public String generateInvoice () throws XRechnungWriterException {
66+ Invoice invoice = Invoice . create ()
7467 .documentTypeCode(InvoiceType . COMMERCIAL_INVOICE. getValue()) // Define invoice type
7568 .documentId(" INV-2025-1001" ) // Unique invoice identifier
7669 .leitwegId(" N/A" ) // Buyer reference (BT-10)
7770 .currency(" EUR" ) // Currency used for the invoice
7871
7972 // Payment details including method and terms
80- .paymentInstructions(PaymentInstructions . builder ()
73+ .paymentInstructions(PaymentInstructions . create ()
8174 .meansType(PaymentCode . CASH )
8275 .meansText(" Cash on delivery" )
8376 .paymentTerms(" The goods remain our property until full payment is received."
84- + " \n Date of service corresponds to invoice date." )
85- .build())
77+ + " \n Date of service corresponds to invoice date." ))
8678
8779 .issueDate(OffsetDateTime . now()) // Invoice issue date
8880
8981 // Seller details
90- .seller(SellerOrBuyer . builder ()
82+ .seller(SellerOrBuyer . create ()
9183 .name(" TechNova Solutions GmbH" )
92- .address(PostalAddress . builder ()
84+ .address(PostalAddress . create ()
9385 .addressLineOne(" Innovationsstraße 15" )
9486 .city(" Berlin" )
9587 .zipCode(" 10115" )
96- .countryIsoCode(" DE" )
97- .build())
88+ .countryIsoCode(" DE" ))
9889 .vatId(" DE298765432" ) // Seller VAT ID
9990 .electronicAddress(
" [email protected] " )
// Electronic address for invoicing100- .contact(Contact . builder ()
91+ .contact(Contact . create ()
10192 .name(" Dr. Stefan Wagner" )
10293 .phone(" +49 (0) 30 987654321" )
103- 104- .build())
105- .build())
94+ 10695
10796 // Buyer details
108- .buyer(SellerOrBuyer . builder ()
97+ .buyer(SellerOrBuyer . create ()
10998 .name(" Greenline Retail AG" )
110- .address(PostalAddress . builder ()
99+ .address(PostalAddress . create ()
111100 .addressLineOne(" Einkaufsstraße 78" )
112101 .city(" Hamburg" )
113102 .zipCode(" 20095" )
114- .countryIsoCode(" DE" )
115- .build())
116- .electronicAddress(
" [email protected] " )
// Electronic address for buyer117- .build())
103+ .countryIsoCode(" DE" ))
104+ .electronicAddress(
" [email protected] " ))
// Electronic address for buyer118105
119106 // Delivery information
120- .deliveryInfo(DeliveryInformation . builder ()
107+ .deliveryInfo(DeliveryInformation . create ()
121108 .name(" Greenline Retail AG - Warehouse" )
122- .deliveryAddress(PostalAddress . builder ()
109+ .deliveryAddress(PostalAddress . create ()
123110 .addressLineOne(" Lagerstraße 5" )
124111 .city(" Hamburg" )
125112 .zipCode(" 21079" )
126- .countryIsoCode(" DE" )
127- .build())
128- .build())
113+ .countryIsoCode(" DE" )))
129114
130115 // Invoice items
131116 .items(List . of(
132- Item . builder ()
117+ Item . create ()
133118 .id(1L )
134119 .name(" Ergonomic Office Chair" )
135120 .sellerAssignedId(" CHAIR-ERG-2025" ) // Seller's internal product ID
136121 .quantity(2L ) // Quantity purchased
137122 .unitPrice(new BigDecimal (" 199.99" )) // Price per unit
138123 .itemTotalNetAmount(new BigDecimal (" 399.98" )) // Total price without VAT
139124 .unitCode(UnitCode . PIECE ) // Unit of measurement
140- .vat(Vat . builder ()
125+ .vat(Vat . create ()
141126 .rate(BigDecimal . valueOf(19 )) // VAT rate (19%)
142- .category(TaxCategory . STANDARD_RATE )
143- .build())
144- .build(),
145- Item . builder()
127+ .category(TaxCategory . STANDARD_RATE )),
128+ Item . create()
146129 .id(2L )
147130 .name(" Wireless Mechanical Keyboard" )
148131 .sellerAssignedId(" KEY-MECH-WL" )
149132 .quantity(1L )
150133 .unitPrice(new BigDecimal (" 129.50" ))
151134 .itemTotalNetAmount(new BigDecimal (" 129.50" ))
152135 .unitCode(UnitCode . PIECE )
153- .vat(Vat . builder ()
136+ .vat(Vat . create ()
154137 .rate(BigDecimal . valueOf(19 ))
155- .category(TaxCategory . STANDARD_RATE )
156- .build())
157- .build()
158- ))
138+ .category(TaxCategory . STANDARD_RATE ))))
159139
160140 // VAT breakdown
161141 .vatTotals(List . of(
162- Vat . builder ()
142+ Vat . create ()
163143 .rate(BigDecimal . valueOf(19 ))
164144 .category(TaxCategory . STANDARD_RATE )
165145 .taxableAmount(BigDecimal . valueOf(529.48 )) // Taxable amount
166146 .taxAmount(BigDecimal . valueOf(100.60 )) // VAT amount
167- .build()
168147 ))
169148
170149 // Invoice totals
@@ -175,13 +154,17 @@ public class InvoiceGenerator {
175154 .duePayableAmount(new BigDecimal (" 630.08" )) // Amount due for payment
176155
177156 // Sales order reference
178- .salesOrderReference(" SO-98765" )
179-
180- .build();
157+ .salesOrderReference(" SO-98765" );
181158
159+ // Generate the XRechnung XML from the invoice
182160 byte [] xRechnungXML = XRechnungWriter . generateXRechnungXML(invoice);
161+ return new String (xRechnungXML);
183162 }
184163}
185164```
186165
187- You also find this code in the ` BuildInvoiceTest ` class.
166+ ### Changelog
167+
168+ - 2.0.0: Gallop no longer relies on lombok, introduce fluent api
169+ - 1.0.1: Add action to publish to maven central
170+ - 1.0.0: Initial version
0 commit comments