Skip to content

Commit

Permalink
introduced enum for syncscope,
Browse files Browse the repository at this point in the history
  • Loading branch information
danielseligmann committed Nov 26, 2019
1 parent 47d3450 commit 36ac4da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/main/java/me/figo/FigoSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -332,7 +333,7 @@ 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<String, String> credentials, List<String> scope) throws FigoException, IOException {
boolean save_credentials, Map<String, String> credentials, List<SyncScope> scope) throws FigoException, IOException {

StartProviderSyncRequest request = new StartProviderSyncRequest(state, redirect_uri, disable_notifications,
save_credentials, credentials, scope);
Expand All @@ -345,7 +346,7 @@ public SyncStatusResponse startProviderSync(String accessId, String state, Strin
boolean disable_notifications,
boolean save_credentials, Map<String, String> credentials) throws FigoException, IOException {

List<String> scope = Collections.singletonList("TRANSACTIONS");
List<SyncScope> 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",
Expand Down
24 changes: 4 additions & 20 deletions src/main/java/me/figo/internal/StartProviderSyncRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class StartProviderSyncRequest {

public StartProviderSyncRequest(String state, String redirect_uri, boolean disable_notifications,
boolean save_secrets, Map<String,String> credentials, List<String> scope) {
boolean save_secrets, Map<String,String> credentials, List<SyncScope> scope) {
super();
this.state = state;
this.redirect_uri = redirect_uri;
Expand All @@ -31,7 +31,7 @@ public StartProviderSyncRequest(String state, String redirect_uri, boolean disab
* Defines the scope of the synchronization.
*/
@Expose
public List<String> scope;
public List<SyncScope> scope;

/**
* URL to redirect to when the synchronization finished
Expand All @@ -51,22 +51,6 @@ public StartProviderSyncRequest(String state, String redirect_uri, boolean disab
@Expose
public Map<String,String> 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<String, String> getCredentials() {
return credentials;
}
Expand Down Expand Up @@ -107,11 +91,11 @@ public void setSaveSecrets(boolean save_secrets) {
this.save_secrets = save_secrets;
}

public List<String> getScope() {
public List<SyncScope> getScope() {
return scope;
}

public void setScope(List<String> scope) {
public void setScope(List<SyncScope> scope) {
this.scope = scope;
}
}
15 changes: 15 additions & 0 deletions src/main/java/me/figo/internal/SyncScope.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
*
*/
package me.figo.internal;

/**
* Defines the scope of the synchronization.<br>
* "ACCOUNTS": Only fetch basic account data (e.g. holder name, IBAN etc.). Add new provider accounts to previously synced accesses.<br>
* "TRANSACTIONS": Fetch transaction and account data.
* @author Daniel
*
*/
public enum SyncScope {
ACCOUNTS,TRANSACTIONS
}

0 comments on commit 36ac4da

Please sign in to comment.