commit ef19fee60819f26f50056d495c352354523c4281
parent f6a846c2ac7cf5e72b370c2cf0d6b98360b35697
Author: Sebastian <sebasjm@gmail.com>
Date: Fri, 21 Mar 2025 12:33:44 -0300
changin form id to match spec tops.html
Diffstat:
3 files changed, 19 insertions(+), 65 deletions(-)
diff --git a/packages/aml-backoffice-ui/src/forms/index.ts b/packages/aml-backoffice-ui/src/forms/index.ts
@@ -152,66 +152,66 @@ export const preloadedForms: (
{
label: i18n.str`Identification Form (customer)`,
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",
+ id: "vqf_902_1_customer",
version: 1,
config: VQF_902_1_customer(i18n),
},
{
label: i18n.str`Identification Form (acceptance)`,
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",
+ id: "vqf_902_1_officer",
version: 1,
config: VQF_902_1_officer(i18n),
},
{
label: i18n.str`Risk Profile AMLA`,
- id: "vqf-902-4",
+ id: "vqf_902_4",
version: 1,
config: VQF_902_4(i18n),
},
{
label: i18n.str`Customer Profile`,
description: i18n.str`The information below has to refer to the persons from whom the assets originate ultimately (e.g. beneficial owner of the assets, founder/creator of a trust or foundation). Is the customer an operational legal entity or partnership the information may refer to the entity itself (not to the controlling person), unless the entity holds the assets in trust for a third party.`,
- id: "vqf-902-5",
+ id: "vqf_902_5",
version: 1,
config: VQF_902_5(i18n),
},
{
label: i18n.str`Declaration of identity of the beneficial owner (A)`,
- id: "vqf-902-9",
+ id: "vqf_902_9",
version: 1,
config: VQF_902_9(i18n),
},
{
label: i18n.str`Establishing of the controlling person of operating legal entities and partnerships both not quoted on the stock exchange (K)`,
description: i18n.str`for operating legal entities and partnerships that are contracting partner as well as analogously for operating legal entities and partnership that are beneficial owners`,
- id: "vqf-902-11",
+ id: "vqf_902_11",
version: 1,
config: VQF_902_11(i18n),
},
{
label: i18n.str`Foundations (as well as similar constructs) (S)`,
- id: "vqf-902-12",
+ id: "vqf_902_12",
version: 1,
config: VQF_902_12(i18n),
},
{
label: i18n.str`Declaration for trusts (T)`,
- id: "vqf-902-13",
+ id: "vqf_902_13",
version: 1,
config: VQF_902_13(i18n),
},
{
label: i18n.str`Special Clarifications`,
description: i18n.str`When a business relationship or transaction is associated with increased risk, appears unusual or evidence exists that the assets are the proceeds of a felony or a qualified tax offence, the member has to perform additional clarifications.`,
- id: "vqf-902-14",
+ id: "vqf_902_14",
version: 1,
config: VQF_902_14(i18n),
},
{
label: i18n.str`Insurance policies (I)`,
description: i18n.str`Information of life insurance policies with separately managed accounts/securities accounts (so-called insurance wrappers)`,
- id: "vqf-902-15",
+ id: "vqf_902_15",
version: 1,
config: VQF_902_15(i18n),
},
diff --git a/packages/aml-backoffice-ui/src/pages/CaseUpdate.tsx b/packages/aml-backoffice-ui/src/pages/CaseUpdate.tsx
@@ -24,19 +24,16 @@ import {
} from "@gnu-taler/taler-util";
import {
Button,
- FormMetadata,
FormUI,
- InternationalizationAPI,
LocalNotificationBanner,
useExchangeApiContext,
useForm,
useLocalNotificationHandler,
- useTranslationContext,
+ useTranslationContext
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { privatePages } from "../Routing.js";
import { useUiFormsContext } from "../context/ui-forms.js";
-import { preloadedForms } from "../forms/index.js";
import { useOfficer } from "../hooks/officer.js";
import { Justification } from "./CaseDetails.js";
import { HandleAccountNotReady } from "./HandleAccountNotReady.js";
@@ -63,7 +60,7 @@ export function CaseUpdate({
const [notification, withErrorHandler] = useLocalNotificationHandler();
const { config } = useExchangeApiContext();
- const { forms } = useUiFormsContext();
+
const initial: FormType = {
when: AbsoluteTime.now(),
state: TalerExchangeApi.AmlState.pending,
@@ -162,35 +159,3 @@ export function CaseUpdate({
);
}
-function SelectForm({ account }: { account: string }) {
- const { i18n } = useTranslationContext();
- const { forms } = useUiFormsContext();
- const pf = preloadedForms(i18n);
- return (
- <div>
- <pre>New form for account: {account.substring(0, 16)}...</pre>
- {forms.map((form) => {
- return (
- <a
- key={form.id}
- href={privatePages.caseUpdate.url({ cid: account, type: form.id })}
- class="m-4 block rounded-md w-fit border-0 p-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-600"
- >
- {form.label}
- </a>
- );
- })}
- {pf.map((form) => {
- return (
- <a
- key={form.id}
- href={privatePages.caseUpdate.url({ cid: account, type: form.id })}
- class="m-4 block rounded-md w-fit border-0 p-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-600"
- >
- {form.label}
- </a>
- );
- })}
- </div>
- );
-}
diff --git a/packages/aml-backoffice-ui/src/pages/decision/Information.tsx b/packages/aml-backoffice-ui/src/pages/decision/Information.tsx
@@ -1,4 +1,4 @@
-import { AbsoluteTime, calcRBlind, Duration } from "@gnu-taler/taler-util";
+import { AbsoluteTime, Duration } from "@gnu-taler/taler-util";
import {
ErrorsSummary,
FormDesign,
@@ -15,7 +15,6 @@ import {
import { h, VNode } from "preact";
import { useEffect, useState } from "preact/compat";
import { useUiFormsContext } from "../../context/ui-forms.js";
-import { preloadedForms } from "../../forms/index.js";
import { useCurrentDecisionRequest } from "../../hooks/decision-request.js";
/**
@@ -28,7 +27,6 @@ export function Attributes({
}: {
formId: string | undefined;
}): VNode {
- const { i18n } = useTranslationContext();
const [request] = useCurrentDecisionRequest();
const formByState = request.attributes?.formId;
@@ -39,7 +37,7 @@ export function Attributes({
const theForm = !selectedFormId
? undefined
- : searchForm(i18n, forms, selectedFormId);
+ : findLatestVersionOfFormWithId(forms, selectedFormId);
if (!theForm) {
return (
@@ -74,7 +72,6 @@ function FillCustomerData({
Duration.fromSpec({ months: 1 }),
);
-
const [request, _, updateRequest] = useCurrentDecisionRequest();
const [expiration, setExpiration] = useState(
request.attributes?.expiration ?? defaultExp,
@@ -95,7 +92,6 @@ function FillCustomerData({
[TalerFormAttributes.FormMetadata.FORM_VERSION.id]: theForm.version,
};
-
const errors = form.status.errors;
onComponentUnload(() => {
@@ -221,19 +217,12 @@ const formDesign = (
],
});
-function searchForm(
- i18n: InternationalizationAPI,
+function findLatestVersionOfFormWithId(
forms: FormMetadata[],
formId: string,
): FormMetadata | undefined {
- {
- const found = forms.find((v) => v.id === formId);
- if (found) return found;
- }
- {
- const pf = preloadedForms(i18n);
- const found = pf.find((v) => v.id === formId);
- if (found) return found;
- }
- return undefined;
+ const found = forms.filter((v) => v.id === formId);
+ if (!found.length) return undefined;
+ if (found.length === 1) return found[0]
+ return found.sort((a,b) => b.version - a.version)[0]
}