@pipedream/taxjar 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/actions/calculate-sales-tax/calculate-sales-tax.mjs +98 -0
- package/actions/create-customer/create-customer.mjs +82 -0
- package/actions/validate-address/validate-address.mjs +62 -0
- package/common/constants.mjs +8 -0
- package/package.json +5 -5
- package/taxjar.app.mjs +142 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The TaxJar API offers a suite of tools for automating sales tax calculations, reporting, and filings. With this API, you can get real-time sales tax rates and calculations at checkout, generate detailed sales tax reports for each state, and automate your sales tax filings. Integrating TaxJar with Pipedream allows you to create workflows that can enhance e-commerce platforms, financial systems, and accounting software, ensuring that sales tax handling is both accurate and effortless.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Real-Time Sales Tax Calculation at Checkout**
|
|
8
|
+
Automatically calculate sales tax in Pipedream workflows for e-commerce orders. When a new order is received in Shopify, trigger a workflow that uses the TaxJar API to calculate the appropriate sales tax based on the customer’s location and the items purchased.
|
|
9
|
+
|
|
10
|
+
- **Monthly Sales Tax Reporting**
|
|
11
|
+
Schedule a Pipedream workflow that runs at the end of every month, summarizing total sales and taxes collected through Stripe. Use TaxJar to prepare the tax reports needed for filing, ensuring compliance with minimal manual effort.
|
|
12
|
+
|
|
13
|
+
- **Automated Tax Filing Reminders**
|
|
14
|
+
Combine the TaxJar API with Google Calendar in Pipedream to create workflows that remind you to file taxes before the due date. When TaxJar reports a nearing filing deadline, the workflow can create an event in your Google Calendar as a reminder.
|
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/taxjar",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream TaxJar Components",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "taxjar.app.mjs",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pipedream",
|
|
8
8
|
"taxjar"
|
|
9
9
|
],
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
10
|
"homepage": "https://pipedream.com/apps/taxjar",
|
|
14
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
15
12
|
"publishConfig": {
|
|
16
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.0.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/taxjar.app.mjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
import constants from "./common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
type: "app",
|
|
6
|
+
app: "taxjar",
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
customerId: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Customer ID",
|
|
11
|
+
description: "Unique identifier for the customer",
|
|
12
|
+
},
|
|
13
|
+
exemptionType: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Exemption Type",
|
|
16
|
+
description: "The type of tax exemption for the customer",
|
|
17
|
+
options: constants.EXEMPTION_TYPES,
|
|
18
|
+
},
|
|
19
|
+
name: {
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Name",
|
|
22
|
+
description: "The name of the customer",
|
|
23
|
+
},
|
|
24
|
+
country: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "Country",
|
|
27
|
+
description: "The two-letter ISO country code, i.e.: `US`",
|
|
28
|
+
},
|
|
29
|
+
state: {
|
|
30
|
+
type: "string",
|
|
31
|
+
label: "State",
|
|
32
|
+
description: "The two-letter ISO state code, i.e.: `CA`",
|
|
33
|
+
},
|
|
34
|
+
zip: {
|
|
35
|
+
type: "string",
|
|
36
|
+
label: "Zip",
|
|
37
|
+
description: "The ZIP code of the customer's primary address, i.e.: `92093`",
|
|
38
|
+
},
|
|
39
|
+
city: {
|
|
40
|
+
type: "string",
|
|
41
|
+
label: "City",
|
|
42
|
+
description: "The city of the customer's primary address, i.e.: `La Jolla`",
|
|
43
|
+
},
|
|
44
|
+
street: {
|
|
45
|
+
type: "string",
|
|
46
|
+
label: "Street",
|
|
47
|
+
description: "The street of the customer's primary address, i.e.: `9500 Gilman Drive`",
|
|
48
|
+
},
|
|
49
|
+
fromCountry: {
|
|
50
|
+
type: "string",
|
|
51
|
+
label: "From Country",
|
|
52
|
+
description: "The two-letter ISO country code of the country where the order shipped from, i.e.: `US`",
|
|
53
|
+
},
|
|
54
|
+
fromZip: {
|
|
55
|
+
type: "string",
|
|
56
|
+
label: "From Zip",
|
|
57
|
+
description: "The postal code where the order shipped from, i.e.: `92093`",
|
|
58
|
+
},
|
|
59
|
+
fromState: {
|
|
60
|
+
type: "string",
|
|
61
|
+
label: "From State",
|
|
62
|
+
description: "The two-letter ISO state code where the order shipped from, i.e.: `CA`",
|
|
63
|
+
},
|
|
64
|
+
fromCity: {
|
|
65
|
+
type: "string",
|
|
66
|
+
label: "From City",
|
|
67
|
+
description: "The city where the order shipped from, i.e.: `La Jolla`",
|
|
68
|
+
},
|
|
69
|
+
fromStreet: {
|
|
70
|
+
type: "string",
|
|
71
|
+
label: "From Street",
|
|
72
|
+
description: "The street address where the order shipped from, i.e.: `9500 Gilman Drive`",
|
|
73
|
+
},
|
|
74
|
+
toCountry: {
|
|
75
|
+
type: "string",
|
|
76
|
+
label: "To Country",
|
|
77
|
+
description: "The two-letter ISO country code of the country where the order shipped to, i.e.: `US`",
|
|
78
|
+
},
|
|
79
|
+
toZip: {
|
|
80
|
+
type: "string",
|
|
81
|
+
label: "To Zip",
|
|
82
|
+
description: "The postal code where the order shipped to, i.e.: `92093`",
|
|
83
|
+
},
|
|
84
|
+
toState: {
|
|
85
|
+
type: "string",
|
|
86
|
+
label: "To State",
|
|
87
|
+
description: "The two-letter ISO state code where the order shipped yo, i.e.: `CA`",
|
|
88
|
+
},
|
|
89
|
+
amount: {
|
|
90
|
+
type: "string",
|
|
91
|
+
label: "Amount",
|
|
92
|
+
description: "Total amount of the order, excluding shipping",
|
|
93
|
+
},
|
|
94
|
+
shipping: {
|
|
95
|
+
type: "string",
|
|
96
|
+
label: "Shipping",
|
|
97
|
+
description: "Total amount of shipping for the order",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
_baseUrl() {
|
|
102
|
+
return "https://api.taxjar.com/v2";
|
|
103
|
+
},
|
|
104
|
+
async _makeRequest(opts = {}) {
|
|
105
|
+
const {
|
|
106
|
+
$ = this,
|
|
107
|
+
path,
|
|
108
|
+
headers,
|
|
109
|
+
...otherOpts
|
|
110
|
+
} = opts;
|
|
111
|
+
return axios($, {
|
|
112
|
+
...otherOpts,
|
|
113
|
+
url: this._baseUrl() + path,
|
|
114
|
+
headers: {
|
|
115
|
+
Authorization: `Bearer ${this.$auth.api_key}`,
|
|
116
|
+
...headers,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
async createCustomer(args = {}) {
|
|
121
|
+
return this._makeRequest({
|
|
122
|
+
path: "/customers",
|
|
123
|
+
method: "post",
|
|
124
|
+
...args,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
async calculateSalesTax(args = {}) {
|
|
128
|
+
return this._makeRequest({
|
|
129
|
+
path: "/taxes",
|
|
130
|
+
method: "post",
|
|
131
|
+
...args,
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
async validateAddress(args = {}) {
|
|
135
|
+
return this._makeRequest({
|
|
136
|
+
path: "/addresses/validate",
|
|
137
|
+
method: "post",
|
|
138
|
+
...args,
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|