-
Notifications
You must be signed in to change notification settings - Fork 5.4k
17455 components veriff #17536
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
base: master
Are you sure you want to change the base?
17455 components veriff #17536
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,161 @@ | ||||||||||||||||||||||||||||
import constants from "../../common/constants.mjs"; | ||||||||||||||||||||||||||||
import { parseObject } from "../../common/utils.mjs"; | ||||||||||||||||||||||||||||
import app from "../../veriff.app.mjs"; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
export default { | ||||||||||||||||||||||||||||
key: "veriff-create-verification", | ||||||||||||||||||||||||||||
name: "Create Verification Session", | ||||||||||||||||||||||||||||
description: "Creates a new verification session [See the documentation](https://devdocs.veriff.com/apidocs/v1sessions)", | ||||||||||||||||||||||||||||
version: "0.0.1", | ||||||||||||||||||||||||||||
type: "action", | ||||||||||||||||||||||||||||
props: { | ||||||||||||||||||||||||||||
app, | ||||||||||||||||||||||||||||
callback: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Callback URL", | ||||||||||||||||||||||||||||
description: "The callback URL to where the end-user is redirected after the verification session is completed. Default is visible in the Veriff Customer Portal > Settings. Changing the value in this request body will overwrite the default callback URL, but it will not change the callback URL that is visible in the Customer Portal.", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
firstName: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "First Name", | ||||||||||||||||||||||||||||
description: "Person's first name", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
lastName: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Last Name", | ||||||||||||||||||||||||||||
description: "Person's last name", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
idNumber: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "ID Number", | ||||||||||||||||||||||||||||
description: "Person's national identification number", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
phoneNumber: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Phone Number", | ||||||||||||||||||||||||||||
description: "Person's phone number", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
gender: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Gender", | ||||||||||||||||||||||||||||
description: "Person's gender", | ||||||||||||||||||||||||||||
options: constants.GENDER_OPTIONS, | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
dateOfBirth: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Date of Birth", | ||||||||||||||||||||||||||||
description: "Person's date of birth (YYYY-MM-DD)", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
email: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Email", | ||||||||||||||||||||||||||||
description: "Person's email address", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
maritalStatus: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Marital Status", | ||||||||||||||||||||||||||||
description: "Person's marital status", | ||||||||||||||||||||||||||||
options: constants.MARITAL_STATUS_OPTIONS, | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
isDeceased: { | ||||||||||||||||||||||||||||
type: "boolean", | ||||||||||||||||||||||||||||
label: "Is Deceased", | ||||||||||||||||||||||||||||
description: "Person's deceased status", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
number: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Document Number", | ||||||||||||||||||||||||||||
description: "Document number, [a-zA-Z0-9] characters only", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
Comment on lines
+75
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add input validation for document number format. The document number field specifies "[a-zA-Z0-9] characters only" but lacks validation to enforce this constraint. Consider adding validation to ensure the document number format is correct: number: {
type: "string",
label: "Document Number",
description: "Document number, [a-zA-Z0-9] characters only",
+ pattern: "^[a-zA-Z0-9]+$",
optional: true,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
country: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Country", | ||||||||||||||||||||||||||||
description: "Document issuing country (ISO 3166-1 alpha-2)", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
Comment on lines
+81
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add input validation for country code format. The country field expects "ISO 3166-1 alpha-2" format but lacks validation to ensure users provide valid country codes. Consider adding validation to ensure the country code format is correct: country: {
type: "string",
label: "Country",
description: "Document issuing country (ISO 3166-1 alpha-2)",
+ pattern: "^[A-Z]{2}$",
optional: true,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
type: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Document Type", | ||||||||||||||||||||||||||||
description: "Type of document to verify", | ||||||||||||||||||||||||||||
options: constants.DOCUMENT_TYPE_OPTIONS, | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
firstIssue: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "First Issue", | ||||||||||||||||||||||||||||
description: "Date of first issue of the document (YYYY-MM-DD)", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
Comment on lines
+94
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add input validation for first issue date format. The first issue field expects "YYYY-MM-DD" format but lacks validation to ensure users provide the correct format. Consider adding validation to ensure the date format is correct: firstIssue: {
type: "string",
label: "First Issue",
description: "Date of first issue of the document (YYYY-MM-DD)",
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$",
optional: true,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
fullAddress: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Address", | ||||||||||||||||||||||||||||
description: "Full address (mandatory only for UK DIATF M1B profile flow)", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
vendorData: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "Vendor Data", | ||||||||||||||||||||||||||||
description: "The unique identifier that you created for your end-user. It can be max 1,000 characters long and contain only non-semantic data that can not be resolved or used outside your systems or environments. Veriff returns it unmodified in webhooks and API response payloads, or as null if not provided", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
endUserId: { | ||||||||||||||||||||||||||||
type: "string", | ||||||||||||||||||||||||||||
label: "End User ID", | ||||||||||||||||||||||||||||
description: "The `UUID` that you created for your end-user, that can not be resolved or used outside your systems or environments. Veriff returns it unmodified in webhooks and API response payloads, or as `null` if not provided", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
consents: { | ||||||||||||||||||||||||||||
type: "string[]", | ||||||||||||||||||||||||||||
label: "Consents", | ||||||||||||||||||||||||||||
description: "Array of objects listing the type of consent given. Optional, should be only included for features that require consent", | ||||||||||||||||||||||||||||
optional: true, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
Comment on lines
+118
to
+123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Clarify the consents data type and structure. The consents field is defined as Consider clarifying the data type and providing an example: consents: {
- type: "string[]",
+ type: "string",
label: "Consents",
- description: "Array of objects listing the type of consent given. Optional, should be only included for features that require consent",
+ description: "JSON string representing an array of objects listing the type of consent given. Example: `[{\"type\": \"data_processing\", \"given\": true}]`. Optional, should be only included for features that require consent",
optional: true,
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
async run({ $ }) { | ||||||||||||||||||||||||||||
const response = await this.app.createVerificationSession({ | ||||||||||||||||||||||||||||
$, | ||||||||||||||||||||||||||||
data: { | ||||||||||||||||||||||||||||
verification: { | ||||||||||||||||||||||||||||
callback: this.callback, | ||||||||||||||||||||||||||||
person: { | ||||||||||||||||||||||||||||
firstName: this.firstName, | ||||||||||||||||||||||||||||
lastName: this.lastName, | ||||||||||||||||||||||||||||
idNumber: this.idNumber, | ||||||||||||||||||||||||||||
phoneNumber: this.phoneNumber, | ||||||||||||||||||||||||||||
gender: this.gender, | ||||||||||||||||||||||||||||
dateOfBirth: this.dateOfBirth, | ||||||||||||||||||||||||||||
email: this.email, | ||||||||||||||||||||||||||||
maritalStatus: this.maritalStatus, | ||||||||||||||||||||||||||||
isDeceased: this.isDeceased, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
document: { | ||||||||||||||||||||||||||||
number: this.number, | ||||||||||||||||||||||||||||
country: this.country, | ||||||||||||||||||||||||||||
type: this.type, | ||||||||||||||||||||||||||||
firstIssue: this.firstIssue, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
address: { | ||||||||||||||||||||||||||||
fullAddress: this.fullAddress, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
vendorData: this.vendorData, | ||||||||||||||||||||||||||||
endUserId: this.endUserId, | ||||||||||||||||||||||||||||
consents: parseObject(this.consents), | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
$.export("$summary", `Created verification session ${response.verification.id}`); | ||||||||||||||||||||||||||||
return response; | ||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import crypto from "crypto"; | ||
import app from "../../veriff.app.mjs"; | ||
|
||
export default { | ||
key: "veriff-find-a-decision", | ||
name: "Find A Decision", | ||
description: "Finds decision by session ID. [See the documentation](https://devdocs.veriff.com/apidocs/v1sessionsiddecision-1)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
sessionId: { | ||
type: "string", | ||
label: "Session ID", | ||
description: "The session ID to find the decision for", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const hmacSignature = crypto | ||
.createHmac("sha256", this.app.$auth.secret_key) | ||
.update(this.sessionId) | ||
.digest("hex"); | ||
|
||
const response = await this.app.getSessionDecision({ | ||
$, | ||
sessionId: this.sessionId, | ||
headers: { | ||
"x-hmac-signature": hmacSignature, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Found decision for session ${this.sessionId}`); | ||
return response; | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export default { | ||
BASE_URL: "https://api.veriff.me/v1", | ||
WEBHOOK_EVENTS: { | ||
SESSION_COMPLETED: "session.completed", | ||
SESSION_APPROVED: "session.approved", | ||
SESSION_DECLINED: "session.declined", | ||
SESSION_RESUBMITTED: "session.resubmitted", | ||
}, | ||
VERIFICATION_STATUS: { | ||
APPROVED: "approved", | ||
DECLINED: "declined", | ||
RESUBMITTED: "resubmitted", | ||
PENDING: "pending", | ||
}, | ||
GENDER_OPTIONS: [ | ||
{ | ||
label: "Male", | ||
value: "M", | ||
}, | ||
{ | ||
label: "Female", | ||
value: "F", | ||
}, | ||
], | ||
MARITAL_STATUS_OPTIONS: [ | ||
{ | ||
label: "Single", | ||
value: "single", | ||
}, | ||
{ | ||
label: "Married", | ||
value: "married", | ||
}, | ||
{ | ||
label: "Divorced", | ||
value: "divorced", | ||
}, | ||
{ | ||
label: "Widowed", | ||
value: "widowed", | ||
}, | ||
], | ||
DOCUMENT_TYPE_OPTIONS: [ | ||
{ | ||
label: "Id Card", | ||
value: "ID_CARD", | ||
}, | ||
{ | ||
label: "Passport", | ||
value: "PASSPORT", | ||
}, | ||
{ | ||
label: "Driver's License", | ||
value: "DRIVERS_LICENSE", | ||
}, | ||
{ | ||
label: "Residence Permit", | ||
value: "RESIDENCE_PERMIT", | ||
}, | ||
], | ||
ID_CARD_TYPE_OPTIONS: [ | ||
"CE", | ||
"TI", | ||
], | ||
Comment on lines
+61
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the completeness of ID card type options. The 🌐 Web query:
💡 Result: Veriff's identity verification API supports a wide range of government-issued identity documents from over 230 countries and territories. This includes more than 12,000 document specimens, such as passports, national ID cards, driver's licenses, and residence permits. (veriff.com) The API is designed to automatically recognize and process various document types, including those in Latin-based, Cyrillic, Japanese, and Arabic scripts. This extensive support ensures that Veriff can verify identities globally, accommodating diverse document formats and languages. (veriff.com) For a comprehensive list of supported document types and to ensure compatibility with specific ID cards, you can refer to Veriff's official documentation or contact their support team for detailed information. Citations:
Ensure ID_CARD_TYPE_OPTIONS covers all supported Veriff document types The array at components/veriff/common/constants.mjs (lines 61–64) currently only includes • File: components/veriff/common/constants.mjs ID_CARD_TYPE_OPTIONS: [
// replace these two placeholders…
"CE",
"TI",
// …with the full set of required ID document codes
], 🤖 Prompt for AI Agents
|
||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const parseObject = (obj) => { | ||
if (!obj) return undefined; | ||
|
||
if (Array.isArray(obj)) { | ||
return obj.map((item) => { | ||
if (typeof item === "string") { | ||
try { | ||
return JSON.parse(item); | ||
} catch (e) { | ||
return item; | ||
} | ||
} | ||
return item; | ||
}); | ||
} | ||
if (typeof obj === "string") { | ||
try { | ||
return JSON.parse(obj); | ||
} catch (e) { | ||
return obj; | ||
} | ||
} | ||
return obj; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/veriff", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream Veriff Components", | ||
"main": "veriff.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.1.0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,42 @@ | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
type: "app", | ||
app: "veriff", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return `${this.$auth.api_url}/v1`; | ||
}, | ||
_headers(headers = {}) { | ||
return { | ||
"content-type": "application/json", | ||
"x-auth-client": `${this.$auth.api_key}`, | ||
...headers, | ||
}; | ||
}, | ||
_makeRequest({ | ||
$ = this, path, headers, ...opts | ||
}) { | ||
return axios($, { | ||
url: this._baseUrl() + path, | ||
headers: this._headers(headers), | ||
...opts, | ||
}); | ||
}, | ||
createVerificationSession(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/sessions", | ||
...opts, | ||
}); | ||
}, | ||
getSessionDecision({ | ||
sessionId, ...opts | ||
}) { | ||
return this._makeRequest({ | ||
path: `/sessions/${sessionId}/decision`, | ||
...opts, | ||
}); | ||
}, | ||
}, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add input validation for date format.
The date of birth field expects "YYYY-MM-DD" format but lacks validation to ensure users provide the correct format.
Consider adding validation to ensure the date format is correct:
dateOfBirth: { type: "string", label: "Date of Birth", description: "Person's date of birth (YYYY-MM-DD)", + pattern: "^\\d{4}-\\d{2}-\\d{2}$", optional: true, },
📝 Committable suggestion
🤖 Prompt for AI Agents