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

API v3.3 #70

Merged
merged 1 commit into from
Mar 2, 2022
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v2.2.0, 02 March 2022

- Updated to use API v3.3

## v2.1.2, 17 Feb 2022

- Fix `advancedValidation` flag when uploading live photo
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Documentation can be found at <https://documentation.onfido.com>

This library is only for use on the backend, as it uses Onfido API tokens which must be kept secret. If you do need to collect applicant data in the frontend of your application, we recommend that you use the Onfido SDKs: [iOS](https://github.com/onfido/onfido-ios-sdk), [Android](https://github.com/onfido/onfido-android-sdk), [Web](https://github.com/onfido/onfido-sdk-ui), and [React Native](https://github.com/onfido/react-native-sdk).

This version uses Onfido API v3.2. 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.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.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onfido/api",
"version": "2.1.2",
"version": "2.2.0",
"description": "Node.js library for the Onfido API",
"keywords": [
"onfido",
Expand Down
2 changes: 1 addition & 1 deletion src/Onfido.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Onfido {
);
}

const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.2/`;
const regionUrl = `https://api.${region.toLowerCase()}.onfido.com/v3.3/`;

this.axiosInstance = axios.create({
baseURL: unknownApiUrl || regionUrl,
Expand Down
6 changes: 3 additions & 3 deletions test/Onfido.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ it("contains a user agent header", () => {
it("allows setting the EU region", () => {
const onfido = new Onfido({ apiToken: "token", region: Region.EU });
expect(onfido.axiosInstance.defaults.baseURL).toBe(
"https://api.eu.onfido.com/v3.2/"
"https://api.eu.onfido.com/v3.3/"
);
});

it("allows setting the US region", () => {
const onfido = new Onfido({ apiToken: "token", region: Region.US });
expect(onfido.axiosInstance.defaults.baseURL).toBe(
"https://api.us.onfido.com/v3.2/"
"https://api.us.onfido.com/v3.3/"
);
});

it("allows setting the CA region", () => {
const onfido = new Onfido({ apiToken: "token", region: Region.CA });
expect(onfido.axiosInstance.defaults.baseURL).toBe(
"https://api.ca.onfido.com/v3.2/"
"https://api.ca.onfido.com/v3.3/"
);
});

Expand Down
4 changes: 2 additions & 2 deletions test/resources/Checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const exampleCheck: Check = {
id: "abc-123",
reportIds: ["report-1", "report-2"],
createdAt: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/checks/123-abc",
href: "https://api.onfido.com/v3.3/checks/123-abc",
applicantId: "applicant-123",
applicantProvidesData: false,
status: "in_progress",
Expand All @@ -22,7 +22,7 @@ const exampleCheckJson = {
id: "abc-123",
report_ids: ["report-1", "report-2"],
created_at: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/checks/123-abc",
href: "https://api.onfido.com/v3.3/checks/123-abc",
applicant_id: "applicant-123",
applicant_provides_data: false,
status: "in_progress",
Expand Down
8 changes: 4 additions & 4 deletions test/resources/Documents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const exampleDocument: Document = {
id: "123-abc",
applicantId: "applicant-123",
createdAt: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/documents/123-abc",
downloadHref: "https://api.onfido.com/v3.2/documents/123-abc/download",
href: "https://api.onfido.com/v3.3/documents/123-abc",
downloadHref: "https://api.onfido.com/v3.3/documents/123-abc/download",
fileName: "document.png",
fileType: "png",
fileSize: 500_000,
Expand All @@ -20,8 +20,8 @@ const exampleDocumentJson = {
id: "123-abc",
applicant_id: "applicant-123",
created_at: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/documents/123-abc",
download_href: "https://api.onfido.com/v3.2/documents/123-abc/download",
href: "https://api.onfido.com/v3.3/documents/123-abc",
download_href: "https://api.onfido.com/v3.3/documents/123-abc/download",
file_name: "document.png",
file_type: "png",
file_size: 500_000,
Expand Down
8 changes: 4 additions & 4 deletions test/resources/LivePhotos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { createNock, onfido } from "../testHelpers";
const exampleLivePhoto: LivePhoto = {
id: "123-abc",
createdAt: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/live_photos/123-abc",
downloadHref: "https://api.onfido.com/v3.2/live_photos/123-abc/download",
href: "https://api.onfido.com/v3.3/live_photos/123-abc",
downloadHref: "https://api.onfido.com/v3.3/live_photos/123-abc/download",
fileName: "photo.png",
fileType: "png",
fileSize: 500_000
Expand All @@ -16,8 +16,8 @@ const exampleLivePhoto: LivePhoto = {
const exampleLivePhotoJson = {
id: "123-abc",
created_at: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/live_photos/123-abc",
download_href: "https://api.onfido.com/v3.2/live_photos/123-abc/download",
href: "https://api.onfido.com/v3.3/live_photos/123-abc",
download_href: "https://api.onfido.com/v3.3/live_photos/123-abc/download",
file_name: "photo.png",
file_type: "png",
file_size: 500_000
Expand Down
8 changes: 4 additions & 4 deletions test/resources/LiveVideos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { createNock, onfido } from "../testHelpers";
const exampleLiveVideo: LiveVideo = {
id: "123-abc",
createdAt: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/live_videos/123-abc",
downloadHref: "https://api.onfido.com/v3.2/live_videos/123-abc/download",
href: "https://api.onfido.com/v3.3/live_videos/123-abc",
downloadHref: "https://api.onfido.com/v3.3/live_videos/123-abc/download",
fileName: "video.mp4",
fileType: "mp4",
fileSize: 500_000
Expand All @@ -14,8 +14,8 @@ const exampleLiveVideo: LiveVideo = {
const exampleLiveVideoJson = {
id: "123-abc",
created_at: "2020-01-01T00:00:00Z",
href: "https://api.onfido.com/v3.2/live_videos/123-abc",
download_href: "https://api.onfido.com/v3.2/live_videos/123-abc/download",
href: "https://api.onfido.com/v3.3/live_videos/123-abc",
download_href: "https://api.onfido.com/v3.3/live_videos/123-abc/download",
file_name: "video.mp4",
file_type: "mp4",
file_size: 500_000
Expand Down
4 changes: 2 additions & 2 deletions test/resources/Reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const exampleReport: Report = {
id: "abc-123",
createdAt: "2020-01-01T00:00:00Z",
name: "document",
href: "https://api.onfido.com/v3.2/reports/123-abc",
href: "https://api.onfido.com/v3.3/reports/123-abc",
status: "in_progress",
result: null,
subResult: null,
Expand All @@ -19,7 +19,7 @@ const exampleReportJson = {
id: "abc-123",
created_at: "2020-01-01T00:00:00Z",
name: "document",
href: "https://api.onfido.com/v3.2/reports/123-abc",
href: "https://api.onfido.com/v3.3/reports/123-abc",
status: "in_progress",
result: null,
sub_result: null,
Expand Down
2 changes: 1 addition & 1 deletion test/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import { Onfido, Region } from "onfido-node";
export const onfido = new Onfido({ region: Region.EU, apiToken: "api_token" });

export const createNock = (): nock.Scope =>
nock("https://api.eu.onfido.com/v3.2");
nock("https://api.eu.onfido.com/v3.3");