diff --git a/README.md b/README.md
index 4aeaadbc..6edf881b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
The official Java library for integrating with the Onfido API. Refer to the full [API documentation](https://documentation.onfido.com) for details of expected requests and responses for all resources.
-This version uses Onfido API v3.3. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.
+This version uses Onfido API v3.4. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.
## Installation
diff --git a/onfido-java/pom.xml b/onfido-java/pom.xml
index 3eb07f0b..b3694b93 100644
--- a/onfido-java/pom.xml
+++ b/onfido-java/pom.xml
@@ -4,7 +4,7 @@
com.onfido
onfido-api-java
- 2.5.0
+ 2.6.0
Onfido API Java Client
Official Java API client library for the Onfido API
diff --git a/onfido-java/src/main/java/com/onfido/DocumentManager.java b/onfido-java/src/main/java/com/onfido/DocumentManager.java
index 215c7be8..dd2aaf98 100644
--- a/onfido-java/src/main/java/com/onfido/DocumentManager.java
+++ b/onfido-java/src/main/java/com/onfido/DocumentManager.java
@@ -46,6 +46,7 @@ public Document upload(InputStream inputStream, String fileName, Document.Reques
addFormDataParam(builder, "side", request.getSide());
addFormDataParam(builder, "issuing_country", request.getIssuingCountry());
addFormDataParam(builder, "validate_image_quality", request.getValidateImageQuality());
+ addFormDataParam(builder, "location", request.getLocation());
builder.addFormDataPart(
"file",
diff --git a/onfido-java/src/main/java/com/onfido/Onfido.java b/onfido-java/src/main/java/com/onfido/Onfido.java
index 13ff9bb3..6cbff06e 100644
--- a/onfido-java/src/main/java/com/onfido/Onfido.java
+++ b/onfido-java/src/main/java/com/onfido/Onfido.java
@@ -11,9 +11,9 @@
public final class Onfido {
private static final OkHttpClient CLIENT = new OkHttpClient();
- private static final String EU_API_URL = "https://api.eu.onfido.com/v3.3/";
- private static final String US_API_URL = "https://api.us.onfido.com/v3.3/";
- private static final String CA_API_URL = "https://api.ca.onfido.com/v3.3/";
+ private static final String EU_API_URL = "https://api.eu.onfido.com/v3.4/";
+ private static final String US_API_URL = "https://api.us.onfido.com/v3.4/";
+ private static final String CA_API_URL = "https://api.ca.onfido.com/v3.4/";
/** The Configuration for the instance. */
public final Config config;
diff --git a/onfido-java/src/main/models/applicant.json b/onfido-java/src/main/models/applicant.json
index 54173f02..3df8ee20 100644
--- a/onfido-java/src/main/models/applicant.json
+++ b/onfido-java/src/main/models/applicant.json
@@ -56,6 +56,22 @@
"$ref": "id_number.yaml"
},
"description": "The applicants ID numbers"
+ },
+ "phone_number": {
+ "type": "string",
+ "description": "The applicant’s phone number"
+ },
+ "location": {
+ "$ref": "../location/location.yaml",
+ "description": "The applicant's location"
+ },
+ "consents": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "The applicant’s consents",
+ "writeOnly": true
}
}
}
diff --git a/onfido-java/src/main/models/document.json b/onfido-java/src/main/models/document.json
index 2fb66be1..956f8529 100644
--- a/onfido-java/src/main/models/document.json
+++ b/onfido-java/src/main/models/document.json
@@ -59,6 +59,11 @@
"type": "boolean",
"description": "When true the submitted image will undergo an image quality validation",
"writeOnly": true
+ },
+ "location": {
+ "$ref": "../location/location.yaml",
+ "description": "The applicant's location",
+ "writeOnly": true
}
}
}
diff --git a/onfido-java/src/main/models/location.json b/onfido-java/src/main/models/location.json
new file mode 100644
index 00000000..8d3b0fc9
--- /dev/null
+++ b/onfido-java/src/main/models/location.json
@@ -0,0 +1,13 @@
+{
+ "title": "Location",
+ "properties": {
+ "ip_address": {
+ "type": "string",
+ "description": "The applicant's ip address"
+ },
+ "country_of_residence": {
+ "type": "string",
+ "description": "The applicant's country of residence"
+ }
+ }
+}
diff --git a/onfido-java/src/test/java/com/onfido/OnfidoTest.java b/onfido-java/src/test/java/com/onfido/OnfidoTest.java
index 7eb49c3f..7674943b 100644
--- a/onfido-java/src/test/java/com/onfido/OnfidoTest.java
+++ b/onfido-java/src/test/java/com/onfido/OnfidoTest.java
@@ -23,18 +23,18 @@ public void throwsExceptionForMissingRegion() {
@Test()
public void usesEURegionApiUrl() {
Onfido onfido = Onfido.builder().apiToken("token").regionEU().build();
- assertEquals("https://api.eu.onfido.com/v3.3/", onfido.config.getApiUrl());
+ assertEquals("https://api.eu.onfido.com/v3.4/", onfido.config.getApiUrl());
}
@Test()
public void usesUSRegionApiUrl() {
Onfido onfido = Onfido.builder().apiToken("token").regionUS().build();
- assertEquals("https://api.us.onfido.com/v3.3/", onfido.config.getApiUrl());
+ assertEquals("https://api.us.onfido.com/v3.4/", onfido.config.getApiUrl());
}
@Test()
public void usesCanadaRegionApiUrl() {
Onfido onfido = Onfido.builder().apiToken("token").regionCA().build();
- assertEquals("https://api.ca.onfido.com/v3.3/", onfido.config.getApiUrl());
+ assertEquals("https://api.ca.onfido.com/v3.4/", onfido.config.getApiUrl());
}
}
diff --git a/onfido-java/src/test/java/com/onfido/integration/DocumentManagerTest.java b/onfido-java/src/test/java/com/onfido/integration/DocumentManagerTest.java
index 8dc25b4b..7365be60 100644
--- a/onfido-java/src/test/java/com/onfido/integration/DocumentManagerTest.java
+++ b/onfido-java/src/test/java/com/onfido/integration/DocumentManagerTest.java
@@ -7,6 +7,7 @@
import com.onfido.api.FileDownload;
import com.onfido.exceptions.ApiException;
import com.onfido.models.Document;
+import com.onfido.models.Location;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;
@@ -28,12 +29,20 @@ public void uploadDocument() throws Exception {
Onfido.builder().apiToken("token").unknownApiUrl(server.url("/").toString()).build();
InputStream inputStream = new ByteArrayInputStream("testing testing 1 2".getBytes());
+
+ Location.Request locationRequest =
+ Location.request()
+ .ipAddress("127.0.0.1")
+ .countryOfResidence("GBR");
+
Document.Request documentRequest =
Document.request()
.applicantId("test id")
.issuingCountry("USA")
.side("front")
- .type("passport");
+ .type("passport")
+ .location(locationRequest);
+
Document document = onfido.document.upload(inputStream, "file.png", documentRequest);
// Correct path
@@ -51,6 +60,7 @@ public void uploadDocument() throws Exception {
Assert.assertTrue(requestBody.contains("type"));
Assert.assertTrue(requestBody.contains("passport"));
Assert.assertTrue(requestBody.contains("testing testing 1 2"));
+ Assert.assertTrue(requestBody.contains("{\"country_of_residence\":\"GBR\",\"ip_address\":\"127.0.0.1\"}"));
// Correct response body
assertEquals("file.png", document.getFileName());