From a3a77b1cb93e872216cee3bdfbba3e456078faec Mon Sep 17 00:00:00 2001 From: Alex Burt Date: Mon, 23 Sep 2024 02:13:12 +0100 Subject: [PATCH] SDK-2340: Allow Relying Business to configure if expanded document fields should be created for a text-extraction task --- .../task/RequestedIdDocTextExtractionTask.java | 8 +++++++- .../RequestedIdDocTextExtractionTaskConfig.java | 16 +++++++++++++++- .../RequestedIdDocTextExtractionTaskTest.java | 10 ++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java index 0f08f0331..9ba67453d 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java @@ -31,6 +31,7 @@ public static class Builder { private String manualCheck; private String chipData; + private Boolean createExpandedDocumentFields; public Builder withManualCheckAlways() { this.manualCheck = DocScanConstants.ALWAYS; @@ -57,8 +58,13 @@ public Builder withChipDataIgnore() { return this; } + public Builder withCreateExpandedDocumentFields(boolean value) { + this.createExpandedDocumentFields = value; + return this; + } + public RequestedIdDocTextExtractionTask build() { - RequestedIdDocTextExtractionTaskConfig config = new RequestedIdDocTextExtractionTaskConfig(manualCheck, chipData); + RequestedIdDocTextExtractionTaskConfig config = new RequestedIdDocTextExtractionTaskConfig(manualCheck, chipData, createExpandedDocumentFields); return new RequestedIdDocTextExtractionTask(config); } diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java index 9911e7d74..2f86306d1 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java @@ -13,9 +13,13 @@ public class RequestedIdDocTextExtractionTaskConfig implements RequestedTaskConf @JsonProperty("chip_data") private final String chipData; - RequestedIdDocTextExtractionTaskConfig(String manualCheck, String chipData) { + @JsonProperty("create_expanded_document_fields") + private final Boolean createExpandedDocumentFields; + + RequestedIdDocTextExtractionTaskConfig(String manualCheck, String chipData, Boolean createExpandedDocumentFields) { this.manualCheck = manualCheck; this.chipData = chipData; + this.createExpandedDocumentFields = createExpandedDocumentFields; } /** @@ -37,4 +41,14 @@ public String getChipData() { return chipData; } + /** + * Describes if expanded document fields should be created for a text-extraction task + * in the session. + * + * @return if expanded document fields should be created + */ + public Boolean getCreateExpandedDocumentFields() { + return createExpandedDocumentFields; + } + } diff --git a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java index 93e3562c4..65452c4d7 100644 --- a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java +++ b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java @@ -63,4 +63,14 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithChipDataIgnore() { assertThat(configResult.getChipData(), is("IGNORE")); } + @Test + public void shouldBuildSimpleRequestedTextExtractionTaskWithCreateExpandedDocumentFields() { + RequestedIdDocTextExtractionTask result = RequestedIdDocTextExtractionTask.builder() + .withCreateExpandedDocumentFields(true) + .build(); + + RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); + assertThat(configResult.getCreateExpandedDocumentFields(), is(true)); + } + }