lib: fixed validation rules for minimul viable csv rules to include account1 etc

This commit is contained in:
Dmitry Astapov 2019-10-14 21:41:25 +01:00
parent f1ab107400
commit b2ba1086b6

View File

@ -468,16 +468,18 @@ validateRules rules = do
(not amount && (amountin && amountout)) || (not amount && (amountin && amountout)) ||
balance) balance)
$ Left $ unlines [ $ Left $ unlines [
"Please specify (as a top level CSV rule) either the amount field," "Please specify (as a top level CSV rule) either the amount1 field,"
,"both the amount-in and amount-out fields, or the balance field. Eg:" ,"both the amount1-in and amount1-out fields, or the balance1 field. Eg:"
,"amount %2\n" ,"amount1 %2\n"
,"You can also use amount, or both amount-in and amount-out, or balance,"
,"though this syntax is considered legacy."
] ]
Right rules Right rules
where where
amount = isAssigned "amount" amount = isAssigned "amount" || isAssigned "amount1"
amountin = isAssigned "amount-in" amountin = isAssigned "amount-in" || isAssigned "amount1-in"
amountout = isAssigned "amount-out" amountout = isAssigned "amount-out" || isAssigned "amount1-out"
balance = isAssigned "balance" || isAssigned "balance1" || isAssigned "balance2" balance = isAssigned "balance" || isAssigned "balance1"
isAssigned f = isJust $ getEffectiveAssignment rules [] f isAssigned f = isJust $ getEffectiveAssignment rules [] f
-- parsers -- parsers