zudello-integration-sdk 1.0.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 +1 -0
- package/package.json +23 -0
- package/src/index.js +62 -0
- package/src/integrations/samples/bc-zudello/account.js +40 -0
- package/src/integrations/samples/bc-zudello/accountingPeriod.js +52 -0
- package/src/integrations/samples/bc-zudello/currency.js +42 -0
- package/src/integrations/samples/bc-zudello/customer.js +45 -0
- package/src/integrations/samples/bc-zudello/dimension.js +85 -0
- package/src/integrations/samples/bc-zudello/employee.js +38 -0
- package/src/integrations/samples/bc-zudello/fixedAsset.js +48 -0
- package/src/integrations/samples/bc-zudello/item.js +45 -0
- package/src/integrations/samples/bc-zudello/itemCategory.js +37 -0
- package/src/integrations/samples/bc-zudello/location.js +37 -0
- package/src/integrations/samples/bc-zudello/paymentMethod.js +38 -0
- package/src/integrations/samples/bc-zudello/paymentTerm.js +41 -0
- package/src/integrations/samples/bc-zudello/project.js +38 -0
- package/src/integrations/samples/bc-zudello/purchaseCredit.js +109 -0
- package/src/integrations/samples/bc-zudello/purchaseInvoice.js +138 -0
- package/src/integrations/samples/bc-zudello/purchaseOrder.js +150 -0
- package/src/integrations/samples/bc-zudello/purchaseOrderFetch.js +100 -0
- package/src/integrations/samples/bc-zudello/supplier.js +40 -0
- package/src/integrations/samples/bc-zudello/taxRate.js +39 -0
- package/src/integrations/samples/bc-zudello/uom.js +42 -0
- package/src/integrations/samples/dear-zudello/account.js +20 -0
- package/src/integrations/samples/dear-zudello/customer.js +23 -0
- package/src/integrations/samples/dear-zudello/item.js +30 -0
- package/src/integrations/samples/dear-zudello/location.js +19 -0
- package/src/integrations/samples/dear-zudello/salesOrder.js +126 -0
- package/src/integrations/samples/dear-zudello/supplier.js +23 -0
- package/src/integrations/samples/dear-zudello/taxRate.js +19 -0
- package/src/integrations/samples/fo-zudello/account.js +20 -0
- package/src/integrations/samples/fo-zudello/costCentre.js +20 -0
- package/src/integrations/samples/fo-zudello/department.js +20 -0
- package/src/integrations/samples/fo-zudello/item.js +21 -0
- package/src/integrations/samples/fo-zudello/location.js +20 -0
- package/src/integrations/samples/fo-zudello/project.js +18 -0
- package/src/integrations/samples/fo-zudello/subsidiary.js +20 -0
- package/src/integrations/samples/fo-zudello/supplier.js +23 -0
- package/src/integrations/samples/fo-zudello/taxRate.js +20 -0
- package/src/integrations/samples/intacct-zudello/account.js +56 -0
- package/src/integrations/samples/intacct-zudello/accountGroup.js +54 -0
- package/src/integrations/samples/intacct-zudello/accountingPeriod.js +67 -0
- package/src/integrations/samples/intacct-zudello/apBill.js +146 -0
- package/src/integrations/samples/intacct-zudello/apBillFetch.js +195 -0
- package/src/integrations/samples/intacct-zudello/costCentre.js +54 -0
- package/src/integrations/samples/intacct-zudello/costType.js +54 -0
- package/src/integrations/samples/intacct-zudello/customerCategory.js +54 -0
- package/src/integrations/samples/intacct-zudello/customerGroup.js +54 -0
- package/src/integrations/samples/intacct-zudello/department.js +54 -0
- package/src/integrations/samples/intacct-zudello/employee.js +51 -0
- package/src/integrations/samples/intacct-zudello/expense-create.js +156 -0
- package/src/integrations/samples/intacct-zudello/item.js +64 -0
- package/src/integrations/samples/intacct-zudello/itemCategory.js +54 -0
- package/src/integrations/samples/intacct-zudello/itemGroup.js +54 -0
- package/src/integrations/samples/intacct-zudello/location.js +54 -0
- package/src/integrations/samples/intacct-zudello/paymentTerm.js +56 -0
- package/src/integrations/samples/intacct-zudello/project.js +54 -0
- package/src/integrations/samples/intacct-zudello/projectGroup.js +54 -0
- package/src/integrations/samples/intacct-zudello/projectTask.js +40 -0
- package/src/integrations/samples/intacct-zudello/subsidiary.js +54 -0
- package/src/integrations/samples/intacct-zudello/supplier.js +168 -0
- package/src/integrations/samples/intacct-zudello/supplierCategory.js +54 -0
- package/src/integrations/samples/intacct-zudello/supplierGroup.js +54 -0
- package/src/integrations/samples/intacct-zudello/supplierV2.js +64 -0
- package/src/integrations/samples/intacct-zudello/taxRate.js +34 -0
- package/src/integrations/samples/intacct-zudello/taxSolution.js +35 -0
- package/src/integrations/samples/intacct-zudello/uom.js +37 -0
- package/src/integrations/samples/intacct-zudello/warehouse.js +54 -0
- package/src/integrations/samples/intacct-zudello/zone.js +54 -0
- package/src/integrations/samples/nexvia-zudello/account.js +20 -0
- package/src/integrations/samples/nexvia-zudello/costCentre.js +19 -0
- package/src/integrations/samples/nexvia-zudello/costType.js +19 -0
- package/src/integrations/samples/nexvia-zudello/currency.js +20 -0
- package/src/integrations/samples/nexvia-zudello/department.js +20 -0
- package/src/integrations/samples/nexvia-zudello/itemCategory.js +19 -0
- package/src/integrations/samples/nexvia-zudello/location.js +20 -0
- package/src/integrations/samples/nexvia-zudello/project.js +20 -0
- package/src/integrations/samples/nexvia-zudello/supplier.js +21 -0
- package/src/integrations/samples/nexvia-zudello/taxRate.js +21 -0
- package/src/integrations/samples/nexvia-zudello/uom.js +19 -0
- package/src/integrations/samples/nexvia-zudello/zone.js +20 -0
- package/src/integrations/samples/zenoti-zudello/location.js +20 -0
- package/src/integrations/samples/zenoti-zudello/product.js +32 -0
- package/src/integrations/samples/zenoti-zudello/purchaseOrder.js +193 -0
- package/src/sdk/Auth.js +42 -0
- package/src/sdk/Base.js +118 -0
- package/src/sdk/BusinessCentral.js +31 -0
- package/src/sdk/Dear.js +31 -0
- package/src/sdk/Fo.js +31 -0
- package/src/sdk/Intacct.js +103 -0
- package/src/sdk/JobReady.js +31 -0
- package/src/sdk/MYOBAcumatica.js +33 -0
- package/src/sdk/Netsuite.js +31 -0
- package/src/sdk/NetsuiteSOAP.js +92 -0
- package/src/sdk/Nexvia.js +31 -0
- package/src/sdk/RetailExpress.js +31 -0
- package/src/sdk/Sybiz.js +31 -0
- package/src/sdk/Zenoti.js +31 -0
- package/src/sdk/Zudello.js +206 -0
- package/src/sdk/submodules/bc/Universal.js +109 -0
- package/src/sdk/submodules/dear/Universal.js +110 -0
- package/src/sdk/submodules/fo/Universal.js +111 -0
- package/src/sdk/submodules/intacct/Account.js +31 -0
- package/src/sdk/submodules/intacct/AccountGroup.js +31 -0
- package/src/sdk/submodules/intacct/AccountingPeriod.js +31 -0
- package/src/sdk/submodules/intacct/ApAdjustment.js +35 -0
- package/src/sdk/submodules/intacct/ApBill.js +52 -0
- package/src/sdk/submodules/intacct/ApTerm.js +31 -0
- package/src/sdk/submodules/intacct/ArAdjustment.js +35 -0
- package/src/sdk/submodules/intacct/ArInvoice.js +35 -0
- package/src/sdk/submodules/intacct/ArTerm.js +31 -0
- package/src/sdk/submodules/intacct/Budget.js +31 -0
- package/src/sdk/submodules/intacct/Class.js +31 -0
- package/src/sdk/submodules/intacct/CostType.js +31 -0
- package/src/sdk/submodules/intacct/Customer.js +31 -0
- package/src/sdk/submodules/intacct/CustomerGroup.js +31 -0
- package/src/sdk/submodules/intacct/CustomerType.js +31 -0
- package/src/sdk/submodules/intacct/Department.js +31 -0
- package/src/sdk/submodules/intacct/Employee.js +31 -0
- package/src/sdk/submodules/intacct/Entity.js +31 -0
- package/src/sdk/submodules/intacct/File.js +26 -0
- package/src/sdk/submodules/intacct/Item.js +31 -0
- package/src/sdk/submodules/intacct/ItemGroup.js +31 -0
- package/src/sdk/submodules/intacct/Location.js +31 -0
- package/src/sdk/submodules/intacct/PoDocument.js +52 -0
- package/src/sdk/submodules/intacct/ProductLine.js +31 -0
- package/src/sdk/submodules/intacct/Project.js +31 -0
- package/src/sdk/submodules/intacct/ProjectGroup.js +31 -0
- package/src/sdk/submodules/intacct/Task.js +31 -0
- package/src/sdk/submodules/intacct/TaxDetail.js +31 -0
- package/src/sdk/submodules/intacct/TaxGroups.js +31 -0
- package/src/sdk/submodules/intacct/TaxSolution.js +31 -0
- package/src/sdk/submodules/intacct/Universal.js +139 -0
- package/src/sdk/submodules/intacct/Uom.js +31 -0
- package/src/sdk/submodules/intacct/Vendor.js +31 -0
- package/src/sdk/submodules/intacct/VendorGroup.js +31 -0
- package/src/sdk/submodules/intacct/VendorTypes.js +31 -0
- package/src/sdk/submodules/intacct/Warehouse.js +31 -0
- package/src/sdk/submodules/intacct/Zone.js +31 -0
- package/src/sdk/submodules/intacct/apAdjustment/Item.js +31 -0
- package/src/sdk/submodules/intacct/apBill/Item.js +31 -0
- package/src/sdk/submodules/intacct/arAdjustment/Item.js +31 -0
- package/src/sdk/submodules/intacct/arInvoice/Item.js +31 -0
- package/src/sdk/submodules/intacct/poDocument/Item.js +31 -0
- package/src/sdk/submodules/jobready/Universal.js +107 -0
- package/src/sdk/submodules/myobAcumatica/OData.js +109 -0
- package/src/sdk/submodules/myobAcumatica/Universal.js +109 -0
- package/src/sdk/submodules/netsuite/Universal.js +97 -0
- package/src/sdk/submodules/netsuite-soap/PurchaseOrder.js +39 -0
- package/src/sdk/submodules/netsuite-soap/Receipt.js +39 -0
- package/src/sdk/submodules/netsuite-soap/Universal.js +124 -0
- package/src/sdk/submodules/netsuite-soap/UniversalTransaction.js +138 -0
- package/src/sdk/submodules/netsuite-soap/VendorBill.js +41 -0
- package/src/sdk/submodules/netsuite-soap/VendorCredit.js +39 -0
- package/src/sdk/submodules/nexvia/Universal.js +108 -0
- package/src/sdk/submodules/retailExpress/Universal.js +107 -0
- package/src/sdk/submodules/sybiz/Universal.js +108 -0
- package/src/sdk/submodules/zenoti/Universal.js +110 -0
- package/src/sdk/submodules/zudello/Account.js +63 -0
- package/src/sdk/submodules/zudello/AccountGroup.js +63 -0
- package/src/sdk/submodules/zudello/AccountingPeriod.js +63 -0
- package/src/sdk/submodules/zudello/CostCentre.js +63 -0
- package/src/sdk/submodules/zudello/CostType.js +63 -0
- package/src/sdk/submodules/zudello/Currency.js +63 -0
- package/src/sdk/submodules/zudello/Customer.js +63 -0
- package/src/sdk/submodules/zudello/CustomerCategory.js +63 -0
- package/src/sdk/submodules/zudello/CustomerGroup.js +63 -0
- package/src/sdk/submodules/zudello/Department.js +63 -0
- package/src/sdk/submodules/zudello/Employee.js +63 -0
- package/src/sdk/submodules/zudello/FixedAsset.js +63 -0
- package/src/sdk/submodules/zudello/Item.js +63 -0
- package/src/sdk/submodules/zudello/ItemCategory.js +63 -0
- package/src/sdk/submodules/zudello/ItemGroup.js +63 -0
- package/src/sdk/submodules/zudello/Location.js +63 -0
- package/src/sdk/submodules/zudello/PaymentMethod.js +63 -0
- package/src/sdk/submodules/zudello/PaymentTerm.js +63 -0
- package/src/sdk/submodules/zudello/Project.js +63 -0
- package/src/sdk/submodules/zudello/ProjectGroup.js +63 -0
- package/src/sdk/submodules/zudello/ProjectTask.js +63 -0
- package/src/sdk/submodules/zudello/PurchaseOrder.js +63 -0
- package/src/sdk/submodules/zudello/Subsidiary.js +63 -0
- package/src/sdk/submodules/zudello/Supplier.js +63 -0
- package/src/sdk/submodules/zudello/SupplierCategory.js +63 -0
- package/src/sdk/submodules/zudello/SupplierGroup.js +63 -0
- package/src/sdk/submodules/zudello/Universal.js +31 -0
- package/src/sdk/submodules/zudello/Uom.js +63 -0
- package/src/sdk/submodules/zudello/Warehouse.js +63 -0
- package/src/sdk/submodules/zudello/Zone.js +63 -0
- package/src/sdk/submodules/zudello/tax/Rate.js +63 -0
- package/src/sdk/submodules/zudello/tax/Solution.js +63 -0
- package/src/utils/apiInstance.js +198 -0
- package/src/utils/config.js +18 -0
- package/src/utils/logger.js +122 -0
- package/src/utils/metadata.js +102 -0
- package/src/utils/miscHelper.js +24 -0
- package/src/utils/modelHelper.js +140 -0
- package/src/utils/properties.js +32 -0
- package/src/utils/responseHandler.js +28 -0
- package/src/utils/s3Client.js +128 -0
- package/src/utils/tags.js +32 -0
- package/src/utils/validator.js +73 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const { payload } = providedData
|
|
3
|
+
|
|
4
|
+
const model = payload?.resource?.model || null
|
|
5
|
+
const uuid = payload?.resource?.uuid || null
|
|
6
|
+
|
|
7
|
+
logger.log(payload)
|
|
8
|
+
logger.log(model)
|
|
9
|
+
logger.log(uuid)
|
|
10
|
+
|
|
11
|
+
if (model && uuid) {
|
|
12
|
+
const fetchedItem = await Zudello.fetch({ model, uuid })
|
|
13
|
+
|
|
14
|
+
logger.log(fetchedItem)
|
|
15
|
+
|
|
16
|
+
if (fetchedItem && fetchedItem.data) {
|
|
17
|
+
const data = fetchedItem.data
|
|
18
|
+
|
|
19
|
+
logger.log(data)
|
|
20
|
+
|
|
21
|
+
const datePosted = (moment(_.get(data, "data.date_posted")).isValid()) ? moment(_.get(data, "data.date_posted")).format('YYYY-MM-DD') : moment(_.get(data, "data.date_issued")).format('YYYY-MM-DD')
|
|
22
|
+
|
|
23
|
+
const headerBody = {
|
|
24
|
+
"currencyCode": _.get(data, "data.currency.code"),
|
|
25
|
+
"creditMemoDate": moment(_.get(data, "data.date_issued")).format('YYYY-MM-DD'),
|
|
26
|
+
"postingDate": datePosted,
|
|
27
|
+
"invoiceNumber": _.get(data, "data.number"), // Must be passed as a string regardless of type
|
|
28
|
+
"vendorNumber": _.get(data, "data.supplier.code") // Must be passed as a string regardless of type
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
logger.log(headerBody)
|
|
32
|
+
|
|
33
|
+
const headerPayload = await BC.universal.request({ method: 'POST', url: 'purchaseCreditMemos', body: headerBody })
|
|
34
|
+
|
|
35
|
+
logger.log(headerPayload)
|
|
36
|
+
|
|
37
|
+
if (headerPayload && headerPayload.data) {
|
|
38
|
+
const headerPayloadData = headerPayload.data
|
|
39
|
+
|
|
40
|
+
let status = "COMPLETE"
|
|
41
|
+
let errorMessage = ""
|
|
42
|
+
|
|
43
|
+
for (const line of _.get(data, "data.lines")) {
|
|
44
|
+
logger.log(line)
|
|
45
|
+
|
|
46
|
+
const lineBody = {
|
|
47
|
+
"description": _.get(line, "description"),
|
|
48
|
+
"documentId": _.get(headerPayloadData, "id"),
|
|
49
|
+
"lineObjectNumber": _.get(line, "item.code") ? _.get(line, "item.code") : _.get(line, "account.code"),
|
|
50
|
+
"lineType": _.get(line, "item.external_id") ? "Item" : "Account",
|
|
51
|
+
"quantity": _.get(line, "quantity"),
|
|
52
|
+
"taxCode": _.get(line, "tax_rate.code"),
|
|
53
|
+
"unitCost": _.get(line, "total_exclusive")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
logger.log(lineBody)
|
|
57
|
+
|
|
58
|
+
const linePayload = await BC.universal.request({ method: 'POST', url: 'purchaseCreditMemoLines', body: lineBody })
|
|
59
|
+
|
|
60
|
+
logger.log(linePayload)
|
|
61
|
+
|
|
62
|
+
if(!linePayload || !linePayload.success) {
|
|
63
|
+
await BC.universal.request({ method: 'DELETE', url: `purchaseCredits/${_.get(headerPayloadData, "id")}` })
|
|
64
|
+
|
|
65
|
+
logger.log(`Delete Transaction: ${_.get(headerPayloadData, "id")}`)
|
|
66
|
+
|
|
67
|
+
status = "UNABLE"
|
|
68
|
+
errorMessage = linePayload.error?.messages[0]?.error?.message
|
|
69
|
+
|
|
70
|
+
logger.log(errorMessage)
|
|
71
|
+
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const zudelloUpdateData = {
|
|
77
|
+
uuid,
|
|
78
|
+
status,
|
|
79
|
+
external_id: _.get(headerPayloadData, "id")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (status === "UNABLE") {
|
|
83
|
+
zudelloUpdateData.log_messages = {
|
|
84
|
+
replace: false,
|
|
85
|
+
items: [
|
|
86
|
+
{
|
|
87
|
+
create: true,
|
|
88
|
+
data: {
|
|
89
|
+
status_code: 404,
|
|
90
|
+
body: errorMessage,
|
|
91
|
+
parse_as: "INTEGRATION_ERROR"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const zudelloUpdateResponse = await Zudello.update({
|
|
99
|
+
model,
|
|
100
|
+
module: _.get(data, "data.module"),
|
|
101
|
+
submodule: _.get(data, "data.submodule"),
|
|
102
|
+
data: zudelloUpdateData
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
logger.log(zudelloUpdateResponse)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const { payload } = providedData
|
|
3
|
+
|
|
4
|
+
const model = payload?.resource?.model || null
|
|
5
|
+
const uuid = payload?.resource?.uuid || null
|
|
6
|
+
|
|
7
|
+
logger.log(payload)
|
|
8
|
+
logger.log(model)
|
|
9
|
+
logger.log(uuid)
|
|
10
|
+
|
|
11
|
+
if (model && uuid) {
|
|
12
|
+
const fetchedItem = await Zudello.fetch({ model, uuid })
|
|
13
|
+
|
|
14
|
+
logger.log(fetchedItem)
|
|
15
|
+
|
|
16
|
+
if (fetchedItem && fetchedItem.data) {
|
|
17
|
+
const data = fetchedItem.data
|
|
18
|
+
|
|
19
|
+
logger.log(data)
|
|
20
|
+
|
|
21
|
+
const dateDue = (moment(_.get(data, "data.date_due")).isValid()) ? moment(_.get(data, "data.date_due")).format('YYYY-MM-DD') : null
|
|
22
|
+
const datePosted = (moment(_.get(data, "data.date_posted")).isValid()) ? moment(_.get(data, "data.date_posted")).format('YYYY-MM-DD') : moment(_.get(data, "data.date_issued")).format('YYYY-MM-DD')
|
|
23
|
+
|
|
24
|
+
const headerBody = {
|
|
25
|
+
"currencyCode": _.get(data, "data.currency.code"),
|
|
26
|
+
"dueDate": dateDue,
|
|
27
|
+
"invoiceDate": moment(_.get(data, "data.date_issued")).format('YYYY-MM-DD'),
|
|
28
|
+
"postingDate": datePosted,
|
|
29
|
+
"pricesIncludeTax": _.get(data, "tax_included"),
|
|
30
|
+
"vendorInvoiceNumber": _.get(data, "data.document_number"), // Must be passed as a string regardless of type
|
|
31
|
+
"vendorNumber": _.get(data, "data.supplier.code") // Must be passed as a string regardless of type
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
logger.log(headerBody)
|
|
35
|
+
|
|
36
|
+
const headerPayload = await BC.universal.request({ method: 'POST', url: 'purchaseInvoices', body: headerBody })
|
|
37
|
+
|
|
38
|
+
logger.log(headerPayload)
|
|
39
|
+
|
|
40
|
+
if (headerPayload && headerPayload.data) {
|
|
41
|
+
const headerPayloadData = headerPayload.data
|
|
42
|
+
|
|
43
|
+
let status = "COMPLETE"
|
|
44
|
+
let errorMessage = ""
|
|
45
|
+
|
|
46
|
+
for (const line of _.get(data, "data.lines")) {
|
|
47
|
+
logger.log(line)
|
|
48
|
+
|
|
49
|
+
const lineBody = {
|
|
50
|
+
"description": _.get(line, "description"),
|
|
51
|
+
"documentId": _.get(headerPayloadData, "id"),
|
|
52
|
+
"lineObjectNumber": _.get(line, "item.code") ? _.get(line, "item.code") : _.get(line, "account.code"),
|
|
53
|
+
"lineType": _.get(line, "item.external_id") ? "Item" : "Account",
|
|
54
|
+
"quantity": _.get(line, "quantity"),
|
|
55
|
+
"taxCode": _.get(line, "tax_rate.code"),
|
|
56
|
+
"unitCost": _.get(line, "unit_price")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
logger.log(lineBody)
|
|
60
|
+
|
|
61
|
+
const linePayload = await BC.universal.request({ method: 'POST', url: 'purchaseInvoiceLines', body: lineBody })
|
|
62
|
+
|
|
63
|
+
logger.log(linePayload)
|
|
64
|
+
|
|
65
|
+
if (!linePayload || !linePayload.success) {
|
|
66
|
+
await BC.universal.request({ method: 'DELETE', url: `purchaseInvoices/${_.get(headerPayloadData, "id")}` })
|
|
67
|
+
|
|
68
|
+
logger.log(`Delete Transaction: ${_.get(headerPayloadData, "id")}`)
|
|
69
|
+
|
|
70
|
+
status = "UNABLE"
|
|
71
|
+
errorMessage = linePayload.error?.messages[0]?.error?.message
|
|
72
|
+
|
|
73
|
+
logger.log(errorMessage)
|
|
74
|
+
|
|
75
|
+
break
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const dimensions = [
|
|
79
|
+
'batch',
|
|
80
|
+
'bin',
|
|
81
|
+
'cost_centre',
|
|
82
|
+
'cost_type',
|
|
83
|
+
'department',
|
|
84
|
+
'project',
|
|
85
|
+
'warehouse',
|
|
86
|
+
'zone'
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
for (dimension of dimensions) {
|
|
90
|
+
const dimensionMeta = metadata.get(`dimension_${dimension}`)
|
|
91
|
+
|
|
92
|
+
if (dimensionMeta) {
|
|
93
|
+
const lineDim = {
|
|
94
|
+
"code": dimensionMeta,
|
|
95
|
+
"valueCode": _.get(line, `${dimension}.code`)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const lineDimPayload = await BC.universal.request({ method: 'POST', url: `purchaseInvoiceLines(${linePayload.data.id})/dimensionSetLines`, body: lineDim })
|
|
99
|
+
|
|
100
|
+
logger.log(lineDimPayload)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const zudelloUpdateData = {
|
|
106
|
+
uuid,
|
|
107
|
+
status,
|
|
108
|
+
external_id: _.get(headerPayloadData, "id")
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (status === "UNABLE") {
|
|
112
|
+
zudelloUpdateData.log_messages = {
|
|
113
|
+
replace: false,
|
|
114
|
+
items: [
|
|
115
|
+
{
|
|
116
|
+
create: true,
|
|
117
|
+
data: {
|
|
118
|
+
status_code: 404,
|
|
119
|
+
body: errorMessage,
|
|
120
|
+
parse_as: "INTEGRATION_ERROR"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const zudelloUpdateResponse = await Zudello.update({
|
|
128
|
+
model,
|
|
129
|
+
module: _.get(data, "data.module"),
|
|
130
|
+
submodule: _.get(data, "data.submodule"),
|
|
131
|
+
data: zudelloUpdateData
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
logger.log(zudelloUpdateResponse)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const lastModifiedDateTime = metadata.get('lastModifiedDateTime')
|
|
3
|
+
const fetchData = {
|
|
4
|
+
url: 'purchaseOrders',
|
|
5
|
+
method: 'GET',
|
|
6
|
+
qs: {
|
|
7
|
+
$expand: "purchaseOrderLines($select=id,sequence,description,itemId,accountId,quantity,directUnitCost,totalTaxAmount,amountIncludingTax,taxCode;$expand=dimensionSetLines($select=id,code,displayName,valueId,valueCode,valueDisplayName))",
|
|
8
|
+
$orderby: 'lastModifiedDateTime'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (lastModifiedDateTime) {
|
|
13
|
+
fetchData.qs.$filter = `lastModifiedDateTime gt ${lastModifiedDateTime}`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
logger.log(fetchData)
|
|
17
|
+
|
|
18
|
+
for await (const items of BC.universal.autoPaginationList(fetchData)) {
|
|
19
|
+
logger.log(items)
|
|
20
|
+
|
|
21
|
+
const data = _.map(items.data.value, (item) => {
|
|
22
|
+
const itemData = {
|
|
23
|
+
"external_id": _.get(item, "id"),
|
|
24
|
+
"document_number": _.get(item, "number"),
|
|
25
|
+
"supplier": {
|
|
26
|
+
"external_id": _.get(item, "vendorId"),
|
|
27
|
+
"code": _.get(item, "vendorNumber"),
|
|
28
|
+
"legal_name": _.get(item, "vendorName"),
|
|
29
|
+
"payment_term": {
|
|
30
|
+
"external_id": _.get(item, "paymentTermsId")
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"addressee": _.get(item, "shipToName"),
|
|
34
|
+
"attention": _.get(item, "shipToContact"),
|
|
35
|
+
"address_line_1": _.get(item, "shipToAddressLine1"),
|
|
36
|
+
"address_line_2": _.get(item, "shipToAddressLine2"),
|
|
37
|
+
"city": _.get(item, "shipToCity"),
|
|
38
|
+
"country": _.get(item, "shipToCountry"),
|
|
39
|
+
"state": _.get(item, "shipToState"),
|
|
40
|
+
"postcode": _.get(item, "shipToPostCode"),
|
|
41
|
+
"currency": {
|
|
42
|
+
"external_id": _.get(item, "currencyId"),
|
|
43
|
+
"code": _.get(item, "currencyCode")
|
|
44
|
+
},
|
|
45
|
+
"tax_included": _.get(item, "pricesIncludeTax"),
|
|
46
|
+
"discount": _.get(item, "discountAmount"),
|
|
47
|
+
"subtotal": _.get(item, "totalAmountExcludingTax"),
|
|
48
|
+
"tax": _.get(item, "totalTaxAmount"),
|
|
49
|
+
"total": _.get(item, "totalAmountIncludingTax"),
|
|
50
|
+
"status": _.get(item, "status"),
|
|
51
|
+
"lines": _.map(_.get(item, "purchaseOrderLines"), (lineItem) => {
|
|
52
|
+
const costCentreMetafield = metadata.get('dimension_cost_centre', '')
|
|
53
|
+
const departmentMetafield = metadata.get('dimension_department', '')
|
|
54
|
+
const costTypeMetafield = metadata.get('dimension_cost_type', '')
|
|
55
|
+
|
|
56
|
+
const lineData = {
|
|
57
|
+
"external_id": _.get(lineItem, "id"),
|
|
58
|
+
"line_number": _.get(lineItem, "sequence"),
|
|
59
|
+
"item": {
|
|
60
|
+
"external_id": _.get(lineItem, "itemId")
|
|
61
|
+
},
|
|
62
|
+
"account": {
|
|
63
|
+
"external_id": _.get(lineItem, "accountId")
|
|
64
|
+
},
|
|
65
|
+
"description": _.get(lineItem, "description"),
|
|
66
|
+
"unit_of_measure": {
|
|
67
|
+
"external_id": _.get(lineItem, "unitOfMeasureId"),
|
|
68
|
+
"code": _.get(lineItem, "unitOfMeasureCode")
|
|
69
|
+
},
|
|
70
|
+
"quantity": _.get(lineItem, "quantity"),
|
|
71
|
+
"unit_price": _.get(lineItem, "directUnitCost"),
|
|
72
|
+
"discount_amount": _.get(lineItem, "discountAmount"),
|
|
73
|
+
"discount_percent": _.get(lineItem, "discountPercent"),
|
|
74
|
+
"tax_rate": {
|
|
75
|
+
"external_id": _.get(lineItem, "taxCode")
|
|
76
|
+
},
|
|
77
|
+
"location": {
|
|
78
|
+
"external_id": _.get(lineItem, "locationId")
|
|
79
|
+
}
|
|
80
|
+
// "quantity": _.get(lineItem, "invoiceQuantity"), // we already have "quantity": _.get(lineItem, "quantity"),
|
|
81
|
+
// "quantity": _.get(lineItem, "receiveQuantity"),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const dimensionSetLines = _.get(lineItem, "dimensionSetLines")
|
|
85
|
+
|
|
86
|
+
if (departmentMetafield) {
|
|
87
|
+
const departmentLine = dimensionSetLines.find(line => line.code === departmentMetafield)
|
|
88
|
+
|
|
89
|
+
if (departmentLine) {
|
|
90
|
+
lineData.department = departmentLine.valueId
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (costCentreMetafield) {
|
|
95
|
+
const costCentreLine = dimensionSetLines.find(line => line.code === costCentreMetafield)
|
|
96
|
+
|
|
97
|
+
if (costCentreLine) {
|
|
98
|
+
lineData.cost_centre = costCentreLine.valueId
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (costTypeMetafield) {
|
|
103
|
+
const costTypeLine = dimensionSetLines.find(line => line.code === costTypeMetafield)
|
|
104
|
+
|
|
105
|
+
if (costTypeLine) {
|
|
106
|
+
lineData.cost_type = costTypeLine.valueId
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return lineData
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const orderDate = _.get(item, "orderDate")
|
|
115
|
+
|
|
116
|
+
if (orderDate) {
|
|
117
|
+
itemData["date_issued"] = moment(orderDate).format("YYYY-MM-DD")
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const postingDate = _.get(item, "postingDate")
|
|
121
|
+
|
|
122
|
+
if (postingDate) {
|
|
123
|
+
itemData["date_posted"] = moment(postingDate).format("YYYY-MM-DD")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const dueDate = _.get(item, "dueDate")
|
|
127
|
+
|
|
128
|
+
if (dueDate) {
|
|
129
|
+
itemData["date_due"] = moment(dueDate).format("YYYY-MM-DD")
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return itemData
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
logger.log(data)
|
|
136
|
+
|
|
137
|
+
const result = await Zudello.purchaseOrder.updateOrCreate({ data })
|
|
138
|
+
|
|
139
|
+
logger.log(result)
|
|
140
|
+
|
|
141
|
+
if (result.success) {
|
|
142
|
+
const lastObject = _.last(items.data.value)
|
|
143
|
+
const updatedLastModifiedDateTime = lastObject ? lastObject.lastModifiedDateTime : null
|
|
144
|
+
|
|
145
|
+
if (updatedLastModifiedDateTime) {
|
|
146
|
+
metadata.set('lastModifiedDateTime', updatedLastModifiedDateTime)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const lastModifiedDateTime = metadata.get('lastModifiedDateTime')
|
|
3
|
+
|
|
4
|
+
const fetchData = {
|
|
5
|
+
url: 'purchaseOrders',
|
|
6
|
+
method: 'GET',
|
|
7
|
+
qs: {
|
|
8
|
+
$orderby: 'lastModifiedDateTime',
|
|
9
|
+
$expand: "purchaseOrderLines( $select=id , sequence , description , itemId , accountId , quantity , directUnitCost , totalTaxAmount , amountIncludingTax , taxCode;$expand=dimensionSetLines( $select=id , code , displayName , valueId , valueCode , valueDisplayName ) )"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (lastModifiedDateTime) {
|
|
14
|
+
fetchData.qs.$filter = `lastModifiedDateTime gt ${lastModifiedDateTime}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
logger.log(JSON.stringify(fetchData))
|
|
18
|
+
|
|
19
|
+
for await (const items of BC.universal.autoPaginationList(fetchData)) {
|
|
20
|
+
logger.log(JSON.stringify(items))
|
|
21
|
+
|
|
22
|
+
const data = _.map(items.data.value, (item) => {
|
|
23
|
+
return {
|
|
24
|
+
model: "Transaction",
|
|
25
|
+
data: {
|
|
26
|
+
module: "PURCHASING",
|
|
27
|
+
submodule: "ORDER",
|
|
28
|
+
document_type: "PURCHASE_ORDER",
|
|
29
|
+
"external_id": _.get(item, 'id'),
|
|
30
|
+
"supplier": {
|
|
31
|
+
"fetch": true,
|
|
32
|
+
"create": true,
|
|
33
|
+
"data": {
|
|
34
|
+
"external_id": _.get(item, 'vendorId')
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"company_name": _.get(item, 'vendorName'),
|
|
38
|
+
"document_number": _.get(item, 'number'),
|
|
39
|
+
"date_issued": _.get(item, 'orderDate'),
|
|
40
|
+
"date_due": _.get(item, 'requestedReceiptDate'),
|
|
41
|
+
"subtotal": _.get(item, 'totalAmountExcludingTax'),
|
|
42
|
+
"subtotal": _.get(item, 'totalTaxAmount'),
|
|
43
|
+
"total": _.get(item, 'totalAmountIncludingTax'),
|
|
44
|
+
"status": "COMPLETE",
|
|
45
|
+
"lines": {
|
|
46
|
+
"replace": false,
|
|
47
|
+
"items": _.map(_.get(item, 'purchaseOrderLines'), (x) => {
|
|
48
|
+
return {
|
|
49
|
+
"create": true,
|
|
50
|
+
"update": true,
|
|
51
|
+
"data": {
|
|
52
|
+
"external_id": _.get(x, 'id'),
|
|
53
|
+
"description": _.get(x, 'description'),
|
|
54
|
+
"line_number": _.get(x, 'sequence'),
|
|
55
|
+
"quantity": _.get(x, 'quantity'),
|
|
56
|
+
"unit_price": _.get(x, 'directUnitCost'),
|
|
57
|
+
"total": _.get(x, 'amountIncludingTax'),
|
|
58
|
+
"item": {
|
|
59
|
+
"fetch": true,
|
|
60
|
+
"create": true,
|
|
61
|
+
"data": {
|
|
62
|
+
"external_id": _.get(x, 'itemId')
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"account": {
|
|
66
|
+
"fetch": true,
|
|
67
|
+
"create": true,
|
|
68
|
+
"data": {
|
|
69
|
+
"external_id": _.get(x, 'accountId')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"enrich": false,
|
|
78
|
+
"submit": false,
|
|
79
|
+
"create": true,
|
|
80
|
+
"update": true,
|
|
81
|
+
"update_status": false
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
logger.log(JSON.stringify(data))
|
|
86
|
+
|
|
87
|
+
const result = await Zudello.updateOrCreate({ data })
|
|
88
|
+
|
|
89
|
+
logger.log(JSON.stringify(result))
|
|
90
|
+
|
|
91
|
+
if (result.success) {
|
|
92
|
+
const lastObject = _.last(items.data.value)
|
|
93
|
+
const updatedLastModifiedDateTime = lastObject ? lastObject.lastModifiedDateTime : null
|
|
94
|
+
|
|
95
|
+
if (updatedLastModifiedDateTime) {
|
|
96
|
+
metadata.set('lastModifiedDateTime', updatedLastModifiedDateTime)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const lastModifiedDateTime = metadata.get('lastModifiedDateTime')
|
|
3
|
+
const fetchData = { url: 'vendors', method: 'GET', qs: { $orderby: 'lastModifiedDateTime' } }
|
|
4
|
+
|
|
5
|
+
if (lastModifiedDateTime) {
|
|
6
|
+
fetchData.qs.$filter = `lastModifiedDateTime gt ${lastModifiedDateTime}`
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
logger.log(fetchData)
|
|
10
|
+
|
|
11
|
+
for await (const items of BC.universal.autoPaginationList(fetchData)) {
|
|
12
|
+
logger.log(items)
|
|
13
|
+
|
|
14
|
+
const data = _.map(items.data.value, (item) => {
|
|
15
|
+
return {
|
|
16
|
+
"external_id": _.get(item, "id"),
|
|
17
|
+
"code": _.get(item, "number"),
|
|
18
|
+
"legal_name": _.get(item, "displayName"),
|
|
19
|
+
"trading_name": _.get(item, "displayName"),
|
|
20
|
+
"tax_number": _.get(item, "taxRegistrationNumber"),
|
|
21
|
+
"status": item.blocked == "_x0020_" ? "ACTIVE" : "INACTIVE"
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
logger.log(data)
|
|
26
|
+
|
|
27
|
+
const result = await Zudello.supplier.updateOrCreate({ data })
|
|
28
|
+
|
|
29
|
+
logger.log(result)
|
|
30
|
+
|
|
31
|
+
if (result.success) {
|
|
32
|
+
const lastObject = _.last(items.data.value)
|
|
33
|
+
const updatedLastModifiedDateTime = lastObject ? lastObject.lastModifiedDateTime : null
|
|
34
|
+
|
|
35
|
+
if (updatedLastModifiedDateTime) {
|
|
36
|
+
metadata.set('lastModifiedDateTime', updatedLastModifiedDateTime)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const lastModifiedDateTime = metadata.get('lastModifiedDateTime')
|
|
3
|
+
const fetchData = { url: 'taxGroups', method: 'GET', qs: { $orderby: 'lastModifiedDateTime' } }
|
|
4
|
+
|
|
5
|
+
if (lastModifiedDateTime) {
|
|
6
|
+
fetchData.qs.$filter = `lastModifiedDateTime gt ${lastModifiedDateTime}`
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
logger.log(JSON.stringify(fetchData))
|
|
10
|
+
|
|
11
|
+
for await (const items of BC.universal.autoPaginationList(fetchData)) {
|
|
12
|
+
logger.log(JSON.stringify(items))
|
|
13
|
+
|
|
14
|
+
const data = _.map(items.data.value, (item) => {
|
|
15
|
+
return {
|
|
16
|
+
"external_id": _.get(item, "id"),
|
|
17
|
+
"code": _.get(item, "code"),
|
|
18
|
+
"name": _.get(item, "displayName"),
|
|
19
|
+
"status": "ACTIVE",
|
|
20
|
+
"rate": _.includes(_.get(item, "code"), "100") ? 100.00 : _.includes(_.get(item, "code"), "10") ? 10.00 : 0.00
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
logger.log(JSON.stringify(data))
|
|
25
|
+
|
|
26
|
+
const result = await Zudello.tax.rate.updateOrCreate({ data })
|
|
27
|
+
|
|
28
|
+
logger.log(JSON.stringify(result))
|
|
29
|
+
|
|
30
|
+
if (result.success) {
|
|
31
|
+
const lastObject = _.last(items.data.value)
|
|
32
|
+
const updatedLastModifiedDateTime = lastObject ? lastObject.lastModifiedDateTime : null
|
|
33
|
+
|
|
34
|
+
if (updatedLastModifiedDateTime) {
|
|
35
|
+
metadata.set('lastModifiedDateTime', updatedLastModifiedDateTime)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
const lastModifiedDateTime = metadata.get('lastModifiedDateTime')
|
|
3
|
+
const fetchData = { url: 'unitsOfMeasure', method: 'GET', qs: { $orderby: 'lastModifiedDateTime' } }
|
|
4
|
+
|
|
5
|
+
if (lastModifiedDateTime) {
|
|
6
|
+
fetchData.qs.$filter = `lastModifiedDateTime gt ${lastModifiedDateTime}`
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
logger.log(fetchData)
|
|
10
|
+
|
|
11
|
+
for await (const items of BC.universal.autoPaginationList(fetchData)) {
|
|
12
|
+
logger.log(items)
|
|
13
|
+
|
|
14
|
+
const data = _.map(items.data.value, (item) => {
|
|
15
|
+
return {
|
|
16
|
+
"external_id": _.get(item, "id"),
|
|
17
|
+
"code": _.get(item, "code"),
|
|
18
|
+
"name": _.get(item, "displayName"),
|
|
19
|
+
"status": "ACTIVE",
|
|
20
|
+
"custom": JSON.stringify({
|
|
21
|
+
"internationalStandardCode": _.get(item, "internationalStandardCode"),
|
|
22
|
+
"symbol": _.get(item, "symbol")
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
logger.log(data)
|
|
28
|
+
|
|
29
|
+
const result = await Zudello.uom.updateOrCreate({ data })
|
|
30
|
+
|
|
31
|
+
logger.log(result)
|
|
32
|
+
|
|
33
|
+
if (result.success) {
|
|
34
|
+
const lastObject = _.last(items.data.value)
|
|
35
|
+
const updatedLastModifiedDateTime = lastObject ? lastObject.lastModifiedDateTime : null
|
|
36
|
+
|
|
37
|
+
if (updatedLastModifiedDateTime) {
|
|
38
|
+
metadata.set('lastModifiedDateTime', updatedLastModifiedDateTime)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
for await (const items of Dear.universal.autoPaginationList({ url: 'ref/account', method: 'GET' })) {
|
|
3
|
+
logger.log(items)
|
|
4
|
+
|
|
5
|
+
const data = _.map(items.data.AccountsList, (item) => {
|
|
6
|
+
return {
|
|
7
|
+
"external_id": _.get(item, "Code"),
|
|
8
|
+
"code": _.get(item, "Code"),
|
|
9
|
+
"name": _.get(item, "Name"),
|
|
10
|
+
"status": (_.get(item, "Status") == "Active") ? "ACTIVE" : "INACTIVE"
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
logger.log(data)
|
|
15
|
+
|
|
16
|
+
const result = await Zudello.account.updateOrCreate({ data })
|
|
17
|
+
|
|
18
|
+
logger.log(result)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const handler = async (providedData) => {
|
|
2
|
+
for await (const items of Dear.universal.autoPaginationList({ url: 'customer', method: 'GET', qs: {
|
|
3
|
+
"ModifiedSince": "2024-07-30"
|
|
4
|
+
} })) {
|
|
5
|
+
logger.log(items)
|
|
6
|
+
|
|
7
|
+
const data = _.map(items.data.CustomerList, (item) => {
|
|
8
|
+
return {
|
|
9
|
+
"external_id": _.get(item, "ID"),
|
|
10
|
+
"legal_name": _.get(item, "Name"),
|
|
11
|
+
"trading_name": _.get(item, "Name"),
|
|
12
|
+
"tax_number": _.get(item, "TaxNumber"),
|
|
13
|
+
"status": (_.get(item, "Status") == "Active") ? "ACTIVE" : "INACTIVE"
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
logger.log(data)
|
|
18
|
+
|
|
19
|
+
const result = await Zudello.customer.updateOrCreate({ data })
|
|
20
|
+
|
|
21
|
+
logger.log(result)
|
|
22
|
+
}
|
|
23
|
+
}
|