zudello-integration-sdk 1.0.56 → 1.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudello-integration-sdk",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "Zudello Integrations SDK",
5
5
  "main": "./src/index.js",
6
6
  "repository": {
@@ -9,6 +9,7 @@ const AccountingPeriodModule = require("./submodules/zudello/AccountingPeriod");
9
9
  const AmortizationScheduleModule = require("./submodules/zudello/AmortizationSchedule");
10
10
  const BatchModule = require("./submodules/zudello/Batch");
11
11
  const BinModule = require("./submodules/zudello/Bin");
12
+ const BudgetModule = require("./submodules/zudello/Budget");
12
13
  const CostCentreModule = require("./submodules/zudello/CostCentre");
13
14
  const CostTypeModule = require("./submodules/zudello/CostType");
14
15
  const CustomerModule = require("./submodules/zudello/Customer");
@@ -26,6 +27,7 @@ const TaxSolutionModule = require("./submodules/zudello/tax/Solution");
26
27
  const ItemModule = require("./submodules/zudello/Item");
27
28
  const ItemCategoryModule = require("./submodules/zudello/ItemCategory");
28
29
  const ItemGroupModule = require("./submodules/zudello/ItemGroup");
30
+ const JournalModule = require("./submodules/zudello/Journal");
29
31
  const PurchaseOrderModule = require("./submodules/zudello/PurchaseOrder");
30
32
  const PaymentTermModule = require("./submodules/zudello/PaymentTerm");
31
33
  const PaymentMethodModule = require("./submodules/zudello/PaymentMethod");
@@ -76,6 +78,7 @@ class ZudelloSDK extends BaseSDK {
76
78
  this.amortizationSchedule = new AmortizationScheduleModule(this);
77
79
  this.batch = new BatchModule(this);
78
80
  this.bin = new BinModule(this);
81
+ this.budget = new BudgetModule(this);
79
82
  this.costCentre = new CostCentreModule(this);
80
83
  this.costType = new CostTypeModule(this);
81
84
  this.customer = new CustomerModule(this);
@@ -91,6 +94,7 @@ class ZudelloSDK extends BaseSDK {
91
94
  this.item = new ItemModule(this);
92
95
  this.itemCategory = new ItemCategoryModule(this);
93
96
  this.itemGroup = new ItemGroupModule(this);
97
+ this.journal = new JournalModule(this);
94
98
  this.purchaseOrder = new PurchaseOrderModule(this);
95
99
  this.paymentTerm = new PaymentTermModule(this);
96
100
  this.paymentMethod = new PaymentMethodModule(this);
@@ -0,0 +1,63 @@
1
+ 'use strict'
2
+
3
+ class BudgetModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of ZudelloV3 class.
7
+ */
8
+ constructor(parentModule) {
9
+ this.module = parentModule
10
+
11
+ this.staticFields = {
12
+ model: 'Budget',
13
+ module: 'BUDGETS',
14
+ submodule: 'BUDGET',
15
+ documentType: 'BUDGET',
16
+ enrich: false,
17
+ extractedEvent: false,
18
+ update: true,
19
+ create: true
20
+ }
21
+ }
22
+
23
+ async fetch({ uuid, fetchDetails = true, simplified = true }) {
24
+ const validateIsEmpty = this.module.validator.isEmpty({ uuid })
25
+
26
+ if (!validateIsEmpty.valid) {
27
+ return this.module.responseHandler.error(validateIsEmpty.errors)
28
+ }
29
+
30
+ return await this.module.fetch({
31
+ model: this.staticFields.model,
32
+ uuid,
33
+ fetchDetails,
34
+ simplified
35
+ })
36
+ }
37
+
38
+ async updateOrCreate({ data, clearNulls = true, simplified = false, submit = false, updateStatus = false }) {
39
+ const validateIsEmpty = this.module.validator.isEmpty({ data })
40
+
41
+ if (!validateIsEmpty.valid) {
42
+ return this.module.responseHandler.error(validateIsEmpty.errors)
43
+ }
44
+
45
+ this.module.logger.log(`[UPDATE OR CREATE]: ZudelloV3 [model - ${this.staticFields.model}]`)
46
+ this.module.logger.log('[PAGE DATA]:')
47
+ this.module.logger.log(data)
48
+
49
+ data = this.module.mapUpdateOrCreateData({
50
+ data,
51
+ staticFields: this.staticFields,
52
+ submit,
53
+ updateStatus
54
+ })
55
+
56
+ this.module.logger.log('[MAPPED PAGE DATA]:')
57
+ this.module.logger.log(data)
58
+
59
+ return await this.module.updateOrCreate({ data, clearNulls, simplified })
60
+ }
61
+ }
62
+
63
+ module.exports = BudgetModule
@@ -0,0 +1,63 @@
1
+ 'use strict'
2
+
3
+ class JournalModule {
4
+ /**
5
+ * Constructor.
6
+ * @param {class} parentModule Object of ZudelloV3 class.
7
+ */
8
+ constructor(parentModule) {
9
+ this.module = parentModule
10
+
11
+ this.staticFields = {
12
+ model: 'Transaction',
13
+ module: 'LEDGER',
14
+ submodule: 'JOURNAL',
15
+ documentType: 'JOURNAL',
16
+ enrich: true,
17
+ extractedEvent: false,
18
+ update: true,
19
+ create: true
20
+ }
21
+ }
22
+
23
+ async fetch({ uuid, fetchDetails = true, simplified = true }) {
24
+ const validateIsEmpty = this.module.validator.isEmpty({ uuid })
25
+
26
+ if (!validateIsEmpty.valid) {
27
+ return this.module.responseHandler.error(validateIsEmpty.errors)
28
+ }
29
+
30
+ return await this.module.fetch({
31
+ model: this.staticFields.model,
32
+ uuid,
33
+ fetchDetails,
34
+ simplified
35
+ })
36
+ }
37
+
38
+ async updateOrCreate({ data, clearNulls = true, simplified = false, submit = false, updateStatus = false }) {
39
+ const validateIsEmpty = this.module.validator.isEmpty({ data })
40
+
41
+ if (!validateIsEmpty.valid) {
42
+ return this.module.responseHandler.error(validateIsEmpty.errors)
43
+ }
44
+
45
+ this.module.logger.log(`[UPDATE OR CREATE]: ZudelloV3 [model - ${this.staticFields.model}]`)
46
+ this.module.logger.log('[PAGE DATA]:')
47
+ this.module.logger.log(data)
48
+
49
+ data = this.module.mapUpdateOrCreateData({
50
+ data,
51
+ staticFields: this.staticFields,
52
+ submit,
53
+ updateStatus
54
+ })
55
+
56
+ this.module.logger.log('[MAPPED PAGE DATA]:')
57
+ this.module.logger.log(data)
58
+
59
+ return await this.module.updateOrCreate({ data, clearNulls, simplified })
60
+ }
61
+ }
62
+
63
+ module.exports = JournalModule