commit 0053ed49ae9f61d097a6d835345cd185603e1f03
parent ebb5cc274a51020004e247848eeba558f6add5f5
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 11:11:14 +0200
util: derive AML events for accounts without a previous decision
The three VQF 902.14 rules bailed out when the previous property set was
absent, although that is the specification's own precondition, so a report
filed on such an account left the MROS counters at zero.
Diffstat:
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/packages/taler-util/src/aml/events.ts b/packages/taler-util/src/aml/events.ts
@@ -480,14 +480,16 @@ export const EventsDerivation_TOPS: EventMapInfo<typeof TOPS_AmlEventsName> = {
},
MROS_REPORTED_SUSPICION_SIMPLE: {
shouldBeTriggered(formId, prevState, nextState, attr) {
- if (prevState === undefined || nextState === undefined) {
+ // An account with no previous decision has no properties at all, which
+ // the specification's "INVESTIGATION_STATE == null" precondition covers.
+ if (nextState === undefined) {
return false;
}
if (
- prevState[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
- prevState[TalerAmlProperties.INVESTIGATION_STATE] ===
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] ===
"INVESTIGATION_PENDING" ||
- !prevState[TalerAmlProperties.INVESTIGATION_STATE]
+ !prevState?.[TalerAmlProperties.INVESTIGATION_STATE]
) {
if (
nextState[TalerAmlProperties.INVESTIGATION_STATE] ===
@@ -501,14 +503,16 @@ export const EventsDerivation_TOPS: EventMapInfo<typeof TOPS_AmlEventsName> = {
},
MROS_REPORTED_SUSPICION_SUBSTANTIATED: {
shouldBeTriggered(formId, prevState, nextState, attr) {
- if (prevState === undefined || nextState === undefined) {
+ // An account with no previous decision has no properties at all, which
+ // the specification's "INVESTIGATION_STATE == null" precondition covers.
+ if (nextState === undefined) {
return false;
}
if (
- prevState[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
- prevState[TalerAmlProperties.INVESTIGATION_STATE] ===
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] ===
"INVESTIGATION_PENDING" ||
- !prevState[TalerAmlProperties.INVESTIGATION_STATE]
+ !prevState?.[TalerAmlProperties.INVESTIGATION_STATE]
) {
if (
nextState[TalerAmlProperties.INVESTIGATION_STATE] ===
@@ -522,14 +526,16 @@ export const EventsDerivation_TOPS: EventMapInfo<typeof TOPS_AmlEventsName> = {
},
INCR_INVESTIGATION_CONCLUDED: {
shouldBeTriggered(formId, prevState, nextState, attr) {
- if (prevState === undefined || nextState === undefined) {
+ // An account with no previous decision has no properties at all, which
+ // the specification's "INVESTIGATION_STATE == null" precondition covers.
+ if (nextState === undefined) {
return false;
}
if (
- prevState[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
- prevState[TalerAmlProperties.INVESTIGATION_STATE] ===
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] === "NONE" ||
+ prevState?.[TalerAmlProperties.INVESTIGATION_STATE] ===
"INVESTIGATION_PENDING" ||
- !prevState[TalerAmlProperties.INVESTIGATION_STATE]
+ !prevState?.[TalerAmlProperties.INVESTIGATION_STATE]
) {
if (
nextState[TalerAmlProperties.INVESTIGATION_STATE] ===