Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh onfido-java after onfido-openapi-spec update (54ce45f) #138

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "964fb43",
"long_sha": "964fb43a1bf211197ef7a45c230771b8ba561b3c",
"version": "v4.4.0"
"short_sha": "54ce45f",
"long_sha": "54ce45f2138f044cc5cb40f6904dc7bc1a675be6",
"version": "v4.5.0"
},
"release": "v5.4.0"
"release": "v5.5.0"
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.onfido</groupId>
<artifactId>onfido-api-java</artifactId>
<version>5.4.0</version>
<version>5.5.0</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -59,7 +59,7 @@ Add this dependency to your project's build file:
}

dependencies {
implementation "com.onfido:onfido-api-java:5.4.0"
implementation "com.onfido:onfido-api-java:5.5.0"
}
```

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

Then manually install the following JARs:

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

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

## Getting Started

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

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

buildscript {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "com.onfido",
name := "onfido-api-java",
version := "5.4.0",
version := "5.5.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>onfido-api-java</artifactId>
<packaging>jar</packaging>
<name>onfido-api-java</name>
<version>5.4.0</version>
<version>5.5.0</version>
<url>https://documentation.onfido.com</url>
<description>Official Java API client library for the Onfido API</description>
<scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/onfido/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void init() {
json = new JSON();

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

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

private static ApiClient defaultApiClient = new ApiClient();

Expand Down
132 changes: 132 additions & 0 deletions src/main/java/com/onfido/api/DefaultApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,138 @@ public okhttp3.Call downloadDocumentVideoAsync(String documentId, final ApiCallb
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for downloadEvidenceFolder
* @param workflowRunId Workflow Run ID (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call downloadEvidenceFolderCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };

// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}

Object localVarPostBody = null;

// create path and map variables
String localVarPath = "/workflow_runs/{workflow_run_id}/evidence_folder"
.replace("{" + "workflow_run_id" + "}", localVarApiClient.escapeString(workflowRunId.toString()));

List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

final String[] localVarAccepts = {
"application/zip",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}

final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}

String[] localVarAuthNames = new String[] { "Token" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}

@SuppressWarnings("rawtypes")
private okhttp3.Call downloadEvidenceFolderValidateBeforeCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'workflowRunId' is set
if (workflowRunId == null) {
throw new ApiException("Missing the required parameter 'workflowRunId' when calling downloadEvidenceFolder(Async)");
}

return downloadEvidenceFolderCall(workflowRunId, _callback);

}

/**
* Retrieve Workflow Run Evidence Folder
* Retrieves the evidence folder for the designated Workflow Run
* @param workflowRunId Workflow Run ID (required)
* @return FileTransfer
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
</table>
*/
public FileTransfer downloadEvidenceFolder(UUID workflowRunId) throws ApiException {
ApiResponse<FileTransfer> localVarResp = downloadEvidenceFolderWithHttpInfo(workflowRunId);
return localVarResp.getData();
}

/**
* Retrieve Workflow Run Evidence Folder
* Retrieves the evidence folder for the designated Workflow Run
* @param workflowRunId Workflow Run ID (required)
* @return ApiResponse&lt;FileTransfer&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
</table>
*/
public ApiResponse<FileTransfer> downloadEvidenceFolderWithHttpInfo(UUID workflowRunId) throws ApiException {
okhttp3.Call localVarCall = downloadEvidenceFolderValidateBeforeCall(workflowRunId, null);
Type localVarReturnType = new TypeToken<FileTransfer>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}

/**
* Retrieve Workflow Run Evidence Folder (asynchronously)
* Retrieves the evidence folder for the designated Workflow Run
* @param workflowRunId Workflow Run ID (required)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 302 </td><td> Found </td><td> * Location - Link to the Timeline File. <br> </td></tr>
<tr><td> 200 </td><td> The evidence folder binary data. </td><td> - </td></tr>
<tr><td> 0 </td><td> Unexpected error </td><td> - </td></tr>
</table>
*/
public okhttp3.Call downloadEvidenceFolderAsync(UUID workflowRunId, final ApiCallback<FileTransfer> _callback) throws ApiException {

okhttp3.Call localVarCall = downloadEvidenceFolderValidateBeforeCall(workflowRunId, _callback);
Type localVarReturnType = new TypeToken<FileTransfer>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for downloadIdPhoto
* @param idPhotoId The ID photo&#39;s unique identifier. (required)
Expand Down
27 changes: 24 additions & 3 deletions src/test/java/com/onfido/integration/WorkflowRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import com.onfido.model.WorkflowRun;
import com.onfido.model.WorkflowRunBuilder;
import com.onfido.model.WorkflowRunStatus;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.zip.ZipFile;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -18,7 +21,8 @@ public class WorkflowRunTest extends TestBase {
private UUID workflowRunId;

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

@BeforeEach
public void setup() throws Exception {
Expand Down Expand Up @@ -76,7 +80,7 @@ public void evidenceWorkflowRunTest() throws Exception {

@Test
public void generateTimelineFileTest() throws Exception {
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_TIMELINE, applicantId).getId();
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();

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

@Test
public void findTimelineFileTest() throws Exception {
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_TIMELINE, applicantId).getId();
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();

repeatRequestUntilStatusChanges(
"findWorkflowRun", new UUID[] {workflowRunId}, WorkflowRunStatus.APPROVED, 10, 1000);
Expand All @@ -106,4 +110,21 @@ public void findTimelineFileTest() throws Exception {
Assertions.assertEquals("%PDF", new String(byteArray, 0, 4));
Assertions.assertTrue(byteArray.length > 0);
}

@Test
public void downloadEvidenceFolderTest() throws Exception {
UUID workflowRunId = createWorkflowRun(WORKFLOW_ID_AUTO_APPROVE, applicantId).getId();

repeatRequestUntilStatusChanges(
"findWorkflowRun", new UUID[] {workflowRunId}, WorkflowRunStatus.APPROVED, 10, 1000);

byte[] byteArray = onfido.downloadEvidenceFolder(workflowRunId).getByteArray();

Path path = Files.createTempFile("evidence-folder", ".zip");
path.toFile().deleteOnExit();
Files.write(path, byteArray);

Assertions.assertDoesNotThrow(() -> new ZipFile(path.toFile()));
Assertions.assertTrue(byteArray.length > 0);
}
}
Loading