1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
/*
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 <http://www.gnu.org/licenses/>
*/
declare module "*.css" {
const mapping: Record<string, string>;
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;
interface Balance {
amount: Amount;
credit_debit_indicator: "credit" | "debit";
}
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",
}
namespace Access {
interface PublicAccountsResponse {
publicAccounts: PublicAccount[];
}
interface PublicAccount {
iban: string;
balance: string;
// The account name _and_ the username of the
// Sandbox customer that owns such a bank account.
accountLabel: string;
}
interface BankAccountBalanceResponse {
// Available balance on the account.
balance: Balance;
// payto://-URI of the account. (New)
paytoUri: string;
// Number indicating the max debit allowed for the requesting user.
debitThreshold: Amount;
}
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 {
creditorIban: string;
creditorBic: string; // Optional
creditorName: string;
debtorIban: string;
debtorBic: string;
debtorName: string;
amount: number;
currency: string;
subject: string;
// Transaction unique ID. Matches
// $transaction_id from the URI.
uid: string;
direction: "DBIT" | "CRDT";
date: string; // milliseconds since the Unix epoch
}
interface CreateBankAccountTransactionCreate {
// Address in the Payto format of the wire transfer receiver.
// It needs at least the 'message' query string parameter.
paytoUri: 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 BankRegistrationRequest {
username: string;
password: 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 };
}
}
|