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
52 changes: 52 additions & 0 deletions src/main/java/com/gocardless/resources/BillingRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private BillingRequest() {
// blank to prevent instantiation
}

private AccountInformationRequest accountInformationRequest;
private List<Action> actions;
private String createdAt;
private Boolean fallbackEnabled;
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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<Scope> scopes;

/**
* <a href=
* "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO
* 3166-1 alpha-2 code.</a>
*/
public String getCountryCode() {
return countryCode;
}

/**
* List of scopes for the account information request
*/
public List<Scope> getScopes() {
return scopes;
}

public enum Scope {
@SerializedName("account_verification")
ACCOUNT_VERIFICATION, @SerializedName("unknown")
UNKNOWN
}
}

/**
* Represents a action resource returned from the API.
*
Expand Down Expand Up @@ -743,6 +787,7 @@ private Links() {
// blank to prevent instantiation
}

private String accountInformationRequest;
private String bankAuthorisation;
private String creditor;
private String customer;
Expand All @@ -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
* <a href="https://docs.gocardless.com/docs/api-reference/bank-authorisation">bank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ private BillingRequests() {
// blank to prevent instantiation
}

private AccountInformationRequest accountInformationRequest;
private List<Action> actions;
private String createdAt;
private Boolean fallbackEnabled;
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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<Scope> scopes;

/**
* <a href=
* "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO
* 3166-1 alpha-2 code.</a>
*/
public String getCountryCode() {
return countryCode;
}

/**
* List of scopes for the account information request
*/
public List<Scope> getScopes() {
return scopes;
}

public enum Scope {
@SerializedName("account_verification")
ACCOUNT_VERIFICATION, @SerializedName("unknown")
UNKNOWN
}
}

/**
* Represents a action resource returned from the API.
*
Expand Down Expand Up @@ -947,6 +991,7 @@ private Links() {
// blank to prevent instantiation
}

private String accountInformationRequest;
private String bankAuthorisation;
private String creditor;
private String customer;
Expand All @@ -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
* <a href="https://docs.gocardless.com/docs/api-reference/bank-authorisation">bank
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/com/gocardless/services/BillingRequestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public BillingRequestSelectInstitutionRequest selectInstitution(String identity)
*/
public static final class BillingRequestCreateRequest
extends IdempotentPostRequest<BillingRequest> {
private AccountInformationRequest accountInformationRequest;
private Boolean fallbackEnabled;
private InstalmentScheduleRequest instalmentScheduleRequest;
private Links links;
Expand All @@ -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;
}

/**
* <a href=
* "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO
* 3166-1 alpha-2 code.</a>
*/
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<String> 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.
Expand Down Expand Up @@ -1059,6 +1092,29 @@ public String toString() {
}
}

public static class AccountInformationRequest {
private String countryCode;
private List<String> scopes;

/**
* <a href=
* "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO
* 3166-1 alpha-2 code.</a>
*/
public AccountInformationRequest withCountryCode(String countryCode) {
this.countryCode = countryCode;
return this;
}

/**
* List of scopes for the account information request
*/
public AccountInformationRequest withScopes(List<String> scopes) {
this.scopes = scopes;
return this;
}
}

public static class InstalmentsWithDates {
private Integer amount;
private String chargeDate;
Expand Down
Loading