konik-io / konik

A library to create, read and validate ZUGFeRD compliant invoices. Available for Java and .NET
https://konik.io
Other
48 stars 19 forks source link

Define currency global #63

Closed djmj closed 5 years ago

djmj commented 6 years ago

It feels a little cumbersome to repeat the same code in many places (item, sum, tax) like:

final MonetarySummation sum = new MonetarySummation();
sum.setLineTotal(new Amount(lineTotal, CurrencyCode.EUR));
sum.setChargeTotal(new Amount(chargeTotal, CurrencyCode.EUR));

This approach would reduce code and make it more readable:

final MonetarySummation sum = new MonetarySummation(CurrencyCode.EUR);
sum.setLineTotal(lineTotal);
sum.setChargeTotal(chargeTotal);

Defining the currency on Invoice level would be the most elegant solution.

Vad1mo commented 6 years ago

This would break the API, but its a nice concept.

Before approving the change, We need to make sure that an Invoice must have only one currency.

This would be something for 2.0

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.