3using System.Globalization;
19 public string Label {
get; }
20 public string Value {
get; }
21 public string? Mapping {
get; }
22 public bool FromField {
get; }
23 public bool IsInvalid {
get; }
25 public DisplayQuad(
string Label,
string Value,
string? Mapping,
bool FromField,
bool IsInvalid =
false)
29 this.Mapping = Mapping;
30 this.FromField = FromField;
31 this.IsInvalid = IsInvalid;
44 public string FileName {
get; }
45 public string? ContentType {
get; }
49 this.FileName = FileName;
50 this.ContentType = ContentType;
56 public List<DisplayQuad> Personal {
get; } =
new List<DisplayQuad>();
57 public List<DisplayQuad> Address {
get; } =
new List<DisplayQuad>();
58 public List<DisplayQuad> Attachments {
get; } =
new List<DisplayQuad>();
59 public List<DisplayQuad> CompanyInfo {
get; } =
new List<DisplayQuad>();
60 public List<DisplayQuad> CompanyAddress {
get; } =
new List<DisplayQuad>();
61 public List<DisplayQuad> CompanyRepresentative {
get; } =
new List<DisplayQuad>();
66 public string Key {
get; }
67 public string Label {
get; }
68 public string Value {
get; }
69 public bool IsReviewable {
get; }
71 public DisplayField(
string Key,
string Label,
string Value,
bool IsReviewable)
76 this.IsReviewable = IsReviewable;
82 public List<DisplayField> Personal {
get; } =
new List<DisplayField>();
83 public List<DisplayField> Organization {
get; } =
new List<DisplayField>();
84 public List<DisplayField> Technical {
get; } =
new List<DisplayField>();
85 public List<DisplayField> Other {
get; } =
new List<DisplayField>();
93 IEnumerable<AttachmentInfo>? Attachments =
null,
94 CultureInfo? Culture =
null,
95 ISet<string>? InvalidMappings =
null)
97 CultureInfo EffectiveCulture = Culture ?? CultureInfo.CurrentCulture;
99 Dictionary<string, string> LabelMap = GetLabelMap();
102 HashSet<string> PersonalKeys =
new HashSet<string>(StringComparer.OrdinalIgnoreCase)
113 Constants.XmppProperties.EMail
116 HashSet<string> AddressKeys =
new(StringComparer.OrdinalIgnoreCase)
124 Constants.XmppProperties.Country
127 HashSet<string> CompanyInfoKeys =
new(StringComparer.OrdinalIgnoreCase)
136 HashSet<string> CompanyAddressKeys =
new(StringComparer.OrdinalIgnoreCase)
144 Constants.XmppProperties.OrgCountry
147 HashSet<string> CompanyRepresentativeKeys =
new(StringComparer.OrdinalIgnoreCase)
158 Dictionary<string, string> Dict =
new(StringComparer.OrdinalIgnoreCase);
164 string Name = P.Name ??
string.Empty;
165 string Value = P.Value ??
string.Empty;
166 if (
string.IsNullOrWhiteSpace(Name) ||
string.IsNullOrWhiteSpace(Value))
169 Dict[Name] = Value.Trim();
177 if (
int.TryParse(DayStr, out
int Day) &&
int.TryParse(MonthStr, out
int Month) &&
int.TryParse(YearStr, out
int Year))
181 DateTime BirthDate =
new(Year, Month, Day);
191 DayStr = Get(Dict,
"ORGREPBDAY");
192 MonthStr = Get(Dict,
"ORGREPBMONTH");
193 YearStr = Get(Dict,
"ORGREPBYEAR");
195 if (
int.TryParse(DayStr, out Day) &&
int.TryParse(MonthStr, out Month) &&
int.TryParse(YearStr, out Year))
199 DateTime BirthDate =
new(Year, Month, Day);
200 Dict[
"ORGREPBDATE"] = BirthDate.ToString(
"d", EffectiveCulture);
211 foreach (
string Key
in PersonalKeys)
220 if (!Dict.TryGetValue(Key, out
string? Val) ||
string.IsNullOrWhiteSpace(Val))
223 string Label = GetLabel(LabelMap, Key);
230 string Normalized = Val.Trim().ToUpperInvariant();
231 string ResourceKey = Normalized
switch
237 Microsoft.Extensions.Localization.LocalizedString Localized =
ServiceRef.
Localizer[ResourceKey,
false];
238 if (!Localized.ResourceNotFound)
239 Val = Localized.Value;
242 bool IsInvalid = InvalidMappings?.Contains(Key) ??
false;
243 Result.Personal.Add(
new DisplayQuad(Label, Val, Key, Process.HasMapping(Key), IsInvalid));
247 foreach (
string Key
in AddressKeys)
249 if (!Dict.TryGetValue(Key, out
string? Val) ||
string.IsNullOrWhiteSpace(Val))
253 string Label = GetLabel(LabelMap, Key);
258 bool IsInvalid = InvalidMappings?.Contains(Key) ??
false;
259 Result.Address.Add(
new DisplayQuad(Label, Val, Key, Process.HasMapping(Key), IsInvalid));
263 foreach (
string Key
in CompanyInfoKeys)
265 if (!Dict.TryGetValue(Key, out
string? Val) ||
string.IsNullOrWhiteSpace(Val))
268 string Label = GetLabel(LabelMap, Key);
269 bool IsInvalid = InvalidMappings?.Contains(Key) ??
false;
270 Result.CompanyInfo.Add(
new DisplayQuad(Label, Val, Key, Process.HasMapping(Key), IsInvalid));
274 foreach (
string Key
in CompanyAddressKeys)
276 if (!Dict.TryGetValue(Key, out
string? Val) ||
string.IsNullOrWhiteSpace(Val))
279 string Label = GetLabel(LabelMap, Key);
280 bool IsInvalid = InvalidMappings?.Contains(Key) ??
false;
281 Result.CompanyAddress.Add(
new DisplayQuad(Label, Val, Key, Process.HasMapping(Key), IsInvalid));
285 foreach (
string Key
in CompanyRepresentativeKeys)
287 if (!Dict.TryGetValue(Key, out
string? Val) ||
string.IsNullOrWhiteSpace(Val))
289 string Label = GetLabel(LabelMap, Key);
290 bool IsInvalid = InvalidMappings?.Contains(Key) ??
false;
291 Result.CompanyRepresentative.Add(
new DisplayQuad(Label, Val, Key, Process.HasMapping(Key), IsInvalid));
295 if (Attachments is not
null)
299 if (
string.IsNullOrEmpty(Att.FileName))
302 string Base = Att.FileName.Split(
'.')[0];
310 Description = L.ResourceNotFound ? Base : L.Value;
316 Description = L.ResourceNotFound ? Base : L.Value;
322 Description = L.ResourceNotFound ? Base : L.Value;
325 case "DriverLicenseFront":
328 Description = L.ResourceNotFound ? Base : L.Value;
331 case "DriverLicenseBack":
334 Description = L.ResourceNotFound ? Base : L.Value;
340 Description = L.ResourceNotFound ? Base : L.Value;
346 Description = L.ResourceNotFound ? Base : L.Value;
350 Description = Att.FileName;
354 bool IsInvalid = InvalidMappings?.Contains(Base) ??
false;
355 Result.Attachments.Add(
new DisplayQuad(Att.FileName, Description, Base, Process.HasMapping(Base), IsInvalid));
368 CultureInfo EffectiveCulture = Culture ?? CultureInfo.CurrentCulture;
371 HashSet<string> ReviewableKeys =
new(StringComparer.OrdinalIgnoreCase)
397 Constants.XmppProperties.OrgNumber
401 HashSet<string> PersonalKeys =
new(StringComparer.OrdinalIgnoreCase)
421 Constants.XmppProperties.EMail
424 HashSet<string> OrgKeys =
new(StringComparer.OrdinalIgnoreCase)
436 Constants.XmppProperties.OrgNumber
439 HashSet<string> TechnicalKeys =
new(StringComparer.OrdinalIgnoreCase)
449 Constants.XmppProperties.DeviceId
452 Dictionary<string, string> LabelMap = GetIdentityLabelMap();
454 HashSet<string> UsedKeys =
new(StringComparer.OrdinalIgnoreCase);
460 if (
int.TryParse(D, out
int Day) &&
int.TryParse(M, out
int Month) &&
int.TryParse(Y, out
int Year))
464 string BirthDateStr =
new DateTime(Year, Month, Day).ToString(
"d", EffectiveCulture);
465 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
482 if (Prop is
null || UsedKeys.Contains(Prop.
Name))
485 string Key = Prop.
Name;
486 string Value = Prop.Value ??
string.Empty;
487 if (
string.IsNullOrWhiteSpace(Value))
490 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
491 Key, GetLabel(LabelMap, Key), Value);
496 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
500 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
504 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
508 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
512 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
516 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
520 AddField(Result, PersonalKeys, OrgKeys, TechnicalKeys, ReviewableKeys,
527 private static string Get(Dictionary<string, string> Dict,
string Key)
529 if (Dict.TryGetValue(Key, out
string? Value))
534 private static string GetLabel(Dictionary<string, string> LabelMap,
string Key)
536 if (LabelMap.TryGetValue(Key, out
string? Label) && !
string.IsNullOrEmpty(Label))
541 private static Dictionary<string, string> GetLabelMap()
544 Dictionary<string, string> Map =
new(StringComparer.OrdinalIgnoreCase)
588 private static Dictionary<string, string> GetIdentityLabelMap()
590 Dictionary<string, string> Map =
new(StringComparer.OrdinalIgnoreCase)
633 private static void AddField(IdentityGroupsResult Result,
634 HashSet<string> PersonalKeys,
635 HashSet<string> OrgKeys,
636 HashSet<string> TechnicalKeys,
637 HashSet<string> ReviewableKeys,
642 bool IsReviewable = ReviewableKeys.Contains(Key);
643 DisplayField Field =
new(Key, Label, Value, IsReviewable);
645 if (PersonalKeys.Contains(Key)) Result.Personal.Add(Field);
646 else if (OrgKeys.Contains(Key)) Result.Organization.Add(Field);
647 else if (TechnicalKeys.Contains(Key)) Result.Technical.Add(Field);
648 else Result.Other.Add(Field);
Custom XMPP Protocol Properties.
const string BirthDate
Full birthday
const string To
“To” / expiry date
const string From
“From” date
const string State
Current state (Approved, Rejected, …)
const string Created
When it was created
const string Updated
When it was last updated
const string Provider
Issuer / Provider
const string Neuro_Id
Identity ID
XMPP Protocol Properties.
const string PersonalNumber
Personal number
const string OrgAddress2
Organization Address line 2
const string DeviceId
Device ID
const string Country
Country
const string OrgArea
Organization Area
const string Region
Region
const string OrgRegion
Organization Region
const string Nationality
Nationality
const string ZipCode
Zip Code
const string FullName
Full name
const string BirthYear
Birth Year
const string OrgCity
Organization City
const string OrgRole
Organization Role
const string Phone
Phone number
const string EMail
e-Mail address
const string OrgZipCode
Organization Zip Code
const string MiddleNames
Middle names
const string BirthDay
Birth Day
const string OrgCountry
Organization Country
const string OrgDepartment
Organization Department
const string Address2
Address line 2
const string Jid
Jabber ID
const string OrgAddress
Organization Address line 1
const string Address
Address line 1
const string LastNames
Last names
const string OrgNumber
Organization number
const string BirthMonth
Birth Month
const string FirstName
First name
const string Gender
Gender
const string OrgName
Organization name
A set of never changing property constants and helpful values.
A strongly-typed resource class, for looking up localized strings, etc.
static string OrgNumber
Looks up a localized string similar to Organization Number.
static string OrgRepRG
Looks up a localized string similar to Representative RG.
static string Attachment_ProfilePhoto
Looks up a localized string similar to Photo of face.
static string Address2
Looks up a localized string similar to Address (row 2).
static string Female
Looks up a localized string similar to Female.
static string OrgAddress
Looks up a localized string similar to Organization Address.
static string Address
Looks up a localized string similar to Address.
static string OrgEMail
Looks up a localized string similar to Corporate email.
static string Male
Looks up a localized string similar to Male.
static string TradeName
Looks up a localized string similar to Trade name.
static string BirthDate
Looks up a localized string similar to Birth Date.
static string Attachment_DriverLicenseFront
Looks up a localized string similar to Front of driver's license.
static string OrgRepCPF
Looks up a localized string similar to Representative CPF.
static string OrgRepBirthDate
Looks up a localized string similar to Representative birth date.
static string Updated
Looks up a localized string similar to Updated.
static string Country
Looks up a localized string similar to Country.
static string Attachment_Passport
Looks up a localized string similar to Passport image.
static string FirstName
Looks up a localized string similar to First name.
static string Provider
Looks up a localized string similar to Provider.
static string Region
Looks up a localized string similar to Region or State.
static string Issued
Looks up a localized string similar to Issued.
static string Status
Looks up a localized string similar to Status.
static string OrgCity
Looks up a localized string similar to Organization City.
static string EMail
Looks up a localized string similar to E-Mail.
static string OrgPhone
Looks up a localized string similar to Corporate phone.
static string OrgRole
Looks up a localized string similar to Role.
static string Attachment_IdCardFront
Looks up a localized string similar to Front of ID card.
static string Area
Looks up a localized string similar to Area.
static string OrgCountry
Looks up a localized string similar to Organization Country.
static string OrgAddress2
Looks up a localized string similar to Organization Address (row 2).
static string ZipCode
Looks up a localized string similar to Zip or Postal Code.
static string Expires
Looks up a localized string similar to Expires.
static string Nationality
Looks up a localized string similar to Nationality.
static string MiddleNames
Looks up a localized string similar to Middle name(s).
static string Attachment_DriverLicenseBack
Looks up a localized string similar to Back of driver's license.
static string DeviceID
Looks up a localized string similar to Device ID.
static string OrgName
Looks up a localized string similar to Organization Name.
static string PersonalNumber
Looks up a localized string similar to Personal number.
static string OrgDepartment
Looks up a localized string similar to Department.
static string FullName
Looks up a localized string similar to Full name.
static string Gender
Looks up a localized string similar to Gender.
static string OrgRegion
Looks up a localized string similar to Organization Region.
static string Created
Looks up a localized string similar to Created.
static string Attachment_ArticleOfAssociation
Looks up a localized string similar to Article of association.
static string PhoneNr
Looks up a localized string similar to Phone number.
static string OrgRepName
Looks up a localized string similar to Representative name.
static string City
Looks up a localized string similar to City.
static string OrgArea
Looks up a localized string similar to Organization Area.
static string Other
Looks up a localized string similar to Other.
static string NetworkID
Looks up a localized string similar to Network ID.
static string LastNames
Looks up a localized string similar to Last name(s).
static string OrgZipCode
Looks up a localized string similar to Organization Zip or Postal Code.
static string NeuroID
Looks up a localized string similar to Neuro-ID.
static string Attachment_IdCardBack
Looks up a localized string similar to Back of ID card.
Conversion between Country Names and ISO-3166-1 country codes.
static ? string ToName(string? CountryCode)
Converts the code to a country name (if found). If not found, returns the original code.
Represents a displayable set of three related strings: a label, a value, and an optional mapping.
Represents a parsed KYC process with pages, fields, and current values.
Base class that references services in the app.
static ILogService LogService
Log service.
static IReportingStringLocalizer Localizer
Localization service
string Name
Name of property