aboutsummaryrefslogtreecommitdiff
path: root/src/kyclogic/taler-exchange-helper-measure-freeze
blob: 1a8a43b5584dab5d27931deedd6a0127df63dd0c (plain)
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
#!/bin/bash
#
#  This file is part of TALER
#  Copyright (C) 2014-2024 Taler Systems SA
#
#  TALER is free software; you can redistribute it and/or modify it under the
#  terms of the GNU General Public License as published by the Free Software
#  Foundation; either version 3, or (at your option) any later version.
#
#  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
#  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with
#  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/license>
#

# Hard error reporting on.
set -eu

# This is a KYC measure program that freezes
# the account and flags it for manual investigation.
# This is the ultimate fallback measure.

if [ "${1:-no}" = "--required-context" ]
then
    # No context is required.
    exit 0
fi

if [ "${1:-no}" = "--required-attributes" ]
then
    # No required attributes.
    exit 0
fi

# See https://docs.taler.net/taler-exchange-manual.html#tsref-type-AmlProgramInput
# for the full JSON with possible inputs.

# New rules apply for 30 days.
EXPIRATION=$((3600 * 30 + $(date +%s)))

# Finally, output the new rules.
# See https://docs.taler.net/taler-exchange-manual.html#tsref-type-AmlOutcome
# for the required output format.

jq -n \
    --arg expiration "$EXPIRATION" \
    '{ "to_investigate": true,
       "new_rules" : {
         "new_check" : "info-frozen",
         "expiration_time" : { "t_s": $expiration },
         "rules" : [
           {
             "operation_type": "WITHDRAW",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           },
           {
             "operation_type": "DEPOSIT",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           },
           {
             "operation_type": "MERGE",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           },
           {
             "operation_type": "BALANCE",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           },
           {
             "operation_type": "CLOSE",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           },
           {
             "operation_type": "AGE-WITHDRAW",
             "threshold" : "EUR:0",
             "timeframe" : { "d_us" : 3600000000 },
             "measures" : [ "verboten" ],
             "display_priority" : 1,
             "exposed" : false,
             "is_and_combinator" : true
           }
         ]
       }
     }' < /dev/null