params = ImmutableMap.builder();
params.putAll(super.getQueryParams());
+ if (paymentRequestScheme != null) {
+ params.put("payment_request_scheme", paymentRequestScheme);
+ }
return params.build();
}
diff --git a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java
index 77ab8402..a8996381 100644
--- a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java
+++ b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java
@@ -553,7 +553,11 @@ public enum PurposeCode {
GOVERNMENT, @SerializedName("pension")
PENSION, @SerializedName("tax")
TAX, @SerializedName("other")
- OTHER, @SerializedName("unknown")
+ OTHER, @SerializedName("Epayment")
+ EPAYMENT, @SerializedName("Commercial")
+ COMMERCIAL, @SerializedName("OtherPayment")
+ OTHERPAYMENT, @SerializedName("Trade")
+ TRADE, @SerializedName("unknown")
UNKNOWN;
@Override
diff --git a/src/main/java/com/gocardless/services/CreditorBankAccountValidateService.java b/src/main/java/com/gocardless/services/CreditorBankAccountValidateService.java
new file mode 100644
index 00000000..033951c1
--- /dev/null
+++ b/src/main/java/com/gocardless/services/CreditorBankAccountValidateService.java
@@ -0,0 +1,150 @@
+package com.gocardless.services;
+
+import com.gocardless.http.*;
+import com.gocardless.resources.CreditorBankAccountValidate;
+
+/**
+ * Service class for working with creditor bank account validate resources.
+ *
+ * Creditor Bank Accounts hold the bank details of a [creditor](#core-endpoints-creditors). These
+ * are the bank accounts which your [payouts](#core-endpoints-payouts) will be sent to.
+ *
+ * When all locale details and Iban are supplied validates creditor bank details without creating a
+ * creditor bank account and also provdes bank details such as name and icon url. When partial
+ * details are are provided the endpoint will only provide bank details such as name and icon url
+ * but will not be able to determine if the provided details are valid.
+ *
+ *
+ * Restricted: This API is not available for partner integrations.
+ *
+ */
+public class CreditorBankAccountValidateService {
+ 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#creditorBankAccountValidates() }.
+ */
+ public CreditorBankAccountValidateService(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ /**
+ * Validate bank details without creating a creditor bank account
+ */
+ public CreditorBankAccountValidateValidateRequest validate() {
+ return new CreditorBankAccountValidateValidateRequest(httpClient);
+ }
+
+ /**
+ * Request class for {@link CreditorBankAccountValidateService#validate }.
+ *
+ * Validate bank details without creating a creditor bank account
+ */
+ public static final class CreditorBankAccountValidateValidateRequest
+ extends PostRequest {
+ private String iban;
+ private LocalDetails localDetails;
+
+ /**
+ * International Bank Account Number. Alternatively you can provide [local
+ * details](#appendix-local-bank-details). IBANs are not accepted for Swedish bank accounts
+ * denominated in SEK - you must supply [local details](#local-bank-details-sweden).
+ */
+ public CreditorBankAccountValidateValidateRequest withIban(String iban) {
+ this.iban = iban;
+ return this;
+ }
+
+ public CreditorBankAccountValidateValidateRequest withLocalDetails(
+ LocalDetails localDetails) {
+ this.localDetails = localDetails;
+ return this;
+ }
+
+ /**
+ * Bank account number - see [local details](#appendix-local-bank-details) for more
+ * information. Alternatively you can provide an `iban`.
+ */
+ public CreditorBankAccountValidateValidateRequest withLocalDetailsBankNumber(
+ String bankNumber) {
+ if (localDetails == null) {
+ localDetails = new LocalDetails();
+ }
+ localDetails.withBankNumber(bankNumber);
+ return this;
+ }
+
+ /**
+ * Branch code - see [local details](#appendix-local-bank-details) for more information.
+ * Alternatively you can provide an `iban`.
+ */
+ public CreditorBankAccountValidateValidateRequest withLocalDetailsSortCode(
+ String sortCode) {
+ if (localDetails == null) {
+ localDetails = new LocalDetails();
+ }
+ localDetails.withSortCode(sortCode);
+ return this;
+ }
+
+ private CreditorBankAccountValidateValidateRequest(HttpClient httpClient) {
+ super(httpClient);
+ }
+
+ public CreditorBankAccountValidateValidateRequest withHeader(String headerName,
+ String headerValue) {
+ this.addHeader(headerName, headerValue);
+ return this;
+ }
+
+ @Override
+ protected String getPathTemplate() {
+ return "creditor_bank_accounts/validate";
+ }
+
+ @Override
+ protected String getEnvelope() {
+ return "creditor_bank_accounts";
+ }
+
+ @Override
+ protected Class getResponseClass() {
+ return CreditorBankAccountValidate.class;
+ }
+
+ @Override
+ protected boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ protected String getRequestEnvelope() {
+ return "data";
+ }
+
+ public static class LocalDetails {
+ private String bankNumber;
+ private String sortCode;
+
+ /**
+ * Bank account number - see [local details](#appendix-local-bank-details) for more
+ * information. Alternatively you can provide an `iban`.
+ */
+ public LocalDetails withBankNumber(String bankNumber) {
+ this.bankNumber = bankNumber;
+ return this;
+ }
+
+ /**
+ * Branch code - see [local details](#appendix-local-bank-details) for more information.
+ * Alternatively you can provide an `iban`.
+ */
+ public LocalDetails withSortCode(String sortCode) {
+ this.sortCode = sortCode;
+ return this;
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/gocardless/services/OutboundPaymentService.java b/src/main/java/com/gocardless/services/OutboundPaymentService.java
index 64e61177..d8257bf1 100644
--- a/src/main/java/com/gocardless/services/OutboundPaymentService.java
+++ b/src/main/java/com/gocardless/services/OutboundPaymentService.java
@@ -105,7 +105,8 @@ public static final class OutboundPaymentCreateRequest
private String executionDate;
private Links links;
private Map metadata;
- private String scheme;
+ private String reference;
+ private Scheme scheme;
/**
* Amount, in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR).
@@ -181,11 +182,22 @@ public OutboundPaymentCreateRequest withMetadata(String key, String value) {
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 OutboundPaymentCreateRequest withReference(String reference) {
+ this.reference = reference;
+ return this;
+ }
+
/**
* Bank payment scheme to process the outbound payment. Currently only "faster_payments"
* (GBP) is supported.
*/
- public OutboundPaymentCreateRequest withScheme(String scheme) {
+ public OutboundPaymentCreateRequest withScheme(Scheme scheme) {
this.scheme = scheme;
return this;
}
@@ -233,6 +245,17 @@ protected boolean hasBody() {
return true;
}
+ 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;
private String recipientBankAccount;
@@ -266,7 +289,8 @@ public static final class OutboundPaymentWithdrawRequest extends PostRequest metadata;
- private String scheme;
+ private String reference;
+ private Scheme scheme;
/**
* Amount, in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR).
@@ -330,11 +354,22 @@ public OutboundPaymentWithdrawRequest withMetadata(String key, String value) {
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 OutboundPaymentWithdrawRequest withReference(String reference) {
+ this.reference = reference;
+ return this;
+ }
+
/**
* Bank payment scheme to process the outbound payment. Currently only "faster_payments"
* (GBP) is supported.
*/
- public OutboundPaymentWithdrawRequest withScheme(String scheme) {
+ public OutboundPaymentWithdrawRequest withScheme(Scheme scheme) {
this.scheme = scheme;
return this;
}
@@ -373,6 +408,17 @@ protected String getRequestEnvelope() {
return "data";
}
+ 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;