Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ With Maven:
<dependency>
<groupId>com.gocardless</groupId>
<artifactId>gocardless-pro</artifactId>
<version>6.7.0</version>
<version>6.8.0</version>
</dependency>
```

With Gradle:

```
implementation 'com.gocardless:gocardless-pro:6.7.0'
implementation 'com.gocardless:gocardless-pro:6.8.0'
```

## Initializing the client
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.gocardless'
version = '6.7.0'
version = '6.8.0'

apply plugin: 'ch.raffael.pegdown-doclet'

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gocardless/http/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class HttpClient {
private static final String DISALLOWED_USER_AGENT_CHARACTERS =
"[^\\w!#$%&'\\*\\+\\-\\.\\^`\\|~]";
private static final String USER_AGENT =
String.format("gocardless-pro-java/6.7.0 java/%s %s/%s %s/%s",
String.format("gocardless-pro-java/6.8.0 java/%s %s/%s %s/%s",
cleanUserAgentToken(System.getProperty("java.vm.specification.version")),
cleanUserAgentToken(System.getProperty("java.vm.name")),
cleanUserAgentToken(System.getProperty("java.version")),
Expand All @@ -49,7 +49,7 @@ public class HttpClient {
builder.put("GoCardless-Version", "2015-07-06");
builder.put("Accept", "application/json");
builder.put("GoCardless-Client-Library", "gocardless-pro-java");
builder.put("GoCardless-Client-Version", "6.7.0");
builder.put("GoCardless-Client-Version", "6.8.0");
HEADERS = builder.build();
}
private final OkHttpClient rawClient;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/gocardless/resources/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Map<String, Object> getResourceMetadata() {
* <li>`refunds`</li>
* <li>`scheme_identifiers`</li>
* <li>`subscriptions`</li>
* <li>`outbound_payment`</li>
* <li>`outbound_payments`</li>
* </ul>
*/
public ResourceType getResourceType() {
Expand All @@ -124,8 +124,7 @@ public enum ResourceType {
PAYOUTS, @SerializedName("refunds")
REFUNDS, @SerializedName("scheme_identifiers")
SCHEME_IDENTIFIERS, @SerializedName("subscriptions")
SUBSCRIPTIONS, @SerializedName("outbound_payment")
OUTBOUND_PAYMENT, @SerializedName("unknown")
SUBSCRIPTIONS, @SerializedName("unknown")
UNKNOWN
}

Expand Down
42 changes: 41 additions & 1 deletion src/main/java/com/gocardless/resources/Institution.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gocardless.resources;

import com.google.gson.annotations.SerializedName;
import java.util.Map;

/**
* Represents a institution resource returned from the API.
Expand All @@ -20,6 +21,7 @@ private Institution() {
private String countryCode;
private String iconUrl;
private String id;
private Limits limits;
private String logoUrl;
private String name;
private Status status;
Expand All @@ -36,7 +38,8 @@ public Boolean getAutocompletesCollectBankAccount() {
/**
* [ISO
* 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
* alpha-2 code. The country code of the institution.
* alpha-2 code. The country code of the institution. If nothing is provided, institutions with
* the country code 'GB' are returned by default.
*/
public String getCountryCode() {
return countryCode;
Expand All @@ -56,6 +59,13 @@ public String getId() {
return id;
}

/**
* Defines individual limits for business and personal accounts.
*/
public Limits getLimits() {
return limits;
}

/**
* A URL pointing to the logo for this institution
*/
Expand Down Expand Up @@ -84,4 +94,34 @@ public enum Status {
TEMPORARILY_DISABLED, @SerializedName("unknown")
UNKNOWN
}

/**
* Represents a limit resource returned from the API.
*
* Defines individual limits for business and personal accounts.
*/
public static class Limits {
private Limits() {
// blank to prevent instantiation
}

private Map<String, Object> daily;
private Map<String, Object> single;

/**
* Daily limit details for this institution. (The 'limits' property is only available via an
* authenticated request with a generated access token)
*/
public Map<String, Object> getDaily() {
return daily;
}

/**
* Single transaction limit details for this institution. (The 'limits' property is only
* available via an authenticated request with a generated access token)
*/
public Map<String, Object> getSingle() {
return single;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3151,7 +3151,8 @@ public static final class BillingRequestSelectInstitutionRequest
/**
* [ISO
* 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
* alpha-2 code. The country code of the institution.
* alpha-2 code. The country code of the institution. If nothing is provided, institutions
* with the country code 'GB' are returned by default.
*/
public BillingRequestSelectInstitutionRequest withCountryCode(String countryCode) {
this.countryCode = countryCode;
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/gocardless/services/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public EventListRequest<S> withExport(String export) {
* <li>`refund`</li>
* <li>`scheme_identifier`</li>
* <li>`subscription`</li>
* <li>`outbound_payment`</li>
* </ul>
*/
public EventListRequest<S> withInclude(Include include) {
Expand Down Expand Up @@ -272,8 +273,8 @@ public EventListRequest<S> withRefund(String refund) {
/**
* Type of resource that you'd like to get all events for. Cannot be used together with the
* `billing_request`, `creditor`, `export`,`instalment_schedule`, `mandate`,
* `payer_authorisation`, `payment`, `payout`, `refund`, `scheme_identifier` or
* `subscription` parameters. The type can be one of:
* `payer_authorisation`, `payment`, `payout`, `refund`, `scheme_identifier`, `subscription`
* or `outbound_payment` parameters. The type can be one of:
* <ul>
* <li>`billing_requests`</li>
* <li>`creditors`</li>
Expand All @@ -286,6 +287,7 @@ public EventListRequest<S> withRefund(String refund) {
* <li>`refunds`</li>
* <li>`scheme_identifiers`</li>
* <li>`subscriptions`</li>
* <li>`outbound_payments`</li>
* </ul>
*/
public EventListRequest<S> withResourceType(ResourceType resourceType) {
Expand Down Expand Up @@ -428,8 +430,7 @@ public enum ResourceType {
PAYOUTS, @SerializedName("refunds")
REFUNDS, @SerializedName("scheme_identifiers")
SCHEME_IDENTIFIERS, @SerializedName("subscriptions")
SUBSCRIPTIONS, @SerializedName("outbound_payment")
OUTBOUND_PAYMENT, @SerializedName("unknown")
SUBSCRIPTIONS, @SerializedName("unknown")
UNKNOWN;

@Override
Expand Down
62 changes: 60 additions & 2 deletions src/main/java/com/gocardless/services/InstitutionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,51 @@ public InstitutionListForBillingRequestRequest<Iterable<Institution>> listForBil
* Returns a list of supported institutions.
*/
public static final class InstitutionListRequest<S> extends ListRequest<S, Institution> {
private String branchCode;
private String countryCode;
private String feature;
private String scheme;

/**
* (Currently only supports UK sort-codes) The six-digit number that identifies both the
* bank and the specific branch where an account is held, eg. '601234'.
*/
public InstitutionListRequest<S> withBranchCode(String branchCode) {
this.branchCode = branchCode;
return this;
}

/**
* [ISO
* 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
* alpha-2 code. The country code of the institution.
* alpha-2 code. The country code of the institution. If nothing is provided, institutions
* with the country code 'GB' are returned by default.
*/
public InstitutionListRequest<S> withCountryCode(String countryCode) {
this.countryCode = countryCode;
return this;
}

/**
* The feature that institutions support. The available options include `pis`, and
* `vrp_sweeping`. If nothing is provided, institutions supporting 'pis' are returned by
* default.
*/
public InstitutionListRequest<S> withFeature(String feature) {
this.feature = feature;
return this;
}

/**
* The scheme that institutions support. The available options include `faster_payments`,
* `sepa_credit_transfer`, and `sepa_instant_credit_transfer`. If nothing is provided,
* institutions supporting 'faster_payments' are returned by default.
*/
public InstitutionListRequest<S> withScheme(String scheme) {
this.scheme = scheme;
return this;
}

private InstitutionListRequest(HttpClient httpClient,
ListRequestExecutor<S, Institution> executor) {
super(httpClient, executor);
Expand All @@ -84,9 +117,18 @@ public InstitutionListRequest<S> withHeader(String headerName, String headerValu
protected Map<String, Object> getQueryParams() {
ImmutableMap.Builder<String, Object> params = ImmutableMap.builder();
params.putAll(super.getQueryParams());
if (branchCode != null) {
params.put("branch_code", branchCode);
}
if (countryCode != null) {
params.put("country_code", countryCode);
}
if (feature != null) {
params.put("feature", feature);
}
if (scheme != null) {
params.put("scheme", scheme);
}
return params.build();
}

Expand Down Expand Up @@ -119,12 +161,14 @@ public static final class InstitutionListForBillingRequestRequest<S>
private final String identity;
private String countryCode;
private List<String> ids;
private Boolean includeDisabled;
private String search;

/**
* [ISO
* 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
* alpha-2 code. The country code of the institution.
* alpha-2 code. The country code of the institution. If nothing is provided, institutions
* with the country code 'GB' are returned by default.
*/
public InstitutionListForBillingRequestRequest<S> withCountryCode(String countryCode) {
this.countryCode = countryCode;
Expand Down Expand Up @@ -152,6 +196,17 @@ public InstitutionListForBillingRequestRequest<S> withIds(String ids) {
return this;
}

/**
* Indicates whether to include temporarily disabled institutions in the response. If not
* provided or set to false, only enabled institutions will be returned.
*
*/
public InstitutionListForBillingRequestRequest<S> withIncludeDisabled(
Boolean includeDisabled) {
this.includeDisabled = includeDisabled;
return this;
}

/**
* A search substring for retrieving institution(s), based on the institution's name.
*/
Expand Down Expand Up @@ -189,6 +244,9 @@ protected Map<String, Object> getQueryParams() {
if (ids != null) {
params.put("ids", Joiner.on(",").join(ids));
}
if (includeDisabled != null) {
params.put("include_disabled", includeDisabled);
}
if (search != null) {
params.put("search", search);
}
Expand Down