aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-05-25 18:23:38 -0300
committerSebastian <sebasjm@gmail.com>2023-05-26 09:26:12 -0300
commit562067a28788084832af4a2862d06f99a71476d3 (patch)
treede210a059ce718487a3dbd411ad25d7ff7345fc4
parent64e3705669e7c12b8013704654f17cf8eaf659d4 (diff)
resolution field for all forms
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_11e.ts12
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_12e.ts12
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_13e.ts12
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_15e.ts12
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_1e.ts14
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_4e.ts14
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_5e.ts6
-rw-r--r--packages/exchange-backoffice-ui/src/forms/902_9e.ts12
-rw-r--r--packages/exchange-backoffice-ui/src/forms/simplest.ts103
-rw-r--r--packages/exchange-backoffice-ui/src/handlers/forms.ts2
10 files changed, 127 insertions, 72 deletions
diff --git a/packages/exchange-backoffice-ui/src/forms/902_11e.ts b/packages/exchange-backoffice-ui/src/forms/902_11e.ts
index 267b5b52d..24df6a44c 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_11e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_11e.ts
@@ -1,7 +1,13 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_11.Form> => ({
versionId: "2023-05-15",
@@ -114,6 +120,7 @@ export const v1 = (current: State): FlexibleForm<Form902_11.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_11.Form>,
@@ -137,12 +144,11 @@ namespace Form902_11 {
firstName: string;
address: string;
}
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
contractingPartner: string;
declares: "25-or-more" | "controlling-in-other-ways" | "managing-director";
person: Person[];
fiduciaryAssets: "no" | "yes";
- when: AbsoluteTime;
signature: string;
}
}
diff --git a/packages/exchange-backoffice-ui/src/forms/902_12e.ts b/packages/exchange-backoffice-ui/src/forms/902_12e.ts
index 56a3986ee..c80539511 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_12e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_12e.ts
@@ -1,7 +1,13 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_12.Form> => ({
versionId: "2023-05-15",
@@ -363,6 +369,7 @@ export const v1 = (current: State): FlexibleForm<Form902_12.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_12.Form>,
@@ -419,7 +426,7 @@ namespace Form902_12 {
type Founder = WithRevoke<WithDeath<Person>>;
type Beneficiary = WithClaim<Person>;
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
contractingPartner: string;
knownAs: string;
boardMember: string;
@@ -429,6 +436,5 @@ namespace Form902_12 {
beneficiaryWhenSigning: Array<Beneficiary>;
beneficiaryExtra: Array<Beneficiary>;
withRightToNominate: Array<WithRevoke<Person>>;
- when: AbsoluteTime;
}
}
diff --git a/packages/exchange-backoffice-ui/src/forms/902_13e.ts b/packages/exchange-backoffice-ui/src/forms/902_13e.ts
index e933432e4..63870f00a 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_13e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_13e.ts
@@ -1,7 +1,13 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_13.Form> => ({
versionId: "2023-05-15",
@@ -440,6 +446,7 @@ export const v1 = (current: State): FlexibleForm<Form902_13.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_13.Form>,
@@ -505,7 +512,7 @@ namespace Form902_13 {
type Founder = WithRevoke<WithDeath<Person>>;
type Beneficiary = WithClaim<Person>;
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
contractingPartner: string;
knownAs: string;
boardMember: string;
@@ -516,6 +523,5 @@ namespace Form902_13 {
beneficiaryExtra: Array<Beneficiary>;
protectors: Array<WithRevoke<Person>>;
furtherPersons: Array<WithRevoke<Person>>;
- when: AbsoluteTime;
}
}
diff --git a/packages/exchange-backoffice-ui/src/forms/902_15e.ts b/packages/exchange-backoffice-ui/src/forms/902_15e.ts
index be304f357..19a16d3f2 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_15e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_15e.ts
@@ -1,7 +1,13 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_15.Form> => ({
versionId: "2023-05-15",
@@ -159,6 +165,7 @@ export const v1 = (current: State): FlexibleForm<Form902_15.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_15.Form>,
@@ -179,13 +186,12 @@ namespace Form902_15 {
nationality: string;
}
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
contractingPartner: string;
contractualRelationship: string;
insurancePolicy: string;
holder: Person;
premiumsPayer: Person;
- when: AbsoluteTime;
signature: string;
}
}
diff --git a/packages/exchange-backoffice-ui/src/forms/902_1e.ts b/packages/exchange-backoffice-ui/src/forms/902_1e.ts
index 0f60c23d8..04952a985 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_1e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_1e.ts
@@ -1,7 +1,15 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ Amounts,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FlexibleForm, languageList } from "./index.js";
import { FormState } from "../handlers/FormProvider.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { amlStateConverter } from "../pages/AccountDetails.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_1.Form> => ({
versionId: "2023-05-15",
@@ -511,6 +519,7 @@ export const v1 = (current: State): FlexibleForm<Form902_1.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_1.Form>,
@@ -671,8 +680,7 @@ namespace Form902_1 {
purpose: string;
}
- export interface Form {
- when: AbsoluteTime;
+ export interface Form extends Simplest.WithResolution {
fullName: string;
customerType: "natural" | "legal";
naturalCustomer: NaturalCustomer;
diff --git a/packages/exchange-backoffice-ui/src/forms/902_4e.ts b/packages/exchange-backoffice-ui/src/forms/902_4e.ts
index ffe3b28a2..15ad17144 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_4e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_4e.ts
@@ -1,10 +1,18 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ Amounts,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { ArrowRightIcon } from "@heroicons/react/24/outline";
import { h as create } from "preact";
import { ChevronRightIcon } from "@heroicons/react/24/solid";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { amlStateConverter } from "../pages/AccountDetails.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
versionId: "2023-05-15",
@@ -736,6 +744,7 @@ export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_4.Form>,
@@ -749,10 +758,9 @@ export const v1 = (current: State): FlexibleForm<Form902_4.Form> => ({
});
namespace Form902_4 {
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
customer: string;
fullName: string;
- when: AbsoluteTime;
pep: {
foreign: "yes" | "no";
domestic: "yes" | "no" | "yes-but-no-risk";
diff --git a/packages/exchange-backoffice-ui/src/forms/902_5e.ts b/packages/exchange-backoffice-ui/src/forms/902_5e.ts
index 8ff72e0c5..bd27b7a7f 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_5e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_5e.ts
@@ -6,6 +6,8 @@ import {
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm, currencyList } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
versionId: "2023-05-15",
@@ -229,6 +231,7 @@ export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_5.Form>,
@@ -247,10 +250,9 @@ export const v1 = (current: State): FlexibleForm<Form902_5.Form> => ({
});
namespace Form902_5 {
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
customer: string;
fullName: string;
- when: AbsoluteTime;
businessActivity: string;
financial: string;
originOfAssets: {
diff --git a/packages/exchange-backoffice-ui/src/forms/902_9e.ts b/packages/exchange-backoffice-ui/src/forms/902_9e.ts
index 831fcc9f9..e79597bfb 100644
--- a/packages/exchange-backoffice-ui/src/forms/902_9e.ts
+++ b/packages/exchange-backoffice-ui/src/forms/902_9e.ts
@@ -1,7 +1,13 @@
-import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ AmountJson,
+ TranslatedString,
+} from "@gnu-taler/taler-util";
import { FormState } from "../handlers/FormProvider.js";
import { FlexibleForm } from "./index.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { AmlState } from "../types.js";
+import { Simplest, resolutionSection } from "./simplest.js";
export const v1 = (current: State): FlexibleForm<Form902_9.Form> => ({
versionId: "2023-05-15",
@@ -103,6 +109,7 @@ export const v1 = (current: State): FlexibleForm<Form902_9.Form> => ({
},
],
},
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Form902_9.Form>,
@@ -123,10 +130,9 @@ namespace Form902_9 {
nationality: string;
address: string;
}
- export interface Form {
+ export interface Form extends Simplest.WithResolution {
contractingPartner: string;
persons: Person;
- when: AbsoluteTime;
signature: string;
}
}
diff --git a/packages/exchange-backoffice-ui/src/forms/simplest.ts b/packages/exchange-backoffice-ui/src/forms/simplest.ts
index a395410c3..5da01961b 100644
--- a/packages/exchange-backoffice-ui/src/forms/simplest.ts
+++ b/packages/exchange-backoffice-ui/src/forms/simplest.ts
@@ -9,6 +9,7 @@ import { FlexibleForm } from "./index.js";
import { AmlState } from "../types.js";
import { amlStateConverter } from "../pages/AccountDetails.js";
import { State } from "../pages/AntiMoneyLaunderingForm.js";
+import { DoubleColumnFormSection, UIFormField } from "../handlers/forms.js";
export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
versionId: "2023-05-25",
@@ -25,52 +26,7 @@ export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
},
],
},
- {
- title: "Resolution" as TranslatedString,
- description: `Current state is ${amlStateConverter.toStringUI(
- current.state,
- )} and threshold at ${Amounts.stringifyValue(
- current.threshold,
- )}` as TranslatedString,
- fields: [
- {
- type: "date",
- props: {
- name: "when",
- label: "Decision Time" as TranslatedString,
- },
- },
- {
- type: "choiceHorizontal",
- props: {
- name: "state",
- label: "New state" as TranslatedString,
- converter: amlStateConverter,
- choices: [
- {
- value: AmlState.frozen,
- label: "Frozen" as TranslatedString,
- },
- {
- value: AmlState.pending,
- label: "Pending" as TranslatedString,
- },
- {
- value: AmlState.normal,
- label: "Normal" as TranslatedString,
- },
- ],
- },
- },
- {
- type: "amount",
- props: {
- name: "threshold",
- label: "New threshold" as TranslatedString,
- },
- },
- ],
- },
+ resolutionSection(current),
],
behavior: function formBehavior(
v: Partial<Simplest.Form>,
@@ -86,11 +42,62 @@ export const v1 = (current: State): FlexibleForm<Simplest.Form> => ({
},
});
-namespace Simplest {
- export interface Form {
+export namespace Simplest {
+ export interface WithResolution {
when: AbsoluteTime;
threshold: AmountJson;
state: AmlState;
+ }
+ export interface Form extends WithResolution {
comment: string;
}
}
+
+export function resolutionSection(current: State): DoubleColumnFormSection {
+ return {
+ title: "Resolution" as TranslatedString,
+ description: `Current state is ${amlStateConverter.toStringUI(
+ current.state,
+ )} and threshold at ${Amounts.stringifyValue(
+ current.threshold,
+ )}` as TranslatedString,
+ fields: [
+ {
+ type: "date",
+ props: {
+ name: "when",
+ label: "Decision Time" as TranslatedString,
+ },
+ },
+ {
+ type: "choiceHorizontal",
+ props: {
+ name: "state",
+ label: "New state" as TranslatedString,
+ converter: amlStateConverter,
+ choices: [
+ {
+ value: AmlState.frozen,
+ label: "Frozen" as TranslatedString,
+ },
+ {
+ value: AmlState.pending,
+ label: "Pending" as TranslatedString,
+ },
+ {
+ value: AmlState.normal,
+ label: "Normal" as TranslatedString,
+ },
+ ],
+ },
+ },
+ {
+ type: "amount",
+ props: {
+ name: "threshold",
+ label: "New threshold" as TranslatedString,
+ },
+ },
+ ],
+ };
+}
diff --git a/packages/exchange-backoffice-ui/src/handlers/forms.ts b/packages/exchange-backoffice-ui/src/handlers/forms.ts
index 4eb188a09..2c90a69ed 100644
--- a/packages/exchange-backoffice-ui/src/handlers/forms.ts
+++ b/packages/exchange-backoffice-ui/src/handlers/forms.ts
@@ -18,7 +18,7 @@ import { InputChoiceHorizontal } from "./InputChoiceHorizontal.js";
export type DoubleColumnForm = Array<DoubleColumnFormSection | undefined>;
-type DoubleColumnFormSection = {
+export type DoubleColumnFormSection = {
title: TranslatedString;
description?: TranslatedString;
fields: UIFormField[];