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: 3 additions & 1 deletion src/main/java/com/gocardless/resources/BillingRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,9 @@ public String getCurrency() {
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the chosen
* day does not exist in a given month (e.g. <code>31</code> in April), the charge is made
* on the last day of that month.
*/
public Integer getDayOfMonth() {
return dayOfMonth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,9 @@ public String getCurrency() {
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the
* chosen day does not exist in a given month (e.g. <code>31</code> in April), the
* charge is made on the last day of that month.
*/
public Integer getDayOfMonth() {
return dayOfMonth;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/gocardless/resources/Subscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public String getCurrency() {
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the chosen day
* does not exist in a given month (e.g. <code>31</code> in April), the charge is made on the
* last day of that month.
*/
public Integer getDayOfMonth() {
return dayOfMonth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ public BillingRequestCreateRequest withSubscriptionRequestCurrency(String curren
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the chosen
* day does not exist in a given month (e.g. <code>31</code> in April), the charge is made
* on the last day of that month.
*/
public BillingRequestCreateRequest withSubscriptionRequestDayOfMonth(Integer dayOfMonth) {
if (subscriptionRequest == null) {
Expand Down Expand Up @@ -1919,7 +1921,9 @@ public SubscriptionRequest withCurrency(String currency) {
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the
* chosen day does not exist in a given month (e.g. <code>31</code> in April), the
* charge is made on the last day of that month.
*/
public SubscriptionRequest withDayOfMonth(Integer dayOfMonth) {
this.dayOfMonth = dayOfMonth;
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/com/gocardless/services/PaymentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.gocardless.http.*;
import com.gocardless.resources.Payment;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -443,6 +445,7 @@ public static final class PaymentListRequest<S> extends ListRequest<S, Payment>
private String creditor;
private Currency currency;
private String customer;
private List<Include> include;
private String mandate;
private String scheme;
private SortDirection sortDirection;
Expand Down Expand Up @@ -595,6 +598,27 @@ public PaymentListRequest<S> withCustomer(String customer) {
return this;
}

/**
* Includes linked resources in the response. Use <code>customer</code> to embed customer
* details, or <code>mandate</code> to embed mandate details.
*/
public PaymentListRequest<S> withInclude(List<Include> include) {
this.include = include;
return this;
}

/**
* Includes linked resources in the response. Use <code>customer</code> to embed customer
* details, or <code>mandate</code> to embed mandate details.
*/
public PaymentListRequest<S> withInclude(Include include) {
if (this.include == null) {
this.include = new ArrayList<>();
}
this.include.add(include);
return this;
}

/**
* Number of records to return.
*/
Expand Down Expand Up @@ -710,6 +734,9 @@ protected Map<String, Object> getQueryParams() {
if (customer != null) {
params.put("customer", customer);
}
if (include != null) {
params.put("include", Joiner.on(",").join(include));
}
if (mandate != null) {
params.put("mandate", mandate);
}
Expand Down Expand Up @@ -764,6 +791,18 @@ public String toString() {
}
}

public enum Include {
@SerializedName("customer")
CUSTOMER, @SerializedName("mandate")
MANDATE, @SerializedName("unknown")
UNKNOWN;

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

public enum SortDirection {
@SerializedName("asc")
ASC, @SerializedName("desc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ public SubscriptionCreateRequest withCurrency(String currency) {
* <ul>
* <li></li>
* </ul>
* <code>28</code> or <code>-1</code> to indicate the last day of the month.
* <code>31</code> or <code>-1</code> to indicate the last day of the month. If the chosen
* day does not exist in a given month (e.g. <code>31</code> in April), the charge is made
* on the last day of that month.
*/
public SubscriptionCreateRequest withDayOfMonth(Integer dayOfMonth) {
this.dayOfMonth = dayOfMonth;
Expand Down
Loading