fattureincloud / fattureincloud-java-sdk

Fatture in Cloud SDK (Software Development Kit) for Java
MIT License
6 stars 0 forks source link

Exception when calling IssuedEInvoicesApi.getEInvoiceRejectionReason on a rejected e-invoice #51

Closed sguerrini97 closed 2 years ago

sguerrini97 commented 2 years ago

Hello, I'm experiencing a problem when I try to call IssuedEInvoicesApi.getEInvoiceRejectionReason with a rejected document id. Apparently the date field in the API reply is set to a value which cannot be parsed, I think this happens because it includes the time but I'm not sure.

Here is the stack trace:

Text '2022-05-25 18:07:30' could not be parsed, unparsed text found at index 10

java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2049)
java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948)
java.base/java.time.LocalDate.parse(LocalDate.java:428)
it.fattureincloud.sdk.JSON$LocalDateTypeAdapter.read(JSON.java:268)
it.fattureincloud.sdk.JSON$LocalDateTypeAdapter.read(JSON.java:235)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
com.google.gson.Gson.fromJson(Gson.java:963)
com.google.gson.Gson.fromJson(Gson.java:928)
com.google.gson.Gson.fromJson(Gson.java:877)
it.fattureincloud.sdk.JSON.deserialize(JSON.java:153)
it.fattureincloud.sdk.ApiClient.deserialize(ApiClient.java:922)
it.fattureincloud.sdk.ApiClient.handleResponse(ApiClient.java:1130)
it.fattureincloud.sdk.ApiClient.execute(ApiClient.java:1051)
it.fattureincloud.sdk.api.IssuedEInvoicesApi.getEInvoiceRejectionReasonWithHttpInfo(IssuedEInvoicesApi.java:207)
it.fattureincloud.sdk.api.IssuedEInvoicesApi.getEInvoiceRejectionReason(IssuedEInvoicesApi.java:184)
emajo commented 2 years ago

Hi, we looked into the problem and we fixed it! The issue was due to the fact that our api returns in the field date also the time, but the type on the sdk was LocalDate, which accepts only the date, resulting in an error when parsing. The fix will be in the next release which we plan on doing in the next 1-2 weeks. Thanks for reporting the issue, we are very happy to receive user feedback, we'll keep you informed when the next version is released.

sguerrini97 commented 2 years ago

Thank you very much, I'll wait for the new version!

emajo commented 2 years ago

Hi, yesterday we released the new sdk version 2.0.8 that solves your issue, let us know if you encounter other problems using our sdk!

Thanks, Emanuele