Skip to content

Commit 23be078

Browse files
Merge pull request #148 from gocardless/template-changes
Changes from gocardless/gocardless-pro-java-template
2 parents dac66b8 + b3e0a3b commit 23be078

9 files changed

Lines changed: 672 additions & 38 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ With Maven:
1414
<dependency>
1515
<groupId>com.gocardless</groupId>
1616
<artifactId>gocardless-pro</artifactId>
17-
<version>7.0.0</version>
17+
<version>7.1.0</version>
1818
</dependency>
1919
```
2020

2121
With Gradle:
2222

2323
```
24-
implementation 'com.gocardless:gocardless-pro:7.0.0'
24+
implementation 'com.gocardless:gocardless-pro:7.1.0'
2525
```
2626

2727
## Initializing the client

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ plugins {
2525
sourceCompatibility = 1.8
2626
targetCompatibility = 1.8
2727
group = 'com.gocardless'
28-
version = '7.0.0'
28+
version = '7.1.0'
2929

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

src/main/java/com/gocardless/http/HttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class HttpClient {
3535
private static final String DISALLOWED_USER_AGENT_CHARACTERS =
3636
"[^\\w!#$%&'\\*\\+\\-\\.\\^`\\|~]";
3737
private static final String USER_AGENT =
38-
String.format("gocardless-pro-java/7.0.0 java/%s %s/%s %s/%s",
38+
String.format("gocardless-pro-java/7.1.0 java/%s %s/%s %s/%s",
3939
cleanUserAgentToken(System.getProperty("java.vm.specification.version")),
4040
cleanUserAgentToken(System.getProperty("java.vm.name")),
4141
cleanUserAgentToken(System.getProperty("java.version")),
@@ -49,7 +49,7 @@ public class HttpClient {
4949
builder.put("GoCardless-Version", "2015-07-06");
5050
builder.put("Accept", "application/json");
5151
builder.put("GoCardless-Client-Library", "gocardless-pro-java");
52-
builder.put("GoCardless-Client-Version", "7.0.0");
52+
builder.put("GoCardless-Client-Version", "7.1.0");
5353
HEADERS = builder.build();
5454
}
5555
private final OkHttpClient rawClient;

src/main/java/com/gocardless/resources/BillingRequest.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,8 @@ public String getConsentType() {
803803
}
804804

805805
/**
806-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
807-
* VRP.
806+
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
807+
* PayTo and VRP.
808808
*/
809809
public Constraints getConstraints() {
810810
return constraints;
@@ -915,8 +915,8 @@ public enum Verify {
915915
/**
916916
* Represents a constraint resource returned from the API.
917917
*
918-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
919-
* VRP.
918+
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
919+
* PayTo and VRP.
920920
*/
921921
public static class Constraints {
922922
private Constraints() {
@@ -943,7 +943,8 @@ public String getEndDate() {
943943
}
944944

945945
/**
946-
* The maximum amount that can be charged for a single payment. Required for VRP.
946+
* The maximum amount that can be charged for a single payment. Required for PayTo and
947+
* VRP.
947948
*/
948949
public Integer getMaxAmountPerPayment() {
949950
return maxAmountPerPayment;
@@ -1019,7 +1020,8 @@ public Integer getMaxTotalAmount() {
10191020
}
10201021

10211022
/**
1022-
* The repeating period for this mandate
1023+
* The repeating period for this mandate. Defaults to flexible for PayTo if not
1024+
* specified.
10231025
*/
10241026
public Period getPeriod() {
10251027
return period;
@@ -1141,8 +1143,9 @@ public Map<String, Object> getMetadata() {
11411143
}
11421144

11431145
/**
1144-
* A custom payment reference defined by the merchant. It is only available for payments
1145-
* using the Direct Funds settlement model on the Faster Payments scheme.
1146+
* A custom payment reference defined by the merchant. It is only available for payments on
1147+
* the PayTo scheme or payments using the Direct Funds settlement model on the Faster
1148+
* Payments scheme.
11461149
*
11471150
*/
11481151
public String getReference() {

src/main/java/com/gocardless/resources/BillingRequestTemplate.java

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.gocardless.resources;
22

33
import com.google.gson.annotations.SerializedName;
4+
import java.util.List;
45
import java.util.Map;
56

67
/**
@@ -25,6 +26,7 @@ private BillingRequestTemplate() {
2526
private String authorisationUrl;
2627
private String createdAt;
2728
private String id;
29+
private MandateRequestConstraints mandateRequestConstraints;
2830
private String mandateRequestCurrency;
2931
private String mandateRequestDescription;
3032
private Map<String, Object> mandateRequestMetadata;
@@ -62,6 +64,14 @@ public String getId() {
6264
return id;
6365
}
6466

67+
/**
68+
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
69+
* PayTo and VRP.
70+
*/
71+
public MandateRequestConstraints getMandateRequestConstraints() {
72+
return mandateRequestConstraints;
73+
}
74+
6575
/**
6676
* [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code.
6777
*/
@@ -208,4 +218,136 @@ public enum MandateRequestVerify {
208218
ALWAYS, @SerializedName("unknown")
209219
UNKNOWN
210220
}
221+
222+
/**
223+
* Represents a mandate request constraint resource returned from the API.
224+
*
225+
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
226+
* PayTo and VRP.
227+
*/
228+
public static class MandateRequestConstraints {
229+
private MandateRequestConstraints() {
230+
// blank to prevent instantiation
231+
}
232+
233+
private String endDate;
234+
private Integer maxAmountPerPayment;
235+
private String paymentMethod;
236+
private List<PeriodicLimit> periodicLimits;
237+
private String startDate;
238+
239+
/**
240+
* The latest date at which payments can be taken, must occur after start_date if present
241+
*
242+
* This is an optional field and if it is not supplied the agreement will be considered open
243+
* and will not have an end date. Keep in mind the end date must take into account how long
244+
* it will take the user to set up this agreement via the Billing Request.
245+
*
246+
*/
247+
public String getEndDate() {
248+
return endDate;
249+
}
250+
251+
/**
252+
* The maximum amount that can be charged for a single payment. Required for PayTo and VRP.
253+
*/
254+
public Integer getMaxAmountPerPayment() {
255+
return maxAmountPerPayment;
256+
}
257+
258+
/**
259+
* A constraint where you can specify info (free text string) about how payments are
260+
* calculated. _Note:_ This is only supported for ACH and PAD schemes.
261+
*
262+
*/
263+
public String getPaymentMethod() {
264+
return paymentMethod;
265+
}
266+
267+
/**
268+
* List of periodic limits and constraints which apply to them
269+
*/
270+
public List<PeriodicLimit> getPeriodicLimits() {
271+
return periodicLimits;
272+
}
273+
274+
/**
275+
* The date from which payments can be taken.
276+
*
277+
* This is an optional field and if it is not supplied the start date will be set to the day
278+
* authorisation happens.
279+
*
280+
*/
281+
public String getStartDate() {
282+
return startDate;
283+
}
284+
285+
public static class PeriodicLimit {
286+
private PeriodicLimit() {
287+
// blank to prevent instantiation
288+
}
289+
290+
private Alignment alignment;
291+
private Integer maxPayments;
292+
private Integer maxTotalAmount;
293+
private Period period;
294+
295+
/**
296+
* The alignment of the period.
297+
*
298+
* `calendar` - this will finish on the end of the current period. For example this will
299+
* expire on the Monday for the current week or the January for the next year.
300+
*
301+
* `creation_date` - this will finish on the next instance of the current period. For
302+
* example Monthly it will expire on the same day of the next month, or yearly the same
303+
* day of the next year.
304+
*
305+
*/
306+
public Alignment getAlignment() {
307+
return alignment;
308+
}
309+
310+
/**
311+
* (Optional) The maximum number of payments that can be collected in this periodic
312+
* limit.
313+
*/
314+
public Integer getMaxPayments() {
315+
return maxPayments;
316+
}
317+
318+
/**
319+
* The maximum total amount that can be charged for all payments in this periodic limit.
320+
* Required for VRP.
321+
*
322+
*/
323+
public Integer getMaxTotalAmount() {
324+
return maxTotalAmount;
325+
}
326+
327+
/**
328+
* The repeating period for this mandate. Defaults to flexible for PayTo if not
329+
* specified.
330+
*/
331+
public Period getPeriod() {
332+
return period;
333+
}
334+
335+
public enum Alignment {
336+
@SerializedName("calendar")
337+
CALENDAR, @SerializedName("creation_date")
338+
CREATION_DATE, @SerializedName("unknown")
339+
UNKNOWN
340+
}
341+
342+
public enum Period {
343+
@SerializedName("day")
344+
DAY, @SerializedName("week")
345+
WEEK, @SerializedName("month")
346+
MONTH, @SerializedName("year")
347+
YEAR, @SerializedName("flexible")
348+
FLEXIBLE, @SerializedName("unknown")
349+
UNKNOWN
350+
}
351+
}
352+
}
211353
}

src/main/java/com/gocardless/resources/BillingRequestWithAction.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ public String getConsentType() {
10021002
}
10031003

10041004
/**
1005-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
1006-
* and VRP.
1005+
* Constraints that will apply to the mandate_request. (Optional) Specifically required
1006+
* for PayTo and VRP.
10071007
*/
10081008
public Constraints getConstraints() {
10091009
return constraints;
@@ -1117,8 +1117,8 @@ public enum Verify {
11171117
/**
11181118
* Represents a constraint resource returned from the API.
11191119
*
1120-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
1121-
* and VRP.
1120+
* Constraints that will apply to the mandate_request. (Optional) Specifically required
1121+
* for PayTo and VRP.
11221122
*/
11231123
public static class Constraints {
11241124
private Constraints() {
@@ -1146,7 +1146,8 @@ public String getEndDate() {
11461146
}
11471147

11481148
/**
1149-
* The maximum amount that can be charged for a single payment. Required for VRP.
1149+
* The maximum amount that can be charged for a single payment. Required for PayTo
1150+
* and VRP.
11501151
*/
11511152
public Integer getMaxAmountPerPayment() {
11521153
return maxAmountPerPayment;
@@ -1223,7 +1224,8 @@ public Integer getMaxTotalAmount() {
12231224
}
12241225

12251226
/**
1226-
* The repeating period for this mandate
1227+
* The repeating period for this mandate. Defaults to flexible for PayTo if not
1228+
* specified.
12271229
*/
12281230
public Period getPeriod() {
12291231
return period;
@@ -1346,7 +1348,8 @@ public Map<String, Object> getMetadata() {
13461348

13471349
/**
13481350
* A custom payment reference defined by the merchant. It is only available for payments
1349-
* using the Direct Funds settlement model on the Faster Payments scheme.
1351+
* on the PayTo scheme or payments using the Direct Funds settlement model on the Faster
1352+
* Payments scheme.
13501353
*
13511354
*/
13521355
public String getReference() {

src/main/java/com/gocardless/services/BillingRequestService.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public BillingRequestCreateRequest withMandateRequestConsentType(String consentT
405405
}
406406

407407
/**
408-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
409-
* VRP.
408+
* Constraints that will apply to the mandate_request. (Optional) Specifically required for
409+
* PayTo and VRP.
410410
*/
411411
public BillingRequestCreateRequest withMandateRequestConstraints(Constraints constraints) {
412412
if (mandateRequest == null) {
@@ -631,8 +631,9 @@ public BillingRequestCreateRequest withPaymentRequestMetadata(
631631
}
632632

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

12401241
/**
1241-
* The repeating period for this mandate
1242+
* The repeating period for this mandate. Defaults to flexible for PayTo if not
1243+
* specified.
12421244
*/
12431245
public PeriodicLimits withPeriod(Period period) {
12441246
this.period = period;
@@ -1312,7 +1314,8 @@ public Constraints withEndDate(String endDate) {
13121314
}
13131315

13141316
/**
1315-
* The maximum amount that can be charged for a single payment. Required for VRP.
1317+
* The maximum amount that can be charged for a single payment. Required for PayTo and
1318+
* VRP.
13161319
*/
13171320
public Constraints withMaxAmountPerPayment(Integer maxAmountPerPayment) {
13181321
this.maxAmountPerPayment = maxAmountPerPayment;
@@ -1411,8 +1414,8 @@ public MandateRequest withConsentType(String consentType) {
14111414
}
14121415

14131416
/**
1414-
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo
1415-
* and VRP.
1417+
* Constraints that will apply to the mandate_request. (Optional) Specifically required
1418+
* for PayTo and VRP.
14161419
*/
14171420
public MandateRequest withConstraints(Constraints constraints) {
14181421
this.constraints = constraints;
@@ -1609,7 +1612,8 @@ public PaymentRequest withMetadata(Map<String, String> metadata) {
16091612

16101613
/**
16111614
* A custom payment reference defined by the merchant. It is only available for payments
1612-
* using the Direct Funds settlement model on the Faster Payments scheme.
1615+
* on the PayTo scheme or payments using the Direct Funds settlement model on the Faster
1616+
* Payments scheme.
16131617
*
16141618
*/
16151619
public PaymentRequest withReference(String reference) {

0 commit comments

Comments
 (0)