import ch.codeblock.qrinvoice.model.QrInvoice;
import ch.codeblock.qrinvoice.model.builder.QrInvoiceBuilder;
import ch.codeblock.qrinvoice.model.validation.ValidationException;
import ch.codeblock.qrinvoice.model.validation.ValidationResult;
// ...
try {
final QrInvoice qrInvoice = QrInvoiceBuilder
.create()
.creditorIBAN("CH44 3199 9123 0008 8901 2")
.paymentAmountInformation(p -> p
// Important part is here. amount can be left out, however currency must be set
.chf()
)
.creditor(c -> c
.structuredAddress()
.name("Robert Schneider AG")
.streetName("Rue du Lac")
.houseNumber("1268")
.postalCode("2501")
.city("Biel")
.country("CH")
)
.ultimateDebtor(d -> d
.structuredAddress()
.name("Pia-Maria Rutschmann-Schnyder")
.streetName("Grosse Marktgasse")
.houseNumber("28")
.postalCode("9400")
.city("Rorschach")
.country("CH")
)
.paymentReference(r -> r
.qrReference("210000000003139471430009017")
)
.additionalInformation(a -> a
.unstructuredMessage("Instruction of 03.04.2019")
.billInformation("//S1/10/10201409/11/190512/20/1400.000-53/30/106017086/31/180508/32/7.7/40/2:10;0:30")
)
.alternativeSchemeParameters(Arrays.asList(
"Name AV1: UV;UltraPay005;12345",
"Name AV2: XY;XYService;54321"
))
.build();
} catch (ValidationException validationException) {
final ValidationResult validationResult = validationException.getValidationResult();
// handle exception...
}