gocardless-pro-java icon indicating copy to clipboard operation
gocardless-pro-java copied to clipboard

No access to `linked` values when using `withInclude`

Open smur89 opened this issue 5 years ago • 0 comments

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

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.

smur89 avatar Jun 19 '20 14:06 smur89