Skip to content
Merged
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
115 changes: 0 additions & 115 deletions src/main/java/com/gocardless/services/NegativeBalanceLimitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ public NegativeBalanceLimitListRequest<Iterable<NegativeBalanceLimit>> all() {
ListRequest.<NegativeBalanceLimit>iteratingExecutor());
}

/**
* Creates a new negative balance limit, which replaces the existing limit (if present) for that
* currency and creditor combination.
*
*/
public NegativeBalanceLimitCreateRequest create() {
return new NegativeBalanceLimitCreateRequest(httpClient);
}

/**
* Request class for {@link NegativeBalanceLimitService#list }.
*
Expand Down Expand Up @@ -158,110 +149,4 @@ public String toString() {
}
}
}

/**
* Request class for {@link NegativeBalanceLimitService#create }.
*
* Creates a new negative balance limit, which replaces the existing limit (if present) for that
* currency and creditor combination.
*
*/
public static final class NegativeBalanceLimitCreateRequest
extends PostRequest<NegativeBalanceLimit> {
private Integer balanceLimit;
private Currency currency;
private Links links;

/**
* The limit amount in pence (e.g. 10000 for a -100 GBP limit).
*/
public NegativeBalanceLimitCreateRequest withBalanceLimit(Integer balanceLimit) {
this.balanceLimit = balanceLimit;
return this;
}

/**
* [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently
* "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported.
*/
public NegativeBalanceLimitCreateRequest withCurrency(Currency currency) {
this.currency = currency;
return this;
}

public NegativeBalanceLimitCreateRequest withLinks(Links links) {
this.links = links;
return this;
}

/**
* ID of the [creditor](#core-endpoints-creditors) this limit relates to
*/
public NegativeBalanceLimitCreateRequest withLinksCreditor(String creditor) {
if (links == null) {
links = new Links();
}
links.withCreditor(creditor);
return this;
}

private NegativeBalanceLimitCreateRequest(HttpClient httpClient) {
super(httpClient);
}

public NegativeBalanceLimitCreateRequest withHeader(String headerName, String headerValue) {
this.addHeader(headerName, headerValue);
return this;
}

@Override
protected String getPathTemplate() {
return "negative_balance_limits";
}

@Override
protected String getEnvelope() {
return "negative_balance_limits";
}

@Override
protected Class<NegativeBalanceLimit> getResponseClass() {
return NegativeBalanceLimit.class;
}

@Override
protected boolean hasBody() {
return true;
}

public enum Currency {
@SerializedName("AUD")
AUD, @SerializedName("CAD")
CAD, @SerializedName("DKK")
DKK, @SerializedName("EUR")
EUR, @SerializedName("GBP")
GBP, @SerializedName("NZD")
NZD, @SerializedName("SEK")
SEK, @SerializedName("USD")
USD, @SerializedName("unknown")
UNKNOWN;

@Override
public String toString() {
return name();
}
}

public static class Links {
private String creditor;

/**
* ID of the [creditor](#core-endpoints-creditors) this limit relates to
*/
public Links withCreditor(String creditor) {
this.creditor = creditor;
return this;
}
}
}
}