Skip to content

Commit 302c250

Browse files
committed
Added actions
1 parent ce0224b commit 302c250

File tree

9 files changed

+401
-19
lines changed

9 files changed

+401
-19
lines changed

components/taxjar/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import app from "../../taxjar.app.mjs";
2+
3+
export default {
4+
key: "taxjar-calculate-sales-tax",
5+
name: "Calculate Sales Tax",
6+
description: "Shows the sales tax that should be collected for a given order. [See the documentation](https://developers.taxjar.com/api/reference/#taxes)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
exemptionType: {
12+
propDefinition: [
13+
app,
14+
"exemptionType",
15+
],
16+
},
17+
fromCountry: {
18+
propDefinition: [
19+
app,
20+
"fromCountry",
21+
],
22+
},
23+
fromZip: {
24+
propDefinition: [
25+
app,
26+
"fromZip",
27+
],
28+
},
29+
fromState: {
30+
propDefinition: [
31+
app,
32+
"fromState",
33+
],
34+
},
35+
fromCity: {
36+
propDefinition: [
37+
app,
38+
"fromCity",
39+
],
40+
},
41+
fromStreet: {
42+
propDefinition: [
43+
app,
44+
"fromStreet",
45+
],
46+
},
47+
toCountry: {
48+
propDefinition: [
49+
app,
50+
"toCountry",
51+
],
52+
},
53+
toZip: {
54+
propDefinition: [
55+
app,
56+
"toZip",
57+
],
58+
},
59+
toState: {
60+
propDefinition: [
61+
app,
62+
"toState",
63+
],
64+
},
65+
amount: {
66+
propDefinition: [
67+
app,
68+
"amount",
69+
],
70+
},
71+
shipping: {
72+
propDefinition: [
73+
app,
74+
"shipping",
75+
],
76+
},
77+
},
78+
async run({ $ }) {
79+
const response = await this.app.calculateSalesTax({
80+
$,
81+
data: {
82+
exemption_type: this.exemptionType,
83+
from_country: this.fromCountry,
84+
from_zip: this.fromZip,
85+
from_state: this.fromState,
86+
from_city: this.fromCity,
87+
from_street: this.fromStreet,
88+
to_country: this.toCountry,
89+
to_zip: this.toZip,
90+
to_state: this.toState,
91+
amount: this.amount,
92+
shipping: this.shipping,
93+
},
94+
});
95+
$.export("$summary", `Successfully calculated sales tax. Amount to collect: ${response.tax.amount_to_collect}`);
96+
return response;
97+
},
98+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import app from "../../taxjar.app.mjs";
2+
3+
export default {
4+
key: "taxjar-create-customer",
5+
name: "Create Customer",
6+
description: "Creates a new customer at TaxJar. [See the documentation](https://developers.taxjar.com/api/reference/#post-create-a-customer)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
customerId: {
12+
propDefinition: [
13+
app,
14+
"customerId",
15+
],
16+
},
17+
exemptionType: {
18+
propDefinition: [
19+
app,
20+
"exemptionType",
21+
],
22+
},
23+
name: {
24+
propDefinition: [
25+
app,
26+
"name",
27+
],
28+
},
29+
country: {
30+
propDefinition: [
31+
app,
32+
"country",
33+
],
34+
optional: true,
35+
},
36+
state: {
37+
propDefinition: [
38+
app,
39+
"state",
40+
],
41+
optional: true,
42+
},
43+
zip: {
44+
propDefinition: [
45+
app,
46+
"zip",
47+
],
48+
optional: true,
49+
},
50+
city: {
51+
propDefinition: [
52+
app,
53+
"city",
54+
],
55+
optional: true,
56+
},
57+
street: {
58+
propDefinition: [
59+
app,
60+
"street",
61+
],
62+
optional: true,
63+
},
64+
},
65+
async run({ $ }) {
66+
const response = await this.app.createCustomer({
67+
$,
68+
data: {
69+
customer_id: this.customerId,
70+
exemption_type: this.exemptionType,
71+
name: this.name,
72+
country: this.country,
73+
state: this.state,
74+
zip: this.zip,
75+
city: this.city,
76+
street: this.street,
77+
},
78+
});
79+
$.export("$summary", `Successfully created customer with ID ${this.customerId}`);
80+
return response;
81+
},
82+
};
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import app from "../../taxjar.app.mjs";
2+
3+
export default {
4+
key: "taxjar-validate-address",
5+
name: "Validate Address",
6+
description: "Validates a customer address and returns back a collection of address matches. [See the documentation](https://developers.taxjar.com/api/reference/#post-validate-an-address)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
country: {
12+
propDefinition: [
13+
app,
14+
"country",
15+
],
16+
description: "The two-letter ISO country code, i.e.: `US`. At this time only US addresses can be validated",
17+
optional: true,
18+
},
19+
state: {
20+
propDefinition: [
21+
app,
22+
"state",
23+
],
24+
optional: true,
25+
},
26+
zip: {
27+
propDefinition: [
28+
app,
29+
"zip",
30+
],
31+
optional: true,
32+
},
33+
city: {
34+
propDefinition: [
35+
app,
36+
"city",
37+
],
38+
optional: true,
39+
},
40+
street: {
41+
propDefinition: [
42+
app,
43+
"street",
44+
],
45+
optional: true,
46+
},
47+
},
48+
async run({ $ }) {
49+
const response = await this.app.validateAddress({
50+
$,
51+
data: {
52+
country: this.country,
53+
state: this.state,
54+
zip: this.zip,
55+
city: this.city,
56+
street: this.street,
57+
},
58+
});
59+
$.export("$summary", `Successfully sent the request and found ${response.addresses.length} address matches`);
60+
return response;
61+
},
62+
};

components/taxjar/app/taxjar.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
EXEMPTION_TYPES: [
3+
"wholesale",
4+
"government",
5+
"other",
6+
"non_exempt",
7+
],
8+
};

components/taxjar/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
"name": "@pipedream/taxjar",
33
"version": "0.0.2",
44
"description": "Pipedream TaxJar Components",
5-
"main": "dist/app/taxjar.app.mjs",
5+
"main": "taxjar.app.mjs",
66
"keywords": [
77
"pipedream",
88
"taxjar"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/taxjar",
1211
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1312
"publishConfig": {
1413
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1517
}
1618
}

0 commit comments

Comments
 (0)