Skip to content

Commit

Permalink
Merge pull request #137 from onfido/release-upgrade
Browse files Browse the repository at this point in the history
Refresh onfido-java after onfido-openapi-spec update (964fb43)
dvacca-onfido authored Dec 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 8ac8a72 + 87e5b48 commit d10ec55
Showing 14 changed files with 357 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .release.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"source": {
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
"short_sha": "8c793a1",
"long_sha": "8c793a1c8307dcd92fa657edb2a1e9b184c15278",
"version": "v4.3.0"
"short_sha": "964fb43",
"long_sha": "964fb43a1bf211197ef7a45c230771b8ba561b3c",
"version": "v4.4.0"
},
"release": "v5.3.0"
"release": "v5.4.0"
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.onfido</groupId>
<artifactId>onfido-api-java</artifactId>
<version>5.3.0</version>
<version>5.4.0</version>
<scope>compile</scope>
</dependency>
```
@@ -59,7 +59,7 @@ Add this dependency to your project's build file:
}
dependencies {
implementation "com.onfido:onfido-api-java:5.3.0"
implementation "com.onfido:onfido-api-java:5.4.0"
}
```

@@ -73,10 +73,10 @@ mvn clean package

Then manually install the following JARs:

- `target/onfido-api-java-5.3.0.jar`
- `target/onfido-api-java-5.4.0.jar`
- `target/lib/*.jar`

The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.3.0
The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.4.0

## Getting Started

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'

group = 'com.onfido'
version = '5.2.0'
version = '5.4.0'

buildscript {
repositories {
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "com.onfido",
name := "onfido-api-java",
version := "5.2.0",
version := "5.4.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
31 changes: 31 additions & 0 deletions media/studio_webhook_event_with_list_in_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"payload": {
"resource_type": "workflow_task",
"action": "workflow_task.completed",
"object": {
"id": "document_photo_5c229",
"task_spec_id": "document_photo_5c229",
"task_def_id": "upload_document_photo",
"workflow_run_id": "b48fdff9-66a1-405d-9912-54780799bd68",
"status": "completed",
"completed_at_iso8601": "2024-12-18T18:13:10Z",
"href": "https://api.eu.onfido.com/v3.6/workflow_runs/b48fdff9-66a1-405d-9912-54780799bd68/tasks/document_photo_5c229"
},
"resource": {
"updated_at": "2024-12-18T18:13:10Z",
"output": [
{
"type": "document_photo",
"id": "7af75a3a-ba34-4aa5-9e3e-096c9f56256b",
"checksum_sha256": "hiwV2PLmeQZzeySPGGwVL48sxVXcyfpXy9LDl1u3lWU="
}
],
"created_at": "2024-12-18T18:12:44Z",
"task_def_id": "upload_document_photo",
"input": {},
"workflow_run_id": "b48fdff9-66a1-405d-9912-54780799bd68",
"task_def_version": null,
"id": "document_photo_5c229"
}
}
}
264 changes: 264 additions & 0 deletions media/studio_webhook_event_with_object_in_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
{
"payload": {
"resource_type": "workflow_task",
"action": "workflow_task.completed",
"object": {
"id": "document_check_75329",
"task_spec_id": "document_check_75329",
"task_def_id": "document_check",
"workflow_run_id": "b48fdff9-66a1-405d-9912-54780799bd68",
"status": "completed",
"completed_at_iso8601": "2024-12-18T18:13:13Z",
"href": "https://api.eu.onfido.com/v3.6/workflow_runs/b48fdff9-66a1-405d-9912-54780799bd68/tasks/document_check_75329"
},
"resource": {
"task_def_version": null,
"task_def_id": "document_check",
"updated_at": "2024-12-18T18:13:13Z",
"id": "document_check_75329",
"output": {
"status": "complete",
"result": "clear",
"sub_result": "clear",
"uuid": "95c8cc09-db72-42ff-85ef-ee6c82020a24",
"properties": {
"date_of_birth": "1990-01-01",
"date_of_expiry": "2031-05-28",
"document_numbers": [
{
"type": "document_number",
"value": "999999999"
}
],
"document_type": "passport",
"first_name": "Jane",
"issuing_country": "GBR",
"last_name": "Doe",
"document_number": "999999999"
},
"breakdown": {
"data_validation": {
"result": "clear",
"breakdown": {
"mrz": {
"result": "clear",
"properties": {}
},
"expiry_date": {
"result": "clear",
"properties": {}
},
"document_expiration": {
"result": "clear",
"properties": {}
},
"document_numbers": {
"result": "clear",
"properties": {}
},
"date_of_birth": {
"result": "clear",
"properties": {}
},
"gender": {
"result": "clear",
"properties": {}
}
}
},
"visual_authenticity": {
"result": "clear",
"breakdown": {
"face_detection": {
"result": "clear",
"properties": {}
},
"other": {
"result": "clear",
"properties": {}
},
"digital_tampering": {
"result": "clear",
"properties": {}
},
"original_document_present": {
"result": "clear",
"properties": {}
},
"security_features": {
"result": "clear",
"properties": {}
},
"template": {
"result": "clear",
"properties": {}
},
"picture_face_integrity": {
"result": "clear",
"properties": {}
},
"fonts": {
"result": "clear",
"properties": {}
}
}
},
"compromised_document": {
"result": "clear",
"breakdown": {
"repeat_attempts": {
"result": "clear",
"properties": {}
},
"document_database": {
"result": "clear",
"properties": {}
}
}
},
"data_consistency": {
"result": "clear",
"breakdown": {
"nationality": {
"result": "clear",
"properties": {}
},
"last_name": {
"result": "clear",
"properties": {}
},
"first_name": {
"result": "clear",
"properties": {}
},
"multiple_data_sources_present": {
"result": "clear",
"properties": {}
},
"gender": {
"result": "clear",
"properties": {}
},
"date_of_birth": {
"result": "clear",
"properties": {}
},
"document_type": {
"result": "clear",
"properties": {}
},
"issuing_country": {
"result": "clear",
"properties": {}
},
"document_numbers": {
"result": "clear",
"properties": {}
},
"date_of_expiry": {
"result": "clear",
"properties": {}
}
}
},
"data_comparison": {
"result": "clear",
"breakdown": {
"date_of_birth": {
"result": "clear",
"properties": {}
},
"first_name": {
"result": "clear",
"properties": {}
},
"document_numbers": {
"result": "clear",
"properties": {}
},
"document_type": {
"result": "clear",
"properties": {}
},
"last_name": {
"result": "clear",
"properties": {}
},
"date_of_expiry": {
"result": "clear",
"properties": {}
},
"gender": {
"result": "clear",
"properties": {}
},
"issuing_country": {
"result": "clear",
"properties": {}
}
}
},
"image_integrity": {
"result": "clear",
"breakdown": {
"colour_picture": {
"result": "clear",
"properties": {}
},
"supported_document": {
"result": "clear",
"properties": {}
},
"conclusive_document_quality": {
"result": "clear",
"properties": {}
},
"image_quality": {
"result": "clear",
"properties": {}
}
}
},
"police_record": {
"result": "clear",
"breakdown": {
"document_has_not_been_recorded_as_lost,_stolen_or_compromised": {
"result": "clear",
"properties": {}
}
}
},
"age_validation": {
"result": "clear",
"breakdown": {
"minimum_accepted_age": {
"result": "clear",
"properties": {}
}
}
}
},
"repeat_attempts": {
"report_id": "00000000-0000-0000-0000-000000000000",
"repeat_attempts": [],
"attempts_count": 1,
"attempts_clear_rate": 0,
"unique_mismatches_count": 0
}
},
"workflow_run_id": "b48fdff9-66a1-405d-9912-54780799bd68",
"input": {
"document_ids": [
{
"checksum_sha256": "hiwV2PLmeQZzeySPGGwVL48sxVXcyfpXy9LDl1u3lWU=",
"id": "7af75a3a-ba34-4aa5-9e3e-096c9f56256b",
"type": "document_photo"
}
],
"first_name": "Jane",
"last_name": "Doe"
},
"created_at": "2024-12-18T18:13:11Z"
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<artifactId>onfido-api-java</artifactId>
<packaging>jar</packaging>
<name>onfido-api-java</name>
<version>5.3.0</version>
<version>5.4.0</version>
<url>https://documentation.onfido.com</url>
<description>Official Java API client library for the Onfido API</description>
<scm>
2 changes: 1 addition & 1 deletion src/main/java/com/onfido/ApiClient.java
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ private void init() {
json = new JSON();

// Set default User-Agent.
setUserAgent("onfido-java/5.3.0");
setUserAgent("onfido-java/5.4.0");

authentications = new HashMap<String, Authentication>();
}
2 changes: 1 addition & 1 deletion src/main/java/com/onfido/Configuration.java
Original file line number Diff line number Diff line change
@@ -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.3.0";
public static final String VERSION = "5.4.0";

private static ApiClient defaultApiClient = new ApiClient();

2 changes: 1 addition & 1 deletion src/main/java/com/onfido/model/Task.java
Original file line number Diff line number Diff line change
@@ -189,7 +189,7 @@ public Task output(Object output) {
}

/**
* Output object with the fields produced by the Task execution.
* Value field (it can be an Object, List, etc.) with the fields produced by the Task execution.
* @return output
*/
@javax.annotation.Nullable
Original file line number Diff line number Diff line change
@@ -335,7 +335,7 @@ public WebhookEventPayloadResource output(Object output) {
}

/**
* Output object with the fields produced by the Task execution.
* Value field (it can be an Object, List, etc.) with the fields produced by the Task execution.
* @return output
*/
@javax.annotation.Nullable
4 changes: 4 additions & 0 deletions src/main/java/com/onfido/model/WebhookEventResourceType.java
Original file line number Diff line number Diff line change
@@ -41,6 +41,10 @@ public enum WebhookEventResourceType {

WATCHLIST_MONITOR("watchlist_monitor"),

WORKFLOW_TIMELINE_FILE("workflow_timeline_file"),

WORKFLOW_RUN_EVIDENCE_FOLDER("workflow_run_evidence_folder"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;
2 changes: 2 additions & 0 deletions src/main/java/com/onfido/model/WebhookEventType.java
Original file line number Diff line number Diff line change
@@ -63,6 +63,8 @@ public enum WebhookEventType {

WORKFLOW_SIGNED_EVIDENCE_FILE_CREATED("workflow_signed_evidence_file.created"),

WORKFLOW_RUN_EVIDENCE_FOLDER_CREATED("workflow_run_evidence_folder.created"),

UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

private String value;
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@
import com.onfido.model.WebhookEventPayloadResource;
import com.onfido.model.WebhookEventResourceType;
import com.onfido.model.WebhookEventType;
import java.io.File;
import java.nio.file.Files;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.UUID;
@@ -68,4 +70,43 @@ public void invalidSignatureTest() throws Exception {
OnfidoInvalidSignatureError.class,
() -> webhookEventVerifier.readPayload(rawEvent, signature));
}

@Test
public void validSignatureWithObjectInOutputTest() throws Exception {
final String signature = "e3e5565647f5ccf07b2fd8ac22eab94a0a0619413d981fb768295c820523f7d7";

String rawEventFromFile =
new String(
Files.readAllBytes(
new File("media/studio_webhook_event_with_object_in_output.json").toPath()));

WebhookEvent event = webhookEventVerifier.readPayload(rawEventFromFile, signature);

Assertions.assertTrue(
event
.getPayload()
.getResource()
.getOutput()
.toString()
.contains(
"properties={date_of_birth=1990-01-01, date_of_expiry=2031-05-28,"
+ " document_numbers=[{type=document_number, value=999999999}]"));
}

@Test
public void validSignatureWithListInOutputTest() throws Exception {
final String signature = "f3a5170acfcecf8c1bf6d9cb9995c0d9dec941af83056a721530f8de7af2c293";

String rawEventFromFile =
new String(
Files.readAllBytes(
new File("media/studio_webhook_event_with_list_in_output.json").toPath()));

WebhookEvent event = webhookEventVerifier.readPayload(rawEventFromFile, signature);

Assertions.assertEquals(
event.getPayload().getResource().getOutput().toString(),
"[{type=document_photo, id=7af75a3a-ba34-4aa5-9e3e-096c9f56256b,"
+ " checksum_sha256=hiwV2PLmeQZzeySPGGwVL48sxVXcyfpXy9LDl1u3lWU=}]");
}
}

0 comments on commit d10ec55

Please sign in to comment.