From b19333bf00153e49722ab4c4c8e70cf942b4828d Mon Sep 17 00:00:00 2001 From: Phoebe Baxter Date: Wed, 2 Mar 2022 10:47:01 +0000 Subject: [PATCH] Add support for api v3.3 --- CHANGELOG.md | 4 ++++ README.md | 2 +- package-lock.json | 2 +- package.json | 2 +- src/Onfido.ts | 2 +- test/Onfido.test.ts | 6 +++--- test/resources/Checks.test.ts | 4 ++-- test/resources/Documents.test.ts | 8 ++++---- test/resources/LivePhotos.test.ts | 8 ++++---- test/resources/LiveVideos.test.ts | 8 ++++---- test/resources/Reports.test.ts | 4 ++-- test/testHelpers.ts | 2 +- 12 files changed, 28 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9cf635..8a5bb59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 2f10dac..3e85b26 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Documentation can be found at 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 diff --git a/package-lock.json b/package-lock.json index d2f492f..d091b77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@onfido/api", - "version": "2.1.2", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5b0ef45..55dff01 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Onfido.ts b/src/Onfido.ts index 600c9e4..a798b5c 100644 --- a/src/Onfido.ts +++ b/src/Onfido.ts @@ -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, diff --git a/test/Onfido.test.ts b/test/Onfido.test.ts index d1bb32f..d6c2200 100644 --- a/test/Onfido.test.ts +++ b/test/Onfido.test.ts @@ -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/" ); }); diff --git a/test/resources/Checks.test.ts b/test/resources/Checks.test.ts index c91f4f0..674a69b 100644 --- a/test/resources/Checks.test.ts +++ b/test/resources/Checks.test.ts @@ -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", @@ -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", diff --git a/test/resources/Documents.test.ts b/test/resources/Documents.test.ts index 6834793..52d2ab1 100644 --- a/test/resources/Documents.test.ts +++ b/test/resources/Documents.test.ts @@ -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, @@ -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, diff --git a/test/resources/LivePhotos.test.ts b/test/resources/LivePhotos.test.ts index 8e073f2..f129fc7 100644 --- a/test/resources/LivePhotos.test.ts +++ b/test/resources/LivePhotos.test.ts @@ -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 @@ -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 diff --git a/test/resources/LiveVideos.test.ts b/test/resources/LiveVideos.test.ts index 7dd16fe..c2477bd 100644 --- a/test/resources/LiveVideos.test.ts +++ b/test/resources/LiveVideos.test.ts @@ -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 @@ -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 diff --git a/test/resources/Reports.test.ts b/test/resources/Reports.test.ts index 4f737e6..5f3e826 100644 --- a/test/resources/Reports.test.ts +++ b/test/resources/Reports.test.ts @@ -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, @@ -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, diff --git a/test/testHelpers.ts b/test/testHelpers.ts index aa0ae63..36bdaf2 100644 --- a/test/testHelpers.ts +++ b/test/testHelpers.ts @@ -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");