From b513ba31de1c7aab7028dffb1fa685b58150cccf Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 13:26:51 +0000 Subject: [PATCH 1/2] Changes generated by 4f34730b8fb900991bf60242fc64badc89defb8c This commit was automatically created from gocardless/client-library-templates@4f34730b8fb900991bf60242fc64badc89defb8c by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/23491710247 --- src/main/java/com/gocardless/GoCardlessClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gocardless/GoCardlessClient.java b/src/main/java/com/gocardless/GoCardlessClient.java index ceb32ea1..a66b347f 100644 --- a/src/main/java/com/gocardless/GoCardlessClient.java +++ b/src/main/java/com/gocardless/GoCardlessClient.java @@ -153,8 +153,8 @@ public Builder withMaxNoOfRetries(int maxNoOfRetries) { * Configures the fixed wait strategy time the client should wait before retrying a failed * request * - * @param maxNoOfRetries The amount of time to wait before retrying a failed request in - * milli seconds + * @param waitBetweenRetriesInMilliSeconds The amount of time to wait before retrying a + * failed request in milliseconds */ public Builder withWaitBetweenRetriesInMilliSeconds(long waitBetweenRetriesInMilliSeconds) { this.waitBetweenRetriesInMilliSeconds = waitBetweenRetriesInMilliSeconds; From b6c24d59de25700acd9e2b8f2dee295dd2662b9d Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 09:05:21 +0000 Subject: [PATCH 2/2] Changes generated by 8b11b29c01bad5a3e25ac50c5641547d4c0311ed This commit was automatically created from gocardless/client-library-templates@8b11b29c01bad5a3e25ac50c5641547d4c0311ed by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25208955203 --- .../java/com/gocardless/GoCardlessClient.java | 18 + .../gocardless/resources/BillingRequest.java | 3 +- .../resources/BillingRequestWithAction.java | 3 +- .../java/com/gocardless/resources/Export.java | 8 + .../resources/OutboundPaymentImport.java | 231 ++++++++ .../resources/OutboundPaymentImportEntry.java | 219 ++++++++ .../OutboundPaymentImportEntryService.java | 121 +++++ .../OutboundPaymentImportService.java | 498 ++++++++++++++++++ 8 files changed, 1097 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/gocardless/resources/OutboundPaymentImport.java create mode 100644 src/main/java/com/gocardless/resources/OutboundPaymentImportEntry.java create mode 100644 src/main/java/com/gocardless/services/OutboundPaymentImportEntryService.java create mode 100644 src/main/java/com/gocardless/services/OutboundPaymentImportService.java diff --git a/src/main/java/com/gocardless/GoCardlessClient.java b/src/main/java/com/gocardless/GoCardlessClient.java index a66b347f..dc84b482 100644 --- a/src/main/java/com/gocardless/GoCardlessClient.java +++ b/src/main/java/com/gocardless/GoCardlessClient.java @@ -42,6 +42,8 @@ public class GoCardlessClient { private final MandatePdfService mandatePdfs; private final NegativeBalanceLimitService negativeBalanceLimits; private final OutboundPaymentService outboundPayments; + private final OutboundPaymentImportService outboundPaymentImports; + private final OutboundPaymentImportEntryService outboundPaymentImportEntries; private final PayerAuthorisationService payerAuthorisations; private final PayerThemeService payerThemes; private final PaymentService payments; @@ -207,6 +209,8 @@ private GoCardlessClient(HttpClient httpClient) { this.mandatePdfs = new MandatePdfService(httpClient); this.negativeBalanceLimits = new NegativeBalanceLimitService(httpClient); this.outboundPayments = new OutboundPaymentService(httpClient); + this.outboundPaymentImports = new OutboundPaymentImportService(httpClient); + this.outboundPaymentImportEntries = new OutboundPaymentImportEntryService(httpClient); this.payerAuthorisations = new PayerAuthorisationService(httpClient); this.payerThemes = new PayerThemeService(httpClient); this.payments = new PaymentService(httpClient); @@ -421,6 +425,20 @@ public OutboundPaymentService outboundPayments() { return outboundPayments; } + /** + * A service class for working with outbound payment import resources. + */ + public OutboundPaymentImportService outboundPaymentImports() { + return outboundPaymentImports; + } + + /** + * A service class for working with outbound payment import entry resources. + */ + public OutboundPaymentImportEntryService outboundPaymentImportEntries() { + return outboundPaymentImportEntries; + } + /** * A service class for working with payer authorisation resources. */ diff --git a/src/main/java/com/gocardless/resources/BillingRequest.java b/src/main/java/com/gocardless/resources/BillingRequest.java index a5f754bd..6650dfa6 100644 --- a/src/main/java/com/gocardless/resources/BillingRequest.java +++ b/src/main/java/com/gocardless/resources/BillingRequest.java @@ -400,8 +400,7 @@ public AuthorisationType getAuthorisationType() { public enum Adapter { @SerializedName("open_banking_gateway_pis") - OPEN_BANKING_GATEWAY_PIS, @SerializedName("plaid_ais") - PLAID_AIS, @SerializedName("open_banking_gateway_ais") + OPEN_BANKING_GATEWAY_PIS, @SerializedName("open_banking_gateway_ais") OPEN_BANKING_GATEWAY_AIS, @SerializedName("bankid_ais") BANKID_AIS, @SerializedName("bank_pay_recurring") BANK_PAY_RECURRING, @SerializedName("unknown") diff --git a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java index c4e1cd85..dc1545f2 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java +++ b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java @@ -602,8 +602,7 @@ public AuthorisationType getAuthorisationType() { public enum Adapter { @SerializedName("open_banking_gateway_pis") - OPEN_BANKING_GATEWAY_PIS, @SerializedName("plaid_ais") - PLAID_AIS, @SerializedName("open_banking_gateway_ais") + OPEN_BANKING_GATEWAY_PIS, @SerializedName("open_banking_gateway_ais") OPEN_BANKING_GATEWAY_AIS, @SerializedName("bankid_ais") BANKID_AIS, @SerializedName("bank_pay_recurring") BANK_PAY_RECURRING, @SerializedName("unknown") diff --git a/src/main/java/com/gocardless/resources/Export.java b/src/main/java/com/gocardless/resources/Export.java index 022d40be..fea0bb16 100644 --- a/src/main/java/com/gocardless/resources/Export.java +++ b/src/main/java/com/gocardless/resources/Export.java @@ -15,6 +15,7 @@ private Export() { private String createdAt; private String currency; private String downloadUrl; + private String errorMessage; private ExportType exportType; private String id; @@ -39,6 +40,13 @@ public String getDownloadUrl() { return downloadUrl; } + /** + * Error message if the export encountered an error during processing. + */ + public String getErrorMessage() { + return errorMessage; + } + /** * The type of the export */ diff --git a/src/main/java/com/gocardless/resources/OutboundPaymentImport.java b/src/main/java/com/gocardless/resources/OutboundPaymentImport.java new file mode 100644 index 00000000..ab01a04a --- /dev/null +++ b/src/main/java/com/gocardless/resources/OutboundPaymentImport.java @@ -0,0 +1,231 @@ +package com.gocardless.resources; + +import com.google.gson.annotations.SerializedName; + +/** + * Represents a outbound payment import resource returned from the API. + * + * Outbound Payment Imports allow you to create multiple payments via a single API call. + * + * The Workflow: 1. Create the outbound payment import. 2. Retrieve an authorisation link from the + * response. 3. Redirect the user to the link to authorise the import. 4. Once the user authorises + * the import, the individual outbound payments are automatically submitted. + * + * Import entries are not processed as actual payments until they are reviewed and authorised in + * GoCardless Dashboard. Upon approval, a unique outbound payment is generated for every entry in + * the import. + * + *

+ * Outbound Payment Imports are capped at 1000 entries. If you expect to exceed this limit, please + * create multiple smaller imports. + *

+ */ +public class OutboundPaymentImport { + private OutboundPaymentImport() { + // blank to prevent instantiation + } + + private Integer amountSum; + private String authorisationUrl; + private String createdAt; + private Currency currency; + private EntryCounts entryCounts; + private String id; + private Links links; + private Status status; + + /** + * The sum of all import entry amounts, in the lowest denomination for the currency (e.g. pence + * in GBP, cents in EUR). + */ + public Integer getAmountSum() { + return amountSum; + } + + /** + * The link to the GoCardless dashboard to review and authorise the import + */ + public String getAuthorisationUrl() { + return authorisationUrl; + } + + /** + * Fixed [timestamp](#api-usage-dates-and-times), recording when this resource was created. + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. Currently only "GBP" + * is supported. + */ + public Currency getCurrency() { + return currency; + } + + public EntryCounts getEntryCounts() { + return entryCounts; + } + + /** + * Unique identifier, beginning with "IM". + */ + public String getId() { + return id; + } + + public Links getLinks() { + return links; + } + + /** + * The status of the outbound payment import. + * + */ + public Status getStatus() { + return status; + } + + public enum Currency { + @SerializedName("GBP") + GBP, @SerializedName("unknown") + UNKNOWN + } + + public enum Status { + @SerializedName("created") + CREATED, @SerializedName("validating") + VALIDATING, @SerializedName("valid") + VALID, @SerializedName("invalid") + INVALID, @SerializedName("processing") + PROCESSING, @SerializedName("processed") + PROCESSED, @SerializedName("cancelled") + CANCELLED, @SerializedName("unknown") + UNKNOWN + } + + /** + * Represents a entry count resource returned from the API. + * + * + */ + public static class EntryCounts { + private EntryCounts() { + // blank to prevent instantiation + } + + private Integer failedToProcess; + private Integer invalid; + private Integer processed; + private Integer total; + private Integer valid; + private Integer verified; + private Integer verifiedWithFullMatch; + private Integer verifiedWithNoMatch; + private Integer verifiedWithPartialMatch; + private Integer verifiedWithUnableToMatch; + + /** + * Count of entries that encountered a terminal error during the outbound payment generation + * process. + */ + public Integer getFailedToProcess() { + return failedToProcess; + } + + /** + * Count of entries that failed validation checks. + */ + public Integer getInvalid() { + return invalid; + } + + /** + * Count of entries successfully converted into outbound payments after the import was + * authorised. + */ + public Integer getProcessed() { + return processed; + } + + /** + * The total number of entries included in the import. + */ + public Integer getTotal() { + return total; + } + + /** + * Count of entries that passed validation checks. + */ + public Integer getValid() { + return valid; + } + + /** + * Total count of entries checked against bank account holder verification services (e.g., + * CoP). + */ + public Integer getVerified() { + return verified; + } + + /** + * Count of entries where the account holder name was a direct match. + */ + public Integer getVerifiedWithFullMatch() { + return verifiedWithFullMatch; + } + + /** + * Count of entries where the account holder name did not match the records. + */ + public Integer getVerifiedWithNoMatch() { + return verifiedWithNoMatch; + } + + /** + * Count of entries where the account holder name was a close match. + */ + public Integer getVerifiedWithPartialMatch() { + return verifiedWithPartialMatch; + } + + /** + * Count of entries where the verification service could not return a definitive result. + */ + public Integer getVerifiedWithUnableToMatch() { + return verifiedWithUnableToMatch; + } + } + + /** + * Represents a link resource returned from the API. + * + * + */ + public static class Links { + private Links() { + // blank to prevent instantiation + } + + private String creditor; + + /** + * ID of the creditor who sends the outbound payments from the import. + */ + public String getCreditor() { + return creditor; + } + } +} diff --git a/src/main/java/com/gocardless/resources/OutboundPaymentImportEntry.java b/src/main/java/com/gocardless/resources/OutboundPaymentImportEntry.java new file mode 100644 index 00000000..f82c6950 --- /dev/null +++ b/src/main/java/com/gocardless/resources/OutboundPaymentImportEntry.java @@ -0,0 +1,219 @@ +package com.gocardless.resources; + +import com.google.gson.annotations.SerializedName; +import java.util.List; +import java.util.Map; + +/** + * Represents a outbound payment import entry resource returned from the API. + * + * Import Entries are the individual rows of an outbound payment import, representing each payment + * to be created. + */ +public class OutboundPaymentImportEntry { + private OutboundPaymentImportEntry() { + // blank to prevent instantiation + } + + private Integer amount; + private String createdAt; + private String id; + private Links links; + private Map metadata; + private String processedAt; + private String reference; + private Scheme scheme; + private ValidationErrors validationErrors; + private VerificationResult verificationResult; + + /** + * Amount, in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR). + */ + public Integer getAmount() { + return amount; + } + + /** + * Fixed [timestamp](#api-usage-dates-and-times), recording when this resource was created. + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Unique identifier, beginning with "IE". + */ + public String getId() { + return id; + } + + public Links getLinks() { + return links; + } + + /** + * 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. + */ + public Map getMetadata() { + return metadata; + } + + /** + * Fixed [timestamp](#api-usage-dates-and-times), recording when this entry was processed. + */ + public String getProcessedAt() { + return processedAt; + } + + /** + * An optional reference for the outbound payment. + */ + public String getReference() { + return reference; + } + + /** + * Bank payment scheme to process the outbound payment. Currently only "faster_payments" (GBP) + * is supported. + */ + public Scheme getScheme() { + return scheme; + } + + /** + * Per-field validation errors for this entry, keyed by resource type and then by field name. + */ + public ValidationErrors getValidationErrors() { + return validationErrors; + } + + /** + * The result of bank account holder verification, if performed. + */ + public VerificationResult getVerificationResult() { + return verificationResult; + } + + public enum Scheme { + @SerializedName("faster_payments") + FASTER_PAYMENTS, @SerializedName("unknown") + UNKNOWN + } + + public enum VerificationResult { + @SerializedName("full_match") + FULL_MATCH, @SerializedName("partial_match") + PARTIAL_MATCH, @SerializedName("no_match") + NO_MATCH, @SerializedName("unable_to_match") + UNABLE_TO_MATCH, @SerializedName("unknown") + UNKNOWN + } + + /** + * Represents a link resource returned from the API. + * + * + */ + public static class Links { + private Links() { + // blank to prevent instantiation + } + + private String outboundPayment; + private String outboundPaymentImport; + private String recipientBankAccount; + + /** + * ID of the associated outbound payment, once the entry has been processed. + */ + public String getOutboundPayment() { + return outboundPayment; + } + + /** + * ID of the associated import. + */ + public String getOutboundPaymentImport() { + return outboundPaymentImport; + } + + /** + * ID of the recipient bank account. + */ + public String getRecipientBankAccount() { + return recipientBankAccount; + } + } + + /** + * Represents a validation error resource returned from the API. + * + * Per-field validation errors for this entry, keyed by resource type and then by field name. + */ + public static class ValidationErrors { + private ValidationErrors() { + // blank to prevent instantiation + } + + private OutboundPayment outboundPayment; + + /** + * Validation errors for the outbound payment fields. + */ + public OutboundPayment getOutboundPayment() { + return outboundPayment; + } + + /** + * Represents a outbound payment resource returned from the API. + * + * Validation errors for the outbound payment fields. + */ + public static class OutboundPayment { + private OutboundPayment() { + // blank to prevent instantiation + } + + private List amount; + private List recipientBankAccount; + private List reference; + private Scheme scheme; + + /** + * Errors related to the amount field. + */ + public List getAmount() { + return amount; + } + + /** + * Errors related to the recipient bank account. + */ + public List getRecipientBankAccount() { + return recipientBankAccount; + } + + /** + * Errors related to the reference field. + */ + public List getReference() { + return reference; + } + + /** + * Bank payment scheme to process the outbound payment. Currently only "faster_payments" + * (GBP) is supported. + */ + public Scheme getScheme() { + return scheme; + } + + public enum Scheme { + @SerializedName("faster_payments") + FASTER_PAYMENTS, @SerializedName("unknown") + UNKNOWN + } + } + } +} diff --git a/src/main/java/com/gocardless/services/OutboundPaymentImportEntryService.java b/src/main/java/com/gocardless/services/OutboundPaymentImportEntryService.java new file mode 100644 index 00000000..e4ca2fcd --- /dev/null +++ b/src/main/java/com/gocardless/services/OutboundPaymentImportEntryService.java @@ -0,0 +1,121 @@ +package com.gocardless.services; + +import com.gocardless.http.*; +import com.gocardless.resources.OutboundPaymentImportEntry; +import com.google.common.collect.ImmutableMap; +import com.google.gson.reflect.TypeToken; +import java.util.List; +import java.util.Map; + +/** + * Service class for working with outbound payment import entry resources. + * + * Import Entries are the individual rows of an outbound payment import, representing each payment + * to be created. + */ +public class OutboundPaymentImportEntryService { + private final HttpClient httpClient; + + /** + * Constructor. Users of this library should have no need to call this - an instance of this + * class can be obtained by calling + * {@link com.gocardless.GoCardlessClient#outboundPaymentImportEntries() }. + */ + public OutboundPaymentImportEntryService(HttpClient httpClient) { + this.httpClient = httpClient; + } + + /** + * Returns a [cursor-paginated](#api-usage-cursor-pagination) list of the entries for a given + * outbound payment import. + */ + public OutboundPaymentImportEntryListRequest> list() { + return new OutboundPaymentImportEntryListRequest<>(httpClient, + ListRequest.pagingExecutor()); + } + + public OutboundPaymentImportEntryListRequest> all() { + return new OutboundPaymentImportEntryListRequest<>(httpClient, + ListRequest.iteratingExecutor()); + } + + /** + * Request class for {@link OutboundPaymentImportEntryService#list }. + * + * Returns a [cursor-paginated](#api-usage-cursor-pagination) list of the entries for a given + * outbound payment import. + */ + public static final class OutboundPaymentImportEntryListRequest + extends ListRequest { + private String outboundPaymentImport; + + /** + * Cursor pointing to the start of the desired set. + */ + public OutboundPaymentImportEntryListRequest withAfter(String after) { + setAfter(after); + return this; + } + + /** + * Cursor pointing to the end of the desired set. + */ + public OutboundPaymentImportEntryListRequest withBefore(String before) { + setBefore(before); + return this; + } + + /** + * Number of records to return. + */ + public OutboundPaymentImportEntryListRequest withLimit(Integer limit) { + setLimit(limit); + return this; + } + + /** + * Unique identifier, beginning with "IM". + */ + public OutboundPaymentImportEntryListRequest withOutboundPaymentImport( + String outboundPaymentImport) { + this.outboundPaymentImport = outboundPaymentImport; + return this; + } + + private OutboundPaymentImportEntryListRequest(HttpClient httpClient, + ListRequestExecutor executor) { + super(httpClient, executor); + } + + public OutboundPaymentImportEntryListRequest withHeader(String headerName, + String headerValue) { + this.addHeader(headerName, headerValue); + return this; + } + + @Override + protected Map getQueryParams() { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.putAll(super.getQueryParams()); + if (outboundPaymentImport != null) { + params.put("outbound_payment_import", outboundPaymentImport); + } + return params.build(); + } + + @Override + protected String getPathTemplate() { + return "outbound_payment_import_entries"; + } + + @Override + protected String getEnvelope() { + return "outbound_payment_import_entries"; + } + + @Override + protected TypeToken> getTypeToken() { + return new TypeToken>() {}; + } + } +} diff --git a/src/main/java/com/gocardless/services/OutboundPaymentImportService.java b/src/main/java/com/gocardless/services/OutboundPaymentImportService.java new file mode 100644 index 00000000..ddec34b4 --- /dev/null +++ b/src/main/java/com/gocardless/services/OutboundPaymentImportService.java @@ -0,0 +1,498 @@ +package com.gocardless.services; + +import com.gocardless.http.*; +import com.gocardless.resources.OutboundPaymentImport; +import com.google.common.collect.ImmutableMap; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Service class for working with outbound payment import resources. + * + * Outbound Payment Imports allow you to create multiple payments via a single API call. + * + * The Workflow: 1. Create the outbound payment import. 2. Retrieve an authorisation link from the + * response. 3. Redirect the user to the link to authorise the import. 4. Once the user authorises + * the import, the individual outbound payments are automatically submitted. + * + * Import entries are not processed as actual payments until they are reviewed and authorised in + * GoCardless Dashboard. Upon approval, a unique outbound payment is generated for every entry in + * the import. + * + *

+ * Outbound Payment Imports are capped at 1000 entries. If you expect to exceed this limit, please + * create multiple smaller imports. + *

+ */ +public class OutboundPaymentImportService { + private final HttpClient httpClient; + + /** + * Constructor. Users of this library should have no need to call this - an instance of this + * class can be obtained by calling + * {@link com.gocardless.GoCardlessClient#outboundPaymentImports() }. + */ + public OutboundPaymentImportService(HttpClient httpClient) { + this.httpClient = httpClient; + } + + /** + * + */ + public OutboundPaymentImportCreateRequest create() { + return new OutboundPaymentImportCreateRequest(httpClient); + } + + /** + * Returns a single outbound payment import. + */ + public OutboundPaymentImportGetRequest get(String identity) { + return new OutboundPaymentImportGetRequest(httpClient, identity); + } + + /** + * Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your outbound payment + * imports. + */ + public OutboundPaymentImportListRequest> list() { + return new OutboundPaymentImportListRequest<>(httpClient, + ListRequest.pagingExecutor()); + } + + public OutboundPaymentImportListRequest> all() { + return new OutboundPaymentImportListRequest<>(httpClient, + ListRequest.iteratingExecutor()); + } + + /** + * Request class for {@link OutboundPaymentImportService#create }. + * + * + */ + public static final class OutboundPaymentImportCreateRequest + extends IdempotentPostRequest { + private List entryItems; + private Links links; + + public OutboundPaymentImportCreateRequest withEntryItems(List entryItems) { + this.entryItems = entryItems; + return this; + } + + public OutboundPaymentImportCreateRequest withEntryItems(EntryItems entryItems) { + if (this.entryItems == null) { + this.entryItems = new ArrayList<>(); + } + this.entryItems.add(entryItems); + return this; + } + + public OutboundPaymentImportCreateRequest withLinks(Links links) { + this.links = links; + return this; + } + + /** + * ID of the creditor who sends the outbound payments from the import. + */ + public OutboundPaymentImportCreateRequest withLinksCreditor(String creditor) { + if (links == null) { + links = new Links(); + } + links.withCreditor(creditor); + return this; + } + + public OutboundPaymentImportCreateRequest withIdempotencyKey(String idempotencyKey) { + super.setIdempotencyKey(idempotencyKey); + return this; + } + + @Override + protected GetRequest handleConflict(HttpClient httpClient, + String id) { + OutboundPaymentImportGetRequest request = + new OutboundPaymentImportGetRequest(httpClient, id); + for (Map.Entry header : this.getCustomHeaders().entrySet()) { + request = request.withHeader(header.getKey(), header.getValue()); + } + return request; + } + + private OutboundPaymentImportCreateRequest(HttpClient httpClient) { + super(httpClient); + } + + public OutboundPaymentImportCreateRequest withHeader(String headerName, + String headerValue) { + this.addHeader(headerName, headerValue); + return this; + } + + @Override + protected String getPathTemplate() { + return "outbound_payment_imports"; + } + + @Override + protected String getEnvelope() { + return "outbound_payment_imports"; + } + + @Override + protected Class getResponseClass() { + return OutboundPaymentImport.class; + } + + @Override + protected boolean hasBody() { + return true; + } + + public static class EntryItems { + private Integer amount; + private Map metadata; + private String recipientBankAccountId; + private String reference; + private Scheme scheme; + + /** + * Amount, in the lowest denomination for the currency (e.g. pence in GBP, cents in + * EUR). + */ + public EntryItems withAmount(Integer amount) { + this.amount = amount; + 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. + */ + public EntryItems withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * ID of the customer bank account which receives the outbound payment. + */ + public EntryItems withRecipientBankAccountId(String recipientBankAccountId) { + this.recipientBankAccountId = recipientBankAccountId; + return this; + } + + /** + * An optional reference that will appear on your customer's bank statement. The + * character limit for this reference is dependent on the scheme.
+ * Faster Payments - 18 characters, including: + * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 &-./"
+ */ + public EntryItems withReference(String reference) { + this.reference = reference; + return this; + } + + /** + * Bank payment scheme to process the outbound payment. Currently only "faster_payments" + * (GBP) is supported. + */ + public EntryItems withScheme(Scheme scheme) { + this.scheme = scheme; + return this; + } + + public enum Scheme { + @SerializedName("faster_payments") + FASTER_PAYMENTS, @SerializedName("unknown") + UNKNOWN; + + @Override + public String toString() { + return name().toLowerCase(); + } + } + } + + public static class Links { + private String creditor; + + /** + * ID of the creditor who sends the outbound payments from the import. + */ + public Links withCreditor(String creditor) { + this.creditor = creditor; + return this; + } + } + } + + /** + * Request class for {@link OutboundPaymentImportService#get }. + * + * Returns a single outbound payment import. + */ + public static final class OutboundPaymentImportGetRequest + extends GetRequest { + @PathParam + private final String identity; + + private OutboundPaymentImportGetRequest(HttpClient httpClient, String identity) { + super(httpClient); + this.identity = identity; + } + + public OutboundPaymentImportGetRequest withHeader(String headerName, String headerValue) { + this.addHeader(headerName, headerValue); + return this; + } + + @Override + protected Map getPathParams() { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("identity", identity); + return params.build(); + } + + @Override + protected Map getQueryParams() { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.putAll(super.getQueryParams()); + return params.build(); + } + + @Override + protected String getPathTemplate() { + return "outbound_payment_imports/:identity"; + } + + @Override + protected String getEnvelope() { + return "outbound_payment_imports"; + } + + @Override + protected Class getResponseClass() { + return OutboundPaymentImport.class; + } + } + + /** + * Request class for {@link OutboundPaymentImportService#list }. + * + * Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your outbound payment + * imports. + */ + public static final class OutboundPaymentImportListRequest + extends ListRequest { + private CreatedAt createdAt; + private Status status; + + /** + * Cursor pointing to the start of the desired set. + */ + public OutboundPaymentImportListRequest withAfter(String after) { + setAfter(after); + return this; + } + + /** + * Cursor pointing to the end of the desired set. + */ + public OutboundPaymentImportListRequest withBefore(String before) { + setBefore(before); + return this; + } + + public OutboundPaymentImportListRequest withCreatedAt(CreatedAt createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Limit to records created after the specified date-time. + */ + public OutboundPaymentImportListRequest withCreatedAtGt(String gt) { + if (createdAt == null) { + createdAt = new CreatedAt(); + } + createdAt.withGt(gt); + return this; + } + + /** + * Limit to records created on or after the specified date-time. + */ + public OutboundPaymentImportListRequest withCreatedAtGte(String gte) { + if (createdAt == null) { + createdAt = new CreatedAt(); + } + createdAt.withGte(gte); + return this; + } + + /** + * Limit to records created before the specified date-time. + */ + public OutboundPaymentImportListRequest withCreatedAtLt(String lt) { + if (createdAt == null) { + createdAt = new CreatedAt(); + } + createdAt.withLt(lt); + return this; + } + + /** + * Limit to records created on or before the specified date-time. + */ + public OutboundPaymentImportListRequest withCreatedAtLte(String lte) { + if (createdAt == null) { + createdAt = new CreatedAt(); + } + createdAt.withLte(lte); + return this; + } + + /** + * Number of records to return. + */ + public OutboundPaymentImportListRequest withLimit(Integer limit) { + setLimit(limit); + return this; + } + + /** + * The status of the outbound payment import. + *
    + *
  • `created`: The initial state of a new import.
  • + *
  • `validating`: Import validation in progress.
  • + *
  • `invalid`: Import validation failed.
  • + *
  • `valid`: Import validation succeeded.
  • + *
  • `processing`: Authorisation received; payments are being generated.
  • + *
  • `processed`: All entries have been successfully converted into outbound + * payments.
  • + *
  • `cancelled`: The import was cancelled by a user or automatically expired by the + * system.
  • + *
+ */ + public OutboundPaymentImportListRequest withStatus(Status status) { + this.status = status; + return this; + } + + private OutboundPaymentImportListRequest(HttpClient httpClient, + ListRequestExecutor executor) { + super(httpClient, executor); + } + + public OutboundPaymentImportListRequest withHeader(String headerName, + String headerValue) { + this.addHeader(headerName, headerValue); + return this; + } + + @Override + protected Map getQueryParams() { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.putAll(super.getQueryParams()); + if (createdAt != null) { + params.putAll(createdAt.getQueryParams()); + } + if (status != null) { + params.put("status", status); + } + return params.build(); + } + + @Override + protected String getPathTemplate() { + return "outbound_payment_imports"; + } + + @Override + protected String getEnvelope() { + return "outbound_payment_imports"; + } + + @Override + protected TypeToken> getTypeToken() { + return new TypeToken>() {}; + } + + public enum Status { + @SerializedName("created") + CREATED, @SerializedName("validating") + VALIDATING, @SerializedName("valid") + VALID, @SerializedName("invalid") + INVALID, @SerializedName("processing") + PROCESSING, @SerializedName("processed") + PROCESSED, @SerializedName("cancelled") + CANCELLED, @SerializedName("unknown") + UNKNOWN; + + @Override + public String toString() { + return name().toLowerCase(); + } + } + + public static class CreatedAt { + private String gt; + private String gte; + private String lt; + private String lte; + + /** + * Limit to records created after the specified date-time. + */ + public CreatedAt withGt(String gt) { + this.gt = gt; + return this; + } + + /** + * Limit to records created on or after the specified date-time. + */ + public CreatedAt withGte(String gte) { + this.gte = gte; + return this; + } + + /** + * Limit to records created before the specified date-time. + */ + public CreatedAt withLt(String lt) { + this.lt = lt; + return this; + } + + /** + * Limit to records created on or before the specified date-time. + */ + public CreatedAt withLte(String lte) { + this.lte = lte; + return this; + } + + public Map getQueryParams() { + ImmutableMap.Builder params = ImmutableMap.builder(); + if (gt != null) { + params.put("created_at[gt]", gt); + } + if (gte != null) { + params.put("created_at[gte]", gte); + } + if (lt != null) { + params.put("created_at[lt]", lt); + } + if (lte != null) { + params.put("created_at[lte]", lte); + } + return params.build(); + } + } + } +}