/* This file is part of GNU Taler (C) 2022 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ declare module "*.css" { const mapping: Record; export default mapping; } declare module "*.svg" { const content: any; export default content; } declare module "*.jpeg" { const content: any; export default content; } declare module "*.png" { const content: any; export default content; } /********************************************** * Type definitions for states and API calls. * *********************************************/ /** * Request body of POST /transactions. * * If the amount appears twice: both as a Payto parameter and * in the JSON dedicate field, the one on the Payto URI takes * precedence. */ interface TransactionRequestType { paytoUri: string; amount?: string; // with currency. } /** * Request body of /register. */ interface CredentialsRequestType { username?: string; password?: string; repeatPassword?: string; } /** * Request body of /register. */ // interface LoginRequestType { // username: string; // password: string; // } interface WireTransferRequestType { iban?: string; subject?: string; amount?: string; } type HashCode = string; type EddsaPublicKey = string; type EddsaSignature = string; type WireTransferIdentifierRawP = string; type RelativeTime = Duration; type ImageDataUrl = string; interface WithId { id: string; } interface Timestamp { // Milliseconds since epoch, or the special // value "forever" to represent an event that will // never happen. t_s: number | "never"; } interface Duration { d_us: number | "forever"; } interface WithId { id: string; } type Amount = string; type UUID = string; type Integer = number; namespace SandboxBackend { export interface Config { // Name of this API, always "circuit". name: string; // API version in the form $n:$n:$n version: string; // Contains ratios and fees related to buying // and selling the circuit currency. ratios_and_fees: RatiosAndFees; } interface RatiosAndFees { // Exchange rate to buy the circuit currency from fiat. buy_at_ratio: number; // Exchange rate to sell the circuit currency for fiat. sell_at_ratio: number; // Fee to subtract after applying the buy ratio. buy_in_fee: number; // Fee to subtract after applying the sell ratio. sell_out_fee: number; } export interface SandboxError { error?: SandboxErrorDetail; } interface SandboxErrorDetail { // String enum classifying the error. type: ErrorType; // Human-readable error description. description: string; } enum ErrorType { /** * This error can be related to a business operation, * a non-existent object requested by the client, or * even when the bank itself fails. */ SandboxError = "sandbox-error", /** * It is the error type thrown by helper functions * from the Util library. Those are used by both * Sandbox and Nexus, therefore the actual meaning * must be carried by the error 'message' field. */ UtilError = "util-error", } type EmailAddress = string; type PhoneNumber = string; namespace CoreBank { interface BankAccountCreateWithdrawalRequest { // Amount to withdraw. amount: Amount; } interface BankAccountCreateWithdrawalResponse { // ID of the withdrawal, can be used to view/modify the withdrawal operation. withdrawal_id: string; // URI that can be passed to the wallet to initiate the withdrawal. taler_withdraw_uri: string; } interface BankAccountGetWithdrawalResponse { // Amount that will be withdrawn with this withdrawal operation. amount: Amount; // Was the withdrawal aborted? aborted: boolean; // Has the withdrawal been confirmed by the bank? // The wire transfer for a withdrawal is only executed once // both confirmation_done is true and selection_done is true. confirmation_done: boolean; // Did the wallet select reserve details? selection_done: boolean; // Reserve public key selected by the exchange, // only non-null if selection_done is true. selected_reserve_pub: string | null; // Exchange account selected by the wallet, or by the bank // (with the default exchange) in case the wallet did not provide one // through the Integration API. selected_exchange_account: string | null; } interface BankAccountTransactionsResponse { transactions: BankAccountTransactionInfo[]; } interface BankAccountTransactionInfo { creditor_payto_uri: string; debtor_payto_uri: string; amount: Amount; direction: "debit" | "credit"; subject: string; // Transaction unique ID. Matches // $transaction_id from the URI. row_id: number; date: Timestamp; } interface CreateBankAccountTransactionCreate { // Address in the Payto format of the wire transfer receiver. // It needs at least the 'message' query string parameter. payto_uri: string; // Transaction amount (in the $currency:x.y format), optional. // However, when not given, its value must occupy the 'amount' // query string parameter of the 'payto' field. In case it // is given in both places, the paytoUri's takes the precedence. amount?: string; } interface RegisterAccountRequest { // Username username: string; // Password. password: string; // Legal name of the account owner name: string; // Defaults to false. is_public?: boolean; // Is this a taler exchange account? // If true: // - incoming transactions to the account that do not // have a valid reserve public key are automatically // - the account provides the taler-wire-gateway-api endpoints // Defaults to false. is_taler_exchange?: boolean; // Addresses where to send the TAN for transactions. // Currently only used for cashouts. // If missing, cashouts will fail. // In the future, might be used for other transactions // as well. challenge_contact_data?: ChallengeContactData; // 'payto' address pointing a bank account // external to the libeufin-bank. // Payments will be sent to this bank account // when the user wants to convert the local currency // back to fiat currency outside libeufin-bank. cashout_payto_uri?: string; // Internal payto URI of this bank account. // Used mostly for testing. internal_payto_uri?: string; } interface ChallengeContactData { // E-Mail address email?: EmailAddress; // Phone number. phone?: PhoneNumber; } interface AccountReconfiguration { // Addresses where to send the TAN for transactions. // Currently only used for cashouts. // If missing, cashouts will fail. // In the future, might be used for other transactions // as well. challenge_contact_data?: ChallengeContactData; // 'payto' address pointing a bank account // external to the libeufin-bank. // Payments will be sent to this bank account // when the user wants to convert the local currency // back to fiat currency outside libeufin-bank. cashout_address?: string; // Legal name associated with $username. // When missing, the old name is kept. name?: string; // If present, change the is_exchange configuration. // See RegisterAccountRequest is_exchange?: boolean; } interface AccountPasswordChange { // New password. new_password: string; } interface PublicAccountsResponse { public_accounts: PublicAccount[]; } interface PublicAccount { payto_uri: string; balance: Balance; // The account name (=username) of the // libeufin-bank account. account_name: string; } interface ListBankAccountsResponse { accounts: AccountMinimalData[]; } interface Balance { amount: Amount; credit_debit_indicator: "credit" | "debit"; } interface AccountMinimalData { // Username username: string; // Legal name of the account owner. name: string; // current balance of the account balance: Balance; // Number indicating the max debit allowed for the requesting user. debit_threshold: Amount; } interface AccountData { // Legal name of the account owner. name: string; // Available balance on the account. balance: Balance; // payto://-URI of the account. payto_uri: string; // Number indicating the max debit allowed for the requesting user. debit_threshold: Amount; contact_data?: ChallengeContactData; // 'payto' address pointing the bank account // where to send cashouts. This field is optional // because not all the accounts are required to participate // in the merchants' circuit. One example is the exchange: // that never cashouts. Registering these accounts can // be done via the access API. cashout_payto_uri?: string; } } namespace Circuit { interface CircuitAccountRequest { // Username username: string; // Password. password: string; // Addresses where to send the TAN. If // this field is missing, then the cashout // won't succeed. contact_data: CircuitContactData; // Legal subject owning the account. name: string; // 'payto' address pointing the bank account // where to send payments, in case the user // wants to convert the local currency back // to fiat. cashout_address: string; // IBAN of this bank account, which is therefore // internal to the circuit. Randomly generated, // when it is not given. internal_iban?: string; } interface CircuitContactData { // E-Mail address email?: string; // Phone number. phone?: string; } interface CircuitAccountReconfiguration { // Addresses where to send the TAN. contact_data: CircuitContactData; // 'payto' address pointing the bank account // where to send payments, in case the user // wants to convert the local currency back // to fiat. cashout_address: string; } interface AccountPasswordChange { // New password. new_password: string; } interface CircuitAccounts { customers: CircuitAccountMinimalData[]; } interface CircuitAccountMinimalData { // Username username: string; // Legal subject owning the account. name: string; // current balance of the account balance: Balance; } interface CircuitAccountData { // Username username: string; // IBAN hosted at Libeufin Sandbox iban: string; contact_data: CircuitContactData; // Legal subject owning the account. name: string; // 'payto' address pointing the bank account // where to send cashouts. cashout_address: string; } interface CashoutEstimate { // Amount that the user will get deducted from their regional // bank account, according to the 'amount_credit' value. amount_debit: Amount; // Amount that the user will receive in their fiat // bank account, according to 'amount_debit'. amount_credit: Amount; } interface CashoutRequest { // Optional subject to associate to the // cashout operation. This data will appear // as the incoming wire transfer subject in // the user's external bank account. subject?: string; // That is the plain amount that the user specified // to cashout. Its $currency is the circuit currency. amount_debit: Amount; // That is the amount that will effectively be // transferred by the bank to the user's bank // account, that is external to the circuit. // It is expressed in the fiat currency and // is calculated after the cashout fee and the // exchange rate. See the /cashout-rates call. amount_credit: Amount; // Which channel the TAN should be sent to. If // this field is missing, it defaults to SMS. // The default choice prefers to change the communication // channel respect to the one used to issue this request. tan_channel?: TanChannel; } interface CashoutPending { // UUID identifying the operation being created // and now waiting for the TAN confirmation. uuid: string; } interface CashoutConfirm { // the TAN that confirms $cashoutId. tan: string; } interface Config { // Name of this API, always "circuit". name: string; // API version in the form $n:$n:$n version: string; // Contains ratios and fees related to buying // and selling the circuit currency. ratios_and_fees: RatiosAndFees; // Fiat currency. That is the currency in which // cash-out operations ultimately wire money. fiat_currency: string; } interface RatiosAndFees { // Exchange rate to buy the circuit currency from fiat. buy_at_ratio: float; // Exchange rate to sell the circuit currency for fiat. sell_at_ratio: float; // Fee to subtract after applying the buy ratio. buy_in_fee: float; // Fee to subtract after applying the sell ratio. sell_out_fee: float; } interface Cashouts { // Every string represents a cash-out operation UUID. cashouts: string[]; } interface CashoutStatusResponse { status: CashoutStatus; // Amount debited to the circuit bank account. amount_debit: Amount; // Amount credited to the external bank account. amount_credit: Amount; // Transaction subject. subject: string; // Circuit bank account that created the cash-out. account: string; // Fiat bank account that will receive the cashed out amount. cashout_address: string; // Ratios and fees related to this cash-out at the time // when the operation was created. ratios_and_fees: RatiosAndFees; // Time when the cash-out was created. creation_time: number; // milliseconds since the Unix epoch // Time when the cash-out was confirmed via its TAN. // Missing or null, when the operation wasn't confirmed yet. confirmation_time?: number | null; // milliseconds since the Unix epoch } type CashoutStatusResponseWithId = CashoutStatusResponse & { id: string }; } } declare const __VERSION__: string; declare const __GIT_HASH__: string;