Skip to content

Commit

Permalink
Merge pull request #121 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Changes generated by e685521604da0b0aeada4ef6b31731a026dea03f
  • Loading branch information
KarmanLeung authored May 30, 2024
2 parents caf99f5 + e73b50b commit 30aa6ce
Show file tree
Hide file tree
Showing 13 changed files with 404 additions and 10 deletions.
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>5.24.0</version>
<version>5.25.0</version>
</dependency>
```

With Gradle:

```
implementation 'com.gocardless:gocardless-pro:5.24.0'
implementation 'com.gocardless:gocardless-pro:5.25.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 @@ -20,7 +20,7 @@ plugins {
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.gocardless'
version = '5.24.0'
version = '5.25.0'

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

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/gocardless/GoCardlessClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ public class GoCardlessClient {
private final EventService events;
private final InstalmentScheduleService instalmentSchedules;
private final InstitutionService institutions;
private final LogoService logos;
private final MandateService mandates;
private final MandateImportService mandateImports;
private final MandateImportEntryService mandateImportEntries;
private final MandatePdfService mandatePdfs;
private final NegativeBalanceLimitService negativeBalanceLimits;
private final PayerAuthorisationService payerAuthorisations;
private final PayerThemeService payerThemes;
private final PaymentService payments;
private final PayoutService payouts;
private final PayoutItemService payoutItems;
Expand Down Expand Up @@ -183,12 +185,14 @@ private GoCardlessClient(HttpClient httpClient) {
this.events = new EventService(httpClient);
this.instalmentSchedules = new InstalmentScheduleService(httpClient);
this.institutions = new InstitutionService(httpClient);
this.logos = new LogoService(httpClient);
this.mandates = new MandateService(httpClient);
this.mandateImports = new MandateImportService(httpClient);
this.mandateImportEntries = new MandateImportEntryService(httpClient);
this.mandatePdfs = new MandatePdfService(httpClient);
this.negativeBalanceLimits = new NegativeBalanceLimitService(httpClient);
this.payerAuthorisations = new PayerAuthorisationService(httpClient);
this.payerThemes = new PayerThemeService(httpClient);
this.payments = new PaymentService(httpClient);
this.payouts = new PayoutService(httpClient);
this.payoutItems = new PayoutItemService(httpClient);
Expand Down Expand Up @@ -308,6 +312,13 @@ public InstitutionService institutions() {
return institutions;
}

/**
* A service class for working with logo resources.
*/
public LogoService logos() {
return logos;
}

/**
* A service class for working with mandate resources.
*/
Expand Down Expand Up @@ -350,6 +361,13 @@ public PayerAuthorisationService payerAuthorisations() {
return payerAuthorisations;
}

/**
* A service class for working with payer theme resources.
*/
public PayerThemeService payerThemes() {
return payerThemes;
}

/**
* A service class for working with payment resources.
*/
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/5.24.0 java/%s %s/%s %s/%s",
String.format("gocardless-pro-java/5.25.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", "5.24.0");
builder.put("GoCardless-Client-Version", "5.25.0");
HEADERS = builder.build();
}
private final OkHttpClient rawClient;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/gocardless/resources/BillingRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ private PaymentRequest() {
private Integer appFee;
private String currency;
private String description;
private FundsSettlement fundsSettlement;
private Links links;
private Map<String, Object> metadata;
private String scheme;
Expand Down Expand Up @@ -793,6 +794,18 @@ public String getDescription() {
return description;
}

/**
* This field will decide how GoCardless handles settlement of funds from the customer.
*
* - `managed` will be moved through GoCardless' account, batched, and payed out. - `direct`
* will be a direct transfer from the payer's account to the merchant where invoicing will
* be handled separately.
*
*/
public FundsSettlement getFundsSettlement() {
return fundsSettlement;
}

public Links getLinks() {
return links;
}
Expand All @@ -816,6 +829,13 @@ public String getScheme() {
return scheme;
}

public enum FundsSettlement {
@SerializedName("managed")
MANAGED, @SerializedName("direct")
DIRECT, @SerializedName("unknown")
UNKNOWN
}

public static class Links {
private Links() {
// blank to prevent instantiation
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/gocardless/resources/Logo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.gocardless.resources;

/**
* Represents a logo resource returned from the API.
*
* Logos are image uploads that, when associated with a creditor, are shown on the [billing request
* flow](#billing-requests-billing-request-flows) payment pages.
*/
public class Logo {
private Logo() {
// blank to prevent instantiation
}

private String id;

/**
* Unique identifier, beginning with "LO".
*/
public String getId() {
return id;
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/gocardless/resources/PayerTheme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.gocardless.resources;

/**
* Represents a payer theme resource returned from the API.
*
* Custom colour themes for payment pages and customer notifications.
*/
public class PayerTheme {
private PayerTheme() {
// blank to prevent instantiation
}

private String id;

/**
* Unique identifier, beginning with "PTH".
*/
public String getId() {
return id;
}
}
1 change: 0 additions & 1 deletion src/main/java/com/gocardless/resources/Subscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* - if the recurrence rule specified `-1` as the `day_of_month`, the charge date will be rolled
* __backwards__ to the previous business day (i.e., the last working day of the month). - otherwise
* the charge date will be rolled __forwards__ to the next business day.
*
*/
public class Subscription {
private Subscription() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public BankDetailsLookupService(HttpClient httpClient) {
* Performs a bank details lookup. As part of the lookup, a modulus check and reachability check
* are performed.
*
* For UK-based bank accounts, where an account holder name is provided (and an account number,
* a sort code or an iban are already present), we verify that the account holder name and bank
* account number match the details held by the relevant bank.
*
* If your request returns an [error](#api-usage-errors) or the `available_debit_schemes`
* attribute is an empty array, you will not be able to collect payments from the specified bank
* account. GoCardless may be able to collect payments from an account even if no `bic` is
Expand All @@ -50,6 +54,10 @@ public BankDetailsLookupCreateRequest create() {
* Performs a bank details lookup. As part of the lookup, a modulus check and reachability check
* are performed.
*
* For UK-based bank accounts, where an account holder name is provided (and an account number,
* a sort code or an iban are already present), we verify that the account holder name and bank
* account number match the details held by the relevant bank.
*
* If your request returns an [error](#api-usage-errors) or the `available_debit_schemes`
* attribute is an empty array, you will not be able to collect payments from the specified bank
* account. GoCardless may be able to collect payments from an account even if no `bic` is
Expand All @@ -68,12 +76,22 @@ public BankDetailsLookupCreateRequest create() {
*/
public static final class BankDetailsLookupCreateRequest
extends PostRequest<BankDetailsLookup> {
private String accountHolderName;
private String accountNumber;
private String bankCode;
private String branchCode;
private String countryCode;
private String iban;

/**
* The account holder name associated with the account number (if available). If provided
* and the country code is GB, a payer name verification will be performed.
*/
public BankDetailsLookupCreateRequest withAccountHolderName(String accountHolderName) {
this.accountHolderName = accountHolderName;
return this;
}

/**
* Bank account number - see [local details](#appendix-local-bank-details) for more
* information. Alternatively you can provide an `iban`.
Expand Down
53 changes: 53 additions & 0 deletions src/main/java/com/gocardless/services/BillingRequestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public BillingRequestCollectCustomerDetailsRequest collectCustomerDetails(String
* provider to make sure the customer's bank account can accept Direct Debit. If a bank account
* is discovered to be closed or invalid, the customer is requested to adjust the account
* number/routing number and succeed in this check to continue with the flow.
*
* _BACS scheme_ [Payer Name
* Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
* is enabled by default for UK based bank accounts, meaning we verify the account holder name
* and bank account number match the details held by the relevant bank.
*/
public BillingRequestCollectBankAccountRequest collectBankAccount(String identity) {
return new BillingRequestCollectBankAccountRequest(httpClient, identity);
Expand Down Expand Up @@ -426,6 +431,23 @@ public BillingRequestCreateRequest withPaymentRequestDescription(String descript
return this;
}

/**
* This field will decide how GoCardless handles settlement of funds from the customer.
*
* - `managed` will be moved through GoCardless' account, batched, and payed out. - `direct`
* will be a direct transfer from the payer's account to the merchant where invoicing will
* be handled separately.
*
*/
public BillingRequestCreateRequest withPaymentRequestFundsSettlement(
PaymentRequest.FundsSettlement fundsSettlement) {
if (paymentRequest == null) {
paymentRequest = new PaymentRequest();
}
paymentRequest.withFundsSettlement(fundsSettlement);
return this;
}

/**
* Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50
* characters and values up to 500 characters.
Expand Down Expand Up @@ -871,6 +893,7 @@ public static class PaymentRequest {
private Integer appFee;
private String currency;
private String description;
private FundsSettlement fundsSettlement;
private Map<String, String> metadata;
private String scheme;

Expand Down Expand Up @@ -912,6 +935,19 @@ public PaymentRequest withDescription(String description) {
return this;
}

/**
* This field will decide how GoCardless handles settlement of funds from the customer.
*
* - `managed` will be moved through GoCardless' account, batched, and payed out. -
* `direct` will be a direct transfer from the payer's account to the merchant where
* invoicing will be handled separately.
*
*/
public PaymentRequest withFundsSettlement(FundsSettlement fundsSettlement) {
this.fundsSettlement = fundsSettlement;
return this;
}

/**
* Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50
* characters and values up to 500 characters.
Expand All @@ -932,6 +968,18 @@ public PaymentRequest withScheme(String scheme) {
this.scheme = scheme;
return this;
}

public enum FundsSettlement {
@SerializedName("managed")
MANAGED, @SerializedName("direct")
DIRECT, @SerializedName("unknown")
UNKNOWN;

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

Expand Down Expand Up @@ -1434,6 +1482,11 @@ public CustomerBillingDetail withSwedishIdentityNumber(String swedishIdentityNum
* provider to make sure the customer's bank account can accept Direct Debit. If a bank account
* is discovered to be closed or invalid, the customer is requested to adjust the account
* number/routing number and succeed in this check to continue with the flow.
*
* _BACS scheme_ [Payer Name
* Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
* is enabled by default for UK based bank accounts, meaning we verify the account holder name
* and bank account number match the details held by the relevant bank.
*/
public static final class BillingRequestCollectBankAccountRequest
extends PostRequest<BillingRequest> {
Expand Down
Loading

0 comments on commit 30aa6ce

Please sign in to comment.