3using System.Globalization;
5using System.Threading.Tasks;
18 [CollectionName(
"KycReferences")]
19 [Index(nameof(UpdatedUtc), nameof(UpdatedUtc))]
20 [Index(nameof(CreatedIdentityId))]
68 [DefaultValueStringEmpty]
98 [DefaultValueStringEmpty]
109 if (this.applicationReview is
null)
110 this.TryMigrateLegacyReview();
112 return this.applicationReview;
115 set => this.applicationReview = value;
122 [Obsolete(
"Use ApplicationReview instead.")]
129 [Obsolete(
"Use ApplicationReview instead.")]
136 [Obsolete(
"Use ApplicationReview instead.")]
143 [Obsolete(
"Use ApplicationReview instead.")]
150 [Obsolete(
"Use ApplicationReview instead.")]
157 [Obsolete(
"Use ApplicationReview instead.")]
165 public async Task<KycProcess?>
GetProcess(
string? lang =
null)
167 if (this.process is
null && this.
KycXml is not
null)
171 if (this.
Fields is not
null)
179 this.ApplyFieldValue(Field);
183 this.ApplyFieldValue(Field);
198 this.
SetProcess(process, xml, DateTime.UtcNow, DateTime.UtcNow);
210 this.process = process;
212 this.CreatedUtc = created;
213 this.UpdatedUtc = updated;
214 this.FetchedUtc = DateTime.UtcNow;
220 if (this.process is
null || !this.process.
Values.TryGetValue(Field.
Id, out
string? Val) || Val is
null)
222 Field.StringValue = Val;
260 if (Proc is
null || this.
Fields is
null)
264 Proc.Values[Field.FieldId] = Field.Value;
266 foreach (
KycPage Page
in Proc.Pages)
269 this.ApplyFieldValue(Field);
273 this.ApplyFieldValue(Field);
284 public async Task<KycProcess?>
ToProcess(
string? lang =
null)
289 private void TryMigrateLegacyReview()
291 if (this.applicationReview is not
null)
307 Message = this.RejectionMessage ??
string.Empty,
309 ReceivedUtc = this.UpdatedUtc
313 .Where(s => !
string.IsNullOrWhiteSpace(s))
314 .Select(s => s.Trim())
317 .Where(s => !
string.IsNullOrWhiteSpace(s))
318 .Select(s => s.Trim())
321 Migrated.InvalidClaims = invalidClaims is { Length: > 0 } ? invalidClaims : Array.Empty<
string>();
322 Migrated.InvalidPhotos = invalidPhotos is { Length: > 0 } ? invalidPhotos : Array.Empty<
string>();
325 .Where(c => c is not
null && !
string.IsNullOrWhiteSpace(c.Claim))
328 string Claim = c.Claim.Trim();
329 string Reason = c.Reason ??
string.Empty;
335 .Where(p => p is not
null && (!
string.IsNullOrWhiteSpace(p.Mapping) || !
string.IsNullOrWhiteSpace(p.FileName)))
338 string FileName = (p.FileName ??
string.Empty).Trim();
339 string DisplayName = !
string.IsNullOrWhiteSpace(p.Mapping) ? p.Mapping.Trim() : FileName;
344 Migrated.InvalidClaimDetails = claimDetails;
345 Migrated.InvalidPhotoDetails = photoDetails;
347 this.applicationReview = Migrated;
348 this.RejectionMessage =
null;
349 this.RejectionCode =
null;
350 this.InvalidClaims =
null;
351 this.InvalidPhotos =
null;
352 this.InvalidClaimDetails =
null;
353 this.InvalidPhotoDetails =
null;
Contains additional data about an invalid claim.
Captures the result of an application review returned from backend services.
Contains additional data about an invalid photo.
Parses an XML-described KYC process into view-model objects.
static Task< KycProcess > LoadProcessAsync(string Xml, string? Lang=null)
Parses the KYC pages from an XML string.
Contains a local reference to a KYC process.
string? LastVisitedPageId
Last visited page identifier to support resuming.
static KycReference FromProcess(KycProcess process, string xml, string? friendlyName=null)
Creates a KycReference from a KycProcess, serializing its field values.
IdentityState? CreatedIdentityState
Last known state of the created identity (if any), for quick status tagging offline.
double Progress
Progress of the KYC process (0.0–1.0), persisted for UI display.
KycInvalidPhoto?[] InvalidPhotoDetails
Legacy invalid photo detail payload retained for persistence migration. Do not use directly.
string FriendlyName
Optional friendly name.
void SetProcess(KycProcess process, string xml, DateTime created, DateTime updated)
Stores a parsed KYC process into the reference with explicit timestamps.
string LastVisitedMode
Last visited mode: "Form" or "Summary". Default is "Form".
string?[] InvalidClaims
Legacy invalid claim collection retained for persistence migration. Do not use directly.
string? RejectionCode
Legacy rejection code retained for persistence migration. Do not use directly.
async Task ApplyFieldsToProcessAsync(string? lang=null)
Ensures the current process reflects values in Fields by applying them into the cached process instan...
string? RejectionMessage
Legacy rejection message retained for persistence migration. Do not use directly.
string? ObjectId
Object ID
async Task< KycProcess?> GetProcess(string? lang=null)
Gets a parsed KYC process, populating its fields from the reference.
string? CreatedIdentityId
The legal ID of the created identity (if any).
KycFieldValue?[] Fields
Field values in the process.
KycInvalidClaim?[] InvalidClaimDetails
Legacy invalid claim detail payload retained for persistence migration. Do not use directly.
int Version
Monotonically increasing version for optimistic concurrency and snapshot ordering....
DateTime CreatedUtc
When the reference was created.
DateTime FetchedUtc
When the process was last fetched.
void SetProcess(KycProcess process, string xml)
Stores a parsed KYC process into the reference.
async Task< KycProcess?> ToProcess(string? lang=null)
Creates a KycProcess from this reference, populating its fields.
DateTime UpdatedUtc
When the reference was last updated.
string?[] InvalidPhotos
Legacy invalid photo collection retained for persistence migration. Do not use directly.
string? KycXml
XML describing the KYC process.
Represents a field value in a KYC process reference.
string FieldId
Gets or sets the field identifier (unique within the process).
string? Value
Gets or sets the value of the field as a string.
Detailed reason info for an invalidated claim.
Detailed reason info for an invalidated photo/attachment.
Represents a page in a KYC process containing fields and sections.
ObservableCollection< KycSection > AllSections
Gets all sections contained in the page.
void UpdateVisibilities(IDictionary< string, string?> Values)
Updates visibility flags for fields and sections based on current values.
ObservableCollection< ObservableKycField > AllFields
Gets all fields directly contained in the page (excluding sections).
Represents a parsed KYC process with pages, fields, and current values.
ObservableCollection< KycPage > Pages
Gets the collection of pages in the KYC process.
IDictionary< string, string?> Values
Gets a modifiable dictionary of field values keyed by field identifier.
The base KYC field model. Use as-is for generic fields, or subclass for custom logic.
string Id
The unique identifier for the field.
IdentityState
Lists recognized legal identity states.