diff --git a/pom.xml b/pom.xml index 99b01fc..455bfcb 100755 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ me.figo sdk - 3.1.1 + 3.1.3 jar Figo Java SDK diff --git a/src/main/java/me/figo/FigoApi.java b/src/main/java/me/figo/FigoApi.java index cdef183..3b07d15 100644 --- a/src/main/java/me/figo/FigoApi.java +++ b/src/main/java/me/figo/FigoApi.java @@ -136,7 +136,7 @@ public T queryApi(String path, Object data, String method, Type typeOfT) thr connection.setRequestProperty("Authorization", authorization); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Content-Type", "application/json"); - connection.setRequestProperty("User-Agent", "Figo/Java 3.1.1"); + connection.setRequestProperty("User-Agent", "Figo/Java 3.1.3"); // add payload if (data != null) { diff --git a/src/main/java/me/figo/FigoException.java b/src/main/java/me/figo/FigoException.java index 11d5043..c660cc4 100644 --- a/src/main/java/me/figo/FigoException.java +++ b/src/main/java/me/figo/FigoException.java @@ -22,6 +22,8 @@ package me.figo; +import java.util.Map; + import com.google.gson.annotations.Expose; /*** @@ -80,6 +82,9 @@ public static class ErrorObject { @Expose private String code; + @Expose + private Map data; + @Expose private String description; @@ -101,18 +106,16 @@ public String getGroup() { return group; } + public Map getData() { + return data; + } + @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("ErrorObject ["); - if (code != null) - builder.append("code=").append(code).append(", "); - if (description != null) - builder.append("description=").append(description).append(", "); - if (group != null) - builder.append("group=").append(group); - builder.append("]"); - return builder.toString(); + return "ErrorObject [" + (code != null ? "code=" + code + ", " : "") + + (data != null ? "data=" + data + ", " : "") + + (description != null ? "description=" + description + ", " : "") + + (group != null ? "group=" + group : "") + "]"; } } } diff --git a/src/main/java/me/figo/FigoSession.java b/src/main/java/me/figo/FigoSession.java index eea9116..0af4405 100644 --- a/src/main/java/me/figo/FigoSession.java +++ b/src/main/java/me/figo/FigoSession.java @@ -30,9 +30,30 @@ import java.util.Collections; import java.util.List; -import me.figo.internal.*; -import me.figo.models.*; +import me.figo.internal.ModifyStandingOrderRequest; +import me.figo.internal.SetupAccountRequest; +import me.figo.internal.SubmitPaymentRequest; +import me.figo.internal.SyncTokenRequest; +import me.figo.internal.TaskResponseType; +import me.figo.internal.TaskStatusRequest; +import me.figo.internal.TaskStatusResponse; +import me.figo.internal.TaskTokenResponse; +import me.figo.internal.VisitedRequest; +import me.figo.models.Account; +import me.figo.models.AccountBalance; +import me.figo.models.Bank; +import me.figo.models.BankLoginSettings; +import me.figo.models.Notification; +import me.figo.models.Payment; +import me.figo.models.PaymentContainer; +import me.figo.models.PaymentProposal; import me.figo.models.PaymentProposal.PaymentProposalResponse; +import me.figo.models.Security; +import me.figo.models.Service; +import me.figo.models.ServiceLoginSettings; +import me.figo.models.StandingOrder; +import me.figo.models.Transaction; +import me.figo.models.User; /** * Main entry point to the data access-part of the figo connect java library. @@ -347,6 +368,20 @@ public Account getAccount(String accountId) throws FigoException, IOException { return this.queryApi("/rest/accounts/" + accountId, null, "GET", Account.class); } + /** + * Modify an account + * + * @param account + * the modified account to be saved + * @return Account object for the updated account returned by server + * + * @exception FigoException Base class for all figoExceptions + * @exception IOException IOException + */ + public Account updateAccount(Account account) throws FigoException, IOException { + return this.queryApi("/rest/accounts/" + account.getAccountId(), account, "PUT", Account.class); + } + /** * Remove an account * @@ -1400,14 +1435,6 @@ public void cancelTask(String taskToken) throws FigoException, IOException { @Override protected T processResponse(HttpURLConnection connection, Type typeOfT) throws IOException, FigoException { // process response - - try { - @SuppressWarnings("unused") - int code = connection.getResponseCode(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } return super.processResponse(connection, typeOfT); } } diff --git a/src/main/java/me/figo/internal/FigoTrustManager.java b/src/main/java/me/figo/internal/FigoTrustManager.java index 700ff2e..d2db7ed 100644 --- a/src/main/java/me/figo/internal/FigoTrustManager.java +++ b/src/main/java/me/figo/internal/FigoTrustManager.java @@ -37,7 +37,7 @@ public class FigoTrustManager implements X509TrustManager { private static final List VALID_FINGERPRINTS = new ArrayList(Arrays.asList( - "070F14AEB94AFB3DF800E82B69A8515CEED2F5B1BA897BEF6432458F61CF9E33", + "CDF3D326278991B9CDAE4B106C9681B7EBB33810C472376A4D9C84B7B3DCD68D", "79B2A29300853B0692B1B5F2247948583AA5220FC5CDE9499AC8451EDBE0DA50")); /** diff --git a/src/test/java/me/figo/APITest.java b/src/test/java/me/figo/APITest.java index aeb0bf7..71327e1 100644 --- a/src/test/java/me/figo/APITest.java +++ b/src/test/java/me/figo/APITest.java @@ -11,7 +11,6 @@ import java.util.Arrays; import java.util.List; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -131,15 +130,14 @@ public void testWrongCredentialsErrorMessage() throws FigoException, IOException } } - @Test - public void testGetErrorMessage() throws IOException { - try { - FigoSession fs = new FigoSession(accessToken.access_token); - Account acc = fs.getAccount("666"); - fail(acc.getName()); - } - catch(FigoException e) { - assertEquals("The requested object does not exist.", e.getErrorDescription()); - } - } + @Test + public void testGetErrorMessage() throws IOException { + try { + FigoSession fs = new FigoSession(accessToken.access_token); + Account acc = fs.getAccount("666"); + fail(acc.getName()); + } catch (FigoException e) { + assertEquals("The requested object does not exist.", e.getErrorDescription()); + } + } } \ No newline at end of file