diff --git a/.release.json b/.release.json index 80f6527..9d93b99 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "2998dd3", - "long_sha": "2998dd3ad2db49a33e0ecf9b41c7cf873909ef0b", - "version": "v4.0.0" + "short_sha": "d180edd", + "long_sha": "d180eddd168dd95bf84bf7c8fe9f8c7e3c0c5494", + "version": "v4.1.0" }, - "release": "v5.0.0" + "release": "v5.1.0" } diff --git a/README.md b/README.md index d78d093..79a6991 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add this dependency to your project's POM: com.onfido onfido-api-java - 5.0.0 + 5.1.0 compile ``` @@ -59,7 +59,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.onfido:onfido-api-java:5.0.0" + implementation "com.onfido:onfido-api-java:5.1.0" } ``` @@ -73,10 +73,10 @@ mvn clean package Then manually install the following JARs: -- `target/onfido-api-java-5.0.0.jar` +- `target/onfido-api-java-5.1.0.jar` - `target/lib/*.jar` -The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.0.0 +The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.1.0 ## Getting Started diff --git a/pom.xml b/pom.xml index 86036d9..d442f33 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ onfido-api-java jar onfido-api-java - 5.0.0 + 5.1.0 https://documentation.onfido.com Official Java API client library for the Onfido API diff --git a/src/main/java/com/onfido/ApiClient.java b/src/main/java/com/onfido/ApiClient.java index 73c6ff6..df05a90 100644 --- a/src/main/java/com/onfido/ApiClient.java +++ b/src/main/java/com/onfido/ApiClient.java @@ -160,7 +160,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("onfido-java/5.0.0"); + setUserAgent("onfido-java/5.1.0"); authentications = new HashMap(); } diff --git a/src/main/java/com/onfido/Configuration.java b/src/main/java/com/onfido/Configuration.java index 277e626..5ee3b93 100644 --- a/src/main/java/com/onfido/Configuration.java +++ b/src/main/java/com/onfido/Configuration.java @@ -15,7 +15,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0") public class Configuration { - public static final String VERSION = "5.0.0"; + public static final String VERSION = "5.1.0"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/onfido/JSON.java b/src/main/java/com/onfido/JSON.java index feb14b9..59b8c62 100644 --- a/src/main/java/com/onfido/JSON.java +++ b/src/main/java/com/onfido/JSON.java @@ -216,7 +216,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentODPReasons.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentProperties.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesAddressLines.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesBarcodeInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesBarcode.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesDocumentClassification.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesDocumentNumbersInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.DocumentPropertiesDrivingLicenceInformation.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/onfido/model/DocumentProperties.java b/src/main/java/com/onfido/model/DocumentProperties.java index 85f88b8..cd499a5 100644 --- a/src/main/java/com/onfido/model/DocumentProperties.java +++ b/src/main/java/com/onfido/model/DocumentProperties.java @@ -20,7 +20,7 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.onfido.model.DocumentPropertiesAddressLines; -import com.onfido.model.DocumentPropertiesBarcodeInner; +import com.onfido.model.DocumentPropertiesBarcode; import com.onfido.model.DocumentPropertiesDocumentClassification; import com.onfido.model.DocumentPropertiesDocumentNumbersInner; import com.onfido.model.DocumentPropertiesDrivingLicenceInformation; @@ -402,7 +402,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public static final String SERIALIZED_NAME_BARCODE = "barcode"; @SerializedName(SERIALIZED_NAME_BARCODE) - private List barcode = new ArrayList<>(); + private DocumentPropertiesBarcode barcode; public static final String SERIALIZED_NAME_NFC = "nfc"; @SerializedName(SERIALIZED_NAME_NFC) @@ -1191,29 +1191,21 @@ public void setAddressLines(DocumentPropertiesAddressLines addressLines) { } - public DocumentProperties barcode(List barcode) { + public DocumentProperties barcode(DocumentPropertiesBarcode barcode) { this.barcode = barcode; return this; } - public DocumentProperties addBarcodeItem(DocumentPropertiesBarcodeInner barcodeItem) { - if (this.barcode == null) { - this.barcode = new ArrayList<>(); - } - this.barcode.add(barcodeItem); - return this; - } - /** * Get barcode * @return barcode */ @javax.annotation.Nullable - public List getBarcode() { + public DocumentPropertiesBarcode getBarcode() { return barcode; } - public void setBarcode(List barcode) { + public void setBarcode(DocumentPropertiesBarcode barcode) { this.barcode = barcode; } @@ -1668,19 +1660,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("address_lines") != null && !jsonObj.get("address_lines").isJsonNull()) { DocumentPropertiesAddressLines.validateJsonElement(jsonObj.get("address_lines")); } + // validate the optional field `barcode` if (jsonObj.get("barcode") != null && !jsonObj.get("barcode").isJsonNull()) { - JsonArray jsonArraybarcode = jsonObj.getAsJsonArray("barcode"); - if (jsonArraybarcode != null) { - // ensure the json data is an array - if (!jsonObj.get("barcode").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `barcode` to be an array in the JSON string but got `%s`", jsonObj.get("barcode").toString())); - } - - // validate the optional field `barcode` (array) - for (int i = 0; i < jsonArraybarcode.size(); i++) { - DocumentPropertiesBarcodeInner.validateJsonElement(jsonArraybarcode.get(i)); - }; - } + DocumentPropertiesBarcode.validateJsonElement(jsonObj.get("barcode")); } // validate the optional field `nfc` if (jsonObj.get("nfc") != null && !jsonObj.get("nfc").isJsonNull()) { diff --git a/src/main/java/com/onfido/model/DocumentPropertiesBarcodeInner.java b/src/main/java/com/onfido/model/DocumentPropertiesBarcode.java similarity index 87% rename from src/main/java/com/onfido/model/DocumentPropertiesBarcodeInner.java rename to src/main/java/com/onfido/model/DocumentPropertiesBarcode.java index 1a94fcb..a1402e4 100644 --- a/src/main/java/com/onfido/model/DocumentPropertiesBarcodeInner.java +++ b/src/main/java/com/onfido/model/DocumentPropertiesBarcode.java @@ -47,10 +47,10 @@ import com.onfido.JSON; /** - * DocumentPropertiesBarcodeInner + * DocumentPropertiesBarcode */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0") -public class DocumentPropertiesBarcodeInner { +public class DocumentPropertiesBarcode { public static final String SERIALIZED_NAME_FIRST_NAME = "first_name"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) private String firstName; @@ -123,10 +123,10 @@ public class DocumentPropertiesBarcodeInner { @SerializedName(SERIALIZED_NAME_REAL_ID_CLASSIFICATION) private String realIdClassification; - public DocumentPropertiesBarcodeInner() { + public DocumentPropertiesBarcode() { } - public DocumentPropertiesBarcodeInner firstName(String firstName) { + public DocumentPropertiesBarcode firstName(String firstName) { this.firstName = firstName; return this; } @@ -145,7 +145,7 @@ public void setFirstName(String firstName) { } - public DocumentPropertiesBarcodeInner middleName(String middleName) { + public DocumentPropertiesBarcode middleName(String middleName) { this.middleName = middleName; return this; } @@ -164,7 +164,7 @@ public void setMiddleName(String middleName) { } - public DocumentPropertiesBarcodeInner lastName(String lastName) { + public DocumentPropertiesBarcode lastName(String lastName) { this.lastName = lastName; return this; } @@ -183,7 +183,7 @@ public void setLastName(String lastName) { } - public DocumentPropertiesBarcodeInner documentType(String documentType) { + public DocumentPropertiesBarcode documentType(String documentType) { this.documentType = documentType; return this; } @@ -202,7 +202,7 @@ public void setDocumentType(String documentType) { } - public DocumentPropertiesBarcodeInner dateOfExpiry(LocalDate dateOfExpiry) { + public DocumentPropertiesBarcode dateOfExpiry(LocalDate dateOfExpiry) { this.dateOfExpiry = dateOfExpiry; return this; } @@ -221,7 +221,7 @@ public void setDateOfExpiry(LocalDate dateOfExpiry) { } - public DocumentPropertiesBarcodeInner dateOfBirth(LocalDate dateOfBirth) { + public DocumentPropertiesBarcode dateOfBirth(LocalDate dateOfBirth) { this.dateOfBirth = dateOfBirth; return this; } @@ -240,7 +240,7 @@ public void setDateOfBirth(LocalDate dateOfBirth) { } - public DocumentPropertiesBarcodeInner issuingDate(LocalDate issuingDate) { + public DocumentPropertiesBarcode issuingDate(LocalDate issuingDate) { this.issuingDate = issuingDate; return this; } @@ -259,7 +259,7 @@ public void setIssuingDate(LocalDate issuingDate) { } - public DocumentPropertiesBarcodeInner addressLine1(String addressLine1) { + public DocumentPropertiesBarcode addressLine1(String addressLine1) { this.addressLine1 = addressLine1; return this; } @@ -278,7 +278,7 @@ public void setAddressLine1(String addressLine1) { } - public DocumentPropertiesBarcodeInner addressLine2(String addressLine2) { + public DocumentPropertiesBarcode addressLine2(String addressLine2) { this.addressLine2 = addressLine2; return this; } @@ -297,7 +297,7 @@ public void setAddressLine2(String addressLine2) { } - public DocumentPropertiesBarcodeInner addressLine3(String addressLine3) { + public DocumentPropertiesBarcode addressLine3(String addressLine3) { this.addressLine3 = addressLine3; return this; } @@ -316,7 +316,7 @@ public void setAddressLine3(String addressLine3) { } - public DocumentPropertiesBarcodeInner addressLine4(String addressLine4) { + public DocumentPropertiesBarcode addressLine4(String addressLine4) { this.addressLine4 = addressLine4; return this; } @@ -335,7 +335,7 @@ public void setAddressLine4(String addressLine4) { } - public DocumentPropertiesBarcodeInner addressLine5(String addressLine5) { + public DocumentPropertiesBarcode addressLine5(String addressLine5) { this.addressLine5 = addressLine5; return this; } @@ -354,7 +354,7 @@ public void setAddressLine5(String addressLine5) { } - public DocumentPropertiesBarcodeInner issuingState(String issuingState) { + public DocumentPropertiesBarcode issuingState(String issuingState) { this.issuingState = issuingState; return this; } @@ -373,7 +373,7 @@ public void setIssuingState(String issuingState) { } - public DocumentPropertiesBarcodeInner propertyClass(String propertyClass) { + public DocumentPropertiesBarcode propertyClass(String propertyClass) { this.propertyClass = propertyClass; return this; } @@ -392,7 +392,7 @@ public void setPropertyClass(String propertyClass) { } - public DocumentPropertiesBarcodeInner gender(String gender) { + public DocumentPropertiesBarcode gender(String gender) { this.gender = gender; return this; } @@ -411,7 +411,7 @@ public void setGender(String gender) { } - public DocumentPropertiesBarcodeInner issuingCountry(String issuingCountry) { + public DocumentPropertiesBarcode issuingCountry(String issuingCountry) { this.issuingCountry = issuingCountry; return this; } @@ -430,7 +430,7 @@ public void setIssuingCountry(String issuingCountry) { } - public DocumentPropertiesBarcodeInner documentNumber(String documentNumber) { + public DocumentPropertiesBarcode documentNumber(String documentNumber) { this.documentNumber = documentNumber; return this; } @@ -449,7 +449,7 @@ public void setDocumentNumber(String documentNumber) { } - public DocumentPropertiesBarcodeInner realIdClassification(String realIdClassification) { + public DocumentPropertiesBarcode realIdClassification(String realIdClassification) { this.realIdClassification = realIdClassification; return this; } @@ -480,9 +480,9 @@ public void setRealIdClassification(String realIdClassification) { * * @param key name of the property * @param value value of the property - * @return the DocumentPropertiesBarcodeInner instance itself + * @return the DocumentPropertiesBarcode instance itself */ - public DocumentPropertiesBarcodeInner putAdditionalProperty(String key, Object value) { + public DocumentPropertiesBarcode putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -521,26 +521,26 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - DocumentPropertiesBarcodeInner documentPropertiesBarcodeInner = (DocumentPropertiesBarcodeInner) o; - return Objects.equals(this.firstName, documentPropertiesBarcodeInner.firstName) && - Objects.equals(this.middleName, documentPropertiesBarcodeInner.middleName) && - Objects.equals(this.lastName, documentPropertiesBarcodeInner.lastName) && - Objects.equals(this.documentType, documentPropertiesBarcodeInner.documentType) && - Objects.equals(this.dateOfExpiry, documentPropertiesBarcodeInner.dateOfExpiry) && - Objects.equals(this.dateOfBirth, documentPropertiesBarcodeInner.dateOfBirth) && - Objects.equals(this.issuingDate, documentPropertiesBarcodeInner.issuingDate) && - Objects.equals(this.addressLine1, documentPropertiesBarcodeInner.addressLine1) && - Objects.equals(this.addressLine2, documentPropertiesBarcodeInner.addressLine2) && - Objects.equals(this.addressLine3, documentPropertiesBarcodeInner.addressLine3) && - Objects.equals(this.addressLine4, documentPropertiesBarcodeInner.addressLine4) && - Objects.equals(this.addressLine5, documentPropertiesBarcodeInner.addressLine5) && - Objects.equals(this.issuingState, documentPropertiesBarcodeInner.issuingState) && - Objects.equals(this.propertyClass, documentPropertiesBarcodeInner.propertyClass) && - Objects.equals(this.gender, documentPropertiesBarcodeInner.gender) && - Objects.equals(this.issuingCountry, documentPropertiesBarcodeInner.issuingCountry) && - Objects.equals(this.documentNumber, documentPropertiesBarcodeInner.documentNumber) && - Objects.equals(this.realIdClassification, documentPropertiesBarcodeInner.realIdClassification)&& - Objects.equals(this.additionalProperties, documentPropertiesBarcodeInner.additionalProperties); + DocumentPropertiesBarcode documentPropertiesBarcode = (DocumentPropertiesBarcode) o; + return Objects.equals(this.firstName, documentPropertiesBarcode.firstName) && + Objects.equals(this.middleName, documentPropertiesBarcode.middleName) && + Objects.equals(this.lastName, documentPropertiesBarcode.lastName) && + Objects.equals(this.documentType, documentPropertiesBarcode.documentType) && + Objects.equals(this.dateOfExpiry, documentPropertiesBarcode.dateOfExpiry) && + Objects.equals(this.dateOfBirth, documentPropertiesBarcode.dateOfBirth) && + Objects.equals(this.issuingDate, documentPropertiesBarcode.issuingDate) && + Objects.equals(this.addressLine1, documentPropertiesBarcode.addressLine1) && + Objects.equals(this.addressLine2, documentPropertiesBarcode.addressLine2) && + Objects.equals(this.addressLine3, documentPropertiesBarcode.addressLine3) && + Objects.equals(this.addressLine4, documentPropertiesBarcode.addressLine4) && + Objects.equals(this.addressLine5, documentPropertiesBarcode.addressLine5) && + Objects.equals(this.issuingState, documentPropertiesBarcode.issuingState) && + Objects.equals(this.propertyClass, documentPropertiesBarcode.propertyClass) && + Objects.equals(this.gender, documentPropertiesBarcode.gender) && + Objects.equals(this.issuingCountry, documentPropertiesBarcode.issuingCountry) && + Objects.equals(this.documentNumber, documentPropertiesBarcode.documentNumber) && + Objects.equals(this.realIdClassification, documentPropertiesBarcode.realIdClassification)&& + Objects.equals(this.additionalProperties, documentPropertiesBarcode.additionalProperties); } @Override @@ -551,7 +551,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class DocumentPropertiesBarcodeInner {\n"); + sb.append("class DocumentPropertiesBarcode {\n"); sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); sb.append(" middleName: ").append(toIndentedString(middleName)).append("\n"); sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); @@ -620,12 +620,12 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to DocumentPropertiesBarcodeInner + * @throws IOException if the JSON Element is invalid with respect to DocumentPropertiesBarcode */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!DocumentPropertiesBarcodeInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentPropertiesBarcodeInner is not found in the empty JSON string", DocumentPropertiesBarcodeInner.openapiRequiredFields.toString())); + if (!DocumentPropertiesBarcode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DocumentPropertiesBarcode is not found in the empty JSON string", DocumentPropertiesBarcode.openapiRequiredFields.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); @@ -680,16 +680,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!DocumentPropertiesBarcodeInner.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DocumentPropertiesBarcodeInner' and its subtypes + if (!DocumentPropertiesBarcode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocumentPropertiesBarcode' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DocumentPropertiesBarcodeInner.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DocumentPropertiesBarcode.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, DocumentPropertiesBarcodeInner value) throws IOException { + public void write(JsonWriter out, DocumentPropertiesBarcode value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -717,12 +717,12 @@ else if (entry.getValue() instanceof Character) } @Override - public DocumentPropertiesBarcodeInner read(JsonReader in) throws IOException { + public DocumentPropertiesBarcode read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - DocumentPropertiesBarcodeInner instance = thisAdapter.fromJsonTree(jsonObj); + DocumentPropertiesBarcode instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -749,18 +749,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of DocumentPropertiesBarcodeInner given an JSON string + * Create an instance of DocumentPropertiesBarcode given an JSON string * * @param jsonString JSON string - * @return An instance of DocumentPropertiesBarcodeInner - * @throws IOException if the JSON string is invalid with respect to DocumentPropertiesBarcodeInner + * @return An instance of DocumentPropertiesBarcode + * @throws IOException if the JSON string is invalid with respect to DocumentPropertiesBarcode */ - public static DocumentPropertiesBarcodeInner fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DocumentPropertiesBarcodeInner.class); + public static DocumentPropertiesBarcode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocumentPropertiesBarcode.class); } /** - * Convert an instance of DocumentPropertiesBarcodeInner to an JSON string + * Convert an instance of DocumentPropertiesBarcode to an JSON string * * @return JSON string */ diff --git a/src/main/java/com/onfido/model/DocumentWithDriverVerificationReportAllOfProperties.java b/src/main/java/com/onfido/model/DocumentWithDriverVerificationReportAllOfProperties.java index 22985f8..06c3d80 100644 --- a/src/main/java/com/onfido/model/DocumentWithDriverVerificationReportAllOfProperties.java +++ b/src/main/java/com/onfido/model/DocumentWithDriverVerificationReportAllOfProperties.java @@ -20,7 +20,7 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.onfido.model.DocumentPropertiesAddressLines; -import com.onfido.model.DocumentPropertiesBarcodeInner; +import com.onfido.model.DocumentPropertiesBarcode; import com.onfido.model.DocumentPropertiesDocumentClassification; import com.onfido.model.DocumentPropertiesDocumentNumbersInner; import com.onfido.model.DocumentPropertiesDrivingLicenceInformation; @@ -404,7 +404,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public static final String SERIALIZED_NAME_BARCODE = "barcode"; @SerializedName(SERIALIZED_NAME_BARCODE) - private List barcode = new ArrayList<>(); + private DocumentPropertiesBarcode barcode; public static final String SERIALIZED_NAME_NFC = "nfc"; @SerializedName(SERIALIZED_NAME_NFC) @@ -1217,29 +1217,21 @@ public void setAddressLines(DocumentPropertiesAddressLines addressLines) { } - public DocumentWithDriverVerificationReportAllOfProperties barcode(List barcode) { + public DocumentWithDriverVerificationReportAllOfProperties barcode(DocumentPropertiesBarcode barcode) { this.barcode = barcode; return this; } - public DocumentWithDriverVerificationReportAllOfProperties addBarcodeItem(DocumentPropertiesBarcodeInner barcodeItem) { - if (this.barcode == null) { - this.barcode = new ArrayList<>(); - } - this.barcode.add(barcodeItem); - return this; - } - /** * Get barcode * @return barcode */ @javax.annotation.Nullable - public List getBarcode() { + public DocumentPropertiesBarcode getBarcode() { return barcode; } - public void setBarcode(List barcode) { + public void setBarcode(DocumentPropertiesBarcode barcode) { this.barcode = barcode; } @@ -1834,19 +1826,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("address_lines") != null && !jsonObj.get("address_lines").isJsonNull()) { DocumentPropertiesAddressLines.validateJsonElement(jsonObj.get("address_lines")); } + // validate the optional field `barcode` if (jsonObj.get("barcode") != null && !jsonObj.get("barcode").isJsonNull()) { - JsonArray jsonArraybarcode = jsonObj.getAsJsonArray("barcode"); - if (jsonArraybarcode != null) { - // ensure the json data is an array - if (!jsonObj.get("barcode").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `barcode` to be an array in the JSON string but got `%s`", jsonObj.get("barcode").toString())); - } - - // validate the optional field `barcode` (array) - for (int i = 0; i < jsonArraybarcode.size(); i++) { - DocumentPropertiesBarcodeInner.validateJsonElement(jsonArraybarcode.get(i)); - }; - } + DocumentPropertiesBarcode.validateJsonElement(jsonObj.get("barcode")); } // validate the optional field `nfc` if (jsonObj.get("nfc") != null && !jsonObj.get("nfc").isJsonNull()) { diff --git a/src/test/java/com/onfido/integration/ReportSchemasTest.java b/src/test/java/com/onfido/integration/ReportSchemasTest.java index 47296ef..91a046e 100644 --- a/src/test/java/com/onfido/integration/ReportSchemasTest.java +++ b/src/test/java/com/onfido/integration/ReportSchemasTest.java @@ -103,4 +103,35 @@ public void schemaOfFacialSimilarityPhotoReportIsValid() throws Exception { .getProperties() .toJson()); } + + @Test + public void schemaOfDocumentWithAddressInformationReportIsValid() throws Exception { + uploadLivePhoto(applicant, "sample_photo.png"); + + Check check = + createCheck( + applicant, + document, + new CheckBuilder() + .reportNames(Arrays.asList(ReportName.DOCUMENT_WITH_ADDRESS_INFORMATION))); + + Report report = + (Report) + repeatRequestUntilStatusChanges( + "findReport", new Object[] {check.getReportIds().get(0)}, COMPLETE, 10, 1000); + + Assertions.assertEquals(COMPLETE, report.getStatus()); + Assertions.assertEquals(ReportName.DOCUMENT_WITH_ADDRESS_INFORMATION, report.getName()); + Assertions.assertEquals(check.getId(), report.getReportShared().getCheckId()); + Assertions.assertNotNull(report.getDocumentWithAddressInformationReport().getBreakdown()); + Assertions.assertNotNull(report.getReportShared().getResult()); + + Assertions.assertEquals( + "driving_licence", + report + .getDocumentWithAddressInformationReport() + .getProperties() + .getBarcode() + .getDocumentType()); + } }