Skip to content

Commit

Permalink
Merge pull request #76 from figo-connect/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
danielseligmann authored Nov 27, 2019
2 parents 4f297de + 36ac4da commit c3f32e1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
18 changes: 16 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 @@ -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
*
Expand All @@ -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<String, String> credentials) 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);
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<String, String> credentials) throws FigoException, IOException {

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",
SyncStatusResponse.class);
return response;
}

/**
* Returns a list of all supported credit cards and payment services for a country
* @param countryCode
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/me/figo/internal/StartProviderSyncRequest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.figo.internal;

import java.util.List;
import java.util.Map;

import com.google.gson.annotations.Expose;
Expand All @@ -10,13 +11,14 @@
public class StartProviderSyncRequest {

public StartProviderSyncRequest(String state, String redirect_uri, boolean disable_notifications,
boolean save_secrets, Map<String,String> credentials) {
boolean save_secrets, Map<String,String> credentials, List<SyncScope> 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;
}

/**
Expand All @@ -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<SyncScope> scope;

/**
* URL to redirect to when the synchronization finished
*/
Expand All @@ -43,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 @@ -98,4 +90,12 @@ public boolean isSaveSecrets() {
public void setSaveSecrets(boolean save_secrets) {
this.save_secrets = save_secrets;
}

public List<SyncScope> getScope() {
return 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 c3f32e1

Please sign in to comment.