gocardless-pro-java
gocardless-pro-java copied to clipboard
No access to `linked` values when using `withInclude`
While trying to reconcile payout events according to the API docs, we are trying to get all payment and refund events as per the code below.
parentEvent <-client.events().all().withAction("paid").withPayout(payoutId).execute().asScala.headOption
payments = client.events().all().withParentEvent(parentEvent.getId).withInclude(EventListRequest.Include.PAYMENT).withResourceType(EventListRequest.ResourceType.PAYMENTS).execute().asScala
In our second RPC call, when we specify .withInclude(EventListRequest.Include.PAYMENT).withResourceType(EventListRequest.ResourceType.PAYMENTS) the return type is a list of Event. Which means we have no access to the "included" payment objects. We expect these to be returned in the following format as per the API
{
"events": [ ... ]
"linked": {
"payments": [ ... ]
}
"meta" {
...
}
}
The only available return types in the EventService are
- Iterable<Event> which just contains the list of events
- ListResponse<Event> Which contains the meta and the list of items
Eventwhen callingget(id)
Seems like this withInclude is discarded in all cases.
From what I can see this would force us to either:
- Execute a separate RPC for each payment after getting the Ids of all payment and refund events
- Page through all payments/refunds and filter for the ids contained in the payout.