Skip to content
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
123 changes: 123 additions & 0 deletions components/real_id/actions/create-id-check/create-id-check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import app from "../../real_id.app.mjs";

export default {
key: "real_id-create-id-check",
name: "Create ID Check",
description: "Create a new ID check for a user. [See the documentation](https://getverdict.com/help/docs/api/checks#create-an-id-check).",
version: "0.0.1",
type: "action",
props: {
app,
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
info: {
type: "alert",
alertType: "info",
content: "Either the **Email** or the **Phone** number is required to create an ID check.",
},
email: {
propDefinition: [
app,
"email",
],
},
phone: {
propDefinition: [
app,
"phone",
],
},
firstName: {
type: "string",
label: "First Name",
description: "First name of the customer",
optional: true,
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the customer",
optional: true,
},
wooCommerceCustomerId: {
type: "string",
label: "WooCommerce Customer ID",
description: "Unique identifier for the customer in WooCommerce",
optional: true,
},
wooCommerceOrderId: {
type: "string",
label: "WooCommerce Order ID",
description: "Unique identifier for the order in WooCommerce",
optional: true,
},
shopifyAdminGraphqlId: {
type: "string",
label: "Shopify Admin GraphQL ID",
description: "Unique identifier for the customer in Shopify",
optional: true,
},
shopifyAdminGraphqlOrderId: {
type: "string",
label: "Shopify Admin GraphQL Order ID",
description: "Unique identifier for the order in Shopify",
optional: true,
},
shopifyAdminGraphqlOrderName: {
type: "string",
label: "Shopify Admin GraphQL Order Name",
description: "Name of the order in Shopify",
optional: true,
},
additionalParameters: {
type: "object",
label: "Additional Parameters",
description: "Additional parameters to include in the request",
optional: true,
},
},
methods: {
createIdCheck(args = {}) {
return this.app.post({
path: "/checks",
...args,
});
},
},
async run({ $ }) {
const {
createIdCheck,
email,
phone,
firstName,
lastName,
wooCommerceCustomerId,
wooCommerceOrderId,
shopifyAdminGraphqlId,
shopifyAdminGraphqlOrderId,
shopifyAdminGraphqlOrderName,
additionalParameters,
} = this;

const response = await createIdCheck({
$,
data: {
customer: {
first_name: firstName,
last_name: lastName,
email,
phone,
wc_id: wooCommerceCustomerId,
shopify_admin_graphql_id: shopifyAdminGraphqlId,
},
order: {
wc_id: wooCommerceOrderId,
shopify_admin_graphql_id: shopifyAdminGraphqlOrderId,
name: shopifyAdminGraphqlOrderName,
},
...additionalParameters,
},
});
$.export("$summary", "Successfully created ID check.");
return response;
},
};
41 changes: 41 additions & 0 deletions components/real_id/actions/delete-id-check/delete-id-check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import app from "../../real_id.app.mjs";

export default {
key: "real_id-delete-id-check",
name: "Delete ID Check",
description: "Permanently delete all data associated with a specific ID check. [See the documentation](https://getverdict.com/help/docs/api/checks#delete-id-check-data).",
version: "0.0.1",
type: "action",
props: {
app,
checkId: {
propDefinition: [
app,
"checkId",
],
},
},
methods: {
deleteIdCheck({
checkId, ...args
} = {}) {
return this.app.delete({
path: `/checks/${checkId}`,
...args,
});
},
},
async run({ $ }) {
const {
deleteIdCheck,
checkId,
} = this;

const response = await deleteIdCheck({
$,
checkId,
});
$.export("$summary", `Successfully deleted ID check \`${response.check.id}\`.`);
return response;
},
};
52 changes: 52 additions & 0 deletions components/real_id/actions/get-id-check/get-id-check.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import app from "../../real_id.app.mjs";

export default {
key: "real_id-get-id-check",
name: "Get ID Check",
description: "Retrieve an ID check. [See the documentation](https://getverdict.com/help/docs/api/checks#retrieve-an-id-check).",
version: "0.0.1",
type: "action",
props: {
app,
checkId: {
propDefinition: [
app,
"checkId",
],
},
withPhotos: {
type: "boolean",
label: "Include Photos",
description: "All photos will be provided as short lived URLs in the API response under the `photos` key.",
optional: true,
},
},
methods: {
retrieveIdCheck({
checkId, ...args
} = {}) {
return this.app._makeRequest({
path: `/checks/${checkId}`,
...args,
});
},
},
async run({ $ }) {
const {
retrieveIdCheck,
checkId,
withPhotos,
} = this;

const response = await retrieveIdCheck({
$,
checkId,
params: {
withPhotos,
},
});

$.export("$summary", "Successfully retrieved ID check.");
return response;
},
};
5 changes: 4 additions & 1 deletion components/real_id/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/real_id",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Real ID Components",
"main": "real_id.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
55 changes: 51 additions & 4 deletions components/real_id/real_id.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,58 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "real_id",
propDefinitions: {},
propDefinitions: {
email: {
type: "string",
label: "Email",
description: "Email address for initiating the ID check",
optional: true,
},
phone: {
type: "string",
label: "Phone Number",
description: "Phone number for initiating the ID check",
optional: true,
},
checkId: {
type: "string",
label: "ID Check Identifier",
description: "The unique identifier for the ID check",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
getUrl(path) {
return `https://real-id.getverdict.com/api/v1${path}`;
},
getHeaders(headers) {
return {
"Authorization": `Bearer ${this.$auth.api_key}`,
"Content-Type": "application/json",
...headers,
};
},
_makeRequest({
$ = this, path, headers, ...args
} = {}) {
return axios($, {
...args,
url: this.getUrl(path),
headers: this.getHeaders(headers),
});
},
post(args = {}) {
return this._makeRequest({
method: "POST",
...args,
});
},
delete(args = {}) {
return this._makeRequest({
method: "DELETE",
...args,
});
},
},
};
8 changes: 5 additions & 3 deletions pnpm-lock.yaml

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

Loading