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>7.0.0</version>
<version>7.1.0</version>
</dependency>
```

With Gradle:

```
implementation 'com.gocardless:gocardless-pro:7.0.0'
implementation 'com.gocardless:gocardless-pro:7.1.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 = '7.0.0'
version = '7.1.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/7.0.0 java/%s %s/%s %s/%s",
String.format("gocardless-pro-java/7.1.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", "7.0.0");
builder.put("GoCardless-Client-Version", "7.1.0");
HEADERS = builder.build();
}
private final OkHttpClient rawClient;
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/com/gocardless/resources/BillingRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,8 @@ public String getConsentType() {
}

/**
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
* VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
* PayTo and VRP.
*/
public Constraints getConstraints() {
return constraints;
Expand Down Expand Up @@ -915,8 +915,8 @@ public enum Verify {
/**
* Represents a constraint resource returned from the API.
*
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
* VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
* PayTo and VRP.
*/
public static class Constraints {
private Constraints() {
Expand All @@ -943,7 +943,8 @@ public String getEndDate() {
}

/**
* The maximum amount that can be charged for a single payment. Required for VRP.
* The maximum amount that can be charged for a single payment. Required for PayTo and
* VRP.
*/
public Integer getMaxAmountPerPayment() {
return maxAmountPerPayment;
Expand Down Expand Up @@ -1019,7 +1020,8 @@ public Integer getMaxTotalAmount() {
}

/**
* The repeating period for this mandate
* The repeating period for this mandate. Defaults to flexible for PayTo if not
* specified.
*/
public Period getPeriod() {
return period;
Expand Down Expand Up @@ -1141,8 +1143,9 @@ public Map<String, Object> getMetadata() {
}

/**
* A custom payment reference defined by the merchant. It is only available for payments
* using the Direct Funds settlement model on the Faster Payments scheme.
* A custom payment reference defined by the merchant. It is only available for payments on
* the PayTo scheme or payments using the Direct Funds settlement model on the Faster
* Payments scheme.
*
*/
public String getReference() {
Expand Down
142 changes: 142 additions & 0 deletions src/main/java/com/gocardless/resources/BillingRequestTemplate.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.List;
import java.util.Map;

/**
Expand All @@ -25,6 +26,7 @@ private BillingRequestTemplate() {
private String authorisationUrl;
private String createdAt;
private String id;
private MandateRequestConstraints mandateRequestConstraints;
private String mandateRequestCurrency;
private String mandateRequestDescription;
private Map<String, Object> mandateRequestMetadata;
Expand Down Expand Up @@ -62,6 +64,14 @@ public String getId() {
return id;
}

/**
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
* PayTo and VRP.
*/
public MandateRequestConstraints getMandateRequestConstraints() {
return mandateRequestConstraints;
}

/**
* [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code.
*/
Expand Down Expand Up @@ -208,4 +218,136 @@ public enum MandateRequestVerify {
ALWAYS, @SerializedName("unknown")
UNKNOWN
}

/**
* Represents a mandate request constraint resource returned from the API.
*
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
* PayTo and VRP.
*/
public static class MandateRequestConstraints {
private MandateRequestConstraints() {
// blank to prevent instantiation
}

private String endDate;
private Integer maxAmountPerPayment;
private String paymentMethod;
private List<PeriodicLimit> periodicLimits;
private String startDate;

/**
* The latest date at which payments can be taken, must occur after start_date if present
*
* This is an optional field and if it is not supplied the agreement will be considered open
* and will not have an end date. Keep in mind the end date must take into account how long
* it will take the user to set up this agreement via the Billing Request.
*
*/
public String getEndDate() {
return endDate;
}

/**
* The maximum amount that can be charged for a single payment. Required for PayTo and VRP.
*/
public Integer getMaxAmountPerPayment() {
return maxAmountPerPayment;
}

/**
* A constraint where you can specify info (free text string) about how payments are
* calculated. _Note:_ This is only supported for ACH and PAD schemes.
*
*/
public String getPaymentMethod() {
return paymentMethod;
}

/**
* List of periodic limits and constraints which apply to them
*/
public List<PeriodicLimit> getPeriodicLimits() {
return periodicLimits;
}

/**
* The date from which payments can be taken.
*
* This is an optional field and if it is not supplied the start date will be set to the day
* authorisation happens.
*
*/
public String getStartDate() {
return startDate;
}

public static class PeriodicLimit {
private PeriodicLimit() {
// blank to prevent instantiation
}

private Alignment alignment;
private Integer maxPayments;
private Integer maxTotalAmount;
private Period period;

/**
* The alignment of the period.
*
* `calendar` - this will finish on the end of the current period. For example this will
* expire on the Monday for the current week or the January for the next year.
*
* `creation_date` - this will finish on the next instance of the current period. For
* example Monthly it will expire on the same day of the next month, or yearly the same
* day of the next year.
*
*/
public Alignment getAlignment() {
return alignment;
}

/**
* (Optional) The maximum number of payments that can be collected in this periodic
* limit.
*/
public Integer getMaxPayments() {
return maxPayments;
}

/**
* The maximum total amount that can be charged for all payments in this periodic limit.
* Required for VRP.
*
*/
public Integer getMaxTotalAmount() {
return maxTotalAmount;
}

/**
* The repeating period for this mandate. Defaults to flexible for PayTo if not
* specified.
*/
public Period getPeriod() {
return period;
}

public enum Alignment {
@SerializedName("calendar")
CALENDAR, @SerializedName("creation_date")
CREATION_DATE, @SerializedName("unknown")
UNKNOWN
}

public enum Period {
@SerializedName("day")
DAY, @SerializedName("week")
WEEK, @SerializedName("month")
MONTH, @SerializedName("year")
YEAR, @SerializedName("flexible")
FLEXIBLE, @SerializedName("unknown")
UNKNOWN
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,8 @@ public String getConsentType() {
}

/**
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
* and VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required
* for PayTo and VRP.
*/
public Constraints getConstraints() {
return constraints;
Expand Down Expand Up @@ -1117,8 +1117,8 @@ public enum Verify {
/**
* Represents a constraint resource returned from the API.
*
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
* and VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required
* for PayTo and VRP.
*/
public static class Constraints {
private Constraints() {
Expand Down Expand Up @@ -1146,7 +1146,8 @@ public String getEndDate() {
}

/**
* The maximum amount that can be charged for a single payment. Required for VRP.
* The maximum amount that can be charged for a single payment. Required for PayTo
* and VRP.
*/
public Integer getMaxAmountPerPayment() {
return maxAmountPerPayment;
Expand Down Expand Up @@ -1223,7 +1224,8 @@ public Integer getMaxTotalAmount() {
}

/**
* The repeating period for this mandate
* The repeating period for this mandate. Defaults to flexible for PayTo if not
* specified.
*/
public Period getPeriod() {
return period;
Expand Down Expand Up @@ -1346,7 +1348,8 @@ public Map<String, Object> getMetadata() {

/**
* A custom payment reference defined by the merchant. It is only available for payments
* using the Direct Funds settlement model on the Faster Payments scheme.
* on the PayTo scheme or payments using the Direct Funds settlement model on the Faster
* Payments scheme.
*
*/
public String getReference() {
Expand Down
22 changes: 13 additions & 9 deletions src/main/java/com/gocardless/services/BillingRequestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ public BillingRequestCreateRequest withMandateRequestConsentType(String consentT
}

/**
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
* VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
* PayTo and VRP.
*/
public BillingRequestCreateRequest withMandateRequestConstraints(Constraints constraints) {
if (mandateRequest == null) {
Expand Down Expand Up @@ -631,8 +631,9 @@ public BillingRequestCreateRequest withPaymentRequestMetadata(
}

/**
* A custom payment reference defined by the merchant. It is only available for payments
* using the Direct Funds settlement model on the Faster Payments scheme.
* A custom payment reference defined by the merchant. It is only available for payments on
* the PayTo scheme or payments using the Direct Funds settlement model on the Faster
* Payments scheme.
*
*/
public BillingRequestCreateRequest withPaymentRequestReference(String reference) {
Expand Down Expand Up @@ -1238,7 +1239,8 @@ public PeriodicLimits withMaxTotalAmount(Integer maxTotalAmount) {
}

/**
* The repeating period for this mandate
* The repeating period for this mandate. Defaults to flexible for PayTo if not
* specified.
*/
public PeriodicLimits withPeriod(Period period) {
this.period = period;
Expand Down Expand Up @@ -1312,7 +1314,8 @@ public Constraints withEndDate(String endDate) {
}

/**
* The maximum amount that can be charged for a single payment. Required for VRP.
* The maximum amount that can be charged for a single payment. Required for PayTo and
* VRP.
*/
public Constraints withMaxAmountPerPayment(Integer maxAmountPerPayment) {
this.maxAmountPerPayment = maxAmountPerPayment;
Expand Down Expand Up @@ -1411,8 +1414,8 @@ public MandateRequest withConsentType(String consentType) {
}

/**
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
* and VRP.
* Constraints that will apply to the mandate_request. (Optional) Specifically required
* for PayTo and VRP.
*/
public MandateRequest withConstraints(Constraints constraints) {
this.constraints = constraints;
Expand Down Expand Up @@ -1609,7 +1612,8 @@ public PaymentRequest withMetadata(Map<String, String> metadata) {

/**
* A custom payment reference defined by the merchant. It is only available for payments
* using the Direct Funds settlement model on the Faster Payments scheme.
* on the PayTo scheme or payments using the Direct Funds settlement model on the Faster
* Payments scheme.
*
*/
public PaymentRequest withReference(String reference) {
Expand Down
Loading