Skip to content

Commit f7f3a1d

Browse files
committed
quickbooks_sandbox components
1 parent 59a40fe commit f7f3a1d

File tree

44 files changed

+1217
-1084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1217
-1084
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ConfigurationError } from "@pipedream/platform";
22
import quickbooks from "../../quickbooks.app.mjs";
33

44
export default {
5-
key: "quickbooks-sandbox-search-invoices",
5+
key: "quickbooks-search-invoices",
66
name: "Search Invoices",
77
description: "Searches for invoices. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#query-an-invoice)",
88
version: "0.1.6",
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import quickbooks from "../../quickbooks.app.mjs";
2+
3+
export default {
4+
key: "quickbooks-search-services",
5+
name: "Search Services",
6+
description: "Search for services. [See the documentation](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/item#query-an-item)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
quickbooks,
11+
includeClause: {
12+
propDefinition: [
13+
quickbooks,
14+
"includeClause",
15+
],
16+
optional: false,
17+
},
18+
whereClause: {
19+
propDefinition: [
20+
quickbooks,
21+
"whereClause",
22+
],
23+
optional: false,
24+
},
25+
orderClause: {
26+
propDefinition: [
27+
quickbooks,
28+
"orderClause",
29+
],
30+
},
31+
startPosition: {
32+
description: "The starting count of the response for pagination.",
33+
label: "Start Position",
34+
optional: true,
35+
type: "string",
36+
},
37+
maxResults: {
38+
propDefinition: [
39+
quickbooks,
40+
"maxResults",
41+
],
42+
},
43+
minorVersion: {
44+
propDefinition: [
45+
quickbooks,
46+
"minorVersion",
47+
],
48+
},
49+
},
50+
async run({ $ }) {
51+
if (!this.include_clause || !this.where_clause) {
52+
throw new Error("Must provide include_clause, where_clause parameters.");
53+
}
54+
55+
var orderClause = "";
56+
if (this.order_clause) {
57+
orderClause = ` ORDERBY ${this.order_clause}`;
58+
}
59+
60+
var startPosition = "";
61+
if (this.start_position) {
62+
startPosition = ` STARTPOSITION ${this.start_position}`;
63+
}
64+
65+
var maxResults = "";
66+
if (this.max_results) {
67+
maxResults = ` MAXRESULTS ${this.max_results}` || "";
68+
}
69+
70+
const query = `select ${this.include_clause} from Item where Type = 'Service' and ${this.where_clause}${orderClause}${startPosition}${maxResults}`;
71+
72+
const response = await this.quickbooks.query({
73+
$,
74+
params: {
75+
minorversion: this.minorVersion,
76+
query,
77+
},
78+
});
79+
80+
if (response) {
81+
$.export("summary", "Successfully retrieved services");
82+
}
83+
84+
return response;
85+
},
86+
};

components/quickbooks/actions/update-item/update-item.mjs

Lines changed: 321 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../quickbooks_sandbox.app.mjs";
2+
import common from "../../../quickbooks/actions/create-ap-aging-report/create-ap-aging-report.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "quickbooks_sandbox-create-ap-aging-report",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
quickbooks: app,
20+
...props,
21+
},
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import app from "../../quickbooks_sandbox.app.mjs";
2+
import common from "../../../quickbooks/actions/create-bill/create-bill.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
10+
11+
export default {
12+
...others,
13+
key: "quickbooks_sandbox-create-bill",
14+
version: "0.0.1",
15+
name,
16+
description,
17+
type,
18+
props: {
19+
quickbooks: app,
20+
...props,
21+
},
22+
};
Lines changed: 16 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,22 @@
1-
// legacy_hash_id: a_EVi7zr
2-
import { axios } from "@pipedream/platform";
1+
import app from "../../quickbooks_sandbox.app.mjs";
2+
import common from "../../../quickbooks/actions/create-customer/create-customer.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
310

411
export default {
12+
...others,
513
key: "quickbooks_sandbox-create-customer",
6-
name: "Create Customer",
7-
description: "Creates a customer.",
8-
version: "0.1.1",
9-
type: "action",
14+
version: "0.1.2",
15+
name,
16+
description,
17+
type,
1018
props: {
11-
quickbooks_sandbox: {
12-
type: "app",
13-
app: "quickbooks_sandbox",
14-
},
15-
display_name: {
16-
type: "string",
17-
description: "The name of the person or organization as displayed. Must be unique across all Customer, Vendor, and Employee objects. Cannot be removed with sparse update. If not supplied, the system generates DisplayName by concatenating customer name components supplied in the request from the following list: `Title`, `GivenName`, `MiddleName`, `FamilyName`, and `Suffix`.",
18-
optional: true,
19-
},
20-
title: {
21-
type: "string",
22-
description: "Title of the person. This tag supports i18n, all locales. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, `Suffix`, or `FullyQualifiedName` attributes are required during create.",
23-
optional: true,
24-
},
25-
given_name: {
26-
type: "string",
27-
description: "Given name or first name of a person. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.",
28-
optional: true,
29-
},
30-
middle_name: {
31-
type: "string",
32-
description: "Middle name of the person. The person can have zero or more middle names. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.",
33-
optional: true,
34-
},
35-
family_name: {
36-
type: "string",
37-
description: "Family name or the last name of the person. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.",
38-
optional: true,
39-
},
40-
suffix: {
41-
type: "string",
42-
description: "Suffix of the name. For example, `Jr`. The `DisplayName` attribute or at least one of `Title`, `GivenName`, `MiddleName`, `FamilyName`, or `Suffix` attributes is required for object create.",
43-
optional: true,
44-
},
45-
minorversion: {
46-
type: "string",
47-
description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company/<realmId>/journalentry/entityId?minorversion=1`",
48-
optional: true,
49-
},
50-
},
51-
async run({ $ }) {
52-
//See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer#create-a-customer
53-
54-
if (!this.display_name && (!this.title && !this.given_name && !this.middle_name && !this.family_name && !this.suffix)) {
55-
throw new Error("Must provide display_name or at least one of title, given_name, middle_name, family_name, or suffix parameters.");
56-
}
57-
58-
return await axios($, {
59-
method: "post",
60-
url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/customer`,
61-
headers: {
62-
"Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`,
63-
"accept": "application/json",
64-
"content-type": "application/json",
65-
},
66-
data: {
67-
DisplayName: this.display_name,
68-
Suffix: this.suffix,
69-
Title: this.title,
70-
MiddleName: this.middle_name,
71-
FamilyName: this.family_name,
72-
GivenName: this.given_name,
73-
},
74-
params: {
75-
minorversion: this.minorversion,
76-
},
77-
});
19+
quickbooks: app,
20+
...props,
7821
},
7922
};
Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,22 @@
1-
// legacy_hash_id: a_gniWe7
2-
import { axios } from "@pipedream/platform";
1+
import app from "../../quickbooks_sandbox.app.mjs";
2+
import common from "../../../quickbooks/actions/create-invoice/create-invoice.mjs";
3+
4+
import { adjustPropDefinitions } from "../../common/utils.mjs";
5+
6+
const {
7+
name, description, type, ...others
8+
} = common;
9+
const props = adjustPropDefinitions(others.props, app);
310

411
export default {
12+
...others,
513
key: "quickbooks_sandbox-create-invoice",
6-
name: "Create Invoice",
7-
description: "Creates an invoice.",
8-
version: "0.1.1",
9-
type: "action",
14+
version: "0.1.2",
15+
name,
16+
description,
17+
type,
1018
props: {
11-
quickbooks_sandbox: {
12-
type: "app",
13-
app: "quickbooks_sandbox",
14-
},
15-
line_items: {
16-
type: "any",
17-
description: "The minimum line item required for the request is one of the following: \n* `SalesItemLine` type\n* `GroupLine` type\nand Inline subtotal using `DescriptionOnlyLine`",
18-
},
19-
customer_ref_value: {
20-
type: "string",
21-
description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.Id` from that object for `CustomerRef.value`.",
22-
},
23-
customer_ref_name: {
24-
type: "string",
25-
description: "Reference to a customer or job. Query the Customer name list resource to determine the appropriate Customer object for this reference. Use `Customer.DisplayName ` from that object for `CustomerRef.name`.",
26-
optional: true,
27-
},
28-
currency_ref_value: {
29-
type: "string",
30-
description: "A three letter string representing the ISO 4217 code for the currency. For example, `USD`, `AUD`, `EUR`, and so on. This must be defined if multicurrency is enabled for the company.\nMulticurrency is enabled for the company if `Preferences.MultiCurrencyEnabled` is set to `true`. Read more about multicurrency support [here](https://developer.intuit.com/docs?RedirectID=MultCurrencies). Required if multicurrency is enabled for the company.",
31-
optional: true,
32-
},
33-
currency_ref_name: {
34-
type: "object",
35-
description: "The full name of the currency.",
36-
optional: true,
37-
},
38-
minorversion: {
39-
type: "string",
40-
description: "Use the minorversion query parameter in REST API requests to access a version of the API other than the generally available version. For example, to invoke minor version 1 of the JournalEntry entity, issue the following request:\n`https://quickbooks.api.intuit.com/v3/company/<realmId>/journalentry/entityId?minorversion=1`",
41-
optional: true,
42-
},
43-
},
44-
async run({ $ }) {
45-
// See Quickbooks API docs at: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice
46-
47-
if (!this.line_items || !this.customer_ref_value) {
48-
throw new Error("Must provide line_items, and customer_ref_value parameters.");
49-
}
50-
51-
return await axios($, {
52-
method: "post",
53-
url: `https://sandbox-quickbooks.api.intuit.com/v3/company/${this.quickbooks_sandbox.$auth.company_id}/invoice`,
54-
headers: {
55-
"Authorization": `Bearer ${this.quickbooks_sandbox.$auth.oauth_access_token}`,
56-
"accept": "application/json",
57-
"content-type": "application/json",
58-
},
59-
data: {
60-
Line: this.line_items,
61-
CustomerRef: {
62-
value: this.customer_ref_value,
63-
name: this.customer_ref_name,
64-
},
65-
CurrencyRef: {
66-
value: this.currency_ref_value,
67-
name: this.currency_ref_name,
68-
},
69-
},
70-
params: {
71-
minorversion: this.minorversion,
72-
},
73-
});
19+
quickbooks: app,
20+
...props,
7421
},
7522
};

0 commit comments

Comments
 (0)