Skip to content

Commit

Permalink
SDK-2340: Allow Relying Business to configure if expanded document fi…
Browse files Browse the repository at this point in the history
…elds should be created for a text-extraction task
  • Loading branch information
MrBurtyyy committed Sep 23, 2024
1 parent e5c0b03 commit a3a77b1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static class Builder {

private String manualCheck;
private String chipData;
private Boolean createExpandedDocumentFields;

public Builder withManualCheckAlways() {
this.manualCheck = DocScanConstants.ALWAYS;
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}

0 comments on commit a3a77b1

Please sign in to comment.