Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The field Tax Exemption Reason is mandatory when invoices entries have price 0 #171

Open
froque opened this issue Jun 4, 2021 · 0 comments
Labels
Milestone

Comments

@froque
Copy link
Member

froque commented Jun 4, 2021

to reproduce

  • get billy-demo-app source code
$ git clone  [email protected]:premium-minds/billy-demo-app.git
$ cd billy-demo-app
  • apply this diff
$ git diff              
diff --git a/src/main/java/dummyApp/app/DemoApp.java b/src/main/java/dummyApp/app/DemoApp.java
index a8d7f87..028dc1b 100644
--- a/src/main/java/dummyApp/app/DemoApp.java
+++ b/src/main/java/dummyApp/app/DemoApp.java
@@ -153,7 +153,7 @@ public class DemoApp {
                                .setContextUID(billyPortugal.contexts().portugal().allRegions().getUID())
                                .setQuantity(new BigDecimal("10"))
                                .setTaxPointDate(dateFormat.parse("01-02-2013"))
-                               .setUnitAmount(GenericInvoiceEntryBuilder.AmountType.WITH_TAX, new BigDecimal("100"))
+                               .setUnitAmount(GenericInvoiceEntryBuilder.AmountType.WITH_TAX, new BigDecimal("0"))
                                .setContextUID(billyPortugal.contexts().continent().allContinentRegions().getUID())
                                .setProductUID(product.getUID())
                                .setDescription(product.getDescription())
  • run the demo app
$ mvn clean package exec:java -Dexec.mainClass="dummyApp.app.App" -Dexec.args="demo"
  • fails with "The field Tax Exemption Reason is mandatory":
java.lang.NullPointerException: The field Tax Exemption Reason is mandatory
    at java.util.Objects.requireNonNull (Objects.java:348)
    at org.apache.commons.lang3.Validate.notNull (Validate.java:225)
    at com.premiumminds.billy.core.util.BillyValidator.mandatory (BillyValidator.java:76)
    at com.premiumminds.billy.portugal.services.builders.impl.PTGenericInvoiceEntryBuilderImpl.validateInstance (PTGenericInvoiceEntryBuilderImpl.java:76)
    at com.premiumminds.billy.portugal.services.builders.impl.PTInvoiceEntryBuilderImpl.validateInstance (PTInvoiceEntryBuilderImpl.java:55)
    at com.premiumminds.billy.core.services.builders.impl.AbstractBuilder.build (AbstractBuilder.java:64)
    at com.premiumminds.billy.core.services.builders.impl.GenericInvoiceBuilderImpl.addEntry (GenericInvoiceBuilderImpl.java:203)
    at com.premiumminds.billy.core.util.NotOnUpdateInterceptor.invoke (NotOnUpdateInterceptor.java:52)
    at dummyApp.app.DemoApp.createPtInvoice (DemoApp.java:162)
    at dummyApp.app.DemoApp.run (DemoApp.java:67)
    at dummyApp.app.App.main (App.java:27)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:832)

The correct behaviour is to not fail and issue the invoice with a price of 0.

@froque froque added the bug label Nov 23, 2021
@froque froque added this to the billy-7 milestone Sep 14, 2022
@froque froque modified the milestones: billy-8, billy-9 Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant