Skip to content

Commit 00da8bb

Browse files
committed
Create+Update Contact
1 parent 02415f1 commit 00da8bb

File tree

3 files changed

+399
-89
lines changed

3 files changed

+399
-89
lines changed

components/sage_accounting/actions/create-contact/create-contact.mjs

Lines changed: 80 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { ConfigurationError } from "@pipedream/platform";
22
import app from "../../sage_accounting.app.mjs";
3-
import {
4-
CREDIT_TERMS_OPTIONS, LOCALE_OPTIONS,
5-
} from "../../common/constants.mjs";
63

74
export default {
85
key: "sage_accounting-create-contact",
@@ -13,9 +10,10 @@ export default {
1310
props: {
1411
app,
1512
name: {
16-
type: "string",
17-
label: "Name",
18-
description: "The contact's full name or business name",
13+
propDefinition: [
14+
app,
15+
"name",
16+
],
1917
},
2018
contactTypeIds: {
2119
propDefinition: [
@@ -24,56 +22,64 @@ export default {
2422
],
2523
},
2624
reference: {
27-
type: "string",
28-
label: "Reference",
29-
description: "Unique reference for the contact",
30-
optional: true,
25+
propDefinition: [
26+
app,
27+
"reference",
28+
],
3129
},
3230
taxNumber: {
33-
type: "string",
34-
label: "Tax Number",
35-
description: "The VAT registration number of the contact. The format will be validated.",
36-
optional: true,
31+
propDefinition: [
32+
app,
33+
"taxNumber",
34+
],
3735
},
3836
notes: {
39-
type: "string",
40-
label: "Notes",
41-
description: "The notes for the contact",
42-
optional: true,
37+
propDefinition: [
38+
app,
39+
"notes",
40+
],
4341
},
4442
locale: {
45-
type: "string",
46-
label: "Locale",
47-
description: "The locale for the contact",
48-
optional: true,
49-
options: LOCALE_OPTIONS,
43+
propDefinition: [
44+
app,
45+
"locale",
46+
],
5047
},
5148
creditLimit: {
52-
type: "string",
53-
label: "Credit Limit",
54-
description: "Custom credit limit amount for the contact (not applicable to Start)",
55-
optional: true,
49+
propDefinition: [
50+
app,
51+
"creditLimit",
52+
],
5653
},
5754
creditDays: {
58-
type: "integer",
59-
label: "Credit Days",
60-
description: "Custom credit days for the contact (0-365 days)",
61-
optional: true,
62-
min: 0,
63-
max: 365,
55+
propDefinition: [
56+
app,
57+
"creditDays",
58+
],
6459
},
6560
creditTerms: {
66-
type: "string",
67-
label: "Credit Terms",
68-
description: "Credit terms options determine how invoice due dates are calculated",
69-
optional: true,
70-
options: CREDIT_TERMS_OPTIONS,
61+
propDefinition: [
62+
app,
63+
"creditTerms",
64+
],
7165
},
7266
creditTermsAndConditions: {
73-
type: "string",
74-
label: "Credit Terms and Conditions",
75-
description: "Custom terms and conditions for the contact (Customers only)",
76-
optional: true,
67+
propDefinition: [
68+
app,
69+
"creditTermsAndConditions",
70+
],
71+
},
72+
productSalesPriceTypeId: {
73+
propDefinition: [
74+
app,
75+
"productSalesPriceTypeId",
76+
],
77+
},
78+
sourceGuid: {
79+
propDefinition: [
80+
app,
81+
"sourceGuid",
82+
],
7783
},
7884
currencyId: {
7985
propDefinition: [
@@ -82,64 +88,52 @@ export default {
8288
],
8389
},
8490
auxReference: {
85-
type: "string",
86-
label: "Auxiliary Reference",
87-
description: "Auxiliary reference. Used for German 'Kreditorennummer' and 'Debitorennummer'",
88-
optional: true,
91+
propDefinition: [
92+
app,
93+
"auxReference",
94+
],
8995
},
9096
registeredNumber: {
91-
type: "string",
92-
label: "Registered Number",
93-
description: "The registered number of the contact's business (German 'Steuernummer')",
94-
optional: true,
97+
propDefinition: [
98+
app,
99+
"registeredNumber",
100+
],
95101
},
96102
taxCalculation: {
97-
type: "string",
98-
label: "Tax Calculation",
99-
description: "Tax calculation method (France: tax treatment for Vendors, Spain: Recargo de Equivalencia for Customers, UK: domestic reverse charge)",
100-
optional: true,
103+
propDefinition: [
104+
app,
105+
"taxCalculation",
106+
],
101107
},
102108
auxiliaryAccount: {
103-
type: "string",
104-
label: "Auxiliary Account",
105-
description: "Auxiliary account - used when auxiliary accounting is enabled (Spain and France only)",
106-
optional: true,
109+
propDefinition: [
110+
app,
111+
"auxiliaryAccount",
112+
],
107113
},
108114
destinationVatBlocking: {
109-
type: "boolean",
110-
label: "Destination VAT Blocking",
111-
description: "Identifies if a contact should be blocked due to destination VAT",
112-
optional: true,
115+
propDefinition: [
116+
app,
117+
"destinationVatBlocking",
118+
],
113119
},
114120
defaultSalesLedgerAccountId: {
115-
type: "string",
116-
label: "Default Sales Ledger Account ID",
117-
description: "The ID of the default sales ledger account for the contact",
118-
optional: true,
121+
propDefinition: [
122+
app,
123+
"defaultSalesLedgerAccountId",
124+
],
119125
},
120126
defaultSalesTaxRateId: {
121-
type: "string",
122-
label: "Default Sales Tax Rate ID",
123-
description: "The ID of the default sales tax rate for the contact",
124-
optional: true,
127+
propDefinition: [
128+
app,
129+
"defaultSalesTaxRateId",
130+
],
125131
},
126132
defaultPurchaseLedgerAccountId: {
127-
type: "string",
128-
label: "Default Purchase Ledger Account ID",
129-
description: "The ID of the default purchase ledger account for the contact",
130-
optional: true,
131-
},
132-
productSalesPriceTypeId: {
133-
type: "string",
134-
label: "Product Sales Price Type ID",
135-
description: "The ID of the product sales price type for the contact",
136-
optional: true,
137-
},
138-
sourceGuid: {
139-
type: "string",
140-
label: "Source GUID",
141-
description: "The GUID of the source for the contact",
142-
optional: true,
133+
propDefinition: [
134+
app,
135+
"defaultPurchaseLedgerAccountId",
136+
],
143137
},
144138
},
145139
async run({ $ }) {

0 commit comments

Comments
 (0)