Skip to content

Commit e026a3b

Browse files
authored
Merge pull request #131 from gocardless/template-changes
Changes from gocardless/gocardless-pro-java-template
2 parents f8a92a2 + b66c5dc commit e026a3b

12 files changed

+572
-18
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
jdk-version: [ 8, 9, 11 ]
15+
jdk-version: [ 8, 11 ]
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: actions/setup-java@v2

README.md

+2-2
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>5.27.0</version>
17+
<version>6.0.0</version>
1818
</dependency>
1919
```
2020

2121
With Gradle:
2222

2323
```
24-
implementation 'com.gocardless:gocardless-pro:5.27.0'
24+
implementation 'com.gocardless:gocardless-pro:6.0.0'
2525
```
2626

2727
## Initializing the client

build.gradle

+1-1
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 = '5.27.0'
28+
version = '6.0.0'
2929

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

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

+2-2
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/5.27.0 java/%s %s/%s %s/%s",
38+
String.format("gocardless-pro-java/6.0.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", "5.27.0");
52+
builder.put("GoCardless-Client-Version", "6.0.0");
5353
HEADERS = builder.build();
5454
}
5555
private final OkHttpClient rawClient;

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

+187
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ private BillingRequest() {
3131
private PurposeCode purposeCode;
3232
private Resources resources;
3333
private Status status;
34+
private SubscriptionRequest subscriptionRequest;
3435

3536
/**
3637
* List of actions that can be performed before this billing request can be fulfilled.
@@ -119,6 +120,13 @@ public Status getStatus() {
119120
return status;
120121
}
121122

123+
/**
124+
* Request for a subscription
125+
*/
126+
public SubscriptionRequest getSubscriptionRequest() {
127+
return subscriptionRequest;
128+
}
129+
122130
public enum PurposeCode {
123131
@SerializedName("mortgage")
124132
MORTGAGE, @SerializedName("utility")
@@ -383,6 +391,7 @@ private Links() {
383391
private String paymentProvider;
384392
private String paymentRequest;
385393
private String paymentRequestPayment;
394+
private String subscriptionRequest;
386395

387396
/**
388397
* (Optional) ID of the [bank authorisation](#billing-requests-bank-authorisations) that was
@@ -464,6 +473,13 @@ public String getPaymentRequest() {
464473
public String getPaymentRequestPayment() {
465474
return paymentRequestPayment;
466475
}
476+
477+
/**
478+
* (Optional) ID of the associated subscription request
479+
*/
480+
public String getSubscriptionRequest() {
481+
return subscriptionRequest;
482+
}
467483
}
468484

469485
/**
@@ -477,6 +493,7 @@ private MandateRequest() {
477493
}
478494

479495
private AuthorisationSource authorisationSource;
496+
private String consentType;
480497
private Constraints constraints;
481498
private String currency;
482499
private String description;
@@ -500,6 +517,15 @@ public AuthorisationSource getAuthorisationSource() {
500517
return authorisationSource;
501518
}
502519

520+
/**
521+
* This attribute represents the authorisation type between the payer and merchant. It can
522+
* be set to one-off, recurring or standing for ACH scheme. And single, recurring and
523+
* sporadic for PAD scheme.
524+
*/
525+
public String getConsentType() {
526+
return consentType;
527+
}
528+
503529
/**
504530
* Constraints that will apply to the mandate_request. (Optional) Specifically for PayTo and
505531
* VRP.
@@ -1002,6 +1028,7 @@ private CustomerBankAccount() {
10021028
private String accountHolderName;
10031029
private String accountNumberEnding;
10041030
private AccountType accountType;
1031+
private String bankAccountToken;
10051032
private String bankName;
10061033
private String countryCode;
10071034
private String createdAt;
@@ -1038,6 +1065,14 @@ public AccountType getAccountType() {
10381065
return accountType;
10391066
}
10401067

1068+
/**
1069+
* A token to uniquely refer to a set of bank account details. This feature is still in
1070+
* early access and is only available for certain organisations.
1071+
*/
1072+
public String getBankAccountToken() {
1073+
return bankAccountToken;
1074+
}
1075+
10411076
/**
10421077
* Name of bank, taken from the bank details.
10431078
*/
@@ -1249,4 +1284,156 @@ public String getSwedishIdentityNumber() {
12491284
}
12501285
}
12511286
}
1287+
1288+
/**
1289+
* Represents a subscription request resource returned from the API.
1290+
*
1291+
* Request for a subscription
1292+
*/
1293+
public static class SubscriptionRequest {
1294+
private SubscriptionRequest() {
1295+
// blank to prevent instantiation
1296+
}
1297+
1298+
private Integer amount;
1299+
private Integer appFee;
1300+
private Integer count;
1301+
private String currency;
1302+
private Integer dayOfMonth;
1303+
private Integer interval;
1304+
private IntervalUnit intervalUnit;
1305+
private Map<String, Object> metadata;
1306+
private Month month;
1307+
private String name;
1308+
private String paymentReference;
1309+
private String startDate;
1310+
1311+
/**
1312+
* Amount in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR).
1313+
*/
1314+
public Integer getAmount() {
1315+
return amount;
1316+
}
1317+
1318+
/**
1319+
* The amount to be deducted from each payment as an app fee, to be paid to the partner
1320+
* integration which created the subscription, in the lowest denomination for the currency
1321+
* (e.g. pence in GBP, cents in EUR).
1322+
*/
1323+
public Integer getAppFee() {
1324+
return appFee;
1325+
}
1326+
1327+
/**
1328+
* The total number of payments that should be taken by this subscription.
1329+
*/
1330+
public Integer getCount() {
1331+
return count;
1332+
}
1333+
1334+
/**
1335+
* [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently
1336+
* "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported.
1337+
*/
1338+
public String getCurrency() {
1339+
return currency;
1340+
}
1341+
1342+
/**
1343+
* As per RFC 2445. The day of the month to charge customers on. `1`-`28` or `-1` to
1344+
* indicate the last day of the month.
1345+
*/
1346+
public Integer getDayOfMonth() {
1347+
return dayOfMonth;
1348+
}
1349+
1350+
/**
1351+
* Number of `interval_units` between customer charge dates. Must be greater than or equal
1352+
* to `1`. Must result in at least one charge date per year. Defaults to `1`.
1353+
*/
1354+
public Integer getInterval() {
1355+
return interval;
1356+
}
1357+
1358+
/**
1359+
* The unit of time between customer charge dates. One of `weekly`, `monthly` or `yearly`.
1360+
*/
1361+
public IntervalUnit getIntervalUnit() {
1362+
return intervalUnit;
1363+
}
1364+
1365+
/**
1366+
* Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50
1367+
* characters and values up to 500 characters.
1368+
*/
1369+
public Map<String, Object> getMetadata() {
1370+
return metadata;
1371+
}
1372+
1373+
/**
1374+
* Name of the month on which to charge a customer. Must be lowercase. Only applies when the
1375+
* interval_unit is `yearly`.
1376+
*
1377+
*/
1378+
public Month getMonth() {
1379+
return month;
1380+
}
1381+
1382+
/**
1383+
* Optional name for the subscription. This will be set as the description on each payment
1384+
* created. Must not exceed 255 characters.
1385+
*/
1386+
public String getName() {
1387+
return name;
1388+
}
1389+
1390+
/**
1391+
* An optional payment reference. This will be set as the reference on each payment created
1392+
* and will appear on your customer's bank statement. See the documentation for the [create
1393+
* payment endpoint](#payments-create-a-payment) for more details. <br />
1394+
* <p class="restricted-notice">
1395+
* <strong>Restricted</strong>: You need your own Service User Number to specify a payment
1396+
* reference for Bacs payments.
1397+
* </p>
1398+
*/
1399+
public String getPaymentReference() {
1400+
return paymentReference;
1401+
}
1402+
1403+
/**
1404+
* The date on which the first payment should be charged. Must be on or after the
1405+
* [mandate](#core-endpoints-mandates)'s `next_possible_charge_date`. When left blank and
1406+
* `month` or `day_of_month` are provided, this will be set to the date of the first
1407+
* payment. If created without `month` or `day_of_month` this will be set as the mandate's
1408+
* `next_possible_charge_date`
1409+
*/
1410+
public String getStartDate() {
1411+
return startDate;
1412+
}
1413+
1414+
public enum IntervalUnit {
1415+
@SerializedName("weekly")
1416+
WEEKLY, @SerializedName("monthly")
1417+
MONTHLY, @SerializedName("yearly")
1418+
YEARLY, @SerializedName("unknown")
1419+
UNKNOWN
1420+
}
1421+
1422+
public enum Month {
1423+
@SerializedName("january")
1424+
JANUARY, @SerializedName("february")
1425+
FEBRUARY, @SerializedName("march")
1426+
MARCH, @SerializedName("april")
1427+
APRIL, @SerializedName("may")
1428+
MAY, @SerializedName("june")
1429+
JUNE, @SerializedName("july")
1430+
JULY, @SerializedName("august")
1431+
AUGUST, @SerializedName("september")
1432+
SEPTEMBER, @SerializedName("october")
1433+
OCTOBER, @SerializedName("november")
1434+
NOVEMBER, @SerializedName("december")
1435+
DECEMBER, @SerializedName("unknown")
1436+
UNKNOWN
1437+
}
1438+
}
12521439
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private BillingRequestTemplate() {
3232
private MandateRequestVerify mandateRequestVerify;
3333
private Map<String, Object> metadata;
3434
private String name;
35-
private Integer paymentRequestAmount;
35+
private String paymentRequestAmount;
3636
private String paymentRequestCurrency;
3737
private String paymentRequestDescription;
3838
private Map<String, Object> paymentRequestMetadata;
@@ -141,9 +141,9 @@ public String getName() {
141141
}
142142

143143
/**
144-
* Amount in minor unit (e.g. pence in GBP, cents in EUR).
144+
* Amount in full.
145145
*/
146-
public Integer getPaymentRequestAmount() {
146+
public String getPaymentRequestAmount() {
147147
return paymentRequestAmount;
148148
}
149149

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

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ private CustomerBankAccount() {
2727
private String accountHolderName;
2828
private String accountNumberEnding;
2929
private AccountType accountType;
30+
private String bankAccountToken;
3031
private String bankName;
3132
private String countryCode;
3233
private String createdAt;
@@ -62,6 +63,14 @@ public AccountType getAccountType() {
6263
return accountType;
6364
}
6465

66+
/**
67+
* A token to uniquely refer to a set of bank account details. This feature is still in early
68+
* access and is only available for certain organisations.
69+
*/
70+
public String getBankAccountToken() {
71+
return bankAccountToken;
72+
}
73+
6574
/**
6675
* Name of bank, taken from the bank details.
6776
*/

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public enum ResourceType {
116116
EXPORTS, @SerializedName("instalment_schedules")
117117
INSTALMENT_SCHEDULES, @SerializedName("mandates")
118118
MANDATES, @SerializedName("organisations")
119-
ORGANISATIONS, @SerializedName("payer_authorisations")
119+
ORGANISATIONS, @SerializedName("outbound_payments")
120+
OUTBOUND_PAYMENTS, @SerializedName("payer_authorisations")
120121
PAYER_AUTHORISATIONS, @SerializedName("payments")
121122
PAYMENTS, @SerializedName("payouts")
122123
PAYOUTS, @SerializedName("refunds")
@@ -175,6 +176,7 @@ private Details() {
175176
private String cause;
176177
private String currency;
177178
private String description;
179+
private Integer itemCount;
178180
private String notRetriedReason;
179181
private Origin origin;
180182
private String property;
@@ -214,6 +216,13 @@ public String getDescription() {
214216
return description;
215217
}
216218

219+
/**
220+
* Count of rows in the csv. This is sent for export events
221+
*/
222+
public Integer getItemCount() {
223+
return itemCount;
224+
}
225+
217226
/**
218227
* When will_attempt_retry is set to false, this field will contain the reason the payment
219228
* was not retried. This can be one of:

0 commit comments

Comments
 (0)