Skip to content

Commit 5fc72df

Browse files
committed
[Components] xverify - new action components
1 parent e9bd737 commit 5fc72df

File tree

6 files changed

+330
-9
lines changed

6 files changed

+330
-9
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import app from "../../xverify.app.mjs";
2+
3+
export default {
4+
key: "xverify-verify-address",
5+
name: "Verify Address",
6+
description: "Sends an address verification request. [See the documentation](https://apidocs.xverify.com/#address-verification-api-endpoint).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
12+
info: {
13+
type: "alert",
14+
alertType: "info",
15+
content: "**Note**: The `city`, `state`, and `zip` fields are optional. However, you must provide at least one of these fields to verify an address. If you provide all three fields, the API will use the city and state to verify the address.",
16+
},
17+
domain: {
18+
propDefinition: [
19+
app,
20+
"domain",
21+
],
22+
},
23+
address1: {
24+
type: "string",
25+
label: "Street Address 1",
26+
description: "The street address to be verified.",
27+
},
28+
address2: {
29+
type: "string",
30+
label: "Street Address 2",
31+
description: "The second line of the street address to be verified.",
32+
optional: true,
33+
},
34+
city: {
35+
type: "string",
36+
label: "City",
37+
description: "The city of the address to be verified.",
38+
optional: true,
39+
},
40+
state: {
41+
type: "string",
42+
label: "State",
43+
description: "The state of the address to be verified.",
44+
optional: true,
45+
},
46+
zip: {
47+
type: "string",
48+
label: "Zip Code",
49+
description: "The postal code of the address to be verified. **Required** if city and state are not provided.",
50+
optional: true,
51+
},
52+
urbanization: {
53+
type: "string",
54+
label: "Urbanization",
55+
description: "A component of certain addresses in Puerto Rico.",
56+
optional: true,
57+
},
58+
parse: {
59+
type: "boolean",
60+
label: "Parse Address",
61+
description: "Set to `true` if you want the street address to be parsed into individual elements in the response.",
62+
optional: true,
63+
},
64+
aff: {
65+
propDefinition: [
66+
app,
67+
"aff",
68+
],
69+
},
70+
subaff: {
71+
propDefinition: [
72+
app,
73+
"subaff",
74+
],
75+
},
76+
},
77+
methods: {
78+
verifyAddress(args = {}) {
79+
return this.app._makeRequest({
80+
path: "/av",
81+
...args,
82+
});
83+
},
84+
},
85+
async run({ $ }) {
86+
const {
87+
verifyAddress,
88+
domain,
89+
address1,
90+
address2,
91+
city,
92+
state,
93+
zip,
94+
urbanization,
95+
parse,
96+
aff,
97+
subaff,
98+
} = this;
99+
100+
const response = await verifyAddress({
101+
$,
102+
params: {
103+
domain,
104+
address1,
105+
address2,
106+
city,
107+
state,
108+
zip,
109+
urbanization,
110+
parse,
111+
aff,
112+
subaff,
113+
},
114+
});
115+
116+
$.export("$summary", `Successfully sent address verification request with status \`${response.status}\`.`);
117+
return response;
118+
},
119+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import app from "../../xverify.app.mjs";
2+
3+
export default {
4+
key: "xverify-verify-email",
5+
name: "Verify Email",
6+
description: "Sends an email verification request. [See the documentation](https://apidocs.xverify.com/#email-verification-api-endpoint).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
domain: {
12+
propDefinition: [
13+
app,
14+
"domain",
15+
],
16+
},
17+
email: {
18+
propDefinition: [
19+
app,
20+
"email",
21+
],
22+
},
23+
ip: {
24+
type: "string",
25+
label: "IP Address",
26+
description: "IP address from which a user submitted an email address. Can be used to detect fraudulent or risky submissions.",
27+
optional: true,
28+
},
29+
ua: {
30+
type: "string",
31+
label: "User Agent",
32+
description: "User Agent of the browser that submitted the email address. Can be used to detect fraudlent or risky data.",
33+
optional: true,
34+
},
35+
aff: {
36+
propDefinition: [
37+
app,
38+
"aff",
39+
],
40+
},
41+
subaff: {
42+
propDefinition: [
43+
app,
44+
"subaff",
45+
],
46+
},
47+
},
48+
methods: {
49+
verifyEmail(args = {}) {
50+
return this.app._makeRequest({
51+
path: "/ev",
52+
...args,
53+
});
54+
},
55+
},
56+
async run({ $ }) {
57+
const {
58+
verifyEmail,
59+
domain,
60+
email,
61+
ip,
62+
ua,
63+
aff,
64+
subaff,
65+
} = this;
66+
67+
const response = await verifyEmail({
68+
$,
69+
params: {
70+
domain,
71+
email,
72+
ip,
73+
ua,
74+
aff,
75+
subaff,
76+
},
77+
});
78+
79+
$.export("$summary", `Successfully sent email verification with status \`${response.status}\`.`);
80+
return response;
81+
},
82+
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import app from "../../xverify.app.mjs";
2+
3+
export default {
4+
key: "xverify-verify-phone",
5+
name: "Verify Phone",
6+
description: "Sends a phone verification request. [See the documentation](https://apidocs.xverify.com/#phone-verification-api-endpoint).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
domain: {
12+
propDefinition: [
13+
app,
14+
"domain",
15+
],
16+
},
17+
phone: {
18+
propDefinition: [
19+
app,
20+
"phone",
21+
],
22+
},
23+
aff: {
24+
propDefinition: [
25+
app,
26+
"aff",
27+
],
28+
},
29+
subaff: {
30+
propDefinition: [
31+
app,
32+
"subaff",
33+
],
34+
},
35+
},
36+
methods: {
37+
verifyPhone(args = {}) {
38+
return this.app._makeRequest({
39+
path: "/pv",
40+
...args,
41+
});
42+
},
43+
},
44+
async run({ $ }) {
45+
const {
46+
verifyPhone,
47+
domain,
48+
phone,
49+
aff,
50+
subaff,
51+
} = this;
52+
53+
const response = await verifyPhone({
54+
$,
55+
params: {
56+
domain,
57+
phone,
58+
aff,
59+
subaff,
60+
},
61+
});
62+
63+
$.export("$summary", `Successfully sent verification with status \`${response.status}\`.`);
64+
return response;
65+
},
66+
};

components/xverify/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/xverify",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Xverify Components",
55
"main": "xverify.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}

components/xverify/xverify.app.mjs

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,60 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "xverify",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
domain: {
8+
type: "string",
9+
label: "Domain",
10+
description: "The domain you have configured in your Xverify settings under which this query should be processed. See below.",
11+
options() {
12+
return [
13+
this.$auth.domain,
14+
];
15+
},
16+
},
17+
email: {
18+
type: "string",
19+
label: "Email Address",
20+
description: "The email address to be validated (and optionally corrected).",
21+
},
22+
aff: {
23+
type: "string",
24+
label: "Affiliate ID",
25+
description: "The ID you define to identify the affiliate or source of the email for reporting or potential blocking.",
26+
optional: true,
27+
},
28+
subaff: {
29+
type: "string",
30+
label: "Sub-Affiliate ID",
31+
description: "The sub-identifier you define for the affiliate or source of the email for reporting or potential blocking.",
32+
optional: true,
33+
},
34+
phone: {
35+
type: "string",
36+
label: "Phone Number",
37+
description: "The phone number to be verified.",
38+
},
39+
},
540
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
41+
getUrl(path) {
42+
return `https://api.xverify.com/v2${path}`;
43+
},
44+
getParams(params) {
45+
return {
46+
...params,
47+
api_key: this.$auth.api_key,
48+
};
49+
},
50+
_makeRequest({
51+
$ = this, path, params, ...args
52+
} = {}) {
53+
return axios($, {
54+
...args,
55+
url: this.getUrl(path),
56+
params: this.getParams(params),
57+
});
958
},
1059
},
1160
};

pnpm-lock.yaml

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)