From e65251c1fdc78f1aca1ab95da2d10a404233107e Mon Sep 17 00:00:00 2001 From: Artem Tsybulko Date: Mon, 12 May 2025 11:07:32 +0300 Subject: [PATCH 1/2] SP-23182 - remove example license --- src/Regula.DocumentReader.NetCoreExample/Program.cs | 12 +----------- .../Program.cs | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/Regula.DocumentReader.NetCoreExample/Program.cs b/src/Regula.DocumentReader.NetCoreExample/Program.cs index 1847fb8..f534b1d 100644 --- a/src/Regula.DocumentReader.NetCoreExample/Program.cs +++ b/src/Regula.DocumentReader.NetCoreExample/Program.cs @@ -12,19 +12,11 @@ namespace Regula.DocumentReader.NetCoreExample internal static class Program { private const string API_BASE_PATH = "API_BASE_PATH"; - private const string TEST_LICENSE = "TEST_LICENSE"; - private const string LICENSE_FILE_NAME = "regula.license"; public static void Main() { var apiBaseUrl = Environment.GetEnvironmentVariable(API_BASE_PATH) ?? "https://api.regulaforensics.com"; - var licenseFromEnv = - Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes - var licenseFromFile = File.Exists(LICENSE_FILE_NAME) - ? File.ReadAllBytes(LICENSE_FILE_NAME) - : null; - var whitePage0 = File.ReadAllBytes("WHITE.jpg"); var irPage0 = File.ReadAllBytes("IR.jpg"); var uvPage0 = File.ReadAllBytes("UV.jpg"); @@ -59,9 +51,7 @@ public static void Main() // { "Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes("USER:PASSWORD"))}" }, // } }; - var api = licenseFromEnv != null - ? new DocumentReaderApi(configuration).WithLicense(licenseFromEnv) - : new DocumentReaderApi(configuration).WithLicense(licenseFromFile); + var api = new DocumentReaderApi(configuration); var response = api.Process(request); diff --git a/src/Regula.DocumentReader.NetCoreExamplePortraitComparison/Program.cs b/src/Regula.DocumentReader.NetCoreExamplePortraitComparison/Program.cs index fe3c248..2e3caa4 100644 --- a/src/Regula.DocumentReader.NetCoreExamplePortraitComparison/Program.cs +++ b/src/Regula.DocumentReader.NetCoreExamplePortraitComparison/Program.cs @@ -9,8 +9,6 @@ namespace Regula.DocumentReader.NetCoreExamplePortraitComparison internal static class Program { private const string API_BASE_PATH = "API_BASE_PATH"; - private const string TEST_LICENSE = "TEST_LICENSE"; - private const string LICENSE_FILE_NAME = "regula.license"; public static void Main() { @@ -21,12 +19,6 @@ public static void Main() var apiBaseUrl = Environment.GetEnvironmentVariable(API_BASE_PATH) ?? "https://api.regulaforensics.com"; - var licenseFromEnv = - Environment.GetEnvironmentVariable(TEST_LICENSE); // optional, used here only for smoke test purposes - var licenseFromFile = File.Exists(LICENSE_FILE_NAME) - ? File.ReadAllBytes(LICENSE_FILE_NAME) - : null; - var whitePage0 = File.ReadAllBytes("WHITE.jpg"); var requestParams = new RecognitionParams { AlreadyCropped = true } @@ -51,9 +43,7 @@ public static void Main() // { "Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes("USER:PASSWORD"))}" }, // } }; - var api = licenseFromEnv != null - ? new DocumentReaderApi(configuration).WithLicense(licenseFromEnv) - : new DocumentReaderApi(configuration).WithLicense(licenseFromFile); + var api = new DocumentReaderApi(configuration); var request = new RecognitionRequest(requestParams, new List { From 490b60f59f3ceb5c5c38733e7efaa8a012a53f44 Mon Sep 17 00:00:00 2001 From: Artem Tsybulko Date: Mon, 12 May 2025 11:35:23 +0300 Subject: [PATCH 2/2] SP-23182 - update models --- .../Model/ChosenDocumentType.cs | 26 ++++++------------- .../Model/EncryptedRCLItem.cs | 2 +- .../Model/EncryptedRCLResult.cs | 2 +- .../Model/LicenseItem.cs | 2 +- .../Model/LicenseResult.cs | 2 +- .../Model/OneCandidate.cs | 26 ++++++------------- .../Model/ProcessParams.cs | 12 ++++++++- .../Model/TextFieldType.cs | 17 +++++++++++- 8 files changed, 47 insertions(+), 42 deletions(-) diff --git a/src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs b/src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs index 474410e..8f07f57 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ChosenDocumentType.cs @@ -46,12 +46,12 @@ protected ChosenDocumentType() { } /// /// Initializes a new instance of the class. /// - /// Document name (required). + /// Document name. /// Unique document type template identifier (Regula's internal numeric code) (required). /// A measure of the likelihood of correct recognition in the analysis of this type of document (required). /// true if the document of the given type is rotated by 180 degrees (required). /// rFIDPresence (required). - /// fDSIDList (required). + /// fDSIDList. /// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required). /// Set of authentication options provided for this type of document (combination of Authenticity enum) (required). /// The required exposure value of the camera when receiving images of a document of this type for a UV lighting scheme (required). @@ -60,27 +60,17 @@ protected ChosenDocumentType() { } /// rotationAngle. public ChosenDocumentType(string documentName = default(string), int iD = default(int), decimal p = default(decimal), int rotated180 = default(int), RfidLocation rFIDPresence = default(RfidLocation), FDSIDList fDSIDList = default(FDSIDList), int necessaryLights = default(int), int checkAuthenticity = default(int), int uVExp = default(int), int authenticityNecessaryLights = default(int), decimal oVIExp = default(decimal), int rotationAngle = default(int)) { - // to ensure "documentName" is required (not null) - if (documentName == null) - { - throw new ArgumentNullException("documentName is a required property for ChosenDocumentType and cannot be null"); - } - this.DocumentName = documentName; this.ID = iD; this.P = p; this.Rotated180 = rotated180; this.RFIDPresence = rFIDPresence; - // to ensure "fDSIDList" is required (not null) - if (fDSIDList == null) - { - throw new ArgumentNullException("fDSIDList is a required property for ChosenDocumentType and cannot be null"); - } - this.FDSIDList = fDSIDList; this.NecessaryLights = necessaryLights; this.CheckAuthenticity = checkAuthenticity; this.UVExp = uVExp; this.AuthenticityNecessaryLights = authenticityNecessaryLights; this.OVIExp = oVIExp; + this.DocumentName = documentName; + this.FDSIDList = fDSIDList; this.RotationAngle = rotationAngle; } @@ -88,8 +78,8 @@ protected ChosenDocumentType() { } /// Document name /// /// Document name - [DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)] - public string DocumentName { get; set; } + [DataMember(Name = "DocumentName", EmitDefaultValue = false)] + public string? DocumentName { get; set; } /// /// Unique document type template identifier (Regula's internal numeric code) @@ -118,8 +108,8 @@ protected ChosenDocumentType() { } /// /// Gets or Sets FDSIDList /// - [DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)] - public FDSIDList FDSIDList { get; set; } + [DataMember(Name = "FDSIDList", EmitDefaultValue = false)] + public FDSIDList? FDSIDList { get; set; } /// /// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document diff --git a/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLItem.cs b/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLItem.cs index 64686d7..51b2a9c 100644 --- a/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLItem.cs +++ b/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLItem.cs @@ -56,7 +56,7 @@ protected EncryptedRCLItem() { } /// /// Base64 encoded data /* - [B@4b3f0960 + [B@2d970d48 */ [DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)] public byte[] EncryptedRCL { get; set; } diff --git a/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLResult.cs b/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLResult.cs index 8251a01..301fd60 100644 --- a/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/EncryptedRCLResult.cs @@ -62,7 +62,7 @@ protected EncryptedRCLResult() { } /// /// Base64 encoded data /* - [B@4b3f0960 + [B@2d970d48 */ [DataMember(Name = "EncryptedRCL", IsRequired = true, EmitDefaultValue = true)] public byte[] EncryptedRCL { get; set; } diff --git a/src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs b/src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs index 56e93fd..1daac32 100644 --- a/src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs +++ b/src/Regula.DocumentReader.WebClient/Model/LicenseItem.cs @@ -56,7 +56,7 @@ protected LicenseItem() { } /// /// Base64 encoded data /* - [B@5259b0e4 + [B@2065118c */ [DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)] public byte[] License { get; set; } diff --git a/src/Regula.DocumentReader.WebClient/Model/LicenseResult.cs b/src/Regula.DocumentReader.WebClient/Model/LicenseResult.cs index db3f14c..9847f1b 100644 --- a/src/Regula.DocumentReader.WebClient/Model/LicenseResult.cs +++ b/src/Regula.DocumentReader.WebClient/Model/LicenseResult.cs @@ -62,7 +62,7 @@ protected LicenseResult() { } /// /// Base64 encoded data /* - [B@5259b0e4 + [B@2065118c */ [DataMember(Name = "License", IsRequired = true, EmitDefaultValue = true)] public byte[] License { get; set; } diff --git a/src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs b/src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs index 891ed3b..e149078 100644 --- a/src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs +++ b/src/Regula.DocumentReader.WebClient/Model/OneCandidate.cs @@ -46,12 +46,12 @@ protected OneCandidate() { } /// /// Initializes a new instance of the class. /// - /// Document name (required). + /// Document name. /// Unique document type template identifier (Regula's internal numeric code) (required). /// A measure of the likelihood of correct recognition in the analysis of this type of document (required). /// true if the document of the given type is rotated by 180 degrees (required). /// rFIDPresence (required). - /// fDSIDList (required). + /// fDSIDList. /// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document (required). /// Set of authentication options provided for this type of document (combination of Authenticity enum) (required). /// The required exposure value of the camera when receiving images of a document of this type for a UV lighting scheme (required). @@ -60,27 +60,17 @@ protected OneCandidate() { } /// rotationAngle. public OneCandidate(string documentName = default(string), int iD = default(int), decimal p = default(decimal), int rotated180 = default(int), RfidLocation rFIDPresence = default(RfidLocation), FDSIDList fDSIDList = default(FDSIDList), int necessaryLights = default(int), int checkAuthenticity = default(int), int uVExp = default(int), int authenticityNecessaryLights = default(int), decimal oVIExp = default(decimal), int rotationAngle = default(int)) { - // to ensure "documentName" is required (not null) - if (documentName == null) - { - throw new ArgumentNullException("documentName is a required property for OneCandidate and cannot be null"); - } - this.DocumentName = documentName; this.ID = iD; this.P = p; this.Rotated180 = rotated180; this.RFIDPresence = rFIDPresence; - // to ensure "fDSIDList" is required (not null) - if (fDSIDList == null) - { - throw new ArgumentNullException("fDSIDList is a required property for OneCandidate and cannot be null"); - } - this.FDSIDList = fDSIDList; this.NecessaryLights = necessaryLights; this.CheckAuthenticity = checkAuthenticity; this.UVExp = uVExp; this.AuthenticityNecessaryLights = authenticityNecessaryLights; this.OVIExp = oVIExp; + this.DocumentName = documentName; + this.FDSIDList = fDSIDList; this.RotationAngle = rotationAngle; } @@ -88,8 +78,8 @@ protected OneCandidate() { } /// Document name /// /// Document name - [DataMember(Name = "DocumentName", IsRequired = true, EmitDefaultValue = true)] - public string DocumentName { get; set; } + [DataMember(Name = "DocumentName", EmitDefaultValue = false)] + public string? DocumentName { get; set; } /// /// Unique document type template identifier (Regula's internal numeric code) @@ -118,8 +108,8 @@ protected OneCandidate() { } /// /// Gets or Sets FDSIDList /// - [DataMember(Name = "FDSIDList", IsRequired = true, EmitDefaultValue = true)] - public FDSIDList FDSIDList { get; set; } + [DataMember(Name = "FDSIDList", EmitDefaultValue = false)] + public FDSIDList? FDSIDList { get; set; } /// /// Combination of lighting scheme identifiers (Light enum) required to conduct OCR for this type of document diff --git a/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs b/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs index ddc3013..ec8814e 100644 --- a/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs +++ b/src/Regula.DocumentReader.WebClient/Model/ProcessParams.cs @@ -144,7 +144,8 @@ protected ProcessParams() { } /// Set the types of barcodes to process.. /// Set to force DL categories expiry date to affect the overall status or not. As documents usually have their own date of expiry, which might be less or greater than category expiry date, this might be handy for specific cases.. /// Set to generate Alpha-2 codes for nationality and issuing state fields.. - public ProcessParams(bool generateDTCVC = default(bool), List lcidFilter = default(List), bool checkLiveness = default(bool), List lcidIgnoreFilter = default(List), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), Scenario scenario = default(Scenario), List resultTypeOutput = default(List), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List fieldTypesFilter = default(List), string dateFormat = default(string), MeasureSystem? measureSystem = default(MeasureSystem?), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary customParams = default(Dictionary), List config = default(List), bool log = default(bool), LogLevel? logLevel = default(LogLevel?), int forceDocID = default(int), bool matchTextFieldMask = default(bool), bool fastDocDetect = default(bool), bool updateOCRValidityByGlare = default(bool), bool checkRequiredTextFields = default(bool), bool returnCroppedBarcode = default(bool), ImageQA imageQa = default(ImageQA), bool strictImageQuality = default(bool), bool respectImageQuality = default(bool), DocumentFormat? forceDocFormat = default(DocumentFormat?), bool noGraphics = default(bool), bool depersonalizeLog = default(bool), bool multiDocOnImage = default(bool), int shiftExpiryDate = default(int), int minimalHolderAge = default(int), bool returnUncroppedImage = default(bool), List mrzFormatsFilter = default(List), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), TextPostProcessing? convertCase = default(TextPostProcessing?), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List documentGroupFilter = default(List), AuthenticityResultType? processAuth = default(AuthenticityResultType?), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List documentIdList = default(List), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum? mrzDetectMode = default(MrzDetectModeEnum?), bool generateNumericCodes = default(bool), bool strictBarcodeDigitalSignatureCheck = default(bool), bool selectLongestNames = default(bool), List doBarcodes = default(List), bool strictDLCategoryExpiry = default(bool), bool generateAlpha2Codes = default(bool)) + /// Limits the number of pages to be processed from a PDF file.. + public ProcessParams(bool generateDTCVC = default(bool), List lcidFilter = default(List), bool checkLiveness = default(bool), List lcidIgnoreFilter = default(List), bool oneShotIdentification = default(bool), bool useFaceApi = default(bool), FaceApi faceApi = default(FaceApi), bool doDetectCan = default(bool), int imageOutputMaxHeight = default(int), int imageOutputMaxWidth = default(int), Scenario scenario = default(Scenario), List resultTypeOutput = default(List), bool doublePageSpread = default(bool), bool generateDoublePageSpreadImage = default(bool), List fieldTypesFilter = default(List), string dateFormat = default(string), MeasureSystem? measureSystem = default(MeasureSystem?), int imageDpiOutMax = default(int), bool alreadyCropped = default(bool), Dictionary customParams = default(Dictionary), List config = default(List), bool log = default(bool), LogLevel? logLevel = default(LogLevel?), int forceDocID = default(int), bool matchTextFieldMask = default(bool), bool fastDocDetect = default(bool), bool updateOCRValidityByGlare = default(bool), bool checkRequiredTextFields = default(bool), bool returnCroppedBarcode = default(bool), ImageQA imageQa = default(ImageQA), bool strictImageQuality = default(bool), bool respectImageQuality = default(bool), DocumentFormat? forceDocFormat = default(DocumentFormat?), bool noGraphics = default(bool), bool depersonalizeLog = default(bool), bool multiDocOnImage = default(bool), int shiftExpiryDate = default(int), int minimalHolderAge = default(int), bool returnUncroppedImage = default(bool), List mrzFormatsFilter = default(List), bool forceReadMrzBeforeLocate = default(bool), bool parseBarcodes = default(bool), TextPostProcessing? convertCase = default(TextPostProcessing?), bool splitNames = default(bool), bool disablePerforationOCR = default(bool), List documentGroupFilter = default(List), AuthenticityResultType? processAuth = default(AuthenticityResultType?), int deviceId = default(int), int deviceType = default(int), string deviceTypeHex = default(string), bool ignoreDeviceIdFromImage = default(bool), List documentIdList = default(List), ProcessParamsRfid rfid = default(ProcessParamsRfid), bool checkAuth = default(bool), AuthParams authParams = default(AuthParams), MrzDetectModeEnum? mrzDetectMode = default(MrzDetectModeEnum?), bool generateNumericCodes = default(bool), bool strictBarcodeDigitalSignatureCheck = default(bool), bool selectLongestNames = default(bool), List doBarcodes = default(List), bool strictDLCategoryExpiry = default(bool), bool generateAlpha2Codes = default(bool), int pdfPagesLimit = default(int)) { this.Scenario = scenario; this.GenerateDTCVC = generateDTCVC; @@ -208,6 +209,7 @@ protected ProcessParams() { } this.DoBarcodes = doBarcodes; this.StrictDLCategoryExpiry = strictDLCategoryExpiry; this.GenerateAlpha2Codes = generateAlpha2Codes; + this.PdfPagesLimit = pdfPagesLimit; } /// @@ -597,6 +599,13 @@ protected ProcessParams() { } [DataMember(Name = "generateAlpha2Codes", EmitDefaultValue = false)] public bool? GenerateAlpha2Codes { get; set; } + /// + /// Limits the number of pages to be processed from a PDF file. + /// + /// Limits the number of pages to be processed from a PDF file. + [DataMember(Name = "pdfPagesLimit", EmitDefaultValue = false)] + public int? PdfPagesLimit { get; set; } + /// /// Returns the string presentation of the object /// @@ -667,6 +676,7 @@ public override string ToString() sb.Append(" DoBarcodes: ").Append(DoBarcodes).Append("\n"); sb.Append(" StrictDLCategoryExpiry: ").Append(StrictDLCategoryExpiry).Append("\n"); sb.Append(" GenerateAlpha2Codes: ").Append(GenerateAlpha2Codes).Append("\n"); + sb.Append(" PdfPagesLimit: ").Append(PdfPagesLimit).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/src/Regula.DocumentReader.WebClient/Model/TextFieldType.cs b/src/Regula.DocumentReader.WebClient/Model/TextFieldType.cs index fb5bfb5..d22b30e 100644 --- a/src/Regula.DocumentReader.WebClient/Model/TextFieldType.cs +++ b/src/Regula.DocumentReader.WebClient/Model/TextFieldType.cs @@ -3249,7 +3249,22 @@ public enum TextFieldType /// /// Enum AIRLINE_CODE for value: 694 /// - AIRLINE_CODE = 694 + AIRLINE_CODE = 694, + + /// + /// Enum FT_MVC_AGENCY for value: 695 + /// + FT_MVC_AGENCY = 695, + + /// + /// Enum FT_ISSUING_STATE_CODE_ALPHA2 for value: 696 + /// + FT_ISSUING_STATE_CODE_ALPHA2 = 696, + + /// + /// Enum FT_NATIONALITY_CODE_ALPHA2 for value: 697 + /// + FT_NATIONALITY_CODE_ALPHA2 = 697 } }