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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
|
import { deprecate } from "util";
import { codecForAmountString } from "../amounts.js";
import {
Codec,
buildCodecForObject,
buildCodecForUnion,
codecForAny,
codecForBoolean,
codecForConstNumber,
codecForConstString,
codecForEither,
codecForList,
codecForMap,
codecForNumber,
codecForString,
codecOptional,
} from "../codec.js";
import { PaytoString, codecForPaytoString } from "../payto.js";
import {
AmountString,
InternationalizedString,
codecForInternationalizedString,
codecForLocation,
} from "../taler-types.js";
import { TalerUriString, codecForTalerUriString } from "../taleruri.js";
import {
AbsoluteTime,
TalerProtocolDuration,
TalerProtocolTimestamp,
codecForAbsoluteTime,
codecForDuration,
codecForTimestamp,
} from "../time.js";
export type UserAndPassword = {
username: string;
password: string;
};
export type UserAndToken = {
username: string;
token: AccessToken;
};
declare const opaque_OfficerAccount: unique symbol;
export type LockedAccount = string & { [opaque_OfficerAccount]: true };
declare const opaque_OfficerId: unique symbol;
export type OfficerId = string & { [opaque_OfficerId]: true };
declare const opaque_OfficerSigningKey: unique symbol;
export type SigningKey = Uint8Array & { [opaque_OfficerSigningKey]: true };
export interface OfficerAccount {
id: OfficerId;
signingKey: SigningKey;
}
export type PaginationParams = {
/**
* row identifier as the starting point of the query
*/
offset?: string;
/**
* max number of element in the result response
* always greater than 0
*/
limit?: number;
/**
* order
*/
order?: "asc" | "dec";
};
export type LongPollParams = {
/**
* milliseconds the server should wait for at least one result to be shown
*/
timeoutMs?: number;
};
///
/// HASH
///
// 64-byte hash code.
type HashCode = string;
type PaytoHash = string;
type AmlOfficerPublicKeyP = string;
// 32-byte hash code.
type ShortHashCode = string;
// 16-byte salt.
type WireSalt = string;
type SHA256HashCode = ShortHashCode;
type SHA512HashCode = HashCode;
// 32-byte nonce value, must only be used once.
type CSNonce = string;
// 32-byte nonce value, must only be used once.
type RefreshMasterSeed = string;
// 32-byte value representing a point on Curve25519.
type Cs25519Point = string;
// 32-byte value representing a scalar multiplier
// for scalar operations on points on Curve25519.
type Cs25519Scalar = string;
///
/// KEYS
///
// 16-byte access token used to authorize access.
type ClaimToken = string;
// EdDSA and ECDHE public keys always point on Curve25519
// and represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type EddsaPublicKey = string;
// EdDSA and ECDHE public keys always point on Curve25519
// and represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type EddsaPrivateKey = string;
// Edx25519 public keys are points on Curve25519 and represented using the
// standard 256 bits Ed25519 compact format converted to Crockford
// Base32.
type Edx25519PublicKey = string;
// Edx25519 private keys are always points on Curve25519
// and represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type Edx25519PrivateKey = string;
// EdDSA and ECDHE public keys always point on Curve25519
// and represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type EcdhePublicKey = string;
// Point on Curve25519 represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type CsRPublic = string;
// EdDSA and ECDHE public keys always point on Curve25519
// and represented using the standard 256 bits Ed25519 compact format,
// converted to Crockford Base32.
type EcdhePrivateKey = string;
type CoinPublicKey = EddsaPublicKey;
// RSA public key converted to Crockford Base32.
type RsaPublicKey = string;
type Integer = number;
type WireTransferIdentifierRawP = string;
// Subset of numbers: Integers in the
// inclusive range 0 .. (2^53 - 1).
type SafeUint64 = number;
// The string must be a data URL according to RFC 2397
// with explicit mediatype and base64 parameters.
//
// data:<mediatype>;base64,<data>
//
// Supported mediatypes are image/jpeg and image/png.
// Invalid strings will be rejected by the wallet.
type ImageDataUrl = string;
type WadId = string;
type Timestamp = TalerProtocolTimestamp;
type RelativeTime = TalerProtocolDuration;
export interface LoginToken {
token: AccessToken;
expiration: Timestamp;
}
declare const __ac_token: unique symbol;
/**
* Use `createAccessToken(string)` function to build one.
*/
export type AccessToken = string & {
[__ac_token]: true;
};
/**
* Create a rfc8959 access token.
* Adds secret-token: prefix if there is none.
*
* @deprecated use createRFC8959AccessToken
* @param token
* @returns
*/
export function createAccessToken(token: string): AccessToken {
return (
token.startsWith("secret-token:") ? token : `secret-token:${encodeURIComponent(token)}`
) as AccessToken;
}
/**
* Create a rfc8959 access token.
* Adds secret-token: prefix if there is none.
*
* @param token
* @returns
*/
export function createRFC8959AccessToken(token: string): AccessToken {
return (
token.startsWith("secret-token:") ? token : `secret-token:${encodeURIComponent(token)}`
) as AccessToken;
}
/**
* Convert string to access token.
*
* @param clientSecret
* @returns
*/
export function createClientSecretAccessToken(
clientSecret: string,
): AccessToken {
return clientSecret as AccessToken;
}
declare const __officer_signature: unique symbol;
export type OfficerSignature = string & {
[__officer_signature]: true;
};
export namespace TalerAuthentication {
export interface TokenRequest {
// Service-defined scope for the token.
// Typical scopes would be "readonly" or "readwrite".
scope: string;
// Server may impose its own upper bound
// on the token validity duration
duration?: RelativeTime;
// Is the token refreshable into a new token during its
// validity?
// Refreshable tokens effectively provide indefinite
// access if they are refreshed in time.
refreshable?: boolean;
}
export interface TokenSuccessResponse {
// Expiration determined by the server.
// Can be based on the token_duration
// from the request, but ultimately the
// server decides the expiration.
expiration: Timestamp;
// Opque access token.
access_token: AccessToken;
}
export interface TokenSuccessResponseMerchant {
// Expiration determined by the server.
// Can be based on the token_duration
// from the request, but ultimately the
// server decides the expiration.
expiration: Timestamp;
// Opque access token.
token: AccessToken;
}
}
// DD51 https://docs.taler.net/design-documents/051-fractional-digits.html
export interface CurrencySpecification {
// Name of the currency.
name: string;
// how many digits the user may enter after the decimal_separator
num_fractional_input_digits: Integer;
// Number of fractional digits to render in normal font and size.
num_fractional_normal_digits: Integer;
// Number of fractional digits to render always, if needed by
// padding with zeros.
num_fractional_trailing_zero_digits: Integer;
// map of powers of 10 to alternative currency names / symbols, must
// always have an entry under "0" that defines the base name,
// e.g. "0 => €" or "3 => k€". For BTC, would be "0 => BTC, -3 => mBTC".
// Communicates the currency symbol to be used.
alt_unit_names: { [log10: string]: string };
}
//FIXME: implement this codec
export const codecForAccessToken = codecForString as () => Codec<AccessToken>;
export const codecForTokenSuccessResponse =
(): Codec<TalerAuthentication.TokenSuccessResponse> =>
buildCodecForObject<TalerAuthentication.TokenSuccessResponse>()
.property("access_token", codecForAccessToken())
.property("expiration", codecForTimestamp)
.build("TalerAuthentication.TokenSuccessResponse");
export const codecForTokenSuccessResponseMerchant =
(): Codec<TalerAuthentication.TokenSuccessResponseMerchant> =>
buildCodecForObject<TalerAuthentication.TokenSuccessResponseMerchant>()
.property("token", codecForAccessToken())
.property("expiration", codecForTimestamp)
.build("TalerAuthentication.TokenSuccessResponseMerchant");
export const codecForCurrencySpecificiation =
(): Codec<CurrencySpecification> =>
buildCodecForObject<CurrencySpecification>()
.property("name", codecForString())
.property("num_fractional_input_digits", codecForNumber())
.property("num_fractional_normal_digits", codecForNumber())
.property("num_fractional_trailing_zero_digits", codecForNumber())
.property("alt_unit_names", codecForMap(codecForString()))
.build("CurrencySpecification");
export const codecForIntegrationBankConfig =
(): Codec<TalerCorebankApi.IntegrationConfig> =>
buildCodecForObject<TalerCorebankApi.IntegrationConfig>()
.property("name", codecForConstString("taler-bank-integration"))
.property("version", codecForString())
.property("currency", codecForString())
.property("currency_specification", codecForCurrencySpecificiation())
.build("TalerCorebankApi.IntegrationConfig");
export const codecForCoreBankConfig = (): Codec<TalerCorebankApi.Config> =>
buildCodecForObject<TalerCorebankApi.Config>()
.property("name", codecForConstString("libeufin-bank"))
.property("version", codecForString())
.property("bank_name", codecForString())
.property("allow_conversion", codecForBoolean())
.property("allow_registrations", codecForBoolean())
.property("allow_deletions", codecForBoolean())
.property("allow_edit_name", codecForBoolean())
.property("allow_edit_cashout_payto_uri", codecForBoolean())
.property("default_debit_threshold", codecForAmountString())
.property("currency", codecForString())
.property("currency_specification", codecForCurrencySpecificiation())
.property(
"supported_tan_channels",
codecForList(
codecForEither(
codecForConstString(TalerCorebankApi.TanChannel.SMS),
codecForConstString(TalerCorebankApi.TanChannel.EMAIL),
),
),
)
.property("wire_type", codecForString())
.build("TalerCorebankApi.Config");
//FIXME: implement this codec
export const codecForURN = codecForString;
export const codecForExchangeConfigInfo =
(): Codec<TalerMerchantApi.ExchangeConfigInfo> =>
buildCodecForObject<TalerMerchantApi.ExchangeConfigInfo>()
.property("base_url", codecForString())
.property("currency", codecForString())
.property("master_pub", codecForString())
.build("TalerMerchantApi.ExchangeConfigInfo");
export const codecForMerchantConfig =
(): Codec<TalerMerchantApi.VersionResponse> =>
buildCodecForObject<TalerMerchantApi.VersionResponse>()
.property("name", codecForConstString("taler-merchant"))
.property("currency", codecForString())
.property("version", codecForString())
.property("currencies", codecForMap(codecForCurrencySpecificiation()))
.property("exchanges", codecForList(codecForExchangeConfigInfo()))
.build("TalerMerchantApi.VersionResponse");
export const codecForClaimResponse =
(): Codec<TalerMerchantApi.ClaimResponse> =>
buildCodecForObject<TalerMerchantApi.ClaimResponse>()
.property("contract_terms", codecForContractTerms())
.property("sig", codecForString())
.build("TalerMerchantApi.ClaimResponse");
export const codecForPaymentResponse =
(): Codec<TalerMerchantApi.PaymentResponse> =>
buildCodecForObject<TalerMerchantApi.PaymentResponse>()
.property("pos_confirmation", codecOptional(codecForString()))
.property("sig", codecForString())
.build("TalerMerchantApi.PaymentResponse");
export const codecForStatusPaid = (): Codec<TalerMerchantApi.StatusPaid> =>
buildCodecForObject<TalerMerchantApi.StatusPaid>()
.property("refund_amount", codecForAmountString())
.property("refund_pending", codecForBoolean())
.property("refund_taken", codecForAmountString())
.property("refunded", codecForBoolean())
.property("type", codecForConstString("paid"))
.build("TalerMerchantApi.StatusPaid");
export const codecForStatusGoto =
(): Codec<TalerMerchantApi.StatusGotoResponse> =>
buildCodecForObject<TalerMerchantApi.StatusGotoResponse>()
.property("public_reorder_url", codecForURL())
.property("type", codecForConstString("goto"))
.build("TalerMerchantApi.StatusGotoResponse");
export const codecForStatusStatusUnpaid =
(): Codec<TalerMerchantApi.StatusUnpaidResponse> =>
buildCodecForObject<TalerMerchantApi.StatusUnpaidResponse>()
.property("type", codecForConstString("unpaid"))
.property("already_paid_order_id", codecOptional(codecForString()))
.property("fulfillment_url", codecOptional(codecForString()))
.property("taler_pay_uri", codecForTalerUriString())
.build("TalerMerchantApi.PaymentResponse");
export const codecForPaidRefundStatusResponse =
(): Codec<TalerMerchantApi.PaidRefundStatusResponse> =>
buildCodecForObject<TalerMerchantApi.PaidRefundStatusResponse>()
.property("pos_confirmation", codecOptional(codecForString()))
.property("refunded", codecForBoolean())
.build("TalerMerchantApi.PaidRefundStatusResponse");
export const codecForMerchantAbortPayRefundSuccessStatus =
(): Codec<TalerMerchantApi.MerchantAbortPayRefundSuccessStatus> =>
buildCodecForObject<TalerMerchantApi.MerchantAbortPayRefundSuccessStatus>()
.property("exchange_pub", codecForString())
.property("exchange_sig", codecForString())
.property("exchange_status", codecForConstNumber(200))
.property("type", codecForConstString("success"))
.build("TalerMerchantApi.MerchantAbortPayRefundSuccessStatus");
export const codecForMerchantAbortPayRefundFailureStatus =
(): Codec<TalerMerchantApi.MerchantAbortPayRefundFailureStatus> =>
buildCodecForObject<TalerMerchantApi.MerchantAbortPayRefundFailureStatus>()
.property("exchange_code", codecForNumber())
.property("exchange_reply", codecForAny())
.property("exchange_status", codecForNumber())
.property("type", codecForConstString("failure"))
.build("TalerMerchantApi.MerchantAbortPayRefundFailureStatus");
export const codecForMerchantAbortPayRefundStatus =
(): Codec<TalerMerchantApi.MerchantAbortPayRefundStatus> =>
buildCodecForUnion<TalerMerchantApi.MerchantAbortPayRefundStatus>()
.discriminateOn("type")
.alternative("success", codecForMerchantAbortPayRefundSuccessStatus())
.alternative("failure", codecForMerchantAbortPayRefundFailureStatus())
.build("TalerMerchantApi.MerchantAbortPayRefundStatus");
export const codecForAbortResponse =
(): Codec<TalerMerchantApi.AbortResponse> =>
buildCodecForObject<TalerMerchantApi.AbortResponse>()
.property("refunds", codecForList(codecForMerchantAbortPayRefundStatus()))
.build("TalerMerchantApi.AbortResponse");
export const codecForWalletRefundResponse =
(): Codec<TalerMerchantApi.WalletRefundResponse> =>
buildCodecForObject<TalerMerchantApi.WalletRefundResponse>()
.property("merchant_pub", codecForString())
.property("refund_amount", codecForAmountString())
.property("refunds", codecForList(codecForMerchantCoinRefundStatus()))
.build("TalerMerchantApi.AbortResponse");
export const codecForMerchantCoinRefundSuccessStatus =
(): Codec<TalerMerchantApi.MerchantCoinRefundSuccessStatus> =>
buildCodecForObject<TalerMerchantApi.MerchantCoinRefundSuccessStatus>()
.property("type", codecForConstString("success"))
.property("coin_pub", codecForString())
.property("exchange_status", codecForConstNumber(200))
.property("exchange_sig", codecForString())
.property("rtransaction_id", codecForNumber())
.property("refund_amount", codecForAmountString())
.property("exchange_pub", codecForString())
.property("execution_time", codecForTimestamp)
.build("TalerMerchantApi.MerchantCoinRefundSuccessStatus");
export const codecForMerchantCoinRefundFailureStatus =
(): Codec<TalerMerchantApi.MerchantCoinRefundFailureStatus> =>
buildCodecForObject<TalerMerchantApi.MerchantCoinRefundFailureStatus>()
.property("type", codecForConstString("failure"))
.property("coin_pub", codecForString())
.property("exchange_status", codecForNumber())
.property("rtransaction_id", codecForNumber())
.property("refund_amount", codecForAmountString())
.property("exchange_code", codecOptional(codecForNumber()))
.property("exchange_reply", codecOptional(codecForAny()))
.property("execution_time", codecForTimestamp)
.build("TalerMerchantApi.MerchantCoinRefundFailureStatus");
export const codecForMerchantCoinRefundStatus =
(): Codec<TalerMerchantApi.MerchantCoinRefundStatus> =>
buildCodecForUnion<TalerMerchantApi.MerchantCoinRefundStatus>()
.discriminateOn("type")
.alternative("success", codecForMerchantCoinRefundSuccessStatus())
.alternative("failure", codecForMerchantCoinRefundFailureStatus())
.build("TalerMerchantApi.MerchantCoinRefundStatus");
export const codecForQueryInstancesResponse =
(): Codec<TalerMerchantApi.QueryInstancesResponse> =>
buildCodecForObject<TalerMerchantApi.QueryInstancesResponse>()
.property("name", codecForString())
.property("user_type", codecForString())
.property("email", codecOptional(codecForString()))
.property("website", codecOptional(codecForString()))
.property("logo", codecOptional(codecForString()))
.property("merchant_pub", codecForString())
.property("address", codecForLocation())
.property("jurisdiction", codecForLocation())
.property("use_stefan", codecForBoolean())
.property("default_wire_transfer_delay", codecForDuration)
.property("default_pay_delay", codecForDuration)
.property(
"auth",
buildCodecForObject<{
method: "external" | "token";
}>()
.property(
"method",
codecForEither(
codecForConstString("token"),
codecForConstString("external"),
),
)
.build("TalerMerchantApi.QueryInstancesResponse.auth"),
)
.build("TalerMerchantApi.QueryInstancesResponse");
export const codecForAccountKycRedirects =
(): Codec<TalerMerchantApi.AccountKycRedirects> =>
buildCodecForObject<TalerMerchantApi.AccountKycRedirects>()
.property(
"pending_kycs",
codecForList(codecForMerchantAccountKycRedirect()),
)
.property("timeout_kycs", codecForList(codecForExchangeKycTimeout()))
.build("TalerMerchantApi.AccountKycRedirects");
export const codecForMerchantAccountKycRedirect =
(): Codec<TalerMerchantApi.MerchantAccountKycRedirect> =>
buildCodecForObject<TalerMerchantApi.MerchantAccountKycRedirect>()
.property("kyc_url", codecForURL())
.property("aml_status", codecForNumber())
.property("exchange_url", codecForURL())
.property("payto_uri", codecForPaytoString())
.build("TalerMerchantApi.MerchantAccountKycRedirect");
export const codecForExchangeKycTimeout =
(): Codec<TalerMerchantApi.ExchangeKycTimeout> =>
buildCodecForObject<TalerMerchantApi.ExchangeKycTimeout>()
.property("exchange_url", codecForURL())
.property("exchange_code", codecForNumber())
.property("exchange_http_status", codecForNumber())
.build("TalerMerchantApi.ExchangeKycTimeout");
export const codecForAccountAddResponse =
(): Codec<TalerMerchantApi.AccountAddResponse> =>
buildCodecForObject<TalerMerchantApi.AccountAddResponse>()
.property("h_wire", codecForString())
.property("salt", codecForString())
.build("TalerMerchantApi.AccountAddResponse");
export const codecForAccountsSummaryResponse =
(): Codec<TalerMerchantApi.AccountsSummaryResponse> =>
buildCodecForObject<TalerMerchantApi.AccountsSummaryResponse>()
.property("accounts", codecForList(codecForBankAccountSummaryEntry()))
.build("TalerMerchantApi.AccountsSummaryResponse");
export const codecForBankAccountSummaryEntry =
(): Codec<TalerMerchantApi.BankAccountSummaryEntry> =>
buildCodecForObject<TalerMerchantApi.BankAccountSummaryEntry>()
.property("payto_uri", codecForPaytoString())
.property("h_wire", codecForString())
.build("TalerMerchantApi.BankAccountSummaryEntry");
export const codecForBankAccountEntry =
(): Codec<TalerMerchantApi.BankAccountEntry> =>
buildCodecForObject<TalerMerchantApi.BankAccountEntry>()
.property("payto_uri", codecForPaytoString())
.property("h_wire", codecForString())
.property("salt", codecForString())
.property("credit_facade_url", codecOptional(codecForURL()))
.property("active", codecOptional(codecForBoolean()))
.build("TalerMerchantApi.BankAccountEntry");
export const codecForInventorySummaryResponse =
(): Codec<TalerMerchantApi.InventorySummaryResponse> =>
buildCodecForObject<TalerMerchantApi.InventorySummaryResponse>()
.property("products", codecForList(codecForInventoryEntry()))
.build("TalerMerchantApi.InventorySummaryResponse");
export const codecForInventoryEntry =
(): Codec<TalerMerchantApi.InventoryEntry> =>
buildCodecForObject<TalerMerchantApi.InventoryEntry>()
.property("product_id", codecForString())
.property("product_serial", codecForNumber())
.build("TalerMerchantApi.InventoryEntry");
export const codecForProductDetail =
(): Codec<TalerMerchantApi.ProductDetail> =>
buildCodecForObject<TalerMerchantApi.ProductDetail>()
.property("description", codecForString())
.property("description_i18n", codecForInternationalizedString())
.property("unit", codecForString())
.property("price", codecForAmountString())
.property("image", codecForString())
.property("taxes", codecForList(codecForTax()))
.property("address", codecForLocation())
.property("next_restock", codecForTimestamp)
.property("total_stock", codecForNumber())
.property("total_sold", codecForNumber())
.property("total_lost", codecForNumber())
.property("minimum_age", codecOptional(codecForNumber()))
.build("TalerMerchantApi.ProductDetail");
export const codecForTax = (): Codec<TalerMerchantApi.Tax> =>
buildCodecForObject<TalerMerchantApi.Tax>()
.property("name", codecForString())
.property("tax", codecForAmountString())
.build("TalerMerchantApi.Tax");
export const codecForPostOrderResponse =
(): Codec<TalerMerchantApi.PostOrderResponse> =>
buildCodecForObject<TalerMerchantApi.PostOrderResponse>()
.property("order_id", codecForString())
.property("token", codecOptional(codecForString()))
.build("TalerMerchantApi.PostOrderResponse");
export const codecForOutOfStockResponse =
(): Codec<TalerMerchantApi.OutOfStockResponse> =>
buildCodecForObject<TalerMerchantApi.OutOfStockResponse>()
.property("product_id", codecForString())
.property("available_quantity", codecForNumber())
.property("requested_quantity", codecForNumber())
.property("restock_expected", codecForTimestamp)
.build("TalerMerchantApi.OutOfStockResponse");
export const codecForOrderHistory = (): Codec<TalerMerchantApi.OrderHistory> =>
buildCodecForObject<TalerMerchantApi.OrderHistory>()
.property("orders", codecForList(codecForOrderHistoryEntry()))
.build("TalerMerchantApi.OrderHistory");
export const codecForOrderHistoryEntry =
(): Codec<TalerMerchantApi.OrderHistoryEntry> =>
buildCodecForObject<TalerMerchantApi.OrderHistoryEntry>()
.property("order_id", codecForString())
.property("row_id", codecForNumber())
.property("timestamp", codecForTimestamp)
.property("amount", codecForAmountString())
.property("summary", codecForString())
.property("refundable", codecForBoolean())
.property("paid", codecForBoolean())
.build("TalerMerchantApi.OrderHistoryEntry");
export const codecForMerchant = (): Codec<TalerMerchantApi.Merchant> =>
buildCodecForObject<TalerMerchantApi.Merchant>()
.property("name", codecForString())
.property("email", codecOptional(codecForString()))
.property("logo", codecOptional(codecForString()))
.property("website", codecOptional(codecForString()))
.property("address", codecOptional(codecForLocation()))
.property("jurisdiction", codecOptional(codecForLocation()))
.build("TalerMerchantApi.MerchantInfo");
export const codecForExchange = (): Codec<TalerMerchantApi.Exchange> =>
buildCodecForObject<TalerMerchantApi.Exchange>()
.property("master_pub", codecForString())
.property("priority", codecForNumber())
.property("url", codecForString())
.build("TalerMerchantApi.Exchange");
export const codecForContractTerms =
(): Codec<TalerMerchantApi.ContractTerms> =>
buildCodecForObject<TalerMerchantApi.ContractTerms>()
.property("order_id", codecForString())
.property("fulfillment_url", codecOptional(codecForString()))
.property("fulfillment_message", codecOptional(codecForString()))
.property(
"fulfillment_message_i18n",
codecOptional(codecForInternationalizedString()),
)
.property("merchant_base_url", codecForString())
.property("h_wire", codecForString())
.property("auto_refund", codecOptional(codecForDuration))
.property("wire_method", codecForString())
.property("summary", codecForString())
.property(
"summary_i18n",
codecOptional(codecForInternationalizedString()),
)
.property("nonce", codecForString())
.property("amount", codecForAmountString())
.property("pay_deadline", codecForTimestamp)
.property("refund_deadline", codecForTimestamp)
.property("wire_transfer_deadline", codecForTimestamp)
.property("timestamp", codecForTimestamp)
.property("delivery_location", codecOptional(codecForLocation()))
.property("delivery_date", codecOptional(codecForTimestamp))
.property("max_fee", codecForAmountString())
.property("merchant", codecForMerchant())
.property("merchant_pub", codecForString())
.property("exchanges", codecForList(codecForExchange()))
.property("products", codecForList(codecForProduct()))
.property("extra", codecForAny())
.build("TalerMerchantApi.ContractTerms");
export const codecForProduct = (): Codec<TalerMerchantApi.Product> =>
buildCodecForObject<TalerMerchantApi.Product>()
.property("product_id", codecOptional(codecForString()))
.property("description", codecForString())
.property(
"description_i18n",
codecOptional(codecForInternationalizedString()),
)
.property("quantity", codecOptional(codecForNumber()))
.property("unit", codecOptional(codecForString()))
.property("price", codecOptional(codecForAmountString()))
.property("image", codecOptional(codecForString()))
.property("taxes", codecOptional(codecForList(codecForTax())))
.property("delivery_date", codecOptional(codecForTimestamp))
.build("TalerMerchantApi.Product");
export const codecForCheckPaymentPaidResponse =
(): Codec<TalerMerchantApi.CheckPaymentPaidResponse> =>
buildCodecForObject<TalerMerchantApi.CheckPaymentPaidResponse>()
.property("order_status", codecForConstString("paid"))
.property("refunded", codecForBoolean())
.property("refund_pending", codecForBoolean())
.property("wired", codecForBoolean())
.property("deposit_total", codecForAmountString())
.property("exchange_code", codecForNumber())
.property("exchange_http_status", codecForNumber())
.property("refund_amount", codecForAmountString())
.property("contract_terms", codecForContractTerms())
.property("wire_reports", codecForList(codecForTransactionWireReport()))
.property("wire_details", codecForList(codecForTransactionWireTransfer()))
.property("refund_details", codecForList(codecForRefundDetails()))
.property("order_status_url", codecForURL())
.build("TalerMerchantApi.CheckPaymentPaidResponse");
export const codecForCheckPaymentUnpaidResponse =
(): Codec<TalerMerchantApi.CheckPaymentUnpaidResponse> =>
buildCodecForObject<TalerMerchantApi.CheckPaymentUnpaidResponse>()
.property("order_status", codecForConstString("unpaid"))
.property("taler_pay_uri", codecForTalerUriString())
.property("creation_time", codecForTimestamp)
.property("summary", codecForString())
.property("total_amount", codecForAmountString())
.property("already_paid_order_id", codecOptional(codecForString()))
.property("already_paid_fulfillment_url", codecOptional(codecForString()))
.property("order_status_url", codecForString())
.build("TalerMerchantApi.CheckPaymentPaidResponse");
export const codecForCheckPaymentClaimedResponse =
(): Codec<TalerMerchantApi.CheckPaymentClaimedResponse> =>
buildCodecForObject<TalerMerchantApi.CheckPaymentClaimedResponse>()
.property("order_status", codecForConstString("claimed"))
.property("contract_terms", codecForContractTerms())
.build("TalerMerchantApi.CheckPaymentClaimedResponse");
export const codecForMerchantOrderPrivateStatusResponse =
(): Codec<TalerMerchantApi.MerchantOrderStatusResponse> =>
buildCodecForUnion<TalerMerchantApi.MerchantOrderStatusResponse>()
.discriminateOn("order_status")
.alternative("paid", codecForCheckPaymentPaidResponse())
.alternative("unpaid", codecForCheckPaymentUnpaidResponse())
.alternative("claimed", codecForCheckPaymentClaimedResponse())
.build("TalerMerchantApi.MerchantOrderStatusResponse");
export const codecForRefundDetails =
(): Codec<TalerMerchantApi.RefundDetails> =>
buildCodecForObject<TalerMerchantApi.RefundDetails>()
.property("reason", codecForString())
.property("pending", codecForBoolean())
.property("timestamp", codecForTimestamp)
.property("amount", codecForAmountString())
.build("TalerMerchantApi.RefundDetails");
export const codecForTransactionWireTransfer =
(): Codec<TalerMerchantApi.TransactionWireTransfer> =>
buildCodecForObject<TalerMerchantApi.TransactionWireTransfer>()
.property("exchange_url", codecForURL())
.property("wtid", codecForString())
.property("execution_time", codecForTimestamp)
.property("amount", codecForAmountString())
.property("confirmed", codecForBoolean())
.build("TalerMerchantApi.TransactionWireTransfer");
export const codecForTransactionWireReport =
(): Codec<TalerMerchantApi.TransactionWireReport> =>
buildCodecForObject<TalerMerchantApi.TransactionWireReport>()
.property("code", codecForNumber())
.property("hint", codecForString())
.property("exchange_code", codecForNumber())
.property("exchange_http_status", codecForNumber())
.property("coin_pub", codecForString())
.build("TalerMerchantApi.TransactionWireReport");
export const codecForMerchantRefundResponse =
(): Codec<TalerMerchantApi.MerchantRefundResponse> =>
buildCodecForObject<TalerMerchantApi.MerchantRefundResponse>()
.property("taler_refund_uri", codecForTalerUriString())
.property("h_contract", codecForString())
.build("TalerMerchantApi.MerchantRefundResponse");
export const codecForTansferList = (): Codec<TalerMerchantApi.TransferList> =>
buildCodecForObject<TalerMerchantApi.TransferList>()
.property("transfers", codecForList(codecForTransferDetails()))
.build("TalerMerchantApi.TransferList");
export const codecForTransferDetails =
(): Codec<TalerMerchantApi.TransferDetails> =>
buildCodecForObject<TalerMerchantApi.TransferDetails>()
.property("credit_amount", codecForAmountString())
.property("wtid", codecForString())
.property("payto_uri", codecForPaytoString())
.property("exchange_url", codecForURL())
.property("transfer_serial_id", codecForNumber())
.property("execution_time", codecOptional(codecForTimestamp))
.property("verified", codecOptional(codecForBoolean()))
.property("confirmed", codecOptional(codecForBoolean()))
.build("TalerMerchantApi.TransferDetails");
export const codecForOtpDeviceSummaryResponse =
(): Codec<TalerMerchantApi.OtpDeviceSummaryResponse> =>
buildCodecForObject<TalerMerchantApi.OtpDeviceSummaryResponse>()
.property("otp_devices", codecForList(codecForOtpDeviceEntry()))
.build("TalerMerchantApi.OtpDeviceSummaryResponse");
export const codecForOtpDeviceEntry =
(): Codec<TalerMerchantApi.OtpDeviceEntry> =>
buildCodecForObject<TalerMerchantApi.OtpDeviceEntry>()
.property("otp_device_id", codecForString())
.property("device_description", codecForString())
.build("TalerMerchantApi.OtpDeviceEntry");
export const codecForOtpDeviceDetails =
(): Codec<TalerMerchantApi.OtpDeviceDetails> =>
buildCodecForObject<TalerMerchantApi.OtpDeviceDetails>()
.property("device_description", codecForString())
.property("otp_algorithm", codecForNumber())
.property("otp_ctr", codecOptional(codecForNumber()))
.property("otp_timestamp", codecForNumber())
.property("otp_code", codecOptional(codecForString()))
.build("TalerMerchantApi.OtpDeviceDetails");
export const codecForTemplateSummaryResponse =
(): Codec<TalerMerchantApi.TemplateSummaryResponse> =>
buildCodecForObject<TalerMerchantApi.TemplateSummaryResponse>()
.property("templates", codecForList(codecForTemplateEntry()))
.build("TalerMerchantApi.TemplateSummaryResponse");
export const codecForTemplateEntry =
(): Codec<TalerMerchantApi.TemplateEntry> =>
buildCodecForObject<TalerMerchantApi.TemplateEntry>()
.property("template_id", codecForString())
.property("template_description", codecForString())
.build("TalerMerchantApi.TemplateEntry");
export const codecForTemplateDetails =
(): Codec<TalerMerchantApi.TemplateDetails> =>
buildCodecForObject<TalerMerchantApi.TemplateDetails>()
.property("template_description", codecForString())
.property("otp_id", codecOptional(codecForString()))
.property("template_contract", codecForTemplateContractDetails())
.property("required_currency", codecOptional(codecForString()))
.property(
"editable_defaults",
codecOptional(codecForTemplateContractDetailsDefaults()),
)
.build("TalerMerchantApi.TemplateDetails");
export const codecForTemplateContractDetails =
(): Codec<TalerMerchantApi.TemplateContractDetails> =>
buildCodecForObject<TalerMerchantApi.TemplateContractDetails>()
.property("summary", codecOptional(codecForString()))
.property("currency", codecOptional(codecForString()))
.property("amount", codecOptional(codecForAmountString()))
.property("minimum_age", codecForNumber())
.property("pay_duration", codecForDuration)
.build("TalerMerchantApi.TemplateContractDetails");
export const codecForTemplateContractDetailsDefaults =
(): Codec<TalerMerchantApi.TemplateContractDetailsDefaults> =>
buildCodecForObject<TalerMerchantApi.TemplateContractDetailsDefaults>()
.property("summary", codecOptional(codecForString()))
.property("currency", codecOptional(codecForString()))
.property("amount", codecOptional(codecForAmountString()))
.property("minimum_age", codecOptional(codecForNumber()))
.property("pay_duration", codecOptional(codecForDuration))
.build("TalerMerchantApi.TemplateContractDetailsDefaults");
export const codecForWalletTemplateDetails =
(): Codec<TalerMerchantApi.WalletTemplateDetails> =>
buildCodecForObject<TalerMerchantApi.WalletTemplateDetails>()
.property("template_contract", codecForTemplateContractDetails())
.property("required_currency", codecOptional(codecForString()))
.property(
"editable_defaults",
codecOptional(codecForTemplateContractDetailsDefaults()),
)
.build("TalerMerchantApi.WalletTemplateDetails");
export const codecForWebhookSummaryResponse =
(): Codec<TalerMerchantApi.WebhookSummaryResponse> =>
buildCodecForObject<TalerMerchantApi.WebhookSummaryResponse>()
.property("webhooks", codecForList(codecForWebhookEntry()))
.build("TalerMerchantApi.WebhookSummaryResponse");
export const codecForWebhookEntry = (): Codec<TalerMerchantApi.WebhookEntry> =>
buildCodecForObject<TalerMerchantApi.WebhookEntry>()
.property("webhook_id", codecForString())
.property("event_type", codecForString())
.build("TalerMerchantApi.WebhookEntry");
export const codecForWebhookDetails =
(): Codec<TalerMerchantApi.WebhookDetails> =>
buildCodecForObject<TalerMerchantApi.WebhookDetails>()
.property("event_type", codecForString())
.property("url", codecForString())
.property("http_method", codecForString())
.property("header_template", codecOptional(codecForString()))
.property("body_template", codecOptional(codecForString()))
.build("TalerMerchantApi.WebhookDetails");
export const codecForTokenFamilyKind =
(): Codec<TalerMerchantApi.TokenFamilyKind> =>
codecForEither(
codecForConstString("discount"),
codecForConstString("subscription"),
) as any; //FIXME: create a codecForEnum
export const codecForTokenFamilyDetails =
(): Codec<TalerMerchantApi.TokenFamilyDetails> =>
buildCodecForObject<TalerMerchantApi.TokenFamilyDetails>()
.property("slug", codecForString())
.property("name", codecForString())
.property("description", codecForString())
.property("description_i18n", codecForInternationalizedString())
.property("valid_after", codecForTimestamp)
.property("valid_before", codecForTimestamp)
.property("duration", codecForDuration)
.property("kind", codecForTokenFamilyKind())
.property("issued", codecForNumber())
.property("redeemed", codecForNumber())
.build("TalerMerchantApi.TokenFamilyDetails");
export const codecForTokenFamiliesList =
(): Codec<TalerMerchantApi.TokenFamiliesList> =>
buildCodecForObject<TalerMerchantApi.TokenFamiliesList>()
.property("token_families", codecForList(codecForTokenFamilySummary()))
.build("TalerMerchantApi.TokenFamiliesList");
export const codecForTokenFamilySummary =
(): Codec<TalerMerchantApi.TokenFamilySummary> =>
buildCodecForObject<TalerMerchantApi.TokenFamilySummary>()
.property("slug", codecForString())
.property("name", codecForString())
.property("valid_after", codecForTimestamp)
.property("valid_before", codecForTimestamp)
.property("kind", codecForTokenFamilyKind())
.build("TalerMerchantApi.TokenFamilySummary");
export const codecForInstancesResponse =
(): Codec<TalerMerchantApi.InstancesResponse> =>
buildCodecForObject<TalerMerchantApi.InstancesResponse>()
.property("instances", codecForList(codecForInstance()))
.build("TalerMerchantApi.InstancesResponse");
export const codecForInstance = (): Codec<TalerMerchantApi.Instance> =>
buildCodecForObject<TalerMerchantApi.Instance>()
.property("name", codecForString())
.property("user_type", codecForString())
.property("website", codecOptional(codecForString()))
.property("logo", codecOptional(codecForString()))
.property("id", codecForString())
.property("merchant_pub", codecForString())
.property("payment_targets", codecForList(codecForString()))
.property("deleted", codecForBoolean())
.build("TalerMerchantApi.Instance");
export const codecForExchangeConfig =
(): Codec<TalerExchangeApi.ExchangeVersionResponse> =>
buildCodecForObject<TalerExchangeApi.ExchangeVersionResponse>()
.property("version", codecForString())
.property("name", codecForConstString("taler-exchange"))
.property("implementation", codecOptional(codecForURN()))
.property("currency", codecForString())
.property("currency_specification", codecForCurrencySpecificiation())
.property("supported_kyc_requirements", codecForList(codecForString()))
.build("TalerExchangeApi.ExchangeVersionResponse");
export const codecForExchangeKeys =
(): Codec<TalerExchangeApi.ExchangeKeysResponse> =>
buildCodecForObject<TalerExchangeApi.ExchangeKeysResponse>()
.property("version", codecForString())
.property("base_url", codecForString())
.property("currency", codecForString())
.build("TalerExchangeApi.ExchangeKeysResponse");
const codecForBalance = (): Codec<TalerCorebankApi.Balance> =>
buildCodecForObject<TalerCorebankApi.Balance>()
.property("amount", codecForAmountString())
.property(
"credit_debit_indicator",
codecForEither(
codecForConstString("credit"),
codecForConstString("debit"),
),
)
.build("TalerCorebankApi.Balance");
const codecForPublicAccount = (): Codec<TalerCorebankApi.PublicAccount> =>
buildCodecForObject<TalerCorebankApi.PublicAccount>()
.property("username", codecForString())
.property("balance", codecForBalance())
.property("payto_uri", codecForPaytoString())
.property("is_taler_exchange", codecForBoolean())
.property("row_id", codecOptional(codecForNumber()))
.build("TalerCorebankApi.PublicAccount");
export const codecForPublicAccountsResponse =
(): Codec<TalerCorebankApi.PublicAccountsResponse> =>
buildCodecForObject<TalerCorebankApi.PublicAccountsResponse>()
.property("public_accounts", codecForList(codecForPublicAccount()))
.build("TalerCorebankApi.PublicAccountsResponse");
export const codecForAccountMinimalData =
(): Codec<TalerCorebankApi.AccountMinimalData> =>
buildCodecForObject<TalerCorebankApi.AccountMinimalData>()
.property("username", codecForString())
.property("name", codecForString())
.property("payto_uri", codecForPaytoString())
.property("balance", codecForBalance())
.property("debit_threshold", codecForAmountString())
.property("is_public", codecForBoolean())
.property("is_taler_exchange", codecForBoolean())
.property("row_id", codecOptional(codecForNumber()))
.build("TalerCorebankApi.AccountMinimalData");
export const codecForListBankAccountsResponse =
(): Codec<TalerCorebankApi.ListBankAccountsResponse> =>
buildCodecForObject<TalerCorebankApi.ListBankAccountsResponse>()
.property("accounts", codecForList(codecForAccountMinimalData()))
.build("TalerCorebankApi.ListBankAccountsResponse");
export const codecForAccountData = (): Codec<TalerCorebankApi.AccountData> =>
buildCodecForObject<TalerCorebankApi.AccountData>()
.property("name", codecForString())
.property("balance", codecForBalance())
.property("payto_uri", codecForPaytoString())
.property("debit_threshold", codecForAmountString())
.property("contact_data", codecOptional(codecForChallengeContactData()))
.property("cashout_payto_uri", codecOptional(codecForPaytoString()))
.property("is_public", codecForBoolean())
.property("is_taler_exchange", codecForBoolean())
.property(
"tan_channel",
codecOptional(
codecForEither(
codecForConstString(TalerCorebankApi.TanChannel.SMS),
codecForConstString(TalerCorebankApi.TanChannel.EMAIL),
),
),
)
.build("TalerCorebankApi.AccountData");
export const codecForChallengeContactData =
(): Codec<TalerCorebankApi.ChallengeContactData> =>
buildCodecForObject<TalerCorebankApi.ChallengeContactData>()
.property("email", codecOptional(codecForString()))
.property("phone", codecOptional(codecForString()))
.build("TalerCorebankApi.ChallengeContactData");
export const codecForWithdrawalPublicInfo =
(): Codec<TalerCorebankApi.WithdrawalPublicInfo> =>
buildCodecForObject<TalerCorebankApi.WithdrawalPublicInfo>()
.property(
"status",
codecForEither(
codecForConstString("pending"),
codecForConstString("selected"),
codecForConstString("aborted"),
codecForConstString("confirmed"),
),
)
.property("amount", codecForAmountString())
.property("username", codecForString())
.property("selected_reserve_pub", codecOptional(codecForString()))
.property(
"selected_exchange_account",
codecOptional(codecForPaytoString()),
)
.build("TalerCorebankApi.WithdrawalPublicInfo");
export const codecForBankAccountTransactionsResponse =
(): Codec<TalerCorebankApi.BankAccountTransactionsResponse> =>
buildCodecForObject<TalerCorebankApi.BankAccountTransactionsResponse>()
.property(
"transactions",
codecForList(codecForBankAccountTransactionInfo()),
)
.build("TalerCorebankApi.BankAccountTransactionsResponse");
export const codecForBankAccountTransactionInfo =
(): Codec<TalerCorebankApi.BankAccountTransactionInfo> =>
buildCodecForObject<TalerCorebankApi.BankAccountTransactionInfo>()
.property("creditor_payto_uri", codecForPaytoString())
.property("debtor_payto_uri", codecForPaytoString())
.property("amount", codecForAmountString())
.property(
"direction",
codecForEither(
codecForConstString("debit"),
codecForConstString("credit"),
),
)
.property("subject", codecForString())
.property("row_id", codecForNumber())
.property("date", codecForTimestamp)
.build("TalerCorebankApi.BankAccountTransactionInfo");
export const codecForCreateTransactionResponse =
(): Codec<TalerCorebankApi.CreateTransactionResponse> =>
buildCodecForObject<TalerCorebankApi.CreateTransactionResponse>()
.property("row_id", codecForNumber())
.build("TalerCorebankApi.CreateTransactionResponse");
export const codecForRegisterAccountResponse =
(): Codec<TalerCorebankApi.RegisterAccountResponse> =>
buildCodecForObject<TalerCorebankApi.RegisterAccountResponse>()
.property("internal_payto_uri", codecForPaytoString())
.build("TalerCorebankApi.RegisterAccountResponse");
export const codecForBankAccountCreateWithdrawalResponse =
(): Codec<TalerCorebankApi.BankAccountCreateWithdrawalResponse> =>
buildCodecForObject<TalerCorebankApi.BankAccountCreateWithdrawalResponse>()
.property("taler_withdraw_uri", codecForTalerUriString())
.property("withdrawal_id", codecForString())
.build("TalerCorebankApi.BankAccountCreateWithdrawalResponse");
export const codecForCashoutPending =
(): Codec<TalerCorebankApi.CashoutResponse> =>
buildCodecForObject<TalerCorebankApi.CashoutResponse>()
.property("cashout_id", codecForNumber())
.build("TalerCorebankApi.CashoutPending");
export const codecForCashoutConversionResponse =
(): Codec<TalerBankConversionApi.CashoutConversionResponse> =>
buildCodecForObject<TalerBankConversionApi.CashoutConversionResponse>()
.property("amount_credit", codecForAmountString())
.property("amount_debit", codecForAmountString())
.build("TalerCorebankApi.CashoutConversionResponse");
export const codecForCashinConversionResponse =
(): Codec<TalerBankConversionApi.CashinConversionResponse> =>
buildCodecForObject<TalerBankConversionApi.CashinConversionResponse>()
.property("amount_credit", codecForAmountString())
.property("amount_debit", codecForAmountString())
.build("TalerCorebankApi.CashinConversionResponse");
export const codecForCashouts = (): Codec<TalerCorebankApi.Cashouts> =>
buildCodecForObject<TalerCorebankApi.Cashouts>()
.property("cashouts", codecForList(codecForCashoutInfo()))
.build("TalerCorebankApi.Cashouts");
export const codecForCashoutInfo = (): Codec<TalerCorebankApi.CashoutInfo> =>
buildCodecForObject<TalerCorebankApi.CashoutInfo>()
.property("cashout_id", codecForNumber())
.build("TalerCorebankApi.CashoutInfo");
export const codecForGlobalCashouts =
(): Codec<TalerCorebankApi.GlobalCashouts> =>
buildCodecForObject<TalerCorebankApi.GlobalCashouts>()
.property("cashouts", codecForList(codecForGlobalCashoutInfo()))
.build("TalerCorebankApi.GlobalCashouts");
export const codecForGlobalCashoutInfo =
(): Codec<TalerCorebankApi.GlobalCashoutInfo> =>
buildCodecForObject<TalerCorebankApi.GlobalCashoutInfo>()
.property("cashout_id", codecForNumber())
.property("username", codecForString())
.build("TalerCorebankApi.GlobalCashoutInfo");
export const codecForCashoutStatusResponse =
(): Codec<TalerCorebankApi.CashoutStatusResponse> =>
buildCodecForObject<TalerCorebankApi.CashoutStatusResponse>()
.property("amount_debit", codecForAmountString())
.property("amount_credit", codecForAmountString())
.property("subject", codecForString())
.property("creation_time", codecForTimestamp)
.build("TalerCorebankApi.CashoutStatusResponse");
export const codecForConversionRatesResponse =
(): Codec<TalerCorebankApi.ConversionRatesResponse> =>
buildCodecForObject<TalerCorebankApi.ConversionRatesResponse>()
.property("buy_at_ratio", codecForDecimalNumber())
.property("buy_in_fee", codecForDecimalNumber())
.property("sell_at_ratio", codecForDecimalNumber())
.property("sell_out_fee", codecForDecimalNumber())
.build("TalerCorebankApi.ConversionRatesResponse");
export const codecForMonitorResponse =
(): Codec<TalerCorebankApi.MonitorResponse> =>
buildCodecForUnion<TalerCorebankApi.MonitorResponse>()
.discriminateOn("type")
.alternative("no-conversions", codecForMonitorNoConversion())
.alternative("with-conversions", codecForMonitorWithCashout())
.build("TalerWireGatewayApi.IncomingBankTransaction");
export const codecForMonitorNoConversion =
(): Codec<TalerCorebankApi.MonitorNoConversion> =>
buildCodecForObject<TalerCorebankApi.MonitorNoConversion>()
.property("type", codecForConstString("no-conversions"))
.property("talerInCount", codecForNumber())
.property("talerInVolume", codecForAmountString())
.property("talerOutCount", codecForNumber())
.property("talerOutVolume", codecForAmountString())
.build("TalerCorebankApi.MonitorJustPayouts");
export const codecForMonitorWithCashout =
(): Codec<TalerCorebankApi.MonitorWithConversion> =>
buildCodecForObject<TalerCorebankApi.MonitorWithConversion>()
.property("type", codecForConstString("with-conversions"))
.property("cashinCount", codecForNumber())
.property("cashinFiatVolume", codecForAmountString())
.property("cashinRegionalVolume", codecForAmountString())
.property("cashoutCount", codecForNumber())
.property("cashoutFiatVolume", codecForAmountString())
.property("cashoutRegionalVolume", codecForAmountString())
.property("talerInCount", codecForNumber())
.property("talerInVolume", codecForAmountString())
.property("talerOutCount", codecForNumber())
.property("talerOutVolume", codecForAmountString())
.build("TalerCorebankApi.MonitorWithCashout");
export const codecForBankVersion =
(): Codec<TalerBankIntegrationApi.BankVersion> =>
buildCodecForObject<TalerBankIntegrationApi.BankVersion>()
.property("currency", codecForCurrencyName())
.property("currency_specification", codecForCurrencySpecificiation())
.property("name", codecForConstString("taler-bank-integration"))
.property("version", codecForLibtoolVersion())
.build("TalerBankIntegrationApi.BankVersion");
export const codecForBankWithdrawalOperationStatus =
(): Codec<TalerBankIntegrationApi.BankWithdrawalOperationStatus> =>
buildCodecForObject<TalerBankIntegrationApi.BankWithdrawalOperationStatus>()
.property(
"status",
codecForEither(
codecForConstString("pending"),
codecForConstString("selected"),
codecForConstString("aborted"),
codecForConstString("confirmed"),
),
)
.property("amount", codecForAmountString())
.property("sender_wire", codecOptional(codecForPaytoString()))
.property("suggested_exchange", codecOptional(codecForString()))
.property("confirm_transfer_url", codecOptional(codecForURL()))
.property("wire_types", codecForList(codecForString()))
.property("selected_reserve_pub", codecOptional(codecForString()))
.property("selected_exchange_account", codecOptional(codecForString()))
.build("TalerBankIntegrationApi.BankWithdrawalOperationStatus");
export const codecForBankWithdrawalOperationPostResponse =
(): Codec<TalerBankIntegrationApi.BankWithdrawalOperationPostResponse> =>
buildCodecForObject<TalerBankIntegrationApi.BankWithdrawalOperationPostResponse>()
.property(
"status",
codecForEither(
codecForConstString("selected"),
codecForConstString("aborted"),
codecForConstString("confirmed"),
),
)
.property("confirm_transfer_url", codecOptional(codecForURL()))
.build("TalerBankIntegrationApi.BankWithdrawalOperationPostResponse");
export const codecForRevenueConfig = (): Codec<TalerRevenueApi.RevenueConfig> =>
buildCodecForObject<TalerRevenueApi.RevenueConfig>()
.property("name", codecForConstString("taler-revenue"))
.property("version", codecForString())
.property("currency", codecForString())
.property("implementation", codecOptional(codecForString()))
.build("TalerRevenueApi.RevenueConfig");
export const codecForRevenueIncomingHistory =
(): Codec<TalerRevenueApi.RevenueIncomingHistory> =>
buildCodecForObject<TalerRevenueApi.RevenueIncomingHistory>()
.property("credit_account", codecForPaytoString())
.property(
"incoming_transactions",
codecForList(codecForRevenueIncomingBankTransaction()),
)
.build("TalerRevenueApi.MerchantIncomingHistory");
export const codecForRevenueIncomingBankTransaction =
(): Codec<TalerRevenueApi.RevenueIncomingBankTransaction> =>
buildCodecForObject<TalerRevenueApi.RevenueIncomingBankTransaction>()
.property("amount", codecForAmountString())
.property("date", codecForTimestamp)
.property("debit_account", codecForPaytoString())
.property("row_id", codecForNumber())
.property("subject", codecForString())
.build("TalerRevenueApi.RevenueIncomingBankTransaction");
export const codecForTransferResponse =
(): Codec<TalerWireGatewayApi.TransferResponse> =>
buildCodecForObject<TalerWireGatewayApi.TransferResponse>()
.property("row_id", codecForNumber())
.property("timestamp", codecForTimestamp)
.build("TalerWireGatewayApi.TransferResponse");
export const codecForIncomingHistory =
(): Codec<TalerWireGatewayApi.IncomingHistory> =>
buildCodecForObject<TalerWireGatewayApi.IncomingHistory>()
.property("credit_account", codecForPaytoString())
.property(
"incoming_transactions",
codecForList(codecForIncomingBankTransaction()),
)
.build("TalerWireGatewayApi.IncomingHistory");
export const codecForIncomingBankTransaction =
(): Codec<TalerWireGatewayApi.IncomingBankTransaction> =>
buildCodecForUnion<TalerWireGatewayApi.IncomingBankTransaction>()
.discriminateOn("type")
.alternative("RESERVE", codecForIncomingReserveTransaction())
.alternative("WAD", codecForIncomingWadTransaction())
.build("TalerWireGatewayApi.IncomingBankTransaction");
export const codecForIncomingReserveTransaction =
(): Codec<TalerWireGatewayApi.IncomingReserveTransaction> =>
buildCodecForObject<TalerWireGatewayApi.IncomingReserveTransaction>()
.property("amount", codecForAmountString())
.property("date", codecForTimestamp)
.property("debit_account", codecForPaytoString())
.property("reserve_pub", codecForString())
.property("row_id", codecForNumber())
.property("type", codecForConstString("RESERVE"))
.build("TalerWireGatewayApi.IncomingReserveTransaction");
export const codecForIncomingWadTransaction =
(): Codec<TalerWireGatewayApi.IncomingWadTransaction> =>
buildCodecForObject<TalerWireGatewayApi.IncomingWadTransaction>()
.property("amount", codecForAmountString())
.property("credit_account", codecForPaytoString())
.property("date", codecForTimestamp)
.property("debit_account", codecForPaytoString())
.property("origin_exchange_url", codecForURL())
.property("row_id", codecForNumber())
.property("type", codecForConstString("WAD"))
.property("wad_id", codecForString())
.build("TalerWireGatewayApi.IncomingWadTransaction");
export const codecForOutgoingHistory =
(): Codec<TalerWireGatewayApi.OutgoingHistory> =>
buildCodecForObject<TalerWireGatewayApi.OutgoingHistory>()
.property("debit_account", codecForPaytoString())
.property(
"outgoing_transactions",
codecForList(codecForOutgoingBankTransaction()),
)
.build("TalerWireGatewayApi.OutgoingHistory");
export const codecForOutgoingBankTransaction =
(): Codec<TalerWireGatewayApi.OutgoingBankTransaction> =>
buildCodecForObject<TalerWireGatewayApi.OutgoingBankTransaction>()
.property("amount", codecForAmountString())
.property("credit_account", codecForPaytoString())
.property("date", codecForTimestamp)
.property("exchange_base_url", codecForURL())
.property("row_id", codecForNumber())
.property("wtid", codecForString())
.build("TalerWireGatewayApi.OutgoingBankTransaction");
export const codecForAddIncomingResponse =
(): Codec<TalerWireGatewayApi.AddIncomingResponse> =>
buildCodecForObject<TalerWireGatewayApi.AddIncomingResponse>()
.property("row_id", codecForNumber())
.property("timestamp", codecForTimestamp)
.build("TalerWireGatewayApi.AddIncomingResponse");
export const codecForAmlRecords = (): Codec<TalerExchangeApi.AmlRecords> =>
buildCodecForObject<TalerExchangeApi.AmlRecords>()
.property("records", codecForList(codecForAmlRecord()))
.build("TalerExchangeApi.PublicAccountsResponse");
export const codecForAmlRecord = (): Codec<TalerExchangeApi.AmlRecord> =>
buildCodecForObject<TalerExchangeApi.AmlRecord>()
.property("current_state", codecForNumber())
.property("h_payto", codecForString())
.property("rowid", codecForNumber())
.property("threshold", codecForAmountString())
.build("TalerExchangeApi.AmlRecord");
export const codecForAmlDecisionDetails =
(): Codec<TalerExchangeApi.AmlDecisionDetails> =>
buildCodecForObject<TalerExchangeApi.AmlDecisionDetails>()
.property("aml_history", codecForList(codecForAmlDecisionDetail()))
.property("kyc_attributes", codecForList(codecForKycDetail()))
.build("TalerExchangeApi.AmlDecisionDetails");
export const codecForAmlDecisionDetail =
(): Codec<TalerExchangeApi.AmlDecisionDetail> =>
buildCodecForObject<TalerExchangeApi.AmlDecisionDetail>()
.property("justification", codecForString())
.property("new_state", codecForNumber())
.property("decision_time", codecForTimestamp)
.property("new_threshold", codecForAmountString())
.property("decider_pub", codecForString())
.build("TalerExchangeApi.AmlDecisionDetail");
export const codecForChallenge = (): Codec<TalerCorebankApi.Challenge> =>
buildCodecForObject<TalerCorebankApi.Challenge>()
.property("challenge_id", codecForNumber())
.build("TalerCorebankApi.Challenge");
export const codecForTanTransmission =
(): Codec<TalerCorebankApi.TanTransmission> =>
buildCodecForObject<TalerCorebankApi.TanTransmission>()
.property(
"tan_channel",
codecForEither(
codecForConstString(TalerCorebankApi.TanChannel.SMS),
codecForConstString(TalerCorebankApi.TanChannel.EMAIL),
),
)
.property("tan_info", codecForString())
.build("TalerCorebankApi.TanTransmission");
interface KycDetail {
provider_section: string;
attributes?: Object;
collection_time: Timestamp;
expiration_time: Timestamp;
}
export const codecForKycDetail = (): Codec<TalerExchangeApi.KycDetail> =>
buildCodecForObject<TalerExchangeApi.KycDetail>()
.property("provider_section", codecForString())
.property("attributes", codecOptional(codecForAny()))
.property("collection_time", codecForTimestamp)
.property("expiration_time", codecForTimestamp)
.build("TalerExchangeApi.KycDetail");
export const codecForAmlDecision = (): Codec<TalerExchangeApi.AmlDecision> =>
buildCodecForObject<TalerExchangeApi.AmlDecision>()
.property("justification", codecForString())
.property("new_threshold", codecForAmountString())
.property("h_payto", codecForString())
.property("new_state", codecForNumber())
.property("officer_sig", codecForString())
.property("decision_time", codecForTimestamp)
.property("kyc_requirements", codecOptional(codecForList(codecForString())))
.build("TalerExchangeApi.AmlDecision");
export const codecForConversionInfo =
(): Codec<TalerBankConversionApi.ConversionInfo> =>
buildCodecForObject<TalerBankConversionApi.ConversionInfo>()
.property("cashin_fee", codecForAmountString())
.property("cashin_min_amount", codecForAmountString())
.property("cashin_ratio", codecForDecimalNumber())
.property(
"cashin_rounding_mode",
codecForEither(
codecForConstString("zero"),
codecForConstString("up"),
codecForConstString("nearest"),
),
)
.property("cashin_tiny_amount", codecForAmountString())
.property("cashout_fee", codecForAmountString())
.property("cashout_min_amount", codecForAmountString())
.property("cashout_ratio", codecForDecimalNumber())
.property(
"cashout_rounding_mode",
codecForEither(
codecForConstString("zero"),
codecForConstString("up"),
codecForConstString("nearest"),
),
)
.property("cashout_tiny_amount", codecForAmountString())
.build("ConversionBankConfig.ConversionInfo");
export const codecForConversionBankConfig =
(): Codec<TalerBankConversionApi.IntegrationConfig> =>
buildCodecForObject<TalerBankConversionApi.IntegrationConfig>()
.property("name", codecForConstString("taler-conversion-info"))
.property("version", codecForString())
.property("regional_currency", codecForString())
.property(
"regional_currency_specification",
codecForCurrencySpecificiation(),
)
.property("fiat_currency", codecForString())
.property("fiat_currency_specification", codecForCurrencySpecificiation())
.property("conversion_rate", codecForConversionInfo())
.build("ConversionBankConfig.IntegrationConfig");
export const codecForChallengerTermsOfServiceResponse =
(): Codec<ChallengerApi.ChallengerTermsOfServiceResponse> =>
buildCodecForObject<ChallengerApi.ChallengerTermsOfServiceResponse>()
.property("name", codecForConstString("challenger"))
.property("version", codecForString())
.property("implementation", codecOptional(codecForString()))
.build("ChallengerApi.ChallengerTermsOfServiceResponse");
export const codecForChallengeSetupResponse =
(): Codec<ChallengerApi.ChallengeSetupResponse> =>
buildCodecForObject<ChallengerApi.ChallengeSetupResponse>()
.property("nonce", codecForString())
.build("ChallengerApi.ChallengeSetupResponse");
export const codecForChallengeStatus =
(): Codec<ChallengerApi.ChallengeStatus> =>
buildCodecForObject<ChallengerApi.ChallengeStatus>()
.property("restrictions", codecOptional(codecForMap(codecForAny())))
.property("fix_address", codecForBoolean())
.property("last_address", codecOptional(codecForMap(codecForAny())))
.property("changes_left", codecForNumber())
.build("ChallengerApi.ChallengeStatus");
export const codecForChallengeCreateResponse =
(): Codec<ChallengerApi.ChallengeCreateResponse> =>
buildCodecForObject<ChallengerApi.ChallengeCreateResponse>()
.property("attempts_left", codecForNumber())
.property("address", codecForAny())
.property("transmitted", codecForBoolean())
.property("next_tx_time", codecForString())
.build("ChallengerApi.ChallengeCreateResponse");
export const codecForInvalidPinResponse =
(): Codec<ChallengerApi.InvalidPinResponse> =>
buildCodecForObject<ChallengerApi.InvalidPinResponse>()
.property("ec", codecOptional(codecForNumber()))
.property("hint", codecForAny())
.property("addresses_left", codecForNumber())
.property("pin_transmissions_left", codecForNumber())
.property("auth_attempts_left", codecForNumber())
.property("exhausted", codecForBoolean())
.property("no_challenge", codecForBoolean())
.build("ChallengerApi.InvalidPinResponse");
export const codecForChallengerAuthResponse =
(): Codec<ChallengerApi.ChallengerAuthResponse> =>
buildCodecForObject<ChallengerApi.ChallengerAuthResponse>()
.property("access_token", codecForString())
.property("token_type", codecForAny())
.property("expires_in", codecForNumber())
.build("ChallengerApi.ChallengerAuthResponse");
export const codecForChallengerInfoResponse =
(): Codec<ChallengerApi.ChallengerInfoResponse> =>
buildCodecForObject<ChallengerApi.ChallengerInfoResponse>()
.property("id", codecForNumber())
.property("address", codecForAny())
.property("address_type", codecForString())
.property("expires", codecForTimestamp)
.build("ChallengerApi.ChallengerInfoResponse");
type EmailAddress = string;
type PhoneNumber = string;
type EddsaSignature = string;
// base32 encoded RSA blinded signature.
type BlindedRsaSignature = string;
type Base32 = string;
type DecimalNumber = string;
type RsaSignature = string;
type Float = number;
type LibtoolVersion = string;
// The type of a coin's blinded envelope depends on the cipher that is used
// for signing with a denomination key.
type CoinEnvelope = RSACoinEnvelope | CSCoinEnvelope;
// For denomination signatures based on RSA, the planchet is just a blinded
// coin's public EdDSA key.
interface RSACoinEnvelope {
cipher: "RSA" | "RSA+age_restricted";
rsa_blinded_planchet: string; // Crockford Base32 encoded
}
// For denomination signatures based on Blind Clause-Schnorr, the planchet
// consists of the public nonce and two Curve25519 scalars which are two
// blinded challenges in the Blinded Clause-Schnorr signature scheme.
// See https://taler.net/papers/cs-thesis.pdf for details.
interface CSCoinEnvelope {
cipher: "CS" | "CS+age_restricted";
cs_nonce: string; // Crockford Base32 encoded
cs_blinded_c0: string; // Crockford Base32 encoded
cs_blinded_c1: string; // Crockford Base32 encoded
}
// Secret for blinding/unblinding.
// An RSA blinding secret, which is basically
// a 256-bit nonce, converted to Crockford Base32.
type DenominationBlindingKeyP = string;
//FIXME: implement this codec
const codecForURL = codecForString;
//FIXME: implement this codec
const codecForLibtoolVersion = codecForString;
//FIXME: implement this codec
const codecForCurrencyName = codecForString;
//FIXME: implement this codec
const codecForDecimalNumber = codecForString;
export type WithdrawalOperationStatus =
| "pending"
| "selected"
| "aborted"
| "confirmed";
export namespace TalerWireGatewayApi {
export interface TransferResponse {
// Timestamp that indicates when the wire transfer will be executed.
// In cases where the wire transfer gateway is unable to know when
// the wire transfer will be executed, the time at which the request
// has been received and stored will be returned.
// The purpose of this field is for debugging (humans trying to find
// the transaction) as well as for taxation (determining which
// time period a transaction belongs to).
timestamp: Timestamp;
// Opaque ID of the transaction that the bank has made.
row_id: SafeUint64;
}
export interface TransferRequest {
// Nonce to make the request idempotent. Requests with the same
// transaction_uid that differ in any of the other fields
// are rejected.
request_uid: HashCode;
// Amount to transfer.
amount: AmountString;
// Base URL of the exchange. Shall be included by the bank gateway
// in the appropriate section of the wire transfer details.
exchange_base_url: string;
// Wire transfer identifier chosen by the exchange,
// used by the merchant to identify the Taler order(s)
// associated with this wire transfer.
wtid: ShortHashCode;
// The recipient's account identifier as a payto URI.
credit_account: PaytoString;
}
export interface IncomingHistory {
// Array of incoming transactions.
incoming_transactions: IncomingBankTransaction[];
// Payto URI to identify the receiver of funds.
// This must be one of the exchange's bank accounts.
// Credit account is shared by all incoming transactions
// as per the nature of the request.
// undefined if incoming transaction is empty
credit_account?: PaytoString;
}
// Union discriminated by the "type" field.
export type IncomingBankTransaction =
| IncomingReserveTransaction
| IncomingWadTransaction;
export interface IncomingReserveTransaction {
type: "RESERVE";
// Opaque identifier of the returned record.
row_id: SafeUint64;
// Date of the transaction.
date: Timestamp;
// Amount transferred.
amount: AmountString;
// Payto URI to identify the sender of funds.
debit_account: PaytoString;
// The reserve public key extracted from the transaction details.
reserve_pub: EddsaPublicKey;
}
export interface IncomingWadTransaction {
type: "WAD";
// Opaque identifier of the returned record.
row_id: SafeUint64;
// Date of the transaction.
date: Timestamp;
// Amount transferred.
amount: AmountString;
// Payto URI to identify the receiver of funds.
// This must be one of the exchange's bank accounts.
credit_account: PaytoString;
// Payto URI to identify the sender of funds.
debit_account: PaytoString;
// Base URL of the exchange that originated the wad.
origin_exchange_url: string;
// The reserve public key extracted from the transaction details.
wad_id: WadId;
}
export interface OutgoingHistory {
// Array of outgoing transactions.
outgoing_transactions: OutgoingBankTransaction[];
// Payto URI to identify the sender of funds.
// This must be one of the exchange's bank accounts.
// Credit account is shared by all incoming transactions
// as per the nature of the request.
// undefined if outgoing transactions is empty
debit_account?: PaytoString;
}
export interface OutgoingBankTransaction {
// Opaque identifier of the returned record.
row_id: SafeUint64;
// Date of the transaction.
date: Timestamp;
// Amount transferred.
amount: AmountString;
// Payto URI to identify the receiver of funds.
credit_account: PaytoString;
// The wire transfer ID in the outgoing transaction.
wtid: ShortHashCode;
// Base URL of the exchange.
exchange_base_url: string;
}
export interface AddIncomingRequest {
// Amount to transfer.
amount: AmountString;
// Reserve public key that is included in the wire transfer details
// to identify the reserve that is being topped up.
reserve_pub: EddsaPublicKey;
// Account (as payto URI) that makes the wire transfer to the exchange.
// Usually this account must be created by the test harness before this API is
// used. An exception is the "exchange-fakebank", where any debit account can be
// specified, as it is automatically created.
debit_account: PaytoString;
}
export interface AddIncomingResponse {
// Timestamp that indicates when the wire transfer will be executed.
// In cases where the wire transfer gateway is unable to know when
// the wire transfer will be executed, the time at which the request
// has been received and stored will be returned.
// The purpose of this field is for debugging (humans trying to find
// the transaction) as well as for taxation (determining which
// time period a transaction belongs to).
timestamp: Timestamp;
// Opaque ID of the transaction that the bank has made.
row_id: SafeUint64;
}
}
export namespace TalerRevenueApi {
export interface RevenueConfig {
// Name of the API.
name: "taler-revenue";
// libtool-style representation of the Bank protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Currency used by this gateway.
currency: string;
// URN of the implementation (needed to interpret 'revision' in version).
// @since v0, may become mandatory in the future.
implementation?: string;
}
export interface RevenueIncomingHistory {
// Array of incoming transactions.
incoming_transactions: RevenueIncomingBankTransaction[];
// Payto URI to identify the receiver of funds.
// Credit account is shared by all incoming transactions
// as per the nature of the request.
credit_account: string;
}
export interface RevenueIncomingBankTransaction {
// Opaque identifier of the returned record.
row_id: SafeUint64;
// Date of the transaction.
date: Timestamp;
// Amount transferred.
amount: AmountString;
// Payto URI to identify the sender of funds.
debit_account: string;
// The wire transfer subject.
subject: string;
}
}
export namespace TalerBankConversionApi {
export interface ConversionInfo {
// Exchange rate to buy regional currency from fiat
cashin_ratio: DecimalNumber;
// Exchange rate to sell regional currency for fiat
cashout_ratio: DecimalNumber;
// Fee to subtract after applying the cashin ratio.
cashin_fee: AmountString;
// Fee to subtract after applying the cashout ratio.
cashout_fee: AmountString;
// Minimum amount authorised for cashin, in fiat before conversion
cashin_min_amount: AmountString;
// Minimum amount authorised for cashout, in regional before conversion
cashout_min_amount: AmountString;
// Smallest possible regional amount, converted amount is rounded to this amount
cashin_tiny_amount: AmountString;
// Smallest possible fiat amount, converted amount is rounded to this amount
cashout_tiny_amount: AmountString;
// Rounding mode used during cashin conversion
cashin_rounding_mode: "zero" | "up" | "nearest";
// Rounding mode used during cashout conversion
cashout_rounding_mode: "zero" | "up" | "nearest";
}
export interface IntegrationConfig {
// libtool-style representation of the Bank protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Name of the API.
name: "taler-conversion-info";
// Currency used by this bank.
regional_currency: string;
// How the bank SPA should render this currency.
regional_currency_specification: CurrencySpecification;
// External currency used during conversion.
fiat_currency: string;
// How the bank SPA should render this currency.
fiat_currency_specification: CurrencySpecification;
// Extra conversion rate information.
// Only present if server opts in to report the static conversion rate.
conversion_rate: ConversionInfo;
}
export interface CashinConversionResponse {
// Amount that the user will get deducted from their fiat
// bank account, according to the 'amount_credit' value.
amount_debit: AmountString;
// Amount that the user will receive in their regional
// bank account, according to 'amount_debit'.
amount_credit: AmountString;
}
export interface CashoutConversionResponse {
// Amount that the user will get deducted from their regional
// bank account, according to the 'amount_credit' value.
amount_debit: AmountString;
// Amount that the user will receive in their fiat
// bank account, according to 'amount_debit'.
amount_credit: AmountString;
}
export type RoundingMode = "zero" | "up" | "nearest";
export interface ConversionRate {
// Exchange rate to buy regional currency from fiat
cashin_ratio: DecimalNumber;
// Fee to subtract after applying the cashin ratio.
cashin_fee: AmountString;
// Minimum amount authorised for cashin, in fiat before conversion
cashin_min_amount: AmountString;
// Smallest possible regional amount, converted amount is rounded to this amount
cashin_tiny_amount: AmountString;
// Rounding mode used during cashin conversion
cashin_rounding_mode: RoundingMode;
// Exchange rate to sell regional currency for fiat
cashout_ratio: DecimalNumber;
// Fee to subtract after applying the cashout ratio.
cashout_fee: AmountString;
// Minimum amount authorised for cashout, in regional before conversion
cashout_min_amount: AmountString;
// Smallest possible fiat amount, converted amount is rounded to this amount
cashout_tiny_amount: AmountString;
// Rounding mode used during cashout conversion
cashout_rounding_mode: RoundingMode;
}
}
export namespace TalerBankIntegrationApi {
export interface BankVersion {
// libtool-style representation of the Bank protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Currency used by this bank.
currency: string;
// How the bank SPA should render this currency.
currency_specification?: CurrencySpecification;
// Name of the API.
name: "taler-bank-integration";
}
export interface BankWithdrawalOperationStatus {
// Current status of the operation
// pending: the operation is pending parameters selection (exchange and reserve public key)
// selected: the operations has been selected and is pending confirmation
// aborted: the operation has been aborted
// confirmed: the transfer has been confirmed and registered by the bank
status: WithdrawalOperationStatus;
// Amount that will be withdrawn with this operation
// (raw amount without fee considerations).
amount: AmountString;
// Bank account of the customer that is withdrawing, as a
// payto URI.
sender_wire?: PaytoString;
// Suggestion for an exchange given by the bank.
suggested_exchange?: string;
// URL that the user needs to navigate to in order to
// complete some final confirmation (e.g. 2FA).
// It may contain withdrawal operation id
confirm_transfer_url?: string;
// Wire transfer types supported by the bank.
wire_types: string[];
// Reserve public key selected by the exchange,
// only non-null if status is selected or confirmed.
selected_reserve_pub?: string;
// Exchange account selected by the wallet
// only non-null if status is selected or confirmed.
selected_exchange_account?: string;
}
export interface BankWithdrawalOperationPostRequest {
// Reserve public key.
reserve_pub: string;
// Payto address of the exchange selected for the withdrawal.
selected_exchange: PaytoString;
}
export interface BankWithdrawalOperationPostResponse {
// Current status of the operation
// pending: the operation is pending parameters selection (exchange and reserve public key)
// selected: the operations has been selected and is pending confirmation
// aborted: the operation has been aborted
// confirmed: the transfer has been confirmed and registered by the bank
status: Omit<"pending", WithdrawalOperationStatus>;
// URL that the user needs to navigate to in order to
// complete some final confirmation (e.g. 2FA).
//
// Only applicable when status is selected.
// It may contain withdrawal operation id
confirm_transfer_url?: string;
}
}
export namespace TalerCorebankApi {
export interface IntegrationConfig {
// libtool-style representation of the Bank protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
currency: string;
// How the bank SPA should render this currency.
currency_specification: CurrencySpecification;
// Name of the API.
name: "taler-bank-integration";
}
export interface Config {
// Name of this API, always "taler-corebank".
name: "libeufin-bank";
// name: "taler-corebank";
// API version in the form $n:$n:$n
version: string;
// Bank display name to be used in user interfaces.
// For consistency use "Taler Bank" if missing.
// @since v4, will become mandatory in the next version.
bank_name: string;
// If 'true' the server provides local currency conversion support
// If 'false' some parts of the API are not supported and return 501
allow_conversion: boolean;
// If 'true' anyone can register
// If 'false' only the admin can
allow_registrations: boolean;
// If 'true' account can delete themselves
// If 'false' only the admin can delete accounts
allow_deletions: boolean;
// If 'true' anyone can edit their name
// If 'false' only admin can
allow_edit_name: boolean;
// If 'true' anyone can edit their cashout account
// If 'false' only the admin
allow_edit_cashout_payto_uri: boolean;
// Default debt limit for newly created accounts
default_debit_threshold: AmountString;
// Currency used by this bank.
currency: string;
// How the bank SPA should render this currency.
currency_specification: CurrencySpecification;
// TAN channels supported by the server
supported_tan_channels: TanChannel[];
// Wire transfer type supported by the bank.
// Default to 'iban' is missing
// @since v4, may become mandatory in the future.
wire_type: string;
}
export interface BankAccountCreateWithdrawalRequest {
// Amount to withdraw.
amount: AmountString;
}
export 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: TalerUriString;
}
export interface WithdrawalPublicInfo {
// Current status of the operation
// pending: the operation is pending parameters selection (exchange and reserve public key)
// selected: the operations has been selected and is pending confirmation
// aborted: the operation has been aborted
// confirmed: the transfer has been confirmed and registered by the bank
status: WithdrawalOperationStatus;
// Amount that will be withdrawn with this operation
// (raw amount without fee considerations).
amount: AmountString;
// Account username
username: string;
// Reserve public key selected by the exchange,
// only non-null if status is selected or confirmed.
selected_reserve_pub?: string;
// Exchange account selected by the wallet
// only non-null if status is selected or confirmed.
selected_exchange_account?: PaytoString;
}
export interface BankAccountTransactionsResponse {
transactions: BankAccountTransactionInfo[];
}
export interface BankAccountTransactionInfo {
creditor_payto_uri: PaytoString;
debtor_payto_uri: PaytoString;
amount: AmountString;
direction: "debit" | "credit";
subject: string;
// Transaction unique ID. Matches
// $transaction_id from the URI.
row_id: number;
date: Timestamp;
}
export interface CreateTransactionRequest {
// Address in the Payto format of the wire transfer receiver.
// It needs at least the 'message' query string parameter.
payto_uri: PaytoString;
// 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?: AmountString;
// Nonce to make the request idempotent. Requests with the same
// request_uid that differ in any of the other fields
// are rejected.
// @since v4, will become mandatory in the next version.
request_uid?: ShortHashCode;
}
export interface CreateTransactionResponse {
// ID identifying the transaction being created
row_id: Integer;
}
export interface RegisterAccountResponse {
// Internal payto URI of this bank account.
internal_payto_uri: PaytoString;
}
export 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.
contact_data?: ChallengeContactData;
// 'payto' address of a fiat bank account.
// Payments will be sent to this bank account
// when the user wants to convert the regional currency
// back to fiat currency outside bank.
cashout_payto_uri?: PaytoString;
// Internal payto URI of this bank account.
// Used mostly for testing.
payto_uri?: PaytoString;
// If present, set the max debit allowed for this user
// Only admin can set this property.
debit_threshold?: AmountString;
// If present, enables 2FA and set the TAN channel used for challenges
// Only admin can set this property, other user can reconfig their account
// after creation.
tan_channel?: TanChannel;
}
export interface ChallengeContactData {
// E-Mail address
email?: EmailAddress;
// Phone number.
phone?: PhoneNumber;
}
export 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.
// Only admin can change this property.
contact_data?: ChallengeContactData;
// 'payto' URI of a fiat bank account.
// Payments will be sent to this bank account
// when the user wants to convert the regional currency
// back to fiat currency outside bank.
// Only admin can change this property if not allowed in config
cashout_payto_uri?: PaytoString;
// If present, change the legal name associated with $username.
// Only admin can change this property if not allowed in config
name?: string;
// Make this account visible to anyone?
is_public?: boolean;
// If present, change the max debit allowed for this user
// Only admin can change this property.
debit_threshold?: AmountString;
//FIX: missing in SPEC
// If present, enables 2FA and set the TAN channel used for challenges
tan_channel?: TanChannel | null;
}
export interface AccountPasswordChange {
// New password.
new_password: string;
// Old password. If present, check that the old password matches.
// Optional for admin account.
old_password?: string;
}
export interface PublicAccountsResponse {
public_accounts: PublicAccount[];
}
export interface PublicAccount {
// Username of the account
username: string;
// Internal payto URI of this bank account.
payto_uri: string;
// Current balance of the account
balance: Balance;
// Is this a taler exchange account?
is_taler_exchange: boolean;
// Opaque unique ID used for pagination.
// @since v4, will become mandatory in the future.
row_id?: Integer;
}
export interface ListBankAccountsResponse {
accounts: AccountMinimalData[];
}
export interface Balance {
amount: AmountString;
credit_debit_indicator: "credit" | "debit";
}
export interface AccountMinimalData {
// Username
username: string;
// Legal name of the account owner.
name: string;
// Internal payto URI of this bank account.
payto_uri: PaytoString;
// current balance of the account
balance: Balance;
// Number indicating the max debit allowed for the requesting user.
debit_threshold: AmountString;
// Is this account visible to anyone?
is_public: boolean;
// Is this a taler exchange account?
is_taler_exchange: boolean;
// Opaque unique ID used for pagination.
// @since v4, will become mandatory in the future.
row_id?: Integer;
}
export interface AccountData {
// Legal name of the account owner.
name: string;
// Available balance on the account.
balance: Balance;
// payto://-URI of the account.
payto_uri: PaytoString;
// Number indicating the max debit allowed for the requesting user.
debit_threshold: AmountString;
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?: PaytoString;
// Is this account visible to anyone?
is_public: boolean;
// Is this a taler exchange account?
is_taler_exchange: boolean;
// Is 2FA enabled and what channel is used for challenges?
tan_channel?: TanChannel;
}
export interface CashoutRequest {
// Nonce to make the request idempotent. Requests with the same
// request_uid that differ in any of the other fields
// are rejected.
request_uid: ShortHashCode;
// Optional subject to associate to the
// cashout operation. This data will appear
// as the incoming wire transfer subject in
// the user's fiat bank account.
subject?: string;
// That is the plain amount that the user specified
// to cashout. Its $currency is the (regional) currency of the
// bank instance.
amount_debit: AmountString;
// That is the amount that will effectively be
// transferred by the bank to the user's bank
// account, that is external to the regional currency.
// It is expressed in the fiat currency and
// is calculated after the cashout fee and the
// exchange rate. See the /cashout-rates call.
// The client needs to calculate this amount
// correctly based on the amount_debit and the cashout rate,
// otherwise the request will fail.
amount_credit: AmountString;
}
export interface CashoutResponse {
// ID identifying the operation being created
cashout_id: number;
}
/**
* @deprecated since 4, use 2fa
*/
export interface CashoutConfirmRequest {
// the TAN that confirms $CASHOUT_ID.
tan: string;
}
export interface Cashouts {
// Every string represents a cash-out operation ID.
cashouts: CashoutInfo[];
}
export interface CashoutInfo {
cashout_id: number;
/**
* @deprecated since 4, use new 2fa
*/
status?: "pending" | "aborted" | "confirmed";
}
export interface GlobalCashouts {
// Every string represents a cash-out operation ID.
cashouts: GlobalCashoutInfo[];
}
export interface GlobalCashoutInfo {
cashout_id: number;
username: string;
}
export interface CashoutStatusResponse {
// Amount debited to the internal
// regional currency bank account.
amount_debit: AmountString;
// Amount credited to the external bank account.
amount_credit: AmountString;
// Transaction subject.
subject: string;
// Time when the cashout was created.
creation_time: Timestamp;
}
export interface ConversionRatesResponse {
// Exchange rate to buy the local currency from the external one
buy_at_ratio: DecimalNumber;
// Exchange rate to sell the local currency for the external one
sell_at_ratio: DecimalNumber;
// Fee to subtract after applying the buy ratio.
buy_in_fee: DecimalNumber;
// Fee to subtract after applying the sell ratio.
sell_out_fee: DecimalNumber;
}
export enum MonitorTimeframeParam {
hour,
day,
month,
year,
decade,
}
export type MonitorResponse = MonitorNoConversion | MonitorWithConversion;
// Monitoring stats when conversion is not supported
export interface MonitorNoConversion {
type: "no-conversions";
// How many payments were made to a Taler exchange by another
// bank account.
talerInCount: number;
// Overall volume that has been paid to a Taler
// exchange by another bank account.
talerInVolume: AmountString;
// How many payments were made by a Taler exchange to another
// bank account.
talerOutCount: number;
// Overall volume that has been paid by a Taler
// exchange to another bank account.
talerOutVolume: AmountString;
}
// Monitoring stats when conversion is supported
export interface MonitorWithConversion {
type: "with-conversions";
// How many cashin operations were confirmed by a
// wallet owner. Note: wallet owners
// are NOT required to be customers of the libeufin-bank.
cashinCount: number;
// Overall regional currency that has been paid by the regional admin account
// to regional bank accounts to fulfill all the confirmed cashin operations.
cashinRegionalVolume: AmountString;
// Overall fiat currency that has been paid to the fiat admin account
// by fiat bank accounts to fulfill all the confirmed cashin operations.
cashinFiatVolume: AmountString;
// How many cashout operations were confirmed.
cashoutCount: number;
// Overall regional currency that has been paid to the regional admin account
// by fiat bank accounts to fulfill all the confirmed cashout operations.
cashoutRegionalVolume: AmountString;
// Overall fiat currency that has been paid by the fiat admin account
// to fiat bank accounts to fulfill all the confirmed cashout operations.
cashoutFiatVolume: AmountString;
// How many payments were made to a Taler exchange by another
// bank account.
talerInCount: number;
// Overall volume that has been paid to a Taler
// exchange by another bank account.
talerInVolume: AmountString;
// How many payments were made by a Taler exchange to another
// bank account.
talerOutCount: number;
// Overall volume that has been paid by a Taler
// exchange to another bank account.
talerOutVolume: AmountString;
}
export interface TanTransmission {
// Channel of the last successful transmission of the TAN challenge.
tan_channel: TanChannel;
// Info of the last successful transmission of the TAN challenge.
tan_info: string;
}
export interface Challenge {
// Unique identifier of the challenge to solve to run this protected
// operation.
challenge_id: number;
}
export interface ChallengeSolve {
// The TAN code that solves $CHALLENGE_ID
tan: string;
}
export enum TanChannel {
SMS = "sms",
EMAIL = "email",
}
}
export namespace TalerExchangeApi {
export enum AmlState {
normal = 0,
pending = 1,
frozen = 2,
}
export interface AmlRecords {
// Array of AML records matching the query.
records: AmlRecord[];
}
export interface AmlRecord {
// Which payto-address is this record about.
// Identifies a GNU Taler wallet or an affected bank account.
h_payto: PaytoHash;
// What is the current AML state.
current_state: AmlState;
// Monthly transaction threshold before a review will be triggered
threshold: AmountString;
// RowID of the record.
rowid: Integer;
}
export interface AmlDecisionDetails {
// Array of AML decisions made for this account. Possibly
// contains only the most recent decision if "history" was
// not set to 'true'.
aml_history: AmlDecisionDetail[];
// Array of KYC attributes obtained for this account.
kyc_attributes: KycDetail[];
}
export interface AmlDecisionDetail {
// What was the justification given?
justification: string;
// What is the new AML state.
new_state: Integer;
// When was this decision made?
decision_time: Timestamp;
// What is the new AML decision threshold (in monthly transaction volume)?
new_threshold: AmountString;
// Who made the decision?
decider_pub: AmlOfficerPublicKeyP;
}
export interface KycDetail {
// Name of the configuration section that specifies the provider
// which was used to collect the KYC details
provider_section: string;
// The collected KYC data. NULL if the attribute data could not
// be decrypted (internal error of the exchange, likely the
// attribute key was changed).
attributes?: Object;
// Time when the KYC data was collected
collection_time: Timestamp;
// Time when the validity of the KYC data will expire
expiration_time: Timestamp;
}
export interface AmlDecision {
// Human-readable justification for the decision.
justification: string;
// At what monthly transaction volume should the
// decision be automatically reviewed?
new_threshold: AmountString;
// Which payto-address is the decision about?
// Identifies a GNU Taler wallet or an affected bank account.
h_payto: PaytoHash;
// What is the new AML state (e.g. frozen, unfrozen, etc.)
// Numerical values are defined in AmlDecisionState.
new_state: Integer;
// Signature by the AML officer over a
// TALER_MasterAmlOfficerStatusPS.
// Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.
officer_sig: EddsaSignature;
// When was the decision made?
decision_time: Timestamp;
// Optional argument to impose new KYC requirements
// that the customer has to satisfy to unblock transactions.
kyc_requirements?: string[];
}
export interface ExchangeVersionResponse {
// libtool-style representation of the Exchange protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Name of the protocol.
name: "taler-exchange";
// URN of the implementation (needed to interpret 'revision' in version).
// @since v18, may become mandatory in the future.
implementation?: string;
// Currency supported by this exchange, given
// as a currency code ("USD" or "EUR").
currency: string;
// How wallets should render this currency.
currency_specification: CurrencySpecification;
// Names of supported KYC requirements.
supported_kyc_requirements: string[];
}
export type AccountRestriction =
| RegexAccountRestriction
| DenyAllAccountRestriction;
// Account restriction that disables this type of
// account for the indicated operation categorically.
export interface DenyAllAccountRestriction {
type: "deny";
}
// Accounts interacting with this type of account
// restriction must have a payto://-URI matching
// the given regex.
export interface RegexAccountRestriction {
type: "regex";
// Regular expression that the payto://-URI of the
// partner account must follow. The regular expression
// should follow posix-egrep, but without support for character
// classes, GNU extensions, back-references or intervals. See
// https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html
// for a description of the posix-egrep syntax. Applications
// may support regexes with additional features, but exchanges
// must not use such regexes.
payto_regex: string;
// Hint for a human to understand the restriction
// (that is hopefully easier to comprehend than the regex itself).
human_hint: string;
// Map from IETF BCP 47 language tags to localized
// human hints.
human_hint_i18n?: { [lang_tag: string]: string };
}
export interface WireAccount {
// payto:// URI identifying the account and wire method
payto_uri: PaytoString;
// URI to convert amounts from or to the currency used by
// this wire account of the exchange. Missing if no
// conversion is applicable.
conversion_url?: string;
// Restrictions that apply to bank accounts that would send
// funds to the exchange (crediting this exchange bank account).
// Optional, empty array for unrestricted.
credit_restrictions: AccountRestriction[];
// Restrictions that apply to bank accounts that would receive
// funds from the exchange (debiting this exchange bank account).
// Optional, empty array for unrestricted.
debit_restrictions: AccountRestriction[];
// Signature using the exchange's offline key over
// a TALER_MasterWireDetailsPS
// with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.
master_sig: EddsaSignature;
}
export interface ExchangeKeysResponse {
// libtool-style representation of the Exchange protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// The exchange's base URL.
base_url: string;
// The exchange's currency or asset unit.
currency: string;
/**
* FIXME: PARTIALLY IMPLEMENTED!!
*/
// How wallets should render this currency.
// currency_specification: CurrencySpecification;
// // Absolute cost offset for the STEFAN curve used
// // to (over) approximate fees payable by amount.
// stefan_abs: AmountString;
// // Factor to multiply the logarithm of the amount
// // with to (over) approximate fees payable by amount.
// // Note that the total to be paid is first to be
// // divided by the smallest denomination to obtain
// // the value that the logarithm is to be taken of.
// stefan_log: AmountString;
// // Linear cost factor for the STEFAN curve used
// // to (over) approximate fees payable by amount.
// //
// // Note that this is a scalar, as it is multiplied
// // with the actual amount.
// stefan_lin: Float;
// // Type of the asset. "fiat", "crypto", "regional"
// // or "stock". Wallets should adjust their UI/UX
// // based on this value.
// asset_type: string;
// // Array of wire accounts operated by the exchange for
// // incoming wire transfers.
// accounts: WireAccount[];
// // Object mapping names of wire methods (i.e. "iban" or "x-taler-bank")
// // to wire fees.
// wire_fees: { method: AggregateTransferFee[] };
// // List of exchanges that this exchange is partnering
// // with to enable wallet-to-wallet transfers.
// wads: ExchangePartner[];
// // Set to true if this exchange allows the use
// // of reserves for rewards.
// // @deprecated in protocol v18.
// rewards_allowed: false;
// // EdDSA master public key of the exchange, used to sign entries
// // in denoms and signkeys.
// master_public_key: EddsaPublicKey;
// // Relative duration until inactive reserves are closed;
// // not signed (!), can change without notice.
// reserve_closing_delay: RelativeTime;
// // Threshold amounts beyond which wallet should
// // trigger the KYC process of the issuing
// // exchange. Optional option, if not given there is no limit.
// // Currency must match currency.
// wallet_balance_limit_without_kyc?: AmountString[];
// // Denominations offered by this exchange
// denominations: DenomGroup[];
// // Compact EdDSA signature (binary-only) over the
// // contatentation of all of the master_sigs (in reverse
// // chronological order by group) in the arrays under
// // "denominations". Signature of TALER_ExchangeKeySetPS
// exchange_sig: EddsaSignature;
// // Public EdDSA key of the exchange that was used to generate the signature.
// // Should match one of the exchange's signing keys from signkeys. It is given
// // explicitly as the client might otherwise be confused by clock skew as to
// // which signing key was used for the exchange_sig.
// exchange_pub: EddsaPublicKey;
// // Denominations for which the exchange currently offers/requests recoup.
// recoup: Recoup[];
// // Array of globally applicable fees by time range.
// global_fees: GlobalFees[];
// // The date when the denomination keys were last updated.
// list_issue_date: Timestamp;
// // Auditors of the exchange.
// auditors: AuditorKeys[];
// // The exchange's signing keys.
// signkeys: SignKey[];
// // Optional field with a dictionary of (name, object) pairs defining the
// // supported and enabled extensions, such as age_restriction.
// extensions?: { name: ExtensionManifest };
// // Signature by the exchange master key of the SHA-256 hash of the
// // normalized JSON-object of field extensions, if it was set.
// // The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS.
// extensions_sig?: EddsaSignature;
}
interface ExtensionManifest {
// The criticality of the extension MUST be provided. It has the same
// semantics as "critical" has for extensions in X.509:
// - if "true", the client must "understand" the extension before
// proceeding,
// - if "false", clients can safely skip extensions they do not
// understand.
// (see https://datatracker.ietf.org/doc/html/rfc5280#section-4.2)
critical: boolean;
// The version information MUST be provided in Taler's protocol version
// ranges notation, see
// https://docs.taler.net/core/api-common.html#protocol-version-ranges
version: LibtoolVersion;
// Optional configuration object, defined by the feature itself
config?: object;
}
interface SignKey {
// The actual exchange's EdDSA signing public key.
key: EddsaPublicKey;
// Initial validity date for the signing key.
stamp_start: Timestamp;
// Date when the exchange will stop using the signing key, allowed to overlap
// slightly with the next signing key's validity to allow for clock skew.
stamp_expire: Timestamp;
// Date when all signatures made by the signing key expire and should
// henceforth no longer be considered valid in legal disputes.
stamp_end: Timestamp;
// Signature over key and stamp_expire by the exchange master key.
// Signature of TALER_ExchangeSigningKeyValidityPS.
// Must have purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.
master_sig: EddsaSignature;
}
interface AuditorKeys {
// The auditor's EdDSA signing public key.
auditor_pub: EddsaPublicKey;
// The auditor's URL.
auditor_url: string;
// The auditor's name (for humans).
auditor_name: string;
// An array of denomination keys the auditor affirms with its signature.
// Note that the message only includes the hash of the public key, while the
// signature is actually over the expanded information including expiration
// times and fees. The exact format is described below.
denomination_keys: AuditorDenominationKey[];
}
interface AuditorDenominationKey {
// Hash of the public RSA key used to sign coins of the respective
// denomination. Note that the auditor's signature covers more than just
// the hash, but this other information is already provided in denoms and
// thus not repeated here.
denom_pub_h: HashCode;
// Signature of TALER_ExchangeKeyValidityPS.
auditor_sig: EddsaSignature;
}
interface GlobalFees {
// What date (inclusive) does these fees go into effect?
start_date: Timestamp;
// What date (exclusive) does this fees stop going into effect?
end_date: Timestamp;
// Account history fee, charged when a user wants to
// obtain a reserve/account history.
history_fee: AmountString;
// Annual fee charged for having an open account at the
// exchange. Charged to the account. If the account
// balance is insufficient to cover this fee, the account
// is automatically deleted/closed. (Note that the exchange
// will keep the account history around for longer for
// regulatory reasons.)
account_fee: AmountString;
// Purse fee, charged only if a purse is abandoned
// and was not covered by the account limit.
purse_fee: AmountString;
// How long will the exchange preserve the account history?
// After an account was deleted/closed, the exchange will
// retain the account history for legal reasons until this time.
history_expiration: RelativeTime;
// Non-negative number of concurrent purses that any
// account holder is allowed to create without having
// to pay the purse_fee.
purse_account_limit: Integer;
// How long does an exchange keep a purse around after a purse
// has expired (or been successfully merged)? A 'GET' request
// for a purse will succeed until the purse expiration time
// plus this value.
purse_timeout: RelativeTime;
// Signature of TALER_GlobalFeesPS.
master_sig: EddsaSignature;
}
interface Recoup {
// Hash of the public key of the denomination that is being revoked under
// emergency protocol (see /recoup).
h_denom_pub: HashCode;
// We do not include any signature here, as the primary use-case for
// this emergency involves the exchange having lost its signing keys,
// so such a signature here would be pretty worthless. However, the
// exchange will not honor /recoup requests unless they are for
// denomination keys listed here.
}
interface AggregateTransferFee {
// Per transfer wire transfer fee.
wire_fee: AmountString;
// Per transfer closing fee.
closing_fee: AmountString;
// What date (inclusive) does this fee go into effect?
// The different fees must cover the full time period in which
// any of the denomination keys are valid without overlap.
start_date: Timestamp;
// What date (exclusive) does this fee stop going into effect?
// The different fees must cover the full time period in which
// any of the denomination keys are valid without overlap.
end_date: Timestamp;
// Signature of TALER_MasterWireFeePS with
// purpose TALER_SIGNATURE_MASTER_WIRE_FEES.
sig: EddsaSignature;
}
interface ExchangePartner {
// Base URL of the partner exchange.
partner_base_url: string;
// Public master key of the partner exchange.
partner_master_pub: EddsaPublicKey;
// Per exchange-to-exchange transfer (wad) fee.
wad_fee: AmountString;
// Exchange-to-exchange wad (wire) transfer frequency.
wad_frequency: RelativeTime;
// When did this partnership begin (under these conditions)?
start_date: Timestamp;
// How long is this partnership expected to last?
end_date: Timestamp;
// Signature using the exchange's offline key over
// TALER_WadPartnerSignaturePS
// with purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS.
master_sig: EddsaSignature;
}
type DenomGroup =
| DenomGroupRsa
| DenomGroupCs
| DenomGroupRsaAgeRestricted
| DenomGroupCsAgeRestricted;
interface DenomGroupRsa extends DenomGroupCommon {
cipher: "RSA";
denoms: ({
rsa_pub: RsaPublicKey;
} & DenomCommon)[];
}
interface DenomGroupCs extends DenomGroupCommon {
cipher: "CS";
denoms: ({
cs_pub: Cs25519Point;
} & DenomCommon)[];
}
// Binary representation of the age groups.
// The bits set in the mask mark the edges at the beginning of a next age
// group. F.e. for the age groups
// 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-21, 21-*
// the following bits are set:
//
// 31 24 16 8 0
// | | | | |
// oooooooo oo1oo1o1 o1o1o1o1 ooooooo1
//
// A value of 0 means that the exchange does not support the extension for
// age-restriction.
type AgeMask = Integer;
interface DenomGroupRsaAgeRestricted extends DenomGroupCommon {
cipher: "RSA+age_restricted";
age_mask: AgeMask;
denoms: ({
rsa_pub: RsaPublicKey;
} & DenomCommon)[];
}
interface DenomGroupCsAgeRestricted extends DenomGroupCommon {
cipher: "CS+age_restricted";
age_mask: AgeMask;
denoms: ({
cs_pub: Cs25519Point;
} & DenomCommon)[];
}
// Common attributes for all denomination groups
interface DenomGroupCommon {
// How much are coins of this denomination worth?
value: AmountString;
// Fee charged by the exchange for withdrawing a coin of this denomination.
fee_withdraw: AmountString;
// Fee charged by the exchange for depositing a coin of this denomination.
fee_deposit: AmountString;
// Fee charged by the exchange for refreshing a coin of this denomination.
fee_refresh: AmountString;
// Fee charged by the exchange for refunding a coin of this denomination.
fee_refund: AmountString;
}
interface DenomCommon {
// Signature of TALER_DenominationKeyValidityPS.
master_sig: EddsaSignature;
// When does the denomination key become valid?
stamp_start: Timestamp;
// When is it no longer possible to withdraw coins
// of this denomination?
stamp_expire_withdraw: Timestamp;
// When is it no longer possible to deposit coins
// of this denomination?
stamp_expire_deposit: Timestamp;
// Timestamp indicating by when legal disputes relating to these coins must
// be settled, as the exchange will afterwards destroy its evidence relating to
// transactions involving this coin.
stamp_expire_legal: Timestamp;
// Set to 'true' if the exchange somehow "lost"
// the private key. The denomination was not
// necessarily revoked, but still cannot be used
// to withdraw coins at this time (theoretically,
// the private key could be recovered in the
// future; coins signed with the private key
// remain valid).
lost?: boolean;
}
type DenominationKey = RsaDenominationKey | CSDenominationKey;
interface RsaDenominationKey {
cipher: "RSA";
// 32-bit age mask.
age_mask: Integer;
// RSA public key
rsa_public_key: RsaPublicKey;
}
interface CSDenominationKey {
cipher: "CS";
// 32-bit age mask.
age_mask: Integer;
// Public key of the denomination.
cs_public_key: Cs25519Point;
}
}
export namespace TalerMerchantApi {
export interface VersionResponse {
// libtool-style representation of the Merchant protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Name of the protocol.
name: "taler-merchant";
// URN of the implementation (needed to interpret 'revision' in version).
// @since **v8**, may become mandatory in the future.
implementation?: string;
// Default (!) currency supported by this backend.
// This is the currency that the backend should
// suggest by default to the user when entering
// amounts. See currencies for a list of
// supported currencies and how to render them.
currency: string;
// How services should render currencies supported
// by this backend. Maps
// currency codes (e.g. "EUR" or "KUDOS") to
// the respective currency specification.
// All currencies in this map are supported by
// the backend. Note that the actual currency
// specifications are a *hint* for applications
// that would like *advice* on how to render amounts.
// Applications *may* ignore the currency specification
// if they know how to render currencies that they are
// used with.
currencies: { [currency: string]: CurrencySpecification };
// Array of exchanges trusted by the merchant.
// Since protocol **v6**.
exchanges: ExchangeConfigInfo[];
}
export interface ExchangeConfigInfo {
// Base URL of the exchange REST API.
base_url: string;
// Currency for which the merchant is configured
// to trust the exchange.
// May not be the one the exchange actually uses,
// but is the only one we would trust this exchange for.
currency: string;
// Offline master public key of the exchange. The
// /keys data must be signed with this public
// key for us to trust it.
master_pub: EddsaPublicKey;
}
export interface ClaimRequest {
// Nonce to identify the wallet that claimed the order.
nonce: string;
// Token that authorizes the wallet to claim the order.
// *Optional* as the merchant may not have required it
// (create_token set to false in PostOrderRequest).
token?: ClaimToken;
}
export interface ClaimResponse {
// Contract terms of the claimed order
contract_terms: ContractTerms;
// Signature by the merchant over the contract terms.
sig: EddsaSignature;
}
export interface PaymentResponse {
// Signature on TALER_PaymentResponsePS with the public
// key of the merchant instance.
sig: EddsaSignature;
// Text to be shown to the point-of-sale staff as a proof of
// payment.
pos_confirmation?: string;
}
export interface PaymentStatusRequestParams {
// Hash of the order’s contract terms (this is used to
// authenticate the wallet/customer in case
// $ORDER_ID is guessable).
// Required once an order was claimed.
contractTermHash?: string;
// Authorizes the request via the claim token that
// was returned in the PostOrderResponse. Used with
// unclaimed orders only. Whether token authorization is
// required is determined by the merchant when the
// frontend creates the order.
claimToken?: string;
// Session ID that the payment must be bound to.
// If not specified, the payment is not session-bound.
sessionId?: string;
// If specified, the merchant backend will wait up to
// timeout_ms milliseconds for completion of the payment
// before sending the HTTP response. A client must never
// rely on this behavior, as the merchant backend may return
// a response immediately.
timeout?: number;
// If set to “yes”, poll for the order’s pending refunds
// to be picked up. timeout_ms specifies how long we
// will wait for the refund.
awaitRefundObtained?: boolean;
// Indicates that we are polling for a refund above the
// given AMOUNT. timeout_ms will specify how long we
// will wait for the refund.
refund?: AmountString;
// Since protocol v9 refunded orders are only returned
// under “already_paid_order_id” if this flag is set
// explicitly to “YES”.
allowRefundedForRepurchase?: boolean;
}
export interface GetKycStatusRequestParams {
// If specified, the KYC check should return
// the KYC status only for this wire account.
// Otherwise, for all wire accounts.
wireHash?: string;
// If specified, the KYC check should return
// the KYC status only for the given exchange.
// Otherwise, for all exchanges we interacted with.
exchangeURL?: string;
// If specified, the merchant will wait up to
// timeout_ms milliseconds for the exchanges to
// confirm completion of the KYC process(es).
timeout?: number;
}
export interface GetOtpDeviceRequestParams {
// Timestamp in seconds to use when calculating
// the current OTP code of the device. Since protocol v10.
faketime?: number;
// Price to use when calculating the current OTP
// code of the device. Since protocol v10.
price?: AmountString;
}
export interface GetOrderRequestParams {
// Session ID that the payment must be bound to.
// If not specified, the payment is not session-bound.
sessionId?: string;
// Timeout in milliseconds to wait for a payment if
// the answer would otherwise be negative (long polling).
timeout?: number;
// Since protocol v9 refunded orders are only returned
// under “already_paid_order_id” if this flag is set
// explicitly to “YES”.
allowRefundedForRepurchase?: boolean;
}
export interface ListWireTransferRequestParams {
// Filter for transfers to the given bank account
// (subject and amount MUST NOT be given in the payto URI).
paytoURI?: string;
// Filter for transfers executed before the given timestamp.
before?: number;
// Filter for transfers executed after the given timestamp.
after?: number;
// At most return the given number of results. Negative for
// descending in execution time, positive for ascending in
// execution time. Default is -20.
limit?: number;
// Starting transfer_serial_id for an iteration.
offset?: string;
// Filter transfers by verification status.
verified?: boolean;
order?: "asc" | "dec";
}
export interface ListOrdersRequestParams {
// If set to yes, only return paid orders, if no only
// unpaid orders. Do not give (or use “all”) to see all
// orders regardless of payment status.
paid?: boolean;
// If set to yes, only return refunded orders, if no only
// unrefunded orders. Do not give (or use “all”) to see
// all orders regardless of refund status.
refunded?: boolean;
// If set to yes, only return wired orders, if no only
// orders with missing wire transfers. Do not give (or
// use “all”) to see all orders regardless of wire transfer
// status.
wired?: boolean;
// At most return the given number of results. Negative
// for descending by row ID, positive for ascending by
// row ID. Default is 20. Since protocol v12.
limit?: number;
// Non-negative date in seconds after the UNIX Epoc, see delta
// for its interpretation. If not specified, we default to the
// oldest or most recent entry, depending on delta.
date?: AbsoluteTime;
// Starting product_serial_id for an iteration.
// Since protocol v12.
offset?: string;
// Timeout in milliseconds to wait for additional orders if the
// answer would otherwise be negative (long polling). Only useful
// if delta is positive. Note that the merchant MAY still return
// a response that contains fewer than delta orders.
timeout?: number;
// Since protocol v6. Filters by session ID.
sessionId?: string;
// Since protocol v6. Filters by fulfillment URL.
fulfillmentUrl?: string;
order?: "asc" | "dec";
}
export interface PayRequest {
// The coins used to make the payment.
coins: CoinPaySig[];
// Custom inputs from the wallet for the contract.
wallet_data?: Object;
// The session for which the payment is made (or replayed).
// Only set for session-based payments.
session_id?: string;
}
export interface CoinPaySig {
// Signature by the coin.
coin_sig: EddsaSignature;
// Public key of the coin being spent.
coin_pub: EddsaPublicKey;
// Signature made by the denomination public key.
ub_sig: RsaSignature;
// The hash of the denomination public key associated with this coin.
h_denom: HashCode;
// The amount that is subtracted from this coin with this payment.
contribution: AmountString;
// URL of the exchange this coin was withdrawn from.
exchange_url: string;
}
export interface StatusPaid {
type: "paid";
// Was the payment refunded (even partially, via refund or abort)?
refunded: boolean;
// Is any amount of the refund still waiting to be picked up (even partially)?
refund_pending: boolean;
// Amount that was refunded in total.
refund_amount: AmountString;
// Amount that already taken by the wallet.
refund_taken: AmountString;
}
export interface StatusGotoResponse {
type: "goto";
// The client should go to the reorder URL, there a fresh
// order might be created as this one is taken by another
// customer or wallet (or repurchase detection logic may
// apply).
public_reorder_url: string;
}
export interface StatusUnpaidResponse {
type: "unpaid";
// URI that the wallet must process to complete the payment.
taler_pay_uri: string;
// Status URL, can be used as a redirect target for the browser
// to show the order QR code / trigger the wallet.
fulfillment_url?: string;
// Alternative order ID which was paid for already in the same session.
// Only given if the same product was purchased before in the same session.
already_paid_order_id?: string;
}
export interface PaidRefundStatusResponse {
// Text to be shown to the point-of-sale staff as a proof of
// payment (present only if reusable OTP algorithm is used).
pos_confirmation?: string;
// True if the order has been subjected to
// refunds. False if it was simply paid.
refunded: boolean;
}
export interface PaidRequest {
// Signature on TALER_PaymentResponsePS with the public
// key of the merchant instance.
sig: EddsaSignature;
// Hash of the order's contract terms (this is used to authenticate the
// wallet/customer and to enable signature verification without
// database access).
h_contract: HashCode;
// Hash over custom inputs from the wallet for the contract.
wallet_data_hash?: HashCode;
// Session id for which the payment is proven.
session_id: string;
}
export interface AbortRequest {
// Hash of the order's contract terms (this is used to authenticate the
// wallet/customer in case $ORDER_ID is guessable).
h_contract: HashCode;
// List of coins the wallet would like to see refunds for.
// (Should be limited to the coins for which the original
// payment succeeded, as far as the wallet knows.)
coins: AbortingCoin[];
}
interface AbortingCoin {
// Public key of a coin for which the wallet is requesting an abort-related refund.
coin_pub: EddsaPublicKey;
// The amount to be refunded (matches the original contribution)
contribution: AmountString;
// URL of the exchange this coin was withdrawn from.
exchange_url: string;
}
export interface AbortResponse {
// List of refund responses about the coins that the wallet
// requested an abort for. In the same order as the coins
// from the original request.
// The rtransaction_id is implied to be 0.
refunds: MerchantAbortPayRefundStatus[];
}
export type MerchantAbortPayRefundStatus =
| MerchantAbortPayRefundSuccessStatus
| MerchantAbortPayRefundFailureStatus;
// Details about why a refund failed.
export interface MerchantAbortPayRefundFailureStatus {
// Used as tag for the sum type RefundStatus sum type.
type: "failure";
// HTTP status of the exchange request, must NOT be 200.
exchange_status: Integer;
// Taler error code from the exchange reply, if available.
exchange_code?: Integer;
// If available, HTTP reply from the exchange.
exchange_reply?: Object;
}
// Additional details needed to verify the refund confirmation signature
// (h_contract_terms and merchant_pub) are already known
// to the wallet and thus not included.
export interface MerchantAbortPayRefundSuccessStatus {
// Used as tag for the sum type MerchantCoinRefundStatus sum type.
type: "success";
// HTTP status of the exchange request, 200 (integer) required for refund confirmations.
exchange_status: 200;
// The EdDSA :ref:signature (binary-only) with purpose
// TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the
// exchange affirming the successful refund.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. It is given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
}
export interface WalletRefundRequest {
// Hash of the order's contract terms (this is used to authenticate the
// wallet/customer).
h_contract: HashCode;
}
export interface WalletRefundResponse {
// Amount that was refunded in total.
refund_amount: AmountString;
// Successful refunds for this payment, empty array for none.
refunds: MerchantCoinRefundStatus[];
// Public key of the merchant.
merchant_pub: EddsaPublicKey;
}
export type MerchantCoinRefundStatus =
| MerchantCoinRefundSuccessStatus
| MerchantCoinRefundFailureStatus;
// Details about why a refund failed.
export interface MerchantCoinRefundFailureStatus {
// Used as tag for the sum type RefundStatus sum type.
type: "failure";
// HTTP status of the exchange request, must NOT be 200.
exchange_status: Integer;
// Taler error code from the exchange reply, if available.
exchange_code?: Integer;
// If available, HTTP reply from the exchange.
exchange_reply?: Object;
// Refund transaction ID.
rtransaction_id: Integer;
// Public key of a coin that was refunded.
coin_pub: EddsaPublicKey;
// Amount that was refunded, including refund fee charged by the exchange
// to the customer.
refund_amount: AmountString;
// Timestamp when the merchant approved the refund.
// Useful for grouping refunds.
execution_time: Timestamp;
}
// Additional details needed to verify the refund confirmation signature
// (h_contract_terms and merchant_pub) are already known
// to the wallet and thus not included.
export interface MerchantCoinRefundSuccessStatus {
// Used as tag for the sum type MerchantCoinRefundStatus sum type.
type: "success";
// HTTP status of the exchange request, 200 (integer) required for refund confirmations.
exchange_status: 200;
// The EdDSA :ref:signature (binary-only) with purpose
// TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND using a current signing key of the
// exchange affirming the successful refund.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. It is given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
// Refund transaction ID.
rtransaction_id: Integer;
// Public key of a coin that was refunded.
coin_pub: EddsaPublicKey;
// Amount that was refunded, including refund fee charged by the exchange
// to the customer.
refund_amount: AmountString;
// Timestamp when the merchant approved the refund.
// Useful for grouping refunds.
execution_time: Timestamp;
}
interface RewardInformation {
// Exchange from which the reward will be withdrawn. Needed by the
// wallet to determine denominations, fees, etc.
exchange_url: string;
// URL where to go after obtaining the reward.
next_url: string;
// (Remaining) amount of the reward (including fees).
reward_amount: AmountString;
// Timestamp indicating when the reward is set to expire (may be in the past).
// Note that rewards that have expired MAY also result in a 404 response.
expiration: Timestamp;
}
interface RewardPickupRequest {
// List of planchets the wallet wants to use for the reward.
planchets: PlanchetDetail[];
}
interface PlanchetDetail {
// Hash of the denomination's public key (hashed to reduce
// bandwidth consumption).
denom_pub_hash: HashCode;
// Coin's blinded public key.
coin_ev: CoinEnvelope;
}
interface RewardResponse {
// Blind RSA signatures over the planchets.
// The order of the signatures matches the planchets list.
blind_sigs: BlindSignature[];
}
interface BlindSignature {
// The (blind) RSA signature. Still needs to be unblinded.
blind_sig: BlindedRsaSignature;
}
export interface InstanceConfigurationMessage {
// Name of the merchant instance to create (will become $INSTANCE).
// Must match the regex ^[A-Za-z0-9][A-Za-z0-9_.@-]+$.
id: string;
// Merchant name corresponding to this instance.
name: string;
// Type of the user (business or individual).
// Defaults to 'business'. Should become mandatory field
// in the future, left as optional for API compatibility for now.
user_type?: string;
// Merchant email for customer contact.
email?: string;
// Merchant public website.
website?: string;
// Merchant logo.
logo?: ImageDataUrl;
// Authentication settings for this instance
auth: InstanceAuthConfigurationMessage;
// The merchant's physical address (to be put into contracts).
address: Location;
// The jurisdiction under which the merchant conducts its business
// (to be put into contracts).
jurisdiction: Location;
// Use STEFAN curves to determine default fees?
// If false, no fees are allowed by default.
// Can always be overridden by the frontend on a per-order basis.
use_stefan: boolean;
// If the frontend does NOT specify an execution date, how long should
// we tell the exchange to wait to aggregate transactions before
// executing the wire transfer? This delay is added to the current
// time when we generate the advisory execution time for the exchange.
default_wire_transfer_delay: RelativeTime;
// If the frontend does NOT specify a payment deadline, how long should
// offers we make be valid by default?
default_pay_delay: RelativeTime;
}
export interface InstanceAuthConfigurationMessage {
// Type of authentication.
// "external": The mechant backend does not do
// any authentication checks. Instead an API
// gateway must do the authentication.
// "token": The merchant checks an auth token.
// See "token" for details.
method: "external" | "token";
// For method "token", this field is mandatory.
// The token MUST begin with the string "secret-token:".
// After the auth token has been set (with method "token"),
// the value must be provided in a "Authorization: Bearer $token"
// header.
token?: AccessToken;
}
export interface InstanceReconfigurationMessage {
// Merchant name corresponding to this instance.
name: string;
// Type of the user (business or individual).
// Defaults to 'business'. Should become mandatory field
// in the future, left as optional for API compatibility for now.
user_type?: string;
// Merchant email for customer contact.
email?: string;
// Merchant public website.
website?: string;
// Merchant logo.
logo?: ImageDataUrl;
// The merchant's physical address (to be put into contracts).
address: Location;
// The jurisdiction under which the merchant conducts its business
// (to be put into contracts).
jurisdiction: Location;
// Use STEFAN curves to determine default fees?
// If false, no fees are allowed by default.
// Can always be overridden by the frontend on a per-order basis.
use_stefan: boolean;
// If the frontend does NOT specify an execution date, how long should
// we tell the exchange to wait to aggregate transactions before
// executing the wire transfer? This delay is added to the current
// time when we generate the advisory execution time for the exchange.
default_wire_transfer_delay: RelativeTime;
// If the frontend does NOT specify a payment deadline, how long should
// offers we make be valid by default?
default_pay_delay: RelativeTime;
}
export interface InstancesResponse {
// List of instances that are present in the backend (see Instance).
instances: Instance[];
}
export interface Instance {
// Merchant name corresponding to this instance.
name: string;
// Type of the user ("business" or "individual").
user_type: string;
// Merchant public website.
website?: string;
// Merchant logo.
logo?: ImageDataUrl;
// Merchant instance this response is about ($INSTANCE).
id: string;
// Public key of the merchant/instance, in Crockford Base32 encoding.
merchant_pub: EddsaPublicKey;
// List of the payment targets supported by this instance. Clients can
// specify the desired payment target in /order requests. Note that
// front-ends do not have to support wallets selecting payment targets.
payment_targets: string[];
// Has this instance been deleted (but not purged)?
deleted: boolean;
}
export interface QueryInstancesResponse {
// Merchant name corresponding to this instance.
name: string;
// Type of the user ("business" or "individual").
user_type: string;
// Merchant email for customer contact.
email?: string;
// Merchant public website.
website?: string;
// Merchant logo.
logo?: ImageDataUrl;
// Public key of the merchant/instance, in Crockford Base32 encoding.
merchant_pub: EddsaPublicKey;
// The merchant's physical address (to be put into contracts).
address: Location;
// The jurisdiction under which the merchant conducts its business
// (to be put into contracts).
jurisdiction: Location;
// Use STEFAN curves to determine default fees?
// If false, no fees are allowed by default.
// Can always be overridden by the frontend on a per-order basis.
use_stefan: boolean;
// If the frontend does NOT specify an execution date, how long should
// we tell the exchange to wait to aggregate transactions before
// executing the wire transfer? This delay is added to the current
// time when we generate the advisory execution time for the exchange.
default_wire_transfer_delay: RelativeTime;
// If the frontend does NOT specify a payment deadline, how long should
// offers we make be valid by default?
default_pay_delay: RelativeTime;
// Authentication configuration.
// Does not contain the token when token auth is configured.
auth: {
method: "external" | "token";
};
}
export interface AccountKycRedirects {
// Array of pending KYCs.
pending_kycs: MerchantAccountKycRedirect[];
// Array of exchanges with no reply.
timeout_kycs: ExchangeKycTimeout[];
}
export interface MerchantAccountKycRedirect {
// URL that the user should open in a browser to
// proceed with the KYC process (as returned
// by the exchange's /kyc-check/ endpoint).
// Optional, missing if the account is blocked
// due to AML and not due to KYC.
kyc_url?: string;
// AML status of the account.
aml_status: Integer;
// Base URL of the exchange this is about.
exchange_url: string;
// Our bank wire account this is about.
payto_uri: PaytoString;
}
export interface ExchangeKycTimeout {
// Base URL of the exchange this is about.
exchange_url: string;
// Numeric error code indicating errors the exchange
// returned, or TALER_EC_INVALID for none.
exchange_code: number;
// HTTP status code returned by the exchange when we asked for
// information about the KYC status.
// 0 if there was no response at all.
exchange_http_status: number;
}
export interface AccountAddDetails {
// payto:// URI of the account.
payto_uri: PaytoString;
// URL from where the merchant can download information
// about incoming wire transfers to this account.
credit_facade_url?: string;
// Credentials to use when accessing the credit facade.
// Never returned on a GET (as this may be somewhat
// sensitive data). Can be set in POST
// or PATCH requests to update (or delete) credentials.
// To really delete credentials, set them to the type: "none".
credit_facade_credentials?: FacadeCredentials;
}
export type FacadeCredentials =
| NoFacadeCredentials
| BasicAuthFacadeCredentials;
export interface NoFacadeCredentials {
type: "none";
}
export interface BasicAuthFacadeCredentials {
type: "basic";
// Username to use to authenticate
username: string;
// Password to use to authenticate
password: string;
}
export interface AccountAddResponse {
// Hash over the wire details (including over the salt).
h_wire: HashCode;
// Salt used to compute h_wire.
salt: HashCode;
}
export interface AccountPatchDetails {
// URL from where the merchant can download information
// about incoming wire transfers to this account.
credit_facade_url?: string;
// Credentials to use when accessing the credit facade.
// Never returned on a GET (as this may be somewhat
// sensitive data). Can be set in POST
// or PATCH requests to update (or delete) credentials.
// To really delete credentials, set them to the type: "none".
// If the argument is omitted, the old credentials
// are simply preserved.
credit_facade_credentials?: FacadeCredentials;
}
export interface AccountsSummaryResponse {
// List of accounts that are known for the instance.
accounts: BankAccountSummaryEntry[];
}
// TODO: missing in docs
export interface BankAccountSummaryEntry {
// payto:// URI of the account.
payto_uri: PaytoString;
// Hash over the wire details (including over the salt).
h_wire: HashCode;
}
export interface BankAccountEntry {
// payto:// URI of the account.
payto_uri: PaytoString;
// Hash over the wire details (including over the salt).
h_wire: HashCode;
// Salt used to compute h_wire.
salt: HashCode;
// URL from where the merchant can download information
// about incoming wire transfers to this account.
credit_facade_url?: string;
// true if this account is active,
// false if it is historic.
active?: boolean;
}
export interface ProductAddDetail {
// Product ID to use.
product_id: string;
// Human-readable product description.
description: string;
// Map from IETF BCP 47 language tags to localized descriptions.
description_i18n?: { [lang_tag: string]: string };
// Unit in which the product is measured (liters, kilograms, packages, etc.).
unit: string;
// The price for one unit of the product. Zero is used
// to imply that this product is not sold separately, or
// that the price is not fixed, and must be supplied by the
// front-end. If non-zero, this price MUST include applicable
// taxes.
price: AmountString;
// An optional base64-encoded product image.
image?: ImageDataUrl;
// A list of taxes paid by the merchant for one unit of this product.
taxes?: Tax[];
// Number of units of the product in stock in sum in total,
// including all existing sales ever. Given in product-specific
// units.
// A value of -1 indicates "infinite" (i.e. for "electronic" books).
total_stock: Integer;
// Identifies where the product is in stock.
address?: Location;
// Identifies when we expect the next restocking to happen.
next_restock?: Timestamp;
// Minimum age buyer must have (in years). Default is 0.
minimum_age?: Integer;
}
export interface ProductPatchDetail {
// Human-readable product description.
description: string;
// Map from IETF BCP 47 language tags to localized descriptions.
description_i18n?: { [lang_tag: string]: string };
// Unit in which the product is measured (liters, kilograms, packages, etc.).
unit: string;
// The price for one unit of the product. Zero is used
// to imply that this product is not sold separately, or
// that the price is not fixed, and must be supplied by the
// front-end. If non-zero, this price MUST include applicable
// taxes.
price: AmountString;
// An optional base64-encoded product image.
image?: ImageDataUrl;
// A list of taxes paid by the merchant for one unit of this product.
taxes?: Tax[];
// Number of units of the product in stock in sum in total,
// including all existing sales ever. Given in product-specific
// units.
// A value of -1 indicates "infinite" (i.e. for "electronic" books).
total_stock: Integer;
// Number of units of the product that were lost (spoiled, stolen, etc.).
total_lost?: Integer;
// Identifies where the product is in stock.
address?: Location;
// Identifies when we expect the next restocking to happen.
next_restock?: Timestamp;
// Minimum age buyer must have (in years). Default is 0.
minimum_age?: Integer;
}
export interface InventorySummaryResponse {
// List of products that are present in the inventory.
products: InventoryEntry[];
}
export interface InventoryEntry {
// Product identifier, as found in the product.
product_id: string;
// product_serial_id of the product in the database.
product_serial: Integer;
}
export interface ProductDetail {
// Human-readable product description.
description: string;
// Map from IETF BCP 47 language tags to localized descriptions.
description_i18n: { [lang_tag: string]: string };
// Unit in which the product is measured (liters, kilograms, packages, etc.).
unit: string;
// The price for one unit of the product. Zero is used
// to imply that this product is not sold separately, or
// that the price is not fixed, and must be supplied by the
// front-end. If non-zero, this price MUST include applicable
// taxes.
price: AmountString;
// An optional base64-encoded product image.
image: ImageDataUrl;
// A list of taxes paid by the merchant for one unit of this product.
taxes: Tax[];
// Number of units of the product in stock in sum in total,
// including all existing sales ever. Given in product-specific
// units.
// A value of -1 indicates "infinite" (i.e. for "electronic" books).
total_stock: Integer;
// Number of units of the product that have already been sold.
total_sold: Integer;
// Number of units of the product that were lost (spoiled, stolen, etc.).
total_lost: Integer;
// Identifies where the product is in stock.
address: Location;
// Identifies when we expect the next restocking to happen.
next_restock?: Timestamp;
// Minimum age buyer must have (in years).
minimum_age?: Integer;
}
export interface LockRequest {
// UUID that identifies the frontend performing the lock
// Must be unique for the lifetime of the lock.
lock_uuid: string;
// How long does the frontend intend to hold the lock?
duration: RelativeTime;
// How many units should be locked?
quantity: Integer;
}
export interface PostOrderRequest {
// The order must at least contain the minimal
// order detail, but can override all.
order: Order;
// If set, the backend will then set the refund deadline to the current
// time plus the specified delay. If it's not set, refunds will not be
// possible.
refund_delay?: RelativeTime;
// Specifies the payment target preferred by the client. Can be used
// to select among the various (active) wire methods supported by the instance.
payment_target?: string;
// Specifies that some products are to be included in the
// order from the inventory. For these inventory management
// is performed (so the products must be in stock) and
// details are completed from the product data of the backend.
inventory_products?: MinimalInventoryProduct[];
// Specifies a lock identifier that was used to
// lock a product in the inventory. Only useful if
// inventory_products is set. Used in case a frontend
// reserved quantities of the individual products while
// the shopping cart was being built. Multiple UUIDs can
// be used in case different UUIDs were used for different
// products (i.e. in case the user started with multiple
// shopping sessions that were combined during checkout).
lock_uuids?: string[];
// Should a token for claiming the order be generated?
// False can make sense if the ORDER_ID is sufficiently
// high entropy to prevent adversarial claims (like it is
// if the backend auto-generates one). Default is 'true'.
create_token?: boolean;
// OTP device ID to associate with the order.
// This parameter is optional.
otp_id?: string;
}
type Order = MinimalOrderDetail | ContractTerms;
interface MinimalOrderDetail {
// Amount to be paid by the customer.
amount: AmountString;
// Short summary of the order.
summary: string;
// See documentation of fulfillment_url in ContractTerms.
// Either fulfillment_url or fulfillment_message must be specified.
// When creating an order, the fulfillment URL can
// contain ${ORDER_ID} which will be substituted with the
// order ID of the newly created order.
fulfillment_url?: string;
// See documentation of fulfillment_message in ContractTerms.
// Either fulfillment_url or fulfillment_message must be specified.
fulfillment_message?: string;
}
interface MinimalInventoryProduct {
// Which product is requested (here mandatory!).
product_id: string;
// How many units of the product are requested.
quantity: Integer;
}
export interface PostOrderResponse {
// Order ID of the response that was just created.
order_id: string;
// Token that authorizes the wallet to claim the order.
// Provided only if "create_token" was set to 'true'
// in the request.
token?: ClaimToken;
}
export interface OutOfStockResponse {
// Product ID of an out-of-stock item.
product_id: string;
// Requested quantity.
requested_quantity: Integer;
// Available quantity (must be below requested_quantity).
available_quantity: Integer;
// When do we expect the product to be again in stock?
// Optional, not given if unknown.
restock_expected?: Timestamp;
}
export interface OrderHistory {
// Timestamp-sorted array of all orders matching the query.
// The order of the sorting depends on the sign of delta.
orders: OrderHistoryEntry[];
}
export interface OrderHistoryEntry {
// Order ID of the transaction related to this entry.
order_id: string;
// Row ID of the order in the database.
row_id: number;
// When the order was created.
timestamp: Timestamp;
// The amount of money the order is for.
amount: AmountString;
// The summary of the order.
summary: string;
// Whether some part of the order is refundable,
// that is the refund deadline has not yet expired
// and the total amount refunded so far is below
// the value of the original transaction.
refundable: boolean;
// Whether the order has been paid or not.
paid: boolean;
}
export type MerchantOrderStatusResponse =
| CheckPaymentPaidResponse
| CheckPaymentClaimedResponse
| CheckPaymentUnpaidResponse;
export interface CheckPaymentPaidResponse {
// The customer paid for this contract.
order_status: "paid";
// Was the payment refunded (even partially)?
refunded: boolean;
// True if there are any approved refunds that the wallet has
// not yet obtained.
refund_pending: boolean;
// Did the exchange wire us the funds?
wired: boolean;
// Total amount the exchange deposited into our bank account
// for this contract, excluding fees.
deposit_total: AmountString;
// Numeric error code indicating errors the exchange
// encountered tracking the wire transfer for this purchase (before
// we even got to specific coin issues).
// 0 if there were no issues.
exchange_code: number;
// HTTP status code returned by the exchange when we asked for
// information to track the wire transfer for this purchase.
// 0 if there were no issues.
exchange_http_status: number;
// Total amount that was refunded, 0 if refunded is false.
refund_amount: AmountString;
// Contract terms.
contract_terms: ContractTerms;
// The wire transfer status from the exchange for this order if
// available, otherwise empty array.
wire_details: TransactionWireTransfer[];
// Reports about trouble obtaining wire transfer details,
// empty array if no trouble were encountered.
wire_reports: TransactionWireReport[];
// The refund details for this order. One entry per
// refunded coin; empty array if there are no refunds.
refund_details: RefundDetails[];
// Status URL, can be used as a redirect target for the browser
// to show the order QR code / trigger the wallet.
order_status_url: string;
}
export interface CheckPaymentClaimedResponse {
// A wallet claimed the order, but did not yet pay for the contract.
order_status: "claimed";
// Contract terms.
contract_terms: ContractTerms;
}
export interface CheckPaymentUnpaidResponse {
// The order was neither claimed nor paid.
order_status: "unpaid";
// URI that the wallet must process to complete the payment.
taler_pay_uri: string;
// when was the order created
creation_time: Timestamp;
// Order summary text.
summary: string;
// Total amount of the order (to be paid by the customer).
total_amount: AmountString;
// Alternative order ID which was paid for already in the same session.
// Only given if the same product was purchased before in the same session.
already_paid_order_id?: string;
// Fulfillment URL of an already paid order. Only given if under this
// session an already paid order with a fulfillment URL exists.
already_paid_fulfillment_url?: string;
// Status URL, can be used as a redirect target for the browser
// to show the order QR code / trigger the wallet.
order_status_url: string;
// We do we NOT return the contract terms here because they may not
// exist in case the wallet did not yet claim them.
}
export interface RefundDetails {
// Reason given for the refund.
reason: string;
// Set to true if a refund is still available for the wallet for this payment.
pending: boolean;
// When was the refund approved.
timestamp: Timestamp;
// Total amount that was refunded (minus a refund fee).
amount: AmountString;
}
export interface TransactionWireTransfer {
// Responsible exchange.
exchange_url: string;
// 32-byte wire transfer identifier.
wtid: Base32;
// Execution time of the wire transfer.
execution_time: Timestamp;
// Total amount that has been wire transferred
// to the merchant.
amount: AmountString;
// Was this transfer confirmed by the merchant via the
// POST /transfers API, or is it merely claimed by the exchange?
confirmed: boolean;
}
export interface TransactionWireReport {
// Numerical error code.
code: number;
// Human-readable error description.
hint: string;
// Numerical error code from the exchange.
exchange_code: number;
// HTTP status code received from the exchange.
exchange_http_status: number;
// Public key of the coin for which we got the exchange error.
coin_pub: CoinPublicKey;
}
export interface ForgetRequest {
// Array of valid JSON paths to forgettable fields in the order's
// contract terms.
fields: string[];
}
export interface RefundRequest {
// Amount to be refunded.
refund: AmountString;
// Human-readable refund justification.
reason: string;
}
export interface MerchantRefundResponse {
// URL (handled by the backend) that the wallet should access to
// trigger refund processing.
// taler://refund/...
taler_refund_uri: string;
// Contract hash that a client may need to authenticate an
// HTTP request to obtain the above URI in a wallet-friendly way.
h_contract: HashCode;
}
export interface TransferInformation {
// How much was wired to the merchant (minus fees).
credit_amount: AmountString;
// Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).
wtid: WireTransferIdentifierRawP;
// Target account that received the wire transfer.
payto_uri: PaytoString;
// Base URL of the exchange that made the wire transfer.
exchange_url: string;
}
export interface TransferList {
// List of all the transfers that fit the filter that we know.
transfers: TransferDetails[];
}
export interface TransferDetails {
// How much was wired to the merchant (minus fees).
credit_amount: AmountString;
// Raw wire transfer identifier identifying the wire transfer (a base32-encoded value).
wtid: WireTransferIdentifierRawP;
// Target account that received the wire transfer.
payto_uri: PaytoString;
// Base URL of the exchange that made the wire transfer.
exchange_url: string;
// Serial number identifying the transfer in the merchant backend.
// Used for filtering via offset.
transfer_serial_id: number;
// Time of the execution of the wire transfer by the exchange, according to the exchange
// Only provided if we did get an answer from the exchange.
execution_time?: Timestamp;
// True if we checked the exchange's answer and are happy with it.
// False if we have an answer and are unhappy, missing if we
// do not have an answer from the exchange.
verified?: boolean;
// True if the merchant uses the POST /transfers API to confirm
// that this wire transfer took place (and it is thus not
// something merely claimed by the exchange).
confirmed?: boolean;
}
interface ReserveCreateRequest {
// Amount that the merchant promises to put into the reserve.
initial_balance: AmountString;
// Exchange the merchant intends to use for rewards.
exchange_url: string;
// Desired wire method, for example "iban" or "x-taler-bank".
wire_method: string;
}
interface ReserveCreateConfirmation {
// Public key identifying the reserve.
reserve_pub: EddsaPublicKey;
// Wire accounts of the exchange where to transfer the funds.
accounts: TalerExchangeApi.WireAccount[];
}
interface RewardReserveStatus {
// Array of all known reserves (possibly empty!).
reserves: ReserveStatusEntry[];
}
interface ReserveStatusEntry {
// Public key of the reserve.
reserve_pub: EddsaPublicKey;
// Timestamp when it was established.
creation_time: Timestamp;
// Timestamp when it expires.
expiration_time: Timestamp;
// Initial amount as per reserve creation call.
merchant_initial_amount: AmountString;
// Initial amount as per exchange, 0 if exchange did
// not confirm reserve creation yet.
exchange_initial_amount: AmountString;
// Amount picked up so far.
pickup_amount: AmountString;
// Amount approved for rewards that exceeds the pickup_amount.
committed_amount: AmountString;
// Is this reserve active (false if it was deleted but not purged)?
active: boolean;
}
interface ReserveDetail {
// Timestamp when it was established.
creation_time: Timestamp;
// Timestamp when it expires.
expiration_time: Timestamp;
// Initial amount as per reserve creation call.
merchant_initial_amount: AmountString;
// Initial amount as per exchange, 0 if exchange did
// not confirm reserve creation yet.
exchange_initial_amount: AmountString;
// Amount picked up so far.
pickup_amount: AmountString;
// Amount approved for rewards that exceeds the pickup_amount.
committed_amount: AmountString;
// Array of all rewards created by this reserves (possibly empty!).
// Only present if asked for explicitly.
rewards?: RewardStatusEntry[];
// Is this reserve active (false if it was deleted but not purged)?
active: boolean;
// Array of wire accounts of the exchange that could
// be used to fill the reserve, can be NULL
// if the reserve is inactive or was already filled
accounts?: TalerExchangeApi.WireAccount[];
// URL of the exchange hosting the reserve,
// NULL if the reserve is inactive
exchange_url: string;
}
interface RewardStatusEntry {
// Unique identifier for the reward.
reward_id: HashCode;
// Total amount of the reward that can be withdrawn.
total_amount: AmountString;
// Human-readable reason for why the reward was granted.
reason: string;
}
interface RewardCreateRequest {
// Amount that the customer should be rewarded.
amount: AmountString;
// Justification for giving the reward.
justification: string;
// URL that the user should be directed to after receiving the reward,
// will be included in the reward_token.
next_url: string;
}
interface RewardCreateConfirmation {
// Unique reward identifier for the reward that was created.
reward_id: HashCode;
// taler://reward URI for the reward.
taler_reward_uri: string;
// URL that will directly trigger processing
// the reward when the browser is redirected to it.
reward_status_url: string;
// When does the reward expire?
reward_expiration: Timestamp;
}
interface RewardDetails {
// Amount that we authorized for this reward.
total_authorized: AmountString;
// Amount that was picked up by the user already.
total_picked_up: AmountString;
// Human-readable reason given when authorizing the reward.
reason: string;
// Timestamp indicating when the reward is set to expire (may be in the past).
expiration: Timestamp;
// Reserve public key from which the reward is funded.
reserve_pub: EddsaPublicKey;
// Array showing the pickup operations of the wallet (possibly empty!).
// Only present if asked for explicitly.
pickups?: PickupDetail[];
}
interface PickupDetail {
// Unique identifier for the pickup operation.
pickup_id: HashCode;
// Number of planchets involved.
num_planchets: Integer;
// Total amount requested for this pickup_id.
requested_amount: AmountString;
}
interface RewardsResponse {
// List of rewards that are present in the backend.
rewards: Reward[];
}
interface Reward {
// ID of the reward in the backend database.
row_id: number;
// Unique identifier for the reward.
reward_id: HashCode;
// (Remaining) amount of the reward (including fees).
reward_amount: AmountString;
}
export interface OtpDeviceAddDetails {
// Device ID to use.
otp_device_id: string;
// Human-readable description for the device.
otp_device_description: string;
// A key encoded with RFC 3548 Base32.
// IMPORTANT: This is not using the typical
// Taler base32-crockford encoding.
// Instead it uses the RFC 3548 encoding to
// be compatible with the TOTP standard.
otp_key: string;
// Algorithm for computing the POS confirmation.
// "NONE" or 0: No algorithm (no pos confirmation will be generated)
// "TOTP_WITHOUT_PRICE" or 1: Without amounts (typical OTP device)
// "TOTP_WITH_PRICE" or 2: With amounts (special-purpose OTP device)
// The "String" variants are supported @since protocol **v7**.
otp_algorithm: Integer | string;
// Counter for counter-based OTP devices.
otp_ctr?: Integer;
}
export interface OtpDevicePatchDetails {
// Human-readable description for the device.
otp_device_description: string;
// A key encoded with RFC 3548 Base32.
// IMPORTANT: This is not using the typical
// Taler base32-crockford encoding.
// Instead it uses the RFC 3548 encoding to
// be compatible with the TOTP standard.
otp_key: string;
// Algorithm for computing the POS confirmation.
otp_algorithm: Integer;
// Counter for counter-based OTP devices.
otp_ctr?: Integer;
}
export interface OtpDeviceSummaryResponse {
// Array of devices that are present in our backend.
otp_devices: OtpDeviceEntry[];
}
export interface OtpDeviceEntry {
// Device identifier.
otp_device_id: string;
// Human-readable description for the device.
device_description: string;
}
export interface OtpDeviceDetails {
// Human-readable description for the device.
device_description: string;
// Algorithm for computing the POS confirmation.
//
// Currently, the following numbers are defined:
// 0: None
// 1: TOTP without price
// 2: TOTP with price
otp_algorithm: Integer;
// Counter for counter-based OTP devices.
otp_ctr?: Integer;
// Current time for time-based OTP devices.
// Will match the faketime argument of the
// query if one was present, otherwise the current
// time at the backend.
//
// Available since protocol **v10**.
otp_timestamp: Integer;
// Current OTP confirmation string of the device.
// Matches exactly the string that would be returned
// as part of a payment confirmation for the given
// amount and time (so may contain multiple OTP codes).
//
// If the otp_algorithm is time-based, the code is
// returned for the current time, or for the faketime
// if a TIMESTAMP query argument was provided by the client.
//
// When using OTP with counters, the counter is **NOT**
// increased merely because this endpoint created
// an OTP code (this is a GET request, after all!).
//
// If the otp_algorithm requires an amount, the
// amount argument must be specified in the
// query, otherwise the otp_code is not
// generated.
//
// This field is *optional* in the response, as it is
// only provided if we could compute it based on the
// otp_algorithm and matching client query arguments.
//
// Available since protocol **v10**.
otp_code?: string;
}
export interface TemplateAddDetails {
// Template ID to use.
template_id: string;
// Human-readable description for the template.
template_description: string;
// OTP device ID.
// This parameter is optional.
otp_id?: string;
// Additional information in a separate template.
template_contract: TemplateContractDetails;
// Key-value pairs matching a subset of the
// fields from template_contract that are
// user-editable defaults for this template.
// Since protocol **v13**.
editable_defaults?: TemplateContractDetailsDefaults;
// Required currency for payments. Useful if no
// amount is specified in the template_contract
// but the user should be required to pay in a
// particular currency anyway. Merchant backends
// may reject requests if the template_contract
// or editable_defaults do
// specify an amount in a different currency.
// This parameter is optional.
// Since protocol **v13**.
required_currency?: string;
}
export interface TemplateContractDetails {
// Human-readable summary for the template.
summary?: string;
// Required currency for payments to the template.
// The user may specify any amount, but it must be
// in this currency.
// This parameter is optional and should not be present
// if "amount" is given.
currency?: string;
// The price is imposed by the merchant and cannot be changed by the customer.
// This parameter is optional.
amount?: AmountString;
// Minimum age buyer must have (in years). Default is 0.
minimum_age: Integer;
// The time the customer need to pay before his order will be deleted.
// It is deleted if the customer did not pay and if the duration is over.
pay_duration: RelativeTime;
}
export interface TemplateContractDetailsDefaults {
summary?: string;
currency?: string;
amount?: AmountString;
minimum_age?: Integer;
pay_duration?: RelativeTime;
}
export interface TemplatePatchDetails {
// Human-readable description for the template.
template_description: string;
// OTP device ID.
// This parameter is optional.
otp_id?: string;
// Additional information in a separate template.
template_contract: TemplateContractDetails;
// Key-value pairs matching a subset of the
// fields from template_contract that are
// user-editable defaults for this template.
// Since protocol **v13**.
editable_defaults?: TemplateContractDetailsDefaults;
// Required currency for payments. Useful if no
// amount is specified in the template_contract
// but the user should be required to pay in a
// particular currency anyway. Merchant backends
// may reject requests if the template_contract
// or editable_defaults do
// specify an amount in a different currency.
// This parameter is optional.
// Since protocol **v13**.
required_currency?: string;
}
export interface TemplateSummaryResponse {
// List of templates that are present in our backend.
templates: TemplateEntry[];
}
export interface TemplateEntry {
// Template identifier, as found in the template.
template_id: string;
// Human-readable description for the template.
template_description: string;
}
export interface WalletTemplateDetails {
// Hard-coded information about the contrac terms
// for this template.
template_contract: TemplateContractDetails;
// Key-value pairs matching a subset of the
// fields from template_contract that are
// user-editable defaults for this template.
// Since protocol **v13**.
editable_defaults?: TemplateContractDetailsDefaults;
// Required currency for payments. Useful if no
// amount is specified in the template_contract
// but the user should be required to pay in a
// particular currency anyway. Merchant backends
// may reject requests if the template_contract
// or editable_defaults do
// specify an amount in a different currency.
// This parameter is optional.
// Since protocol **v13**.
required_currency?: string;
}
export interface TemplateDetails {
// Human-readable description for the template.
template_description: string;
// OTP device ID.
// This parameter is optional.
otp_id?: string;
// Additional information in a separate template.
template_contract: TemplateContractDetails;
// Key-value pairs matching a subset of the
// fields from template_contract that are
// user-editable defaults for this template.
// Since protocol **v13**.
editable_defaults?: TemplateContractDetailsDefaults;
// Required currency for payments. Useful if no
// amount is specified in the template_contract
// but the user should be required to pay in a
// particular currency anyway. Merchant backends
// may reject requests if the template_contract
// or editable_defaults do
// specify an amount in a different currency.
// This parameter is optional.
// Since protocol **v13**.
required_currency?: string;
}
export interface UsingTemplateDetails {
// Summary of the template
summary?: string;
// The amount entered by the customer.
amount?: AmountString;
}
export interface WebhookAddDetails {
// Webhook ID to use.
webhook_id: string;
// The event of the webhook: why the webhook is used.
event_type: string;
// URL of the webhook where the customer will be redirected.
url: string;
// Method used by the webhook
http_method: string;
// Header template of the webhook
header_template?: string;
// Body template by the webhook
body_template?: string;
}
export interface WebhookPatchDetails {
// The event of the webhook: why the webhook is used.
event_type: string;
// URL of the webhook where the customer will be redirected.
url: string;
// Method used by the webhook
http_method: string;
// Header template of the webhook
header_template?: string;
// Body template by the webhook
body_template?: string;
}
export interface WebhookSummaryResponse {
// Return webhooks that are present in our backend.
webhooks: WebhookEntry[];
}
export interface WebhookEntry {
// Webhook identifier, as found in the webhook.
webhook_id: string;
// The event of the webhook: why the webhook is used.
event_type: string;
}
export interface WebhookDetails {
// The event of the webhook: why the webhook is used.
event_type: string;
// URL of the webhook where the customer will be redirected.
url: string;
// Method used by the webhook
http_method: string;
// Header template of the webhook
header_template?: string;
// Body template by the webhook
body_template?: string;
}
export interface TokenFamilyCreateRequest {
// Identifier for the token family consisting of unreserved characters
// according to RFC 3986.
slug: string;
// Human-readable name for the token family.
name: string;
// Human-readable description for the token family.
description: string;
// Optional map from IETF BCP 47 language tags to localized descriptions.
description_i18n?: { [lang_tag: string]: string };
// Start time of the token family's validity period.
// If not specified, merchant backend will use the current time.
valid_after?: Timestamp;
// End time of the token family's validity period.
valid_before: Timestamp;
// Validity duration of an issued token.
duration: RelativeTime;
// Kind of the token family.
kind: TokenFamilyKind;
}
export enum TokenFamilyKind {
Discount = "discount",
Subscription = "subscription",
}
export interface TokenFamilyUpdateRequest {
// Human-readable name for the token family.
name: string;
// Human-readable description for the token family.
description: string;
// Optional map from IETF BCP 47 language tags to localized descriptions.
description_i18n: { [lang_tag: string]: string };
// Start time of the token family's validity period.
valid_after: Timestamp;
// End time of the token family's validity period.
valid_before: Timestamp;
// Validity duration of an issued token.
duration: RelativeTime;
}
export interface TokenFamiliesList {
// All configured token families of this instance.
token_families: TokenFamilySummary[];
}
export interface TokenFamilySummary {
// Identifier for the token family consisting of unreserved characters
// according to RFC 3986.
slug: string;
// Human-readable name for the token family.
name: string;
// Start time of the token family's validity period.
valid_after: Timestamp;
// End time of the token family's validity period.
valid_before: Timestamp;
// Kind of the token family.
kind: TokenFamilyKind;
}
export interface TokenFamilyDetails {
// Identifier for the token family consisting of unreserved characters
// according to RFC 3986.
slug: string;
// Human-readable name for the token family.
name: string;
// Human-readable description for the token family.
description: string;
// Optional map from IETF BCP 47 language tags to localized descriptions.
description_i18n?: { [lang_tag: string]: string };
// Start time of the token family's validity period.
valid_after: Timestamp;
// End time of the token family's validity period.
valid_before: Timestamp;
// Validity duration of an issued token.
duration: RelativeTime;
// Kind of the token family.
kind: TokenFamilyKind;
// How many tokens have been issued for this family.
issued: Integer;
// How many tokens have been redeemed for this family.
redeemed: Integer;
}
export interface ContractTerms {
// Human-readable description of the whole purchase.
summary: string;
// Map from IETF BCP 47 language tags to localized summaries.
summary_i18n?: { [lang_tag: string]: string };
// Unique, free-form identifier for the proposal.
// Must be unique within a merchant instance.
// For merchants that do not store proposals in their DB
// before the customer paid for them, the order_id can be used
// by the frontend to restore a proposal from the information
// encoded in it (such as a short product identifier and timestamp).
order_id: string;
// Total price for the transaction.
// The exchange will subtract deposit fees from that amount
// before transferring it to the merchant.
amount: AmountString;
// URL where the same contract could be ordered again (if
// available). Returned also at the public order endpoint
// for people other than the actual buyer (hence public,
// in case order IDs are guessable).
public_reorder_url?: string;
// URL that will show that the order was successful after
// it has been paid for. Optional. When POSTing to the
// merchant, the placeholder "${ORDER_ID}" will be
// replaced with the actual order ID (useful if the
// order ID is generated server-side and needs to be
// in the URL).
// Note that this placeholder can only be used once.
// Either fulfillment_url or fulfillment_message must be specified.
fulfillment_url?: string;
// Message shown to the customer after paying for the order.
// Either fulfillment_url or fulfillment_message must be specified.
fulfillment_message?: string;
// Map from IETF BCP 47 language tags to localized fulfillment
// messages.
fulfillment_message_i18n?: { [lang_tag: string]: string };
// Maximum total deposit fee accepted by the merchant for this contract.
// Overrides defaults of the merchant instance.
max_fee: AmountString;
// List of products that are part of the purchase (see Product).
products: Product[];
// Time when this contract was generated.
timestamp: Timestamp;
// After this deadline has passed, no refunds will be accepted.
refund_deadline: Timestamp;
// After this deadline, the merchant won't accept payments for the contract.
pay_deadline: Timestamp;
// Transfer deadline for the exchange. Must be in the
// deposit permissions of coins used to pay for this order.
wire_transfer_deadline: Timestamp;
// Merchant's public key used to sign this proposal; this information
// is typically added by the backend. Note that this can be an ephemeral key.
merchant_pub: EddsaPublicKey;
// Base URL of the (public!) merchant backend API.
// Must be an absolute URL that ends with a slash.
merchant_base_url: string;
// More info about the merchant, see below.
merchant: Merchant;
// The hash of the merchant instance's wire details.
h_wire: HashCode;
// Wire transfer method identifier for the wire method associated with h_wire.
// The wallet may only select exchanges via a matching auditor if the
// exchange also supports this wire method.
// The wire transfer fees must be added based on this wire transfer method.
wire_method: string;
// Exchanges that the merchant accepts even if it does not accept any auditors that audit them.
exchanges: Exchange[];
// Delivery location for (all!) products.
delivery_location?: Location;
// Time indicating when the order should be delivered.
// May be overwritten by individual products.
delivery_date?: Timestamp;
// Nonce generated by the wallet and echoed by the merchant
// in this field when the proposal is generated.
nonce: string;
// Specifies for how long the wallet should try to get an
// automatic refund for the purchase. If this field is
// present, the wallet should wait for a few seconds after
// the purchase and then automatically attempt to obtain
// a refund. The wallet should probe until "delay"
// after the payment was successful (i.e. via long polling
// or via explicit requests with exponential back-off).
//
// In particular, if the wallet is offline
// at that time, it MUST repeat the request until it gets
// one response from the merchant after the delay has expired.
// If the refund is granted, the wallet MUST automatically
// recover the payment. This is used in case a merchant
// knows that it might be unable to satisfy the contract and
// desires for the wallet to attempt to get the refund without any
// customer interaction. Note that it is NOT an error if the
// merchant does not grant a refund.
auto_refund?: RelativeTime;
// Extra data that is only interpreted by the merchant frontend.
// Useful when the merchant needs to store extra information on a
// contract without storing it separately in their database.
extra?: any;
// Minimum age the buyer must have (in years). Default is 0.
// This value is at least as large as the maximum over all
// minimum age requirements of the products in this contract.
// It might also be set independent of any product, due to
// legal requirements.
minimum_age?: Integer;
}
export interface Product {
// Merchant-internal identifier for the product.
product_id?: string;
// Human-readable product description.
description: string;
// Map from IETF BCP 47 language tags to localized descriptions.
description_i18n?: { [lang_tag: string]: string };
// The number of units of the product to deliver to the customer.
quantity?: Integer;
// Unit in which the product is measured (liters, kilograms, packages, etc.).
unit?: string;
// The price of the product; this is the total price for quantity times unit of this product.
price?: AmountString;
// An optional base64-encoded product image.
image?: ImageDataUrl;
// A list of taxes paid by the merchant for this product. Can be empty.
taxes?: Tax[];
// Time indicating when this product should be delivered.
delivery_date?: Timestamp;
}
export interface Tax {
// The name of the tax.
name: string;
// Amount paid in tax.
tax: AmountString;
}
export interface Merchant {
// The merchant's legal name of business.
name: string;
// Label for a location with the business address of the merchant.
email?: string;
// Label for a location with the business address of the merchant.
website?: string;
// An optional base64-encoded product image.
logo?: ImageDataUrl;
// Label for a location with the business address of the merchant.
address?: Location;
// Label for a location that denotes the jurisdiction for disputes.
// Some of the typical fields for a location (such as a street address) may be absent.
jurisdiction?: Location;
}
// Delivery location, loosely modeled as a subset of
// ISO20022's PostalAddress25.
export interface Location {
// Nation with its own government.
country?: string;
// Identifies a subdivision of a country such as state, region, county.
country_subdivision?: string;
// Identifies a subdivision within a country sub-division.
district?: string;
// Name of a built-up area, with defined boundaries, and a local government.
town?: string;
// Specific location name within the town.
town_location?: string;
// Identifier consisting of a group of letters and/or numbers that
// is added to a postal address to assist the sorting of mail.
post_code?: string;
// Name of a street or thoroughfare.
street?: string;
// Name of the building or house.
building_name?: string;
// Number that identifies the position of a building on a street.
building_number?: string;
// Free-form address lines, should not exceed 7 elements.
address_lines?: string[];
}
interface Auditor {
// Official name.
name: string;
// Auditor's public key.
auditor_pub: EddsaPublicKey;
// Base URL of the auditor.
url: string;
}
export interface Exchange {
// The exchange's base URL.
url: string;
// How much would the merchant like to use this exchange.
// The wallet should use a suitable exchange with high
// priority. The following priority values are used, but
// it should be noted that they are NOT in any way normative.
//
// 0: likely it will not work (recently seen with account
// restriction that would be bad for this merchant)
// 512: merchant does not know, might be down (merchant
// did not yet get /wire response).
// 1024: good choice (recently confirmed working)
priority: Integer;
// Master public key of the exchange.
master_pub: EddsaPublicKey;
}
}
export namespace ChallengerApi {
export interface ChallengerTermsOfServiceResponse {
// Name of the service
name: "challenger";
// libtool-style representation of the Challenger protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// URN of the implementation (needed to interpret 'revision' in version).
// @since v0, may become mandatory in the future.
implementation?: string;
}
export interface ChallengeSetupResponse {
// Nonce to use when constructing /authorize endpoint.
nonce: string;
}
export interface Restriction {
regex?: string;
hint?: string;
hint_i18n?: InternationalizedString;
}
export interface ChallengeStatus {
// Object; map of keys (names of the fields of the address
// to be entered by the user) to objects with a "regex" (string)
// containing an extended Posix regular expression for allowed
// address field values, and a "hint"/"hint_i18n" giving a
// human-readable explanation to display if the value entered
// by the user does not match the regex. Keys that are not mapped
// to such an object have no restriction on the value provided by
// the user. See "ADDRESS_RESTRICTIONS" in the challenger configuration.
restrictions: Record<string, Restriction> | undefined;
// indicates if the given address cannot be changed anymore, the
// form should be read-only if set to true.
fix_address: boolean;
// form values from the previous submission if available, details depend
// on the ADDRESS_TYPE, should be used to pre-populate the form
last_address: Record<string, string> | undefined;
// number of times the address can still be changed, may or may not be
// shown to the user
changes_left: Integer;
}
export interface ChallengeCreateResponse {
// how many more attempts are allowed, might be shown to the user,
// highlighting might be appropriate for low values such as 1 or 2 (the
// form will never be used if the value is zero)
attempts_left: Integer;
// the address that is being validated, might be shown or not
address: Object;
// true if we just retransmitted the challenge, false if we sent a
// challenge recently and thus refused to transmit it again this time;
// might make a useful hint to the user
transmitted: boolean;
// timestamp explaining when we would re-transmit the challenge the next
// time (at the earliest) if requested by the user
next_tx_time: string;
}
export interface InvalidPinResponse {
// numeric Taler error code, should be shown to indicate the error
// compactly for reporting to developers
ec?: number;
// human-readable Taler error code, should be shown for the user to
// understand the error
hint: string;
// how many times is the user still allowed to change the address;
// if 0, the user should not be shown a link to jump to the
// address entry form
addresses_left: Integer;
// how many times might the PIN still be retransmitted
pin_transmissions_left: Integer;
// how many times might the user still try entering the PIN code
auth_attempts_left: Integer;
// if true, the PIN was not even evaluated as the user previously
// exhausted the number of attempts
exhausted: boolean;
// if true, the PIN was not even evaluated as no challenge was ever
// issued (the user must have skipped the step of providing their
// address first!)
no_challenge: boolean;
}
export interface ChallengerAuthResponse {
// Token used to authenticate access in /info.
access_token: string;
// Type of the access token.
token_type: "Bearer";
// Amount of time that an access token is valid (in seconds).
expires_in: Integer;
}
export interface ChallengerInfoResponse {
// Unique ID of the record within Challenger
// (identifies the rowid of the token).
id: Integer;
// Address that was validated.
// Key-value pairs, details depend on the
// address_type.
address: Object;
// Type of the address.
address_type: string;
// How long do we consider the address to be
// valid for this user.
expires: Timestamp;
}
}
|