diff --git a/src/main/java/me/figo/FigoSession.java b/src/main/java/me/figo/FigoSession.java index 782451a..e43c915 100644 --- a/src/main/java/me/figo/FigoSession.java +++ b/src/main/java/me/figo/FigoSession.java @@ -40,6 +40,7 @@ import me.figo.internal.StartProviderSyncRequest; import me.figo.internal.SubmitPaymentRequest; import me.figo.internal.SyncChallengeRequest; +import me.figo.internal.SyncScope; import me.figo.internal.SyncStatusResponse; import me.figo.internal.SyncTokenRequest; import me.figo.internal.TaskResponseType; @@ -321,6 +322,7 @@ public ChallengeV4 solveSyncChallenge(String accessId, String syncId, String cha /** * Retrieve the details of a specific provider access identified by its ID. * country + * @param scope * * @return List of Accesses * @@ -331,15 +333,27 @@ public ChallengeV4 solveSyncChallenge(String accessId, String syncId, String cha */ public SyncStatusResponse startProviderSync(String accessId, String state, String redirect_uri, boolean disable_notifications, - boolean save_credentials, Map credentials) throws FigoException, IOException { + boolean save_credentials, Map credentials, List scope) throws FigoException, IOException { StartProviderSyncRequest request = new StartProviderSyncRequest(state, redirect_uri, disable_notifications, - save_credentials, credentials); + save_credentials, credentials, scope); SyncStatusResponse response = this.queryApi("/rest/accesses/" + accessId + "/syncs", request, "POST", SyncStatusResponse.class); return response; } + public SyncStatusResponse startProviderSync(String accessId, String state, String redirect_uri, + boolean disable_notifications, + boolean save_credentials, Map credentials) throws FigoException, IOException { + + List scope = Collections.singletonList(SyncScope.TRANSACTIONS); + StartProviderSyncRequest request = new StartProviderSyncRequest(state, redirect_uri, disable_notifications, + save_credentials, credentials, scope); + SyncStatusResponse response = this.queryApi("/rest/accesses/" + accessId + "/syncs", request, "POST", + SyncStatusResponse.class); + return response; + } + /** * Returns a list of all supported credit cards and payment services for a country * @param countryCode diff --git a/src/main/java/me/figo/internal/StartProviderSyncRequest.java b/src/main/java/me/figo/internal/StartProviderSyncRequest.java index b403ad7..60be8aa 100644 --- a/src/main/java/me/figo/internal/StartProviderSyncRequest.java +++ b/src/main/java/me/figo/internal/StartProviderSyncRequest.java @@ -1,5 +1,6 @@ package me.figo.internal; +import java.util.List; import java.util.Map; import com.google.gson.annotations.Expose; @@ -10,13 +11,14 @@ public class StartProviderSyncRequest { public StartProviderSyncRequest(String state, String redirect_uri, boolean disable_notifications, - boolean save_secrets, Map credentials) { + boolean save_secrets, Map credentials, List scope) { super(); this.state = state; this.redirect_uri = redirect_uri; this.disable_notifications = disable_notifications; this.save_secrets = save_secrets; this.credentials = credentials; + this.scope = scope; } /** @@ -25,6 +27,12 @@ public StartProviderSyncRequest(String state, String redirect_uri, boolean disab @Expose public String state; + /** + * Defines the scope of the synchronization. + */ + @Expose + public List scope; + /** * URL to redirect to when the synchronization finished */ @@ -43,22 +51,6 @@ public StartProviderSyncRequest(String state, String redirect_uri, boolean disab @Expose public Map credentials; - public String getRedirect_uri() { - return redirect_uri; - } - - public void setRedirect_uri(String redirect_uri) { - this.redirect_uri = redirect_uri; - } - - public boolean isDisable_notifications() { - return disable_notifications; - } - - public void setDisable_notifications(boolean disable_notifications) { - this.disable_notifications = disable_notifications; - } - public Map getCredentials() { return credentials; } @@ -98,4 +90,12 @@ public boolean isSaveSecrets() { public void setSaveSecrets(boolean save_secrets) { this.save_secrets = save_secrets; } + + public List getScope() { + return scope; + } + + public void setScope(List scope) { + this.scope = scope; + } } diff --git a/src/main/java/me/figo/internal/SyncScope.java b/src/main/java/me/figo/internal/SyncScope.java new file mode 100644 index 0000000..f2ef06f --- /dev/null +++ b/src/main/java/me/figo/internal/SyncScope.java @@ -0,0 +1,15 @@ +/** + * + */ +package me.figo.internal; + +/** + * Defines the scope of the synchronization.
+ * "ACCOUNTS": Only fetch basic account data (e.g. holder name, IBAN etc.). Add new provider accounts to previously synced accesses.
+ * "TRANSACTIONS": Fetch transaction and account data. + * @author Daniel + * + */ +public enum SyncScope { + ACCOUNTS,TRANSACTIONS +}