Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support_rest_catalog_banks_31'
Browse files Browse the repository at this point in the history
  • Loading branch information
javaes committed Dec 20, 2018
2 parents 83ed837 + d5bb8d6 commit 65322ee
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/me/figo/FigoSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
import me.figo.models.Account;
import me.figo.models.AccountBalance;
import me.figo.models.Bank;

import me.figo.models.CatalogBank.CatalogBanksResponse;
import me.figo.models.LoginSettings;

import me.figo.models.Notification;
import me.figo.models.Payment;
import me.figo.models.PaymentContainer;
Expand Down Expand Up @@ -182,6 +186,17 @@ public ServiceLoginSettings getLoginSettingsForService(String countryCode, Strin
return this.queryApi("/rest/catalog/services/" + countryCode + "/" + serviceName, null, "GET", ServiceLoginSettings.class);
}

/**
* Returns banks catalog by country
* @param countryCode ISO 3166-1
* @return CatalogBanksResponse containing a list of banks for that country
* @throws FigoException
* @throws IOException
*/
public CatalogBanksResponse getCatalogBanks(String countryCode) throws FigoException, IOException {
return this.queryApi("/rest/catalog/banks/" + countryCode, null, "GET", CatalogBanksResponse.class);
}

@Deprecated
/**
* Returns a TaskToken for a new account creation task
Expand Down
104 changes: 104 additions & 0 deletions src/main/java/me/figo/models/CatalogBank.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
*
*/
package me.figo.models;

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

import com.google.gson.annotations.Expose;
import com.google.gson.internal.LinkedTreeMap;

/**
* object representing the response of a /catalog/banks/{country_code} request
*
* @author Daniel
*
*/
public class CatalogBank {

@Expose
private String bank_name;

@Expose
private List<?> icon;

@Expose
private Language language;

@Expose
private String bank_code;

@Expose
private String bic;

@Expose
private List<Credential> credentials;

@Expose
private String advice;

public String getBic() {
return bic;
}

public Language getLanguage() {
return language;
}

public List<Credential> getCredentials() {
return credentials;
}

public String getAdvice() {
return advice;
}

public String getBankName() {
return bank_name;
}

public String getBankCode() {
return bank_code;
}

/**
* wrapper class holding the list of banks as returned by figo api
*
* @author Daniel
*
*/
public static class CatalogBanksResponse {
/**
* List of banks asked for
*/
@Expose
private List<CatalogBank> banks;

public List<CatalogBank> getBanks() {
return banks;
}

}

/**
* @return bank icon URL
*/
public String getIconUrl() {
if(icon!=null&&icon.size()>0){
return (String) icon.get(0);
}
return "";
}

/**
* @return the bank icon in other resolutions
*/
@SuppressWarnings("unchecked")
public Map<String, String> getAdditionalIcons() {
if(icon!=null&&icon.size()>1){
return (LinkedTreeMap<String, String>) icon.get(1);
}
return null;
}
}
28 changes: 28 additions & 0 deletions src/main/java/me/figo/models/Language.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
*
*/
package me.figo.models;

import java.util.List;

import com.google.gson.annotations.Expose;

/**
* @author Daniel
*
*/
public class Language {

@Expose
private List<String> available_languages;

@Expose
private String current_language;

public List<String> getAvailableLanguages() {
return available_languages;
}
public String getCurrentLanguage() {
return current_language;
}
}

0 comments on commit 65322ee

Please sign in to comment.