commit 7f18eca96616a06f2d2183458e4ce5b085455133
parent 830649fcaae043b64bdd63bd535e98836514520b
Author: Sebastian <sebasjm@taler-systems.com>
Date: Wed, 25 Nov 2026 13:44:50 -0300
fix #0012295
also fix the shared component problem between CUSTOMER_TYPE_VQF
Diffstat:
3 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/packages/web-util/src/forms/fields/InputChoiceStacked.tsx b/packages/web-util/src/forms/fields/InputChoiceStacked.tsx
@@ -31,6 +31,11 @@ export function InputChoiceStacked<Choices>(
const groupName = `choice-${useId()}`;
useEffect(() => {
+ // FIXME: since in some case the controller `resolveFieldHandler` is shared with different
+ // UI component and the `choices` are different this effect should only run for the
+ // current controller displayed.
+ // For example 2 CUSTOMER_TYPE_VQF on 902.1
+ if (hidden) return;
// Reset choice if value is set to a choices that's
// not available to this input.
for (const choice of choices) {
@@ -39,7 +44,7 @@ export function InputChoiceStacked<Choices>(
}
}
if (value !== undefined) onChange(undefined);
- }, [choices, onChange, value]);
+ }, [choices, hidden, onChange, value]);
const fieldset = useRef<HTMLFieldSetElement>(null);
useAutoFocus(
diff --git a/packages/web-util/src/forms/gana/VQF_902_1_customer.test.ts b/packages/web-util/src/forms/gana/VQF_902_1_customer.test.ts
@@ -41,3 +41,49 @@ test("company ownership upload uses VQF labels with registry clarification", ()
"Angaben über die Beteiligungsverhältnisse (Aktienregister oder Äquivalent)",
);
});
+
+/**
+ * The attributes the form asks for from a customer whose answers so far
+ * are @a root, at the top level of the form.
+ */
+function askedAttributes(root: Record<string, unknown>): string[] {
+ setupI18n("en", {});
+ const design = design_VQF_902_1_customer(i18n);
+ return design.sections
+ .filter((section) => !section.hide?.(root))
+ .flatMap((section) => section.fields)
+ .filter((field) => !("hide" in field && field.hide?.(undefined, root)))
+ .flatMap((field) => ("id" in field ? [field.id] : []));
+}
+
+// taler-exchange-helper-measure-tops-kyx-check freezes the account if
+// one of these is missing.
+test("legal entities are asked for what tops-kyx-check requires", () => {
+ const asked = askedAttributes({
+ [TalerFormAttributes.CUSTOMER_TYPE]: "LEGAL_ENTITY",
+ });
+ for (const attribute of [
+ TalerFormAttributes.COMPANY_NAME,
+ TalerFormAttributes.REGISTERED_OFFICE_ADDRESS,
+ TalerFormAttributes.LEGAL_ENTITY_IDENTIFICATION_DOCUMENT_COPY,
+ TalerFormAttributes.ESTABLISHER_LIST,
+ ]) {
+ assert.ok(asked.includes(attribute), attribute);
+ }
+});
+
+test("natural persons are asked for what tops-kyx-check requires", () => {
+ const asked = askedAttributes({
+ [TalerFormAttributes.CUSTOMER_TYPE]: "NATURAL_PERSON",
+ });
+ for (const attribute of [
+ TalerFormAttributes.FULL_NAME,
+ TalerFormAttributes.DOMICILE_ADDRESS,
+ TalerFormAttributes.DATE_OF_BIRTH,
+ TalerFormAttributes.NATIONALITY,
+ TalerFormAttributes.PERSONAL_IDENTIFICATION_DOCUMENT_COPY,
+ TalerFormAttributes.CUSTOMER_IS_SOLE_PROPRIETOR,
+ ]) {
+ assert.ok(asked.includes(attribute), attribute);
+ }
+});
diff --git a/packages/web-util/src/forms/gana/VQF_902_1_customer.ts b/packages/web-util/src/forms/gana/VQF_902_1_customer.ts
@@ -289,7 +289,7 @@ export function design_VQF_902_1_customer(
required: true,
},
{
- id: TalerFormAttributes.DOMICILE_ADDRESS,
+ id: TalerFormAttributes.REGISTERED_OFFICE_ADDRESS,
label: i18n.fixed({ en: "Domicile", de: "Sitz" }),
type: "textArea",
required: true,