Create a new operation: allow-list
.
That operation will change the number of rules that should be applied. When an account is allow-listed, authorizer should validate only two rules:
- The transaction amount should not be above limit
- No transaction should be approved when the card is blocked
The account is not allow-listed by default, and once it is allow-listed it can be disabled with a new allow-list
operation.
The allow-list
operation input is going to be:
{"allow-list": {"active": true}}
The output of that operation is going to be the current account state:
{"account": {"active-card": true, "available-limit": 100, "allow-listed": true}, "violations": []}
For the following operations:
{ "account": { "active-card": true, "available-limit": 1000 } }
{ "allow-list": { "active": true } }
{ "transaction": { "merchant": "A", "amount": 20, "time": "2019-02-13T10:00:00.000Z" } }
{ "transaction": { "merchant": "B", "amount": 30, "time": "2019-02-13T10:00:01.000Z" } }
{ "transaction": { "merchant": "C", "amount": 40, "time": "2019-02-13T10:00:02.000Z" } }
{ "transaction": { "merchant": "D", "amount": 50, "time": "2019-02-13T10:00:03.000Z" } }
{ "transaction": { "merchant": "E", "amount": 2000, "time": "2019-02-13T10:00:04.000Z" } }
{ "allow-list": { "active": false } }
{ "transaction": { "merchant": "F", "amount": 50, "time": "2019-02-13T10:00:04.000Z" } }
The output should be:
{ "violations": [], "account": { "allow-listed": false, "available-limit": 1000, "active-card": true } }
{ "violations": [], "account": { "allow-listed": true, "available-limit": 1000, "active-card": true } }
{ "violations": [], "account": { "allow-listed": true, "available-limit": 980, "active-card": true } }
{ "violations": [], "account": { "allow-listed": true, "available-limit": 950, "active-card": true } }
{ "violations": [], "account": { "allow-listed": true, "available-limit": 910, "active-card": true } }
{ "violations": [], "account": { "allow-listed": true, "available-limit": 860, "active-card": true } }
{ "violations": ["insufficient-limit"], "account": { "allow-listed": true, "available-limit": 860, "active-card": true } }
{ "violations": [], "account": { "allow-listed": false, "available-limit": 860, "active-card": true } }
{ "violations": ["high-frequency-small-interval"], "account": { "allow-listed": false, "available-limit": 860, "active-card": true } }