Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
KycProcess.cs
1using System.Collections.ObjectModel;
2using System.Globalization;
4
6{
10 public partial class KycProcess
11 {
15 public KycLocalizedText? Name { get; set; }
16 private readonly Dictionary<string, string?> values = new();
17
21 public IDictionary<string, string?> Values => this.values;
22
26 public ObservableCollection<KycPage> Pages { get; } = new();
27
31 public void Initialize()
32 {
33 foreach (KycPage Page in this.Pages)
34 {
35 Page.InitFieldValueNotifications(this.values);
36 }
37 }
38
42 public void ClearValidation()
43 {
44 foreach (KycPage Page in this.Pages)
45 {
46 foreach (ObservableKycField Field in Page.AllFields)
47 {
48 if (Field is not null)
49 {
50 Field.ValidationText = null;
51 Field.IsValid = true;
52 }
53 }
54 foreach (KycSection Section in Page.AllSections)
55 {
56 foreach (ObservableKycField Field in Section.AllFields)
57 {
58 if (Field is not null)
59 {
60 Field.ValidationText = null;
61 Field.IsValid = true;
62 }
63 }
64 }
65 }
66 }
67
73 public bool HasMapping(string Mapping)
74 {
75 if (Mapping.Equals("BDATE", StringComparison.OrdinalIgnoreCase))
76 {
77 string[] DateMappings = ["BDAY", "BMONTH", "BYEAR"];
78
79 return DateMappings.Select(f => this.FindMapping(f)).Any(f => f);
80 }
81 else if (Mapping.Equals("ORGREPBDATE", StringComparison.OrdinalIgnoreCase))
82 {
83 string[] DateMappings = ["ORGREPBDAY", "ORGREPBMONTH", "ORGREPBYEAR"];
84
85 return DateMappings.Select(f => this.FindMapping(f)).Any(f => f);
86 }
87 else
88 {
89 return this.FindMapping(Mapping);
90 }
91 }
92
93 private bool FindMapping(string Mapping)
94 {
95 foreach (KycPage Page in this.Pages)
96 {
97 if (Page.AllFields.Any(f => f.Mappings.Any(m => m.Key == Mapping)) ||
98 Page.AllSections.Any(s => s.AllFields.Any(f => f.Mappings.Any(m => m.Key == Mapping))))
99 return true;
100 }
101
102 return false;
103 }
104 }
105}
Represents a set of localized strings, addressable by language code (e.g. "en", "sv").
Represents a page in a KYC process containing fields and sections.
Definition: KycPage.cs:20
ObservableCollection< KycSection > AllSections
Gets all sections contained in the page.
Definition: KycPage.cs:64
ObservableCollection< ObservableKycField > AllFields
Gets all fields directly contained in the page (excluding sections).
Definition: KycPage.cs:51
Represents a parsed KYC process with pages, fields, and current values.
Definition: KycProcess.cs:11
void ClearValidation()
Clears validation state (error messages and flags) across all fields.
Definition: KycProcess.cs:42
KycLocalizedText? Name
Optional process-level localized name for display.
Definition: KycProcess.cs:15
ObservableCollection< KycPage > Pages
Gets the collection of pages in the KYC process.
Definition: KycProcess.cs:26
void Initialize()
Initializes page value-change notifications.
Definition: KycProcess.cs:31
IDictionary< string, string?> Values
Gets a modifiable dictionary of field values keyed by field identifier.
Definition: KycProcess.cs:21
bool HasMapping(string Mapping)
Determines if the process contains a mapping for a specific identity property.
Definition: KycProcess.cs:73
The base KYC field model. Use as-is for generic fields, or subclass for custom logic.