diff --git a/src/main/java/com/gocardless/resources/BillingRequest.java b/src/main/java/com/gocardless/resources/BillingRequest.java index ce1786fa..6627bc06 100644 --- a/src/main/java/com/gocardless/resources/BillingRequest.java +++ b/src/main/java/com/gocardless/resources/BillingRequest.java @@ -23,6 +23,7 @@ private BillingRequest() { // blank to prevent instantiation } + private AccountInformationRequest accountInformationRequest; private List actions; private String createdAt; private Boolean fallbackEnabled; @@ -40,6 +41,13 @@ private BillingRequest() { private Status status; private SubscriptionRequest subscriptionRequest; + /** + * Request for account information + */ + public AccountInformationRequest getAccountInformationRequest() { + return accountInformationRequest; + } + /** * List of actions that can be performed before this billing request can be fulfilled. */ @@ -256,6 +264,42 @@ public enum Status { UNKNOWN } + /** + * Represents a account information request resource returned from the API. + * + * Request for account information + */ + public static class AccountInformationRequest { + private AccountInformationRequest() { + // blank to prevent instantiation + } + + private String countryCode; + private List scopes; + + /** + * ISO + * 3166-1 alpha-2 code. + */ + public String getCountryCode() { + return countryCode; + } + + /** + * List of scopes for the account information request + */ + public List getScopes() { + return scopes; + } + + public enum Scope { + @SerializedName("account_verification") + ACCOUNT_VERIFICATION, @SerializedName("unknown") + UNKNOWN + } + } + /** * Represents a action resource returned from the API. * @@ -743,6 +787,7 @@ private Links() { // blank to prevent instantiation } + private String accountInformationRequest; private String bankAuthorisation; private String creditor; private String customer; @@ -759,6 +804,13 @@ private Links() { private String subscriptionRequest; private String subscriptionRequestSubscription; + /** + * (Optional) ID of associated account information request + */ + public String getAccountInformationRequest() { + return accountInformationRequest; + } + /** * (Optional) ID of the * bank diff --git a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java index e2d8c1a6..bb04cf1f 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java +++ b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java @@ -221,6 +221,7 @@ private BillingRequests() { // blank to prevent instantiation } + private AccountInformationRequest accountInformationRequest; private List actions; private String createdAt; private Boolean fallbackEnabled; @@ -238,6 +239,13 @@ private BillingRequests() { private Status status; private SubscriptionRequest subscriptionRequest; + /** + * Request for account information + */ + public AccountInformationRequest getAccountInformationRequest() { + return accountInformationRequest; + } + /** * List of actions that can be performed before this billing request can be fulfilled. */ @@ -456,6 +464,42 @@ public enum Status { UNKNOWN } + /** + * Represents a account information request resource returned from the API. + * + * Request for account information + */ + public static class AccountInformationRequest { + private AccountInformationRequest() { + // blank to prevent instantiation + } + + private String countryCode; + private List scopes; + + /** + * ISO + * 3166-1 alpha-2 code. + */ + public String getCountryCode() { + return countryCode; + } + + /** + * List of scopes for the account information request + */ + public List getScopes() { + return scopes; + } + + public enum Scope { + @SerializedName("account_verification") + ACCOUNT_VERIFICATION, @SerializedName("unknown") + UNKNOWN + } + } + /** * Represents a action resource returned from the API. * @@ -947,6 +991,7 @@ private Links() { // blank to prevent instantiation } + private String accountInformationRequest; private String bankAuthorisation; private String creditor; private String customer; @@ -963,6 +1008,13 @@ private Links() { private String subscriptionRequest; private String subscriptionRequestSubscription; + /** + * (Optional) ID of associated account information request + */ + public String getAccountInformationRequest() { + return accountInformationRequest; + } + /** * (Optional) ID of the * bank diff --git a/src/main/java/com/gocardless/services/BillingRequestService.java b/src/main/java/com/gocardless/services/BillingRequestService.java index 5fd152eb..2803d2c9 100644 --- a/src/main/java/com/gocardless/services/BillingRequestService.java +++ b/src/main/java/com/gocardless/services/BillingRequestService.java @@ -176,6 +176,7 @@ public BillingRequestSelectInstitutionRequest selectInstitution(String identity) */ public static final class BillingRequestCreateRequest extends IdempotentPostRequest { + private AccountInformationRequest accountInformationRequest; private Boolean fallbackEnabled; private InstalmentScheduleRequest instalmentScheduleRequest; private Links links; @@ -187,6 +188,38 @@ public static final class BillingRequestCreateRequest private PurposeCode purposeCode; private SubscriptionRequest subscriptionRequest; + public BillingRequestCreateRequest withAccountInformationRequest( + AccountInformationRequest accountInformationRequest) { + this.accountInformationRequest = accountInformationRequest; + return this; + } + + /** + * ISO + * 3166-1 alpha-2 code. + */ + public BillingRequestCreateRequest withAccountInformationRequestCountryCode( + String countryCode) { + if (accountInformationRequest == null) { + accountInformationRequest = new AccountInformationRequest(); + } + accountInformationRequest.withCountryCode(countryCode); + return this; + } + + /** + * List of scopes for the account information request + */ + public BillingRequestCreateRequest withAccountInformationRequestScopes( + List scopes) { + if (accountInformationRequest == null) { + accountInformationRequest = new AccountInformationRequest(); + } + accountInformationRequest.withScopes(scopes); + return this; + } + /** * (Optional) If true, this billing request can fallback from instant payment to direct * debit. Should not be set if GoCardless payment intelligence feature is used. @@ -1059,6 +1092,29 @@ public String toString() { } } + public static class AccountInformationRequest { + private String countryCode; + private List scopes; + + /** + * ISO + * 3166-1 alpha-2 code. + */ + public AccountInformationRequest withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * List of scopes for the account information request + */ + public AccountInformationRequest withScopes(List scopes) { + this.scopes = scopes; + return this; + } + } + public static class InstalmentsWithDates { private Integer amount; private String chargeDate;