mambu-gmbh / Mambu-APIs-Java

Java Library for working with the Mambu APIs
https://www.mambu.com
Apache License 2.0
29 stars 33 forks source link

getLoanAccountsForClient - doesn't work for all kind of LoanAccounts #33

Closed IrakliCharkhalashvili closed 1 year ago

IrakliCharkhalashvili commented 10 years ago

After moving to MAMBU version 3.7 I receive error while trying to get some Clients Loan Accounts

for ID: 776735710 - it throws an error for ID: 109257621 - returns the values

my code is very simple

MambuAPIFactory.setUp("kapiltd.sandbox.mambu.com", "user", "pass"); LoansService loansService =MambuAPIFactory.getLoanService(); List loanAccounts = loansService.getLoanAccountsForClient(clientID);

HTTP Status 500 - Request processing failed; nested exception is com.google.gson.JsonParseException: The JsonDeserializer EnumTypeAdapter failed to deserialize json object "REFINANCED" given the type class com.mambu.accounts.shared.model.AccountState

type Exception report

message Request processing failed; nested exception is com.google.gson.JsonParseException: The JsonDeserializer EnumTypeAdapter failed to deserialize json object "REFINANCED" given the type class com.mambu.accounts.shared.model.AccountState

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.google.gson.JsonParseException: The JsonDeserializer EnumTypeAdapter failed to deserialize json object "REFINANCED" given the type class com.mambu.accounts.shared.model.AccountState org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause

com.google.gson.JsonParseException: The JsonDeserializer EnumTypeAdapter failed to deserialize json object "REFINANCED" given the type class com.mambu.accounts.shared.model.AccountState com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:64) com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92) com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:117) com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63) com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120) com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76) com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54) com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:663) com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:624) com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51) com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92) com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:80) com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:101) com.google.gson.JsonDeserializationContextDefault.fromJsonArray(JsonDeserializationContextDefault.java:67) com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:52) com.google.gson.Gson.fromJson(Gson.java:551) com.google.gson.Gson.fromJson(Gson.java:498) com.google.gson.Gson.fromJson(Gson.java:467) com.google.gson.Gson.fromJson(Gson.java:417) com.mambu.apisdk.util.ServiceHelper.getCollection(ServiceHelper.java:293) com.mambu.apisdk.util.ServiceHelper.execute(ServiceHelper.java:166) com.mambu.apisdk.util.ServiceHelper.execute(ServiceHelper.java:198) com.mambu.apisdk.services.LoansService.getLoanAccountsForClient(LoansService.java:144) com.ibankService.ibankService.getUpcomingPayments(ibankService.java:202) comm.app.starter.ibank.iBank.getUpcomingPayments(iBank.java:306) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:483) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause

java.lang.IllegalArgumentException: No enum constant com.mambu.accounts.shared.model.AccountState.REFINANCED java.lang.Enum.valueOf(Enum.java:238) com.google.gson.DefaultTypeAdapters$EnumTypeAdapter.deserialize(DefaultTypeAdapters.java:524) com.google.gson.DefaultTypeAdapters$EnumTypeAdapter.deserialize(DefaultTypeAdapters.java:514) com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51) com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92) com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:117) com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63) com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120) com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76) com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54) com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:663) com.google.gson.DefaultTypeAdapters$CollectionTypeAdapter.deserialize(DefaultTypeAdapters.java:624) com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51) com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92) com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:80) com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:101) com.google.gson.JsonDeserializationContextDefault.fromJsonArray(JsonDeserializationContextDefault.java:67) com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:52) com.google.gson.Gson.fromJson(Gson.java:551) com.google.gson.Gson.fromJson(Gson.java:498) com.google.gson.Gson.fromJson(Gson.java:467) com.google.gson.Gson.fromJson(Gson.java:417) com.mambu.apisdk.util.ServiceHelper.getCollection(ServiceHelper.java:293) com.mambu.apisdk.util.ServiceHelper.execute(ServiceHelper.java:166) com.mambu.apisdk.util.ServiceHelper.execute(ServiceHelper.java:198) com.mambu.apisdk.services.LoansService.getLoanAccountsForClient(LoansService.java:144) com.ibankService.ibankService.getUpcomingPayments(ibankService.java:202) comm.app.starter.ibank.iBank.getUpcomingPayments(iBank.java:306) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:483) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.

is there any way to resolve this problem?

thobach commented 10 years ago

Hi, Have you also updated your Mambu Models JAR from mambu-models-V3.6.jar to mambu-models-V3.7.jar? The mambu-models-V3.6.jar should not be on your classpath anymore. If this does not do the trick, please let me know. Thanks! Thomas

IrakliCharkhalashvili commented 10 years ago

Hi, Thank you for your replay. Finally I discovered that is was a problem of "gson" library version problem. Changed the version and the problem was resolved.

georgeghimici commented 1 year ago

Hello!

Unfortunately this repository will be archived because it won't be maintained anymore with new functionality and security updates. Main source of documentation and specifications for API will remain https://api.mambu.com/.

Cheers, George.