aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx
blob: c3fb7dafe3dcac637daf3d04b29a7911c729a184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { h } from "preact";
import { NiceForm } from "../NiceForm.js";
import { v1 as form_902_11e_v1 } from "../forms/902_11e.js";
import { v1 as form_902_12e_v1 } from "../forms/902_12e.js";
import { v1 as form_902_13e_v1 } from "../forms/902_13e.js";
import { v1 as form_902_15e_v1 } from "../forms/902_15e.js";
import { v1 as form_902_1e_v1 } from "../forms/902_1e.js";
import { v1 as form_902_4e_v1 } from "../forms/902_4e.js";
import { v1 as form_902_5e_v1 } from "../forms/902_5e.js";
import { v1 as form_902_9e_v1 } from "../forms/902_9e.js";
import { v1 as simplest } from "../forms/simplest.js";
import { DocumentDuplicateIcon } from "@heroicons/react/24/solid";
import { AbsoluteTime } from "@gnu-taler/taler-util";
import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import { AmlExchangeBackend } from "../types.js";

export function AntiMoneyLaunderingForm({ number }: { number?: string }) {
  const selectedForm = Number.parseInt(number ?? "0", 10);
  if (Number.isNaN(selectedForm)) {
    return <div>WHAT! {number}</div>;
  }
  const showingFrom = allForms[selectedForm].impl;
  const storedValue = {
    fullName: "loggedIn_user_fullname",
    when: AbsoluteTime.now(),
  };
  return (
    <NiceForm
      initial={storedValue}
      form={showingFrom({
        state: AmlExchangeBackend.AmlState.pending,
        threshold: Amounts.parseOrThrow("USD:10"),
      })}
      onUpdate={() => {}}
    />
  );
}

export interface State {
  state: AmlExchangeBackend.AmlState;
  threshold: AmountJson;
}

export const allForms = [
  {
    name: "Simple comment",
    icon: DocumentDuplicateIcon,
    impl: simplest,
  },
  {
    name: "Identification form (902.1e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_1e_v1,
  },
  {
    name: "Operational legal entity or partnership (902.11e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_11e_v1,
  },
  {
    name: "Foundations (902.12e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_12e_v1,
  },
  {
    name: "Declaration for trusts (902.13e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_13e_v1,
  },
  {
    name: "Information on life insurance policies (902.15e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_15e_v1,
  },
  {
    name: "Declaration of beneficial owner (902.9e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_9e_v1,
  },
  {
    name: "Customer profile (902.5e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_5e_v1,
  },
  {
    name: "Risk profile (902.4e)",
    icon: DocumentDuplicateIcon,
    impl: form_902_4e_v1,
  },
];