import type { AccountField, AccountFilter, ConnectionDetails, ConnectionInfo, SearchFilter } from "./models"; export { AccountField, AccountStatus, AccountType, ConnectionDetails, SupportedService, AccessExceededException, CanceledException, InterruptErrorException, InvalidCredentialsException, NotFoundException, PaymentFailedException, PaymentFailedCode, PeriodOutOfBoundsException, ProviderErrorException, ProviderErrorCode, RequestException, ResponseException, ServiceBlockedException, ServiceBlockedCode, TicketException, TicketExceptionCode, UnauthorizedException, UnexpectedErrorException, UnexpectedValueException, UnsupportedProductException, UnsupportedProductReason, } from "./models"; export type { CredentialsModel, ConnectionInfo, SearchFilter, AccountFilter, } from "./models"; export interface ConfirmationOptions { ticket: string; context: Uint8Array; } export interface ResponseOptions { ticket: string; context: Uint8Array; response: string; } interface CredentialsOptions { credentials: Credentials; recurringConsents?: boolean; session?: Uint8Array; ticket: string; } type AccessOptions = (CredentialsOptions & { connectionData?: never; }) | { connectionData: Uint8Array; credentials?: never; recurringConsents?: never; session?: Uint8Array; ticket: string; }; export type AccountsOptions = AccessOptions & { fields: AccountField[]; filter?: AccountFilter; }; export type BalancesOptions = AccessOptions & { accounts: AccountReference[]; }; export type TransactionsOptions = AccessOptions; export interface CollectPaymentOptions extends CredentialsOptions { account?: { iban: string; currency?: string; } | { encryptedIban: Uint8Array | string; currency?: string; }; } export interface TransferOptions extends CredentialsOptions { product: PaymentProduct; debtorAccount?: { iban: string; currency?: string; }; debtorName?: string; requestedExecutionDate?: Date; details: { endToEndIdentification?: string; amount: { /** * Decimal amount, e.g. "123.45". */ amount: string | number; /** * ISO 4217 Alpha 3 currency code. */ currency: string; }; creditorAccount: { iban: string; }; creditorAgentBic?: string; creditorName: string; creditorAddress?: { townName: string; /** * ISO 3166-1 ALPHA-2 country code. */ country: string; }; remittance?: string; chargeBearer?: ChargeBearer; }[]; } type AccountReference = { iban: string; currency?: string; } | { number: string; currency?: string; }; export declare enum PaymentProduct { /** * SEPA Credit Transfer (SCT) in EUR */ SepaCreditTransfer = "SEPA_CREDIT_TRANSFER", /** * SEPA Instant Credit Transfer (SCT Inst) in EUR */ SepaInstantCreditTransfer = "SEPA_INSTANT_CREDIT_TRANSFER", /** * Default SEPA Credit Transfer in EUR * * Tries SCT Inst with a fallback to SCT if this is supported. * Otherwise, SCT is used. */ DefaultSepaCreditTransfer = "DEFAULT_SEPA_CREDIT_TRANSFER", /** * International credit transfer outside of SEPA (typically SWIFT) */ CrossBorderCreditTransfer = "CROSS_BORDER_CREDIT_TRANSFER", /** * Domestic credit transfer in the domestic, non-EUR currency */ DomesticCreditTransfer = "DOMESTIC_CREDIT_TRANSFER", /** * Instant domestic credit transfer in the domestic, non-EUR currency */ DomesticInstantCreditTransfer = "DOMESTIC_INSTANT_CREDIT_TRANSFER" } export declare enum ChargeBearer { BorneByDebtor = "DEBT", BorneByCreditor = "CRED", Shared = "SHAR", FollowingServiceLevel = "SLEV" } export interface Credentials { connectionId: string; userId?: string; password?: string; connectionData?: Uint8Array; } /** * Response from YAXI Open Banking services. * * The response either carries an authenticated Result * or an interrupt (i.e. a dialog or redirect for the user). */ export declare class OBResponse { private _json; static fromJSON(json: ResultJSON | DialogJSON | RedirectJSON | RedirectHandleJSON): OBResponse; protected constructor(json: ResultJSON | DialogJSON | RedirectJSON | RedirectHandleJSON); toJSON(): ResultJSON | DialogJSON | RedirectJSON | RedirectHandleJSON; } type ResultJSON = { Result: [string, string?, string?]; }; /** * Data returned by YAXI Open Banking services, authenticated with an HMAC * * jwt can be used for transfer to a remote system as JSON Web Token {@link https://jwt.io/}. * The remote system can verify and read the data from the "data" claim. * To read the data locally, the frontend can decode the JWT without verification. * * Besides the value itself, it contains a timestamp and a ticket identifier * (bound to known input parameters and service type). */ export declare class Result extends OBResponse { readonly jwt: string; readonly session?: Uint8Array; readonly connectionData?: Uint8Array; static fromJSON(json: ResultJSON): Result; private constructor(); } /** * Context of a user dialog. */ export declare enum DialogContext { /** * SCA or TAN process. * * There are multiple cases, distinguishable by the input: * - {@link Confirmation}: Decoupled process (e.g. confirmation in a SCA app). * - {@link Selection}: TAN method selection. * - {@link Field}: TAN entry. */ Sca = "SCA", /** * Account selection. * * A {@link Selection} gets returned with this context when an account has to be selected. * Note that there might be just a single option that may be chosen automatically without user interaction. */ Accounts = "ACCOUNTS", /** * Pending redirect confirmation. * * A {@link Confirmation} gets returned with this context when a redirect got confirmed but no result is known yet. */ Redirect = "REDIRECT", /** * Pending SCT Inst payment. * * A {@link Confirmation} gets returned with this context when an SCT Inst payment has been initialized and not reached the final status yet. */ PaymentStatus = "PAYMENT_STATUS", /** * Verification of Payee confirmation. * * A {@link Confirmation} gets returned with this context when an explicit confirmation of the creditor is required due to a name mismatch. * Note that this confirmation has legal implications, releasing the bank from liabilities in case of the transfer to an unintended receiver due to incorrect creditor data. */ VopConfirmation = "VOP_CONFIRMATION", /** * Pending Verification of Payee check. * A {@link Confirmation} gets returned with this context when a Verification of Payee check is still pending. */ VopCheck = "VOP_CHECK" } /** * Image data for a dialog. */ export interface Image { mimeType: string; /** * Binary data in the format defined by mimeType. */ data: Uint8Array; /** * HHD_UC data block * * In cases where the ASPSP provides HHD_UC data for optical coupling with a HandHeld-Device * for the generation of an OTP, especially for an HHD_OPT animated graphic, the raw HHD_UC * data stream is provided here. * * The publicly available document "HandHeld-Device (HHD) for the generation of an OTP HHD * enhancement for optical interfaces" describes how to implement the animated graphic for * HHD_OPT in section C. data provides a pre-rendered animated GIF * to be presented with a width of 62.5 mm. */ hhdUcData?: Uint8Array; } /** * Just a primary action to confirm the dialog. */ export declare class Confirmation { /** * Context object that can be used to confirm the dialog. */ context: Uint8Array; /** * If polling is acceptable, a delay in seconds is specified for which the client has to wait before automatically confirming. */ pollingDelaySecs?: number; } /** * A selection of options the user can choose from. */ export declare class Selection { /** * Options are meant to be rendered e.g. as radio buttons where the user must select exactly * one to for a confirmation button to get enabled. Another example for an implementation is * one button per option that immediately confirms the selection. */ options: Array<{ key: string; label: string; explanation?: string; }>; /** * Context object that can be used to respond to the dialog. */ context: Uint8Array; } /** * An input field. */ export declare class Field { /** * Type that may be used for showing hints or dedicated keyboard layouts and for applying input restrictions or validation. */ type: InputType; /** * Indicates if the input should be masked. */ secrecyLevel: SecrecyLevel; /** * Minimal length to allow. */ minLength?: number; /** * Maximum length to allow. */ maxLength?: number; /** * Context object that can be used to respond to the dialog. */ context: Uint8Array; } /** * Type of an input field. */ export declare enum InputType { Date = "DATE", Email = "EMAIL", Number = "NUMBER", Phone = "PHONE", Text = "TEXT" } /** * Level of secrecy for an input field. */ export declare enum SecrecyLevel { /** * The data is not a secret. */ Plain = "PLAIN", /** * The data is a one-time password. This can usually be treated as * no secret but the implementer might still choose to mask the input. */ Otp = "OTP", /** * The data is a secret password. Input must be masked. */ Password = "PASSWORD" } type DialogJSON = { Dialog: { context?: string; message?: string; image: { mimeType: string; data: string; hhdUcData?: string; }; input: { Confirmation: { context: string; pollingDelaySecs?: number; }; } | { Selection: { options: [{ key: string; label: string; explanation?: string; }]; context: string; }; } | { Field: { type: string; secrecyLevel: string; minLength?: number; maxLength?: number; context: string; }; }; }; }; /** * User dialog. * * This is meant to be displayed as a dialog in some User Interface and consists of: * * - A way to cancel the dialog (typically an X symbol and / or a "Cancel" button). * - The display part: * - The message. * - An optional image. * - The interactive part defined by the input. * * The input contains a context for continuing the * process at the service that issued the dialog object. */ export declare class Dialog extends OBResponse { readonly context?: DialogContext; readonly message?: string; readonly image?: Image; /** * Data defining the interactive part of a user dialog. */ readonly input: Confirmation | Selection | Field; static fromJSON(json: DialogJSON): Dialog; private constructor(); } type RedirectJSON = { Redirect: { url: string; context: string; }; }; /** * User redirect. * * The user is meant to get sent to the url and the context can * be used for continuing the process at the service that issued the redirect object afterward. * * A web application needs to direct the user agent to the returned URL. * A desktop or mobile application could either open it in a browser or inside an element like a WebView. */ export declare class Redirect extends OBResponse { readonly url: URL; readonly context: Uint8Array; static fromJSON(json: RedirectJSON): Redirect; private constructor(); } type RedirectHandleJSON = { RedirectHandle: { handle: string; context: string; }; }; /** * Incomplete user redirect. * * A final redirect URI needs to get registered, using the handle, to receive the URL to send the user to. */ export declare class RedirectHandle extends OBResponse { readonly handle: string; readonly context: Uint8Array; static fromJSON(json: RedirectHandleJSON): RedirectHandle; private constructor(); } export type RoutexClientOptions = URL | { url?: URL; retryPolicyFactory?: () => RetryPolicy; }; export declare class RoutexClient { private _core; constructor(options?: RoutexClientOptions); /** * System version for the currently established session */ systemVersion(ticketId: string): string | undefined; /** * Search for service connections (banks and other providers) * * The result is a list of connections that match all the {@link SearchFilter}s. * If IBAN detection is enabled and the first value of a term filter is detected * to be a possible prefix of an IBAN that contains a national bank code, * the result might contain additional connections that match that bank code. */ search(options: { ticket: string; filters: SearchFilter[]; ibanDetection?: boolean; limit?: number; details?: ConnectionDetails[]; }): Promise; /** * Get information for a service connection */ info(ticket: string, connectionId: string): Promise; /** * Trace identifier returned with the last request */ traceId(): Uint8Array | undefined; /** * Retrieve trace data */ trace(ticket: string, traceId: Uint8Array): Promise; /** * Set a redirect URI for subsequent service requests. * * Redirects will eventually forward to that URI. * It can be used to redirect back to a web application or to jump * back into the context of a desktop or mobile application. * If no redirect URI is set, {@link RedirectHandle}s will get returned instead of {@link Redirect}s. */ setRedirectUri(redirectUri: string): void; /** * Register a redirect URI for a given redirect handle. * * Returns the URL that the user is meant to get sent to. */ registerRedirectUri({ ticket, handle, redirectUri, }: { ticket: string; handle: string; redirectUri: string; }): Promise; private _respond; private _confirm; /** * [Accounts service]{@link https://docs.yaxi.tech/accounts.html} */ accounts({ credentials, connectionData, session, recurringConsents, ticket, fields, filter, }: AccountsOptions): Promise; /** * Respond to {@link Dialog} returned while fetching accounts */ respondAccounts(options: ResponseOptions): Promise; /** * Confirm {@link Dialog} or {@link Redirect} returned while fetching accounts */ confirmAccounts(options: ConfirmationOptions): Promise; /** * [Balances service]{@link https://docs.yaxi.tech/balances.html} */ balances({ credentials, connectionData, session, recurringConsents, ticket, accounts, }: BalancesOptions): Promise; /** * Respond to {@link Dialog} returned while fetching balances */ respondBalances(options: ResponseOptions): Promise; /** * Confirm {@link Dialog} or {@link Redirect} returned while fetching balances */ confirmBalances(options: ConfirmationOptions): Promise; /** * [Transactions service]{@link https://docs.yaxi.tech/transactions.html} */ transactions({ credentials, connectionData, session, recurringConsents, ticket, }: TransactionsOptions): Promise; /** * Respond to {@link Dialog} returned while fetching transactions */ respondTransactions(options: ResponseOptions): Promise; /** * Confirm {@link Dialog} or {@link Redirect} returned while fetching transactions */ confirmTransactions(options: ConfirmationOptions): Promise; /** * [Collect Payment service]{@link https://docs.yaxi.tech/collect-payment.html} */ collectPayment({ credentials, session, recurringConsents, ticket, account, }: CollectPaymentOptions): Promise; /** * Respond to {@link Dialog} returned while initiating the payment */ respondCollectPayment(options: ResponseOptions): Promise; /** * Confirm {@link Dialog} or {@link Redirect} returned initiating the payment */ confirmCollectPayment(options: ConfirmationOptions): Promise; /** * [Transfer service]{@link https://docs.yaxi.tech/transfer.html} */ transfer({ credentials, session, recurringConsents, ticket, product, debtorAccount, debtorName, requestedExecutionDate, details, }: TransferOptions): Promise; /** * Respond to {@link Dialog} returned while initiating the transfer */ respondTransfer(options: ResponseOptions): Promise; /** * Confirm {@link Dialog} or {@link Redirect} returned initiating the transfer */ confirmTransfer(options: ConfirmationOptions): Promise; } /** * A policy to determine whether a failed operation should be retried. Gets * passed the error which caused the operation to fail and should return a * `Promise` that resolves to `true` if the request should be retried. * Implementations can wait for some time before resolving the `Promise` to add * a wait time between retries. */ export type RetryPolicy = (error: unknown) => Promise; /** * A `RetryPolicy` that allows `maxTimes` retries if a `RequestException` * occurred. Doesn't wait any time, but instantly returns. */ export declare function retryRequestExceptionNTimesPolicy(maxTimes: number): RetryPolicy; export declare const _testing: { [Key: string]: unknown; };