Skip to content

Commit 1b09110

Browse files
Merge pull request #138 from onfido/release-upgrade
Refresh onfido-java after onfido-openapi-spec update (54ce45f)
2 parents 26566f1 + a562919 commit 1b09110

File tree

9 files changed

+169
-16
lines changed

9 files changed

+169
-16
lines changed

.release.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"source": {
33
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
4-
"short_sha": "964fb43",
5-
"long_sha": "964fb43a1bf211197ef7a45c230771b8ba561b3c",
6-
"version": "v4.4.0"
4+
"short_sha": "54ce45f",
5+
"long_sha": "54ce45f2138f044cc5cb40f6904dc7bc1a675be6",
6+
"version": "v4.5.0"
77
},
8-
"release": "v5.4.0"
8+
"release": "v5.5.0"
99
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Add this dependency to your project's POM:
4343
<dependency>
4444
<groupId>com.onfido</groupId>
4545
<artifactId>onfido-api-java</artifactId>
46-
<version>5.4.0</version>
46+
<version>5.5.0</version>
4747
<scope>compile</scope>
4848
</dependency>
4949
```
@@ -59,7 +59,7 @@ Add this dependency to your project's build file:
5959
}
6060
6161
dependencies {
62-
implementation "com.onfido:onfido-api-java:5.4.0"
62+
implementation "com.onfido:onfido-api-java:5.5.0"
6363
}
6464
```
6565

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

7474
Then manually install the following JARs:
7575

76-
- `target/onfido-api-java-5.4.0.jar`
76+
- `target/onfido-api-java-5.5.0.jar`
7777
- `target/lib/*.jar`
7878

79-
The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.4.0
79+
The latest version can be found at: https://search.maven.org/artifact/com.onfido/5.5.0
8080

8181
## Getting Started
8282

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'java'
44
apply plugin: 'com.diffplug.spotless'
55

66
group = 'com.onfido'
7-
version = '5.4.0'
7+
version = '5.5.0'
88

99
buildscript {
1010
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.onfido",
44
name := "onfido-api-java",
5-
version := "5.4.0",
5+
version := "5.5.0",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>onfido-api-java</artifactId>
66
<packaging>jar</packaging>
77
<name>onfido-api-java</name>
8-
<version>5.4.0</version>
8+
<version>5.5.0</version>
99
<url>https://documentation.onfido.com</url>
1010
<description>Official Java API client library for the Onfido API</description>
1111
<scm>

src/main/java/com/onfido/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private void init() {
160160
json = new JSON();
161161

162162
// Set default User-Agent.
163-
setUserAgent("onfido-java/5.4.0");
163+
setUserAgent("onfido-java/5.5.0");
164164

165165
authentications = new HashMap<String, Authentication>();
166166
}

src/main/java/com/onfido/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0")
1717
public class Configuration {
18-
public static final String VERSION = "5.4.0";
18+
public static final String VERSION = "5.5.0";
1919

2020
private static ApiClient defaultApiClient = new ApiClient();
2121

src/main/java/com/onfido/api/DefaultApi.java

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,138 @@ public okhttp3.Call downloadDocumentVideoAsync(String documentId, final ApiCallb
19041904
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
19051905
return localVarCall;
19061906
}
1907+
/**
1908+
* Build call for downloadEvidenceFolder
1909+
* @param workflowRunId Workflow Run ID (required)
1910+
* @param _callback Callback for upload/download progress
1911+
* @return Call to execute
1912+
* @throws ApiException If fail to serialize the request body object
1913+
* @http.response.details
1914+
<table summary="Response Details" border="1">
1915+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
1916+
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
1917+
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
1918+
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
1919+
</table>
1920+
*/
1921+
public okhttp3.Call downloadEvidenceFolderCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException {
1922+
String basePath = null;
1923+
// Operation Servers
1924+
String[] localBasePaths = new String[] { };
1925+
1926+
// Determine Base Path to Use
1927+
if (localCustomBaseUrl != null){
1928+
basePath = localCustomBaseUrl;
1929+
} else if ( localBasePaths.length > 0 ) {
1930+
basePath = localBasePaths[localHostIndex];
1931+
} else {
1932+
basePath = null;
1933+
}
1934+
1935+
Object localVarPostBody = null;
1936+
1937+
// create path and map variables
1938+
String localVarPath = "/workflow_runs/{workflow_run_id}/evidence_folder"
1939+
.replace("{" + "workflow_run_id" + "}", localVarApiClient.escapeString(workflowRunId.toString()));
1940+
1941+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
1942+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
1943+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
1944+
Map<String, String> localVarCookieParams = new HashMap<String, String>();
1945+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
1946+
1947+
final String[] localVarAccepts = {
1948+
"application/zip",
1949+
"application/json"
1950+
};
1951+
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
1952+
if (localVarAccept != null) {
1953+
localVarHeaderParams.put("Accept", localVarAccept);
1954+
}
1955+
1956+
final String[] localVarContentTypes = {
1957+
};
1958+
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
1959+
if (localVarContentType != null) {
1960+
localVarHeaderParams.put("Content-Type", localVarContentType);
1961+
}
1962+
1963+
String[] localVarAuthNames = new String[] { "Token" };
1964+
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
1965+
}
1966+
1967+
@SuppressWarnings("rawtypes")
1968+
private okhttp3.Call downloadEvidenceFolderValidateBeforeCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException {
1969+
// verify the required parameter 'workflowRunId' is set
1970+
if (workflowRunId == null) {
1971+
throw new ApiException("Missing the required parameter 'workflowRunId' when calling downloadEvidenceFolder(Async)");
1972+
}
1973+
1974+
return downloadEvidenceFolderCall(workflowRunId, _callback);
1975+
1976+
}
1977+
1978+
/**
1979+
* Retrieve Workflow Run Evidence Folder
1980+
* Retrieves the evidence folder for the designated Workflow Run
1981+
* @param workflowRunId Workflow Run ID (required)
1982+
* @return FileTransfer
1983+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1984+
* @http.response.details
1985+
<table summary="Response Details" border="1">
1986+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
1987+
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
1988+
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
1989+
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
1990+
</table>
1991+
*/
1992+
public FileTransfer downloadEvidenceFolder(UUID workflowRunId) throws ApiException {
1993+
ApiResponse<FileTransfer> localVarResp = downloadEvidenceFolderWithHttpInfo(workflowRunId);
1994+
return localVarResp.getData();
1995+
}
1996+
1997+
/**
1998+
* Retrieve Workflow Run Evidence Folder
1999+
* Retrieves the evidence folder for the designated Workflow Run
2000+
* @param workflowRunId Workflow Run ID (required)
2001+
* @return ApiResponse&lt;FileTransfer&gt;
2002+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
2003+
* @http.response.details
2004+
<table summary="Response Details" border="1">
2005+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
2006+
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
2007+
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
2008+
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
2009+
</table>
2010+
*/
2011+
public ApiResponse<FileTransfer> downloadEvidenceFolderWithHttpInfo(UUID workflowRunId) throws ApiException {
2012+
okhttp3.Call localVarCall = downloadEvidenceFolderValidateBeforeCall(workflowRunId, null);
2013+
Type localVarReturnType = new TypeToken<FileTransfer>(){}.getType();
2014+
return localVarApiClient.execute(localVarCall, localVarReturnType);
2015+
}
2016+
2017+
/**
2018+
* Retrieve Workflow Run Evidence Folder (asynchronously)
2019+
* Retrieves the evidence folder for the designated Workflow Run
2020+
* @param workflowRunId Workflow Run ID (required)
2021+
* @param _callback The callback to be executed when the API call finishes
2022+
* @return The request call
2023+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
2024+
* @http.response.details
2025+
<table summary="Response Details" border="1">
2026+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
2027+
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
2028+
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
2029+
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
2030+
</table>
2031+
*/
2032+
public okhttp3.Call downloadEvidenceFolderAsync(UUID workflowRunId, final ApiCallback<FileTransfer> _callback) throws ApiException {
2033+
2034+
okhttp3.Call localVarCall = downloadEvidenceFolderValidateBeforeCall(workflowRunId, _callback);
2035+
Type localVarReturnType = new TypeToken<FileTransfer>(){}.getType();
2036+
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
2037+
return localVarCall;
2038+
}
19072039
/**
19082040
* Build call for downloadIdPhoto
19092041
* @param idPhotoId The ID photo&#39;s unique identifier. (required)

src/test/java/com/onfido/integration/WorkflowRunTest.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import com.onfido.model.WorkflowRun;
66
import com.onfido.model.WorkflowRunBuilder;
77
import com.onfido.model.WorkflowRunStatus;
8+
import java.nio.file.Files;
9+
import java.nio.file.Path;
810
import java.util.HashMap;
911
import java.util.Map;
1012
import java.util.UUID;
13+
import java.util.zip.ZipFile;
1114
import org.junit.jupiter.api.Assertions;
1215
import org.junit.jupiter.api.BeforeEach;
1316
import org.junit.jupiter.api.Test;
@@ -18,7 +21,8 @@ public class WorkflowRunTest extends TestBase {
1821
private UUID workflowRunId;
1922

2023
static final UUID WORKFLOW_ID = UUID.fromString("e8c921eb-0495-44fe-b655-bcdcaffdafe5");
21-
static final UUID WORKFLOW_ID_TIMELINE = UUID.fromString("221f9d24-cf72-4762-ac4a-01bf3ccc09dd");
24+
static final UUID WORKFLOW_ID_AUTO_APPROVE =
25+
UUID.fromString("221f9d24-cf72-4762-ac4a-01bf3ccc09dd");
2226

2327
@BeforeEach
2428
public void setup() throws Exception {
@@ -76,7 +80,7 @@ public void evidenceWorkflowRunTest() throws Exception {
7680

7781
@Test
7882
public void generateTimelineFileTest() throws Exception {
79-
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_TIMELINE, applicantId).getId();
83+
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();
8084

8185
repeatRequestUntilStatusChanges(
8286
"findWorkflowRun", new UUID[] {workflowRunId}, WorkflowRunStatus.APPROVED, 10, 1000);
@@ -90,7 +94,7 @@ public void generateTimelineFileTest() throws Exception {
9094

9195
@Test
9296
public void findTimelineFileTest() throws Exception {
93-
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_TIMELINE, applicantId).getId();
97+
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();
9498

9599
repeatRequestUntilStatusChanges(
96100
"findWorkflowRun", new UUID[] {workflowRunId}, WorkflowRunStatus.APPROVED, 10, 1000);
@@ -106,4 +110,21 @@ public void findTimelineFileTest() throws Exception {
106110
Assertions.assertEquals("%PDF", new String(byteArray, 0, 4));
107111
Assertions.assertTrue(byteArray.length > 0);
108112
}
113+
114+
@Test
115+
public void downloadEvidenceFolderTest() throws Exception {
116+
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();
117+
118+
repeatRequestUntilStatusChanges(
119+
"findWorkflowRun", new UUID[] {workflowRunId}, WorkflowRunStatus.APPROVED, 10, 1000);
120+
121+
byte[] byteArray = onfido.downloadEvidenceFolder(workflowRunId).getByteArray();
122+
123+
Path path = Files.createTempFile("evidence-folder", ".zip");
124+
path.toFile().deleteOnExit();
125+
Files.write(path, byteArray);
126+
127+
Assertions.assertDoesNotThrow(() -> new ZipFile(path.toFile()));
128+
Assertions.assertTrue(byteArray.length > 0);
129+
}
109130
}

0 commit comments

Comments
 (0)