RoutexAsyncClient

Java-friendly async facade for RoutexClient: every public method is exposed here as an instance method returning CompletableFuture. Kotlin callers should use RoutexClient directly; this class is intended for Java consumers and other JVM languages that integrate with CompletableFuture.

The conceptual model carries over from RoutexClient: each call is authorized by a typed Ticket (for example Ticket.Accounts) minted by the caller's backend (see Getting started), the bank-side identification uses a Credentials envelope (see Providing Credentials), and every service call yields a typed Response that is either a final Response.Result or an interrupt the caller resolves with the matching respond* / confirm* method before the flow can complete (see Handling interrupts).

Handling the result

Usage

try (RoutexAsyncClient client = new RoutexAsyncClient()) {
CompletableFuture<Response<AccountsResult>> future =
client.accounts(ticket, credentials, fields);

future.whenComplete(
(response, error) -> {
if (error != null) {
// error is the original exception, not wrapped in CompletionException.
handleFailure(error);
return;
}
if (response instanceof Response.Result<AccountsResult> result) {
// forward result.getAuthenticated().getJwt() to your backend
}
// also handle Response.Dialog / Response.Redirect / Response.RedirectHandle
});
}

Calling CompletableFuture.get / CompletableFuture.join instead rewraps failures in ExecutionException (get) or CompletionException (join); unwrap with e.getCause() to recover the underlying exception (a RoutexError subclass mapped from the server's typed error response, see Errors; RoutexClientError.MalformedResponse; AuthenticatedDecodeError; or an I/O exception).

Lifecycle

The supplied Executor (default ForkJoinPool.commonPool) backs every emitted future. close cancels the underlying coroutine scope: in-flight futures complete exceptionally with CancellationException, and subsequent calls return failed futures. Instances are safe to share across threads.

Constructors

Link copied to clipboard
constructor(baseUrl: Url = DEFAULT_BASE_URL, httpTransport: HttpTransport = defaultHttpTransport(), executor: Executor = ForkJoinPool.commonPool())

Construct a client.

constructor(baseUrl: String, httpTransport: HttpTransport = defaultHttpTransport(), executor: Executor = ForkJoinPool.commonPool())

Convenience overload that parses baseUrl as a Ktor Url.

Properties

Link copied to clipboard

Trace identifier returned with the most recent request, if any.

Functions

Link copied to clipboard
fun accounts(ticket: Ticket.Accounts, credentials: Credentials, fields: List<AccountField<*>>, filter: AccountFilter? = null, session: Session? = null, recurringConsents: Boolean = false): CompletableFuture<Response<AccountsResult>>

Invoke the accounts service: list accounts (and selected fields) reachable through credentials.

Link copied to clipboard
fun balances(ticket: Ticket.Balances, credentials: Credentials, accounts: List<AccountReference>, session: Session? = null, recurringConsents: Boolean = false): CompletableFuture<Response<BalancesResult>>

Invoke the balances service: fetch current balances for accounts.

Link copied to clipboard
open override fun close()

Cancel in-flight futures and release the underlying coroutine scope.

Link copied to clipboard
fun collectPayment(ticket: Ticket.CollectPayment, credentials: Credentials, account: DebtorAccountReference? = null, session: Session? = null, recurringConsents: Boolean = false): CompletableFuture<Response<CollectPaymentResult>>

Invoke the collect-payment service: identify the debtor and prepare a payment-initiation flow.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Fetch metadata for a single service connection.

Link copied to clipboard
fun registerRedirectUri(ticket: Ticket, handle: String, redirectUriValue: String): CompletableFuture<String>

Finalize a Response.RedirectHandle by registering redirectUriValue as the landing URI for handle.

Link copied to clipboard

Continue an accounts flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a balances flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a collect-payment flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a transactions flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard

Continue a transfer flow by submitting the user's answer to a Response.Dialog.

Link copied to clipboard
fun search(ticket: Ticket, filters: List<SearchFilter>, ibanDetection: Boolean = false, limit: Int? = null, details: List<ConnectionDetails> = emptyList()): CompletableFuture<List<ConnectionInfo>>

Search for service connections (banks and other providers).

Link copied to clipboard

Set the redirect URI for subsequent service requests, or pass null to clear it.

Link copied to clipboard

Authenticated TEE system version learned during settlement of ticket's key-settlement session.

Link copied to clipboard
fun trace(ticket: Ticket, traceId: TraceId): CompletableFuture<String>

Retrieve raw trace data for a traceId emitted by a prior request.

Link copied to clipboard
fun transactions(ticket: Ticket.Transactions, credentials: Credentials, session: Session? = null, recurringConsents: Boolean = false): CompletableFuture<Response<TransactionsResult>>

Invoke the transactions service: fetch the booked-and-pending transaction list authorized by credentials.

Link copied to clipboard
fun transfer(ticket: Ticket.Transfer, credentials: Credentials, product: PaymentProduct, details: List<TransferDetails>, debtorAccount: AccountReference? = null, debtorName: String? = null, requestedExecutionDate: IsoDateTimeOrDate? = null, session: Session? = null, recurringConsents: Boolean = false): CompletableFuture<Response<TransferResult>>

Invoke the transfer service: initiate a credit transfer for product with the given details.