-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Danila.Kislitsyn <[email protected]> Co-authored-by: Hleb Albau <[email protected]>
- Loading branch information
1 parent
d962a56
commit 5f90934
Showing
11 changed files
with
252 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/AuthenticityResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Linq; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public abstract class AuthenticityResult<T> where T : class | ||
{ | ||
AuthenticityCheckResult authenticityCheckResult; | ||
|
||
public AuthenticityResult(AuthenticityCheckResult authenticityCheckResult) | ||
{ | ||
this.authenticityCheckResult = authenticityCheckResult; | ||
} | ||
|
||
public AuthenticityCheckResult Payload() | ||
{ | ||
return this.authenticityCheckResult; | ||
} | ||
|
||
public List<T> Items() | ||
{ | ||
var ls = this.authenticityCheckResult.List; | ||
|
||
return ls as List<T>; | ||
} | ||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/Autheticity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public static class Authenticity | ||
{ | ||
|
||
public static SecurityFeatureChecks UvLuminescenceChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.UV_LUMINESCENCE); | ||
} | ||
|
||
public static SecurityFeatureChecks IrB900Checks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.IR_B900); | ||
} | ||
|
||
public static IdentChecks ImagePattern(this AuthenticityCheckList auth) | ||
{ | ||
return auth.identOrNull(AuthenticityResultType.IMAGE_PATTERN); | ||
} | ||
|
||
public static SecurityFeatureChecks AxialProtectionChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.AXIAL_PROTECTION); | ||
} | ||
|
||
public static FiberChecks UVFiberChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.filberOrNull(AuthenticityResultType.UV_FIBERS); | ||
} | ||
|
||
public static IdentChecks IRVisibilityChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.identOrNull(AuthenticityResultType.IR_VISIBILITY); | ||
} | ||
|
||
public static OCRSecurityTextChecks OCRSecurityTextChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.ocrSecurityTextOrNull(AuthenticityResultType.OCR_SECURITY_TEXT); | ||
} | ||
|
||
public static ImageIdentChecks IpiChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.imageIdentOrNull(AuthenticityResultType.IPI); | ||
} | ||
|
||
public static SecurityFeatureChecks EmbededImageChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.PHOTO_EMBED_TYPE); | ||
} | ||
|
||
public static SecurityFeatureChecks HologramsChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.HOLOGRAMS); | ||
} | ||
|
||
public static SecurityFeatureChecks ImageAreaChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.PHOTO_AREA); | ||
} | ||
|
||
public static IdentChecks portraitComparisonChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.identOrNull(AuthenticityResultType.PORTRAIT_COMPARISON); | ||
} | ||
|
||
public static SecurityFeatureChecks BarcodeFormatCheckChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.securityFeatureOrNull(AuthenticityResultType.BARCODE_FORMAT_CHECK); | ||
} | ||
|
||
public static IdentChecks KinegramChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.identOrNull(AuthenticityResultType.KINEGRAM); | ||
} | ||
|
||
public static IdentChecks LetterScreenChecks(this AuthenticityCheckList auth) | ||
{ | ||
return auth.identOrNull(AuthenticityResultType.LETTER_SCREEN); | ||
} | ||
|
||
|
||
private static AuthenticityCheckResult resultByType(this AuthenticityCheckList auth, int type) | ||
{ | ||
return auth?.List.FirstOrDefault(t => t.Type == type); | ||
} | ||
|
||
private static FiberChecks filberOrNull(this AuthenticityCheckList auth, int type) | ||
{ | ||
AuthenticityCheckResult result = auth.resultByType(type); | ||
return result != null ? new FiberChecks(result) : null; | ||
} | ||
|
||
private static IdentChecks identOrNull(this AuthenticityCheckList auth, int type) | ||
{ | ||
AuthenticityCheckResult result = auth.resultByType(type); | ||
return result != null ? new IdentChecks(result) : null; | ||
} | ||
|
||
private static ImageIdentChecks imageIdentOrNull(this AuthenticityCheckList auth, int type) | ||
{ | ||
AuthenticityCheckResult result = auth.resultByType(type); | ||
return result != null ? new ImageIdentChecks(result) : null; | ||
} | ||
|
||
private static OCRSecurityTextChecks ocrSecurityTextOrNull(this AuthenticityCheckList auth, int type) | ||
{ | ||
AuthenticityCheckResult result = auth.resultByType(type); | ||
return result != null ? new OCRSecurityTextChecks(result) : null; | ||
} | ||
|
||
private static SecurityFeatureChecks securityFeatureOrNull(this AuthenticityCheckList auth, int type) | ||
{ | ||
AuthenticityCheckResult result = auth.resultByType(type); | ||
return result != null ? new SecurityFeatureChecks(result) : null; | ||
} | ||
|
||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/FiberChecks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public class FiberChecks : AuthenticityResult<FiberResult> | ||
{ | ||
public FiberChecks(AuthenticityCheckResult authenticityCheckResult) : base(authenticityCheckResult) | ||
{ } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/IdentChecks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public class IdentChecks : AuthenticityResult<IdentResult> | ||
{ | ||
public IdentChecks(AuthenticityCheckResult authenticityCheckResult) : base(authenticityCheckResult) | ||
{ } | ||
|
||
public IdentResult ChecksByElement(int type) | ||
{ | ||
return this.Items()?.FirstOrDefault(t => t.Type == type); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/ImageIdentChecks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public class ImageIdentChecks : AuthenticityResult<PhotoIdentResult> | ||
{ | ||
public ImageIdentChecks(AuthenticityCheckResult authenticityCheckResult) : base(authenticityCheckResult) | ||
{ } | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/OCRSecurityTextChecks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public class OCRSecurityTextChecks : AuthenticityResult<OCRSecurityTextResult> | ||
{ | ||
public OCRSecurityTextChecks(AuthenticityCheckResult authenticityCheckResult) : base(authenticityCheckResult) | ||
{ | ||
|
||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Regula.DocumentReader.WebClient/Model/Ext/Autheticity/SecurityFeatureChecks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Regula.DocumentReader.WebClient.Model.Ext.Autheticity | ||
{ | ||
public class SecurityFeatureChecks : AuthenticityResult<SecurityFeatureResult> | ||
{ | ||
public SecurityFeatureChecks(AuthenticityCheckResult authenticityResult) : base(authenticityResult) | ||
{ } | ||
|
||
public SecurityFeatureResult ChecksByElement(int type) | ||
{ | ||
return this.Items()?.FirstOrDefault(t => t.Type == type); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters