taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 2f287ba08f59c64e370a1ffa12d3551cec3e01a1
parent 1d366c84a34ebab782ff6f2c8cac61dbbb11a834
Author: Sebastian <sebasjm@gmail.com>
Date:   Sat,  1 Mar 2025 18:32:14 -0300

work on #9577

Diffstat:
Mpackages/aml-backoffice-ui/src/forms/index.ts | 14+++++++++++---
Mpackages/aml-backoffice-ui/src/pages/decision/Properties.tsx | 22++++++++++++----------
Mpackages/aml-backoffice-ui/src/pages/decision/aml-events.ts | 70++++++++++++++++++++++++++++++++++++++++++----------------------------
Mpackages/aml-backoffice-ui/src/pages/decision/aml-properties.ts | 52+++++++++++++++++++++++++++++++---------------------
Mpackages/kyc-ui/src/Routing.tsx | 4++--
Mpackages/kyc-ui/src/forms/index.ts | 4++--
Mpackages/web-util/src/utils/countries.ts | 5+----
Mpackages/web-util/src/utils/languagues.ts | 2+-
8 files changed, 102 insertions(+), 71 deletions(-)

diff --git a/packages/aml-backoffice-ui/src/forms/index.ts b/packages/aml-backoffice-ui/src/forms/index.ts @@ -14,12 +14,13 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ import { - VQF_902_1, VQF_902_11, VQF_902_12, VQF_902_13, VQF_902_14, VQF_902_15, + VQF_902_1_all, + VQF_902_1_officer, VQF_902_4, VQF_902_5, VQF_902_9, @@ -149,11 +150,18 @@ export const preloadedForms: ( config: simplest(i18n), }, { - label: i18n.str`Identification Form`, + label: i18n.str`Identification Form (full)`, description: i18n.str`The customer has to be identified on entering into a permanent business relationship or on concluding a cash transaction, which meets the according threshold.`, id: "vqf-902-1", version: 1, - config: VQF_902_1(i18n), + config: VQF_902_1_all(i18n), + }, + { + label: i18n.str`Identification Form (Only officer)`, + description: i18n.str`The customer has to be identified on entering into a permanent business relationship or on concluding a cash transaction, which meets the according threshold.`, + id: "vqf-902-1-officer", + version: 1, + config: VQF_902_1_officer(i18n), }, { label: i18n.str`Risk Profile AMLA`, diff --git a/packages/aml-backoffice-ui/src/pages/decision/Properties.tsx b/packages/aml-backoffice-ui/src/pages/decision/Properties.tsx @@ -172,55 +172,57 @@ export function propertiesByDialect( // if (!dialect) return []; return [ { - id: "AML_ACCOUNT_ACTIVE_DEPOSIT" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id, label: i18n.str`Is account active for deposit and payments?`, type: "toggle", threeState: true, }, { - id: "AML_DOMESTIC_PEP" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id, label: i18n.str`Does account belong to a domestic PEP?`, type: "toggle", threeState: true, }, { - id: "AML_FOREIGN_PEP" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_FOREIGN_PEP.id, label: i18n.str`Does account belong to a foreign PEP?`, type: "toggle", threeState: true, }, { - id: "AML_HIGH_RISK_BUSINESS" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_HIGH_RISK_BUSINESS.id, label: i18n.str`Does account belong to a high risk business?`, type: "toggle", threeState: true, }, { - id: "AML_HIGH_RISK_COUNTRY" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_HIGH_RISK_COUNTRY.id, label: i18n.str`Does account belong to a person from a high risk country?`, type: "toggle", threeState: true, }, { - id: "AML_INVESTIGATION_ART6_COMPLETED" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_INVESTIGATION_ART6_COMPLETED + .id, label: i18n.str`Was succesfully investigated under Art 6 Gwg?`, type: "toggle", threeState: true, }, { - id: "AML_INVESTIGATION_ART6_FAILED" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_INVESTIGATION_ART6_FAILED + .id, label: i18n.str`Was investigated under Art 6 Gwg and failed?`, type: "toggle", threeState: true, }, { - id: "AML_MROS_REPORTED_ART305" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_MROS_REPORTED_ART305.id, label: i18n.str`Was reported to MROS by obligation?`, type: "toggle", threeState: true, }, { - id: "AML_MROS_REPORTED_ART9" satisfies keyof TalerFormAttributes.AccountProperties as UIHandlerId, + id: TalerFormAttributes.AccountProperties.AML_MROS_REPORTED_ART9.id, label: i18n.str`Was reported to MROS by right?`, type: "toggle", threeState: true, @@ -228,7 +230,7 @@ export function propertiesByDialect( ]; } -type PropName = keyof TalerFormAttributes.AccountProperties; +type PropName = keyof typeof TalerFormAttributes.AccountProperties; type PartialRecord<K extends keyof any, T> = { [P in K]?: T; diff --git a/packages/aml-backoffice-ui/src/pages/decision/aml-events.ts b/packages/aml-backoffice-ui/src/pages/decision/aml-events.ts @@ -44,112 +44,126 @@ export const AML_EVENTS_INFO: EventMapInfo = { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_CLOSED: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_OPENED_HIGH_RISK: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_CLOSED_HIGH_RISK: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_OPENED_DOMESTIC_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_CLOSED_DOMESTIC_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_OPENED_FOREIGN_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_CLOSED_FOREIGN_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_OPENED_HR_COUNTRY: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_CLOSED_HR_COUNTRY: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_MROS_REPORTED_ART305: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, ACCOUNT_MROS_REPORTED_ART9: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_INVESTIGATION_ART6_COMPLETED: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, ACCOUNT_INVESTIGATION_ART6_FAILED: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeTriggered(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, TEST_EVENT_KEY_1: { diff --git a/packages/aml-backoffice-ui/src/pages/decision/aml-properties.ts b/packages/aml-backoffice-ui/src/pages/decision/aml-properties.ts @@ -7,7 +7,7 @@ import { TalerFormAttributes } from "@gnu-taler/web-util/browser"; import { DecisionRequest } from "../../hooks/decision-request.js"; export type PropertiesMapInfo = { - [name in keyof TalerFormAttributes.AccountProperties]: { + [name in keyof typeof TalerFormAttributes.AccountProperties]: { // fieldLabel: TranslatedString; dialect: AmlSpaDialect[]; shouldBeOn: ( @@ -23,80 +23,90 @@ export const AML_PROPERTIES_INFO: PropertiesMapInfo = { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, AML_DOMESTIC_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, AML_FOREIGN_PEP: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, AML_HIGH_RISK_BUSINESS: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, AML_HIGH_RISK_COUNTRY: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, AML_INVESTIGATION_ART6_COMPLETED: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, AML_INVESTIGATION_ART6_FAILED: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, AML_MROS_REPORTED_ART305: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, AML_MROS_REPORTED_ART9: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_ACCOUNT_ACTIVE_DEPOSIT; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_ACCOUNT_ACTIVE_DEPOSIT.id + ]; }, }, AML_NO_OPERATION_DURING_PERIOD: { dialect: [AmlSpaDialect.TOPS, AmlSpaDialect.TESTING], shouldBeOn(req, dialect) { if (!req.properties) return false; - return !!(req.properties as TalerFormAttributes.AccountProperties) - .AML_DOMESTIC_PEP; + return !!req.properties[ + TalerFormAttributes.AccountProperties.AML_DOMESTIC_PEP.id + ]; }, }, }; diff --git a/packages/kyc-ui/src/Routing.tsx b/packages/kyc-ui/src/Routing.tsx @@ -24,12 +24,12 @@ import { Fragment, VNode, h } from "preact"; import { AccessToken, assertUnreachable } from "@gnu-taler/taler-util"; import { useEffect, useErrorBoundary } from "preact/hooks"; +import { useSessionState } from "./hooks/session.js"; import { CallengeCompleted } from "./pages/CallengeCompleted.js"; import { Frame } from "./pages/Frame.js"; import { Start } from "./pages/Start.js"; -import { useSessionState } from "./hooks/session.js"; -import { TriggerKyc } from "./pages/TriggerKyc.js"; import { TriggerForms } from "./pages/TriggerForms.js"; +import { TriggerKyc } from "./pages/TriggerKyc.js"; export function Routing(): VNode { // check session and defined if this is diff --git a/packages/kyc-ui/src/forms/index.ts b/packages/kyc-ui/src/forms/index.ts @@ -17,12 +17,12 @@ import { FormMetadata, GLS_Onboarding, InternationalizationAPI, - VQF_902_1, VQF_902_11, VQF_902_12, VQF_902_13, VQF_902_14, VQF_902_15, + VQF_902_1_customer, VQF_902_4, VQF_902_5, VQF_902_9, @@ -66,7 +66,7 @@ export const preloadedForms: ( description: i18n.str`The customer has to be identified on entering into a permanent business relationship or on concluding a cash transaction, which meets the according threshold.`, id: "vqf-902-1", version: 1, - config: VQF_902_1(i18n), + config: VQF_902_1_customer(i18n), }, { label: i18n.str`Risk Profile AMLA`, diff --git a/packages/web-util/src/utils/countries.ts b/packages/web-util/src/utils/countries.ts @@ -15,10 +15,7 @@ */ import { TranslatedString } from "@gnu-taler/taler-util"; -import { - InternationalizationAPI, - SelectUiChoice, -} from "@gnu-taler/web-util/browser"; +import { InternationalizationAPI, SelectUiChoice } from "../index.browser.js"; /** * ISO 3166 of supported countries diff --git a/packages/web-util/src/utils/languagues.ts b/packages/web-util/src/utils/languagues.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { TranslatedString } from "../../../taler-util/src/i18n.js"; +import { TranslatedString } from "@gnu-taler/taler-util"; import { InternationalizationAPI, SelectUiChoice } from "../index.browser.js"; /**