Skip to content

Commit

Permalink
Fix #960: Remove code-level consistency check in Innovatrics Document…
Browse files Browse the repository at this point in the history
… Provider (#961)
  • Loading branch information
jnpsk authored Dec 18, 2023
1 parent 0202d5d commit 1ddfe6d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 26 deletions.
1 change: 0 additions & 1 deletion docs/onboarding/Configuration-Properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ The Onboarding Server uses the following public configuration properties:
| `enrollment-server-onboarding.provider.innovatrics.serviceUserAgent` | `Wultra/OnboardingServer` | User agent to use when making HTTP calls to Innovatrics REST service. |
| `enrollment-server-onboarding.provider.innovatrics.presenceCheckConfiguration.score` | 0.875 | Presence check minimal score threshold. |
| `enrollment-server-onboarding.provider.innovatrics.documentVerificationConfiguration.documentCountries` | `CZE` | List of expected countries of issue of identification documents as three-letter country codes, i.e. ISO 3166-1 alpha-3. If empty, all countries of issue known to Innovatrics are considered during classification, which may have negative impact on performance. |
| `enrollment-server-onboarding.provider.innovatrics.document-verification-configuration.crucialFields` | `documentNumber`, `dateOfIssue`, `dateOfExpiry`, `surname`, `dateOfBirth`, `personalNumber`, `givenNames` | Set of fields in camelCase that are cross-validated between the machine-readable zone and visual zone. Only those specified fields that are actually extracted from a document are considered. If empty, no inconsistencies will be checked. |
| `enrollment-server-onboarding.provider.innovatrics.restClientConfig.acceptInvalidSslCertificate` | `false` | Whether invalid SSL certificate is accepted when calling Zen ID REST service. |
| `enrollment-server-onboarding.provider.innovatrics.restClientConfig.maxInMemorySize` | `10485760` | Maximum in memory size of HTTP requests when calling Innovatrics REST service. |
| `enrollment-server-onboarding.provider.innovatrics.restClientConfig.proxyEnabled` | `false` | Whether proxy server is enabled when calling Innovatrics REST service. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ public static class DocumentVerificationConfiguration {
* Identifies expected document countries of issue in ISO 3166-1 alpha-3 format.
*/
private List<String> documentCountries;

/**
* Set of fields in camelCase that are cross-validated between the machine-readable zone and visual zone, if extracted.
*/
private Set<String> crucialFields;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -372,37 +372,23 @@ private List<String> parseVisualZoneInspection(final VisualZoneInspection visual

final MrzConsistency mrzConsistency = textConsistentWith.getMrz();
if (mrzConsistency != null) {
final List<String> inconsistentAttributes = getCrucial(mrzConsistency.getInconsistentTexts());
final List<String> inconsistentAttributes = mrzConsistency.getInconsistentTexts();
if (!inconsistentAttributes.isEmpty()) {
rejectionReasons.add("Inconsistent crucial attributes with MRZ: %s".formatted(inconsistentAttributes));
rejectionReasons.add("Inconsistent attributes with MRZ: %s".formatted(inconsistentAttributes));
}
}

final BarcodesConsistency barcodesConsistency = textConsistentWith.getBarcodes();
if (barcodesConsistency != null) {
final List<String> inconsistentAttributes = getCrucial(barcodesConsistency.getInconsistentTexts());
final List<String> inconsistentAttributes = barcodesConsistency.getInconsistentTexts();
if (!inconsistentAttributes.isEmpty()) {
rejectionReasons.add("Inconsistent crucial attributes with barcode: %s".formatted(inconsistentAttributes));
rejectionReasons.add("Inconsistent attributes with barcode: %s".formatted(inconsistentAttributes));
}
}

return rejectionReasons;
}

/**
* Intersects list of attributes with CRUCIAL_ATTRIBUTES.
* @param attributes Attributes to do the intersection on.
* @return Attributes intersection.
*/
private List<String> getCrucial(final List<String> attributes) {
if (attributes == null) {
return Collections.emptyList();
}

final Set<String> crucialFields = configuration.getDocumentVerificationConfiguration().getCrucialFields();
return attributes.stream().filter(crucialFields::contains).toList();
}

private <T> String serializeToString(T src) throws DocumentVerificationException {
try {
return objectMapper.writeValueAsString(src);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ enrollment-server-onboarding.presence-check.provider=innovatrics
enrollment-server-onboarding.onboarding-process.enabled=false

enrollment-server-onboarding.provider.innovatrics.documentVerificationConfiguration.documentCountries=CZE,SVK
enrollment-server-onboarding.provider.innovatrics.document-verification-configuration.crucialFields=documentNumber, dateOfIssue, dateOfExpiry, surname, dateOfBirth, personalNumber, givenNames

enrollment-server-onboarding.provider.innovatrics.restClientConfig.maxInMemorySize=1048576
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ enrollment-server-onboarding.provider.innovatrics.presenceCheckConfiguration.sco

# Innovatrics document-verification configuration
enrollment-server-onboarding.provider.innovatrics.documentVerificationConfiguration.documentCountries=CZE
enrollment-server-onboarding.provider.innovatrics.document-verification-configuration.crucialFields=documentNumber, dateOfIssue, dateOfExpiry, surname, dateOfBirth, personalNumber, givenNames

# Innovatrics REST client configuration
enrollment-server-onboarding.provider.innovatrics.restClientConfig.acceptInvalidSslCertificate=false
Expand Down

0 comments on commit 1ddfe6d

Please sign in to comment.