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
10 changes: 9 additions & 1 deletion src/main/java/com/gocardless/http/ListResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public List<PayerAuthorisation> getPayerAuthorisations() {
return payerAuthorisations;
}

private final List<PaymentAccountTransaction> paymentAccountTransactions;

public List<PaymentAccountTransaction> getPaymentAccountTransactions() {
return paymentAccountTransactions;
}

private final List<Payment> payments;

public List<Payment> getPayments() {
Expand Down Expand Up @@ -161,7 +167,8 @@ public List<Subscription> getSubscriptions() {
Linked(List<BillingRequest> billingRequests, List<Creditor> creditors,
List<Customer> customers, List<InstalmentSchedule> instalmentSchedules,
List<Mandate> mandates, List<OutboundPayment> outboundPayments,
List<PayerAuthorisation> payerAuthorisations, List<Payment> payments,
List<PayerAuthorisation> payerAuthorisations,
List<PaymentAccountTransaction> paymentAccountTransactions, List<Payment> payments,
List<Payout> payouts, List<Refund> refunds,
List<SchemeIdentifier> schemeIdentifiers, List<Subscription> subscriptions) {
this.billingRequests = billingRequests;
Expand All @@ -171,6 +178,7 @@ public List<Subscription> getSubscriptions() {
this.mandates = mandates;
this.outboundPayments = outboundPayments;
this.payerAuthorisations = payerAuthorisations;
this.paymentAccountTransactions = paymentAccountTransactions;
this.payments = payments;
this.payouts = payouts;
this.refunds = refunds;
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/gocardless/resources/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Map<String, Object> getResourceMetadata() {
* <li>`scheme_identifiers`</li>
* <li>`subscriptions`</li>
* <li>`outbound_payments`</li>
* <li>`payment_account_transactions`</li>
* </ul>
*/
public ResourceType getResourceType() {
Expand All @@ -128,7 +129,8 @@ public enum ResourceType {
ORGANISATIONS, @SerializedName("outbound_payments")
OUTBOUND_PAYMENTS, @SerializedName("payer_authorisations")
PAYER_AUTHORISATIONS, @SerializedName("payments")
PAYMENTS, @SerializedName("payouts")
PAYMENTS, @SerializedName("payment_account_transactions")
PAYMENT_ACCOUNT_TRANSACTIONS, @SerializedName("payouts")
PAYOUTS, @SerializedName("refunds")
REFUNDS, @SerializedName("scheme_identifiers")
SCHEME_IDENTIFIERS, @SerializedName("subscriptions")
Expand Down Expand Up @@ -356,6 +358,7 @@ private Links() {
private String parentEvent;
private String payerAuthorisation;
private String payment;
private String paymentAccountTransaction;
private String paymentRequestPayment;
private String payout;
private String previousCustomerBankAccount;
Expand Down Expand Up @@ -495,6 +498,14 @@ public String getPayment() {
return payment;
}

/**
* If `resource_type` is `payment_account_transaction`, this is the ID of a transaction
* which has been recorded on the payment account.
*/
public String getPaymentAccountTransaction() {
return paymentAccountTransaction;
}

/**
* If `resource_type` is `billing_requests`, this is the ID of the
* [payment](#core-endpoints-payments) which has been created for Instant Bank Payment.
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/gocardless/resources/OutboundPayment.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private Links() {

private String creditor;
private String customer;
private String outboundPaymentImport;
private String recipientBankAccount;

/**
Expand All @@ -206,6 +207,13 @@ public String getCustomer() {
return customer;
}

/**
* ID of the outbound payment import that created this outbound payment.
*/
public String getOutboundPaymentImport() {
return outboundPaymentImport;
}

/**
* ID of the customer bank account which receives the outbound payment.
*/
Expand Down
26 changes: 22 additions & 4 deletions src/main/java/com/gocardless/services/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static final class EventListRequest<S> extends ListRequest<S, Event> {
private String parentEvent;
private String payerAuthorisation;
private String payment;
private String paymentAccountTransaction;
private String payout;
private String refund;
private ResourceType resourceType;
Expand Down Expand Up @@ -184,6 +185,7 @@ public EventListRequest<S> withExport(String export) {
* <li>`scheme_identifier`</li>
* <li>`subscription`</li>
* <li>`outbound_payment`</li>
* <li>`payment_account_transaction`</li>
* </ul>
*/
public EventListRequest<S> withInclude(Include include) {
Expand Down Expand Up @@ -252,6 +254,15 @@ public EventListRequest<S> withPayment(String payment) {
return this;
}

/**
* ID of a payment account transaction. If specified, this endpoint will return all events
* for the given transaction.
*/
public EventListRequest<S> withPaymentAccountTransaction(String paymentAccountTransaction) {
this.paymentAccountTransaction = paymentAccountTransaction;
return this;
}

/**
* ID of a [payout](#core-endpoints-payouts). If specified, this endpoint will return all
* events for the given payout.
Expand All @@ -273,8 +284,9 @@ public EventListRequest<S> withRefund(String refund) {
/**
* Type of resource that you'd like to get all events for. Cannot be used together with the
* `billing_request`, `creditor`, `export`,`instalment_schedule`, `mandate`,
* `payer_authorisation`, `payment`, `payout`, `refund`, `scheme_identifier`, `subscription`
* or `outbound_payment` parameters. The type can be one of:
* `payer_authorisation`, `payment`, `payout`, `refund`, `scheme_identifier`,
* `subscription`, `outbound_payment` or `payment_account_transaction` parameters. The type
* can be one of:
* <ul>
* <li>`billing_requests`</li>
* <li>`creditors`</li>
Expand All @@ -288,6 +300,7 @@ public EventListRequest<S> withRefund(String refund) {
* <li>`scheme_identifiers`</li>
* <li>`subscriptions`</li>
* <li>`outbound_payments`</li>
* <li>`payment_account_transactions`</li>
* </ul>
*/
public EventListRequest<S> withResourceType(ResourceType resourceType) {
Expand Down Expand Up @@ -362,6 +375,9 @@ protected Map<String, Object> getQueryParams() {
if (payment != null) {
params.put("payment", payment);
}
if (paymentAccountTransaction != null) {
params.put("payment_account_transaction", paymentAccountTransaction);
}
if (payout != null) {
params.put("payout", payout);
}
Expand Down Expand Up @@ -404,7 +420,8 @@ public enum Include {
MANDATE, @SerializedName("outbound_payment")
OUTBOUND_PAYMENT, @SerializedName("payer_authorisation")
PAYER_AUTHORISATION, @SerializedName("payment")
PAYMENT, @SerializedName("payout")
PAYMENT, @SerializedName("payment_account_transaction")
PAYMENT_ACCOUNT_TRANSACTION, @SerializedName("payout")
PAYOUT, @SerializedName("refund")
REFUND, @SerializedName("scheme_identifier")
SCHEME_IDENTIFIER, @SerializedName("subscription")
Expand All @@ -428,7 +445,8 @@ public enum ResourceType {
ORGANISATIONS, @SerializedName("outbound_payments")
OUTBOUND_PAYMENTS, @SerializedName("payer_authorisations")
PAYER_AUTHORISATIONS, @SerializedName("payments")
PAYMENTS, @SerializedName("payouts")
PAYMENTS, @SerializedName("payment_account_transactions")
PAYMENT_ACCOUNT_TRANSACTIONS, @SerializedName("payouts")
PAYOUTS, @SerializedName("refunds")
REFUNDS, @SerializedName("scheme_identifiers")
SCHEME_IDENTIFIERS, @SerializedName("subscriptions")
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/gocardless/services/OutboundPaymentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ public OutboundPaymentCreateRequest withLinksCreditor(String creditor) {
return this;
}

/**
* ID of the outbound payment import that created this outbound payment.
*/
public OutboundPaymentCreateRequest withLinksOutboundPaymentImport(
String outboundPaymentImport) {
if (links == null) {
links = new Links();
}
links.withOutboundPaymentImport(outboundPaymentImport);
return this;
}

/**
* ID of the customer bank account which receives the outbound payment.
*/
Expand Down Expand Up @@ -266,6 +278,7 @@ public String toString() {

public static class Links {
private String creditor;
private String outboundPaymentImport;
private String recipientBankAccount;

/**
Expand All @@ -276,6 +289,14 @@ public Links withCreditor(String creditor) {
return this;
}

/**
* ID of the outbound payment import that created this outbound payment.
*/
public Links withOutboundPaymentImport(String outboundPaymentImport) {
this.outboundPaymentImport = outboundPaymentImport;
return this;
}

/**
* ID of the customer bank account which receives the outbound payment.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public PaymentAccountTransactionService(HttpClient httpClient) {
this.httpClient = httpClient;
}

/**
* Retrieves the details of an existing payment account transaction.
*/
public PaymentAccountTransactionGetRequest get(String identity) {
return new PaymentAccountTransactionGetRequest(httpClient, identity);
}

/**
* List transactions for a given payment account.
*/
Expand All @@ -42,6 +49,50 @@ public PaymentAccountTransactionListRequest<Iterable<PaymentAccountTransaction>>
ListRequest.<PaymentAccountTransaction>iteratingExecutor(), identity);
}

/**
* Request class for {@link PaymentAccountTransactionService#get }.
*
* Retrieves the details of an existing payment account transaction.
*/
public static final class PaymentAccountTransactionGetRequest
extends GetRequest<PaymentAccountTransaction> {
@PathParam
private final String identity;

private PaymentAccountTransactionGetRequest(HttpClient httpClient, String identity) {
super(httpClient);
this.identity = identity;
}

public PaymentAccountTransactionGetRequest withHeader(String headerName,
String headerValue) {
this.addHeader(headerName, headerValue);
return this;
}

@Override
protected Map<String, String> getPathParams() {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("identity", identity);
return params.build();
}

@Override
protected String getPathTemplate() {
return "payment_account_transactions/:identity";
}

@Override
protected String getEnvelope() {
return "payment_account_transactions";
}

@Override
protected Class<PaymentAccountTransaction> getResponseClass() {
return PaymentAccountTransaction.class;
}
}

/**
* Request class for {@link PaymentAccountTransactionService#list }.
*
Expand Down