@chift/chift-nodejs 1.0.6 → 1.0.8

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.
Files changed (66) hide show
  1. package/.github/workflows/ci.yml +38 -38
  2. package/CHANGELOG.md +42 -0
  3. package/dist/src/modules/accounting.d.ts +27 -24
  4. package/dist/src/modules/accounting.js +76 -31
  5. package/dist/src/modules/api.d.ts +2119 -28031
  6. package/dist/src/modules/consumer.d.ts +413 -64
  7. package/dist/src/modules/consumer.js +10 -0
  8. package/dist/src/modules/consumers.d.ts +2130 -365
  9. package/dist/src/modules/ecommerce.d.ts +8 -0
  10. package/dist/src/modules/ecommerce.js +28 -0
  11. package/dist/src/modules/flow.js +1 -1
  12. package/dist/src/modules/pos.d.ts +3 -1
  13. package/dist/src/modules/pos.js +7 -0
  14. package/dist/src/modules/sync.d.ts +1710 -298
  15. package/dist/src/modules/syncs.d.ts +8 -27677
  16. package/dist/src/modules/syncs.js +10 -0
  17. package/dist/test/modules/accounting.test.js +28 -11
  18. package/dist/test/modules/ecommerce.test.js +34 -7
  19. package/dist/test/modules/pos.test.js +10 -5
  20. package/package.json +2 -2
  21. package/src/modules/accounting.ts +120 -35
  22. package/src/modules/api.ts +2 -2
  23. package/src/modules/consumer.ts +21 -0
  24. package/src/modules/ecommerce.ts +52 -0
  25. package/src/modules/flow.ts +1 -1
  26. package/src/modules/pos.ts +15 -1
  27. package/src/modules/syncs.ts +32 -1
  28. package/src/types/public-api/schema.d.ts +3624 -2621
  29. package/test/modules/accounting.test.ts +31 -14
  30. package/test/modules/ecommerce.test.ts +34 -3
  31. package/test/modules/pos.test.ts +11 -5
  32. package/.eslintcache +0 -1
  33. package/coverage/clover.xml +0 -1645
  34. package/coverage/coverage-final.json +0 -19
  35. package/coverage/lcov-report/base.css +0 -224
  36. package/coverage/lcov-report/block-navigation.js +0 -87
  37. package/coverage/lcov-report/favicon.png +0 -0
  38. package/coverage/lcov-report/index.html +0 -146
  39. package/coverage/lcov-report/prettify.css +0 -1
  40. package/coverage/lcov-report/prettify.js +0 -2
  41. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  42. package/coverage/lcov-report/sorter.js +0 -196
  43. package/coverage/lcov-report/src/helpers/index.html +0 -131
  44. package/coverage/lcov-report/src/helpers/openapi.ts.html +0 -151
  45. package/coverage/lcov-report/src/helpers/settings.ts.html +0 -94
  46. package/coverage/lcov-report/src/index.html +0 -116
  47. package/coverage/lcov-report/src/index.ts.html +0 -88
  48. package/coverage/lcov-report/src/modules/accounting.ts.html +0 -1156
  49. package/coverage/lcov-report/src/modules/api.ts.html +0 -190
  50. package/coverage/lcov-report/src/modules/consumer.ts.html +0 -616
  51. package/coverage/lcov-report/src/modules/consumers.ts.html +0 -331
  52. package/coverage/lcov-report/src/modules/custom.ts.html +0 -193
  53. package/coverage/lcov-report/src/modules/datastores.ts.html +0 -142
  54. package/coverage/lcov-report/src/modules/ecommerce.ts.html +0 -331
  55. package/coverage/lcov-report/src/modules/flow.ts.html +0 -589
  56. package/coverage/lcov-report/src/modules/index.html +0 -326
  57. package/coverage/lcov-report/src/modules/integrations.ts.html +0 -151
  58. package/coverage/lcov-report/src/modules/internalApi.ts.html +0 -586
  59. package/coverage/lcov-report/src/modules/invoicing.ts.html +0 -391
  60. package/coverage/lcov-report/src/modules/pos.ts.html +0 -421
  61. package/coverage/lcov-report/src/modules/sync.ts.html +0 -316
  62. package/coverage/lcov-report/src/modules/syncs.ts.html +0 -169
  63. package/coverage/lcov-report/src/modules/webhooks.ts.html +0 -343
  64. package/coverage/lcov.info +0 -1976
  65. package/dist/test/modules/flow.test.d.ts +0 -1
  66. package/dist/test/modules/flow.test.js +0 -69
@@ -21,9 +21,19 @@ const Syncs = (internalApi) => {
21
21
  const { data } = yield _internalApi.get(`/syncs/${syncid}`);
22
22
  return (0, sync_1.Sync)(_internalApi, data);
23
23
  });
24
+ const createSync = (body) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const { data, } = yield _internalApi.post('/syncs', body);
26
+ return (0, sync_1.Sync)(_internalApi, data);
27
+ });
28
+ const updateSync = (body) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const { data, } = yield _internalApi.patch('/syncs', body);
30
+ return (0, sync_1.Sync)(_internalApi, data);
31
+ });
24
32
  return {
33
+ createSync,
25
34
  getSyncs,
26
35
  getSyncById,
36
+ updateSync,
27
37
  };
28
38
  };
29
39
  exports.Syncs = Syncs;
@@ -377,17 +377,6 @@ let analyticAccounts;
377
377
  const analyticAccountsWithMultiplePlans = yield consumer.accounting.getAnalyticAccountsWithMultiplePlans();
378
378
  (0, globals_1.expect)(analyticAccountsWithMultiplePlans).toBeInstanceOf(Array);
379
379
  }));
380
- (0, globals_1.test)('getAnalyticLinesOfAccount', () => __awaiter(void 0, void 0, void 0, function* () {
381
- const analyticLinesOfAccount = yield consumer.accounting.getAnalyticLinesOfAccount(analyticAccounts[0].id);
382
- (0, globals_1.expect)(analyticLinesOfAccount).toBeInstanceOf(Array);
383
- if (analyticLinesOfAccount.length > 0) {
384
- (0, globals_1.expect)(analyticLinesOfAccount[0]).toHaveProperty('account_id', analyticAccounts[0].id);
385
- (0, globals_1.expect)(analyticLinesOfAccount[0]).toHaveProperty('description', globals_1.expect.any(String));
386
- (0, globals_1.expect)(analyticLinesOfAccount[0]).toHaveProperty('amount', globals_1.expect.any(Number));
387
- (0, globals_1.expect)(analyticLinesOfAccount[0]).toHaveProperty('date', globals_1.expect.any(String));
388
- (0, globals_1.expect)(analyticLinesOfAccount[0]).toHaveProperty('id', globals_1.expect.any(String));
389
- }
390
- }));
391
380
  (0, globals_1.test)('createJournalEntry', () => __awaiter(void 0, void 0, void 0, function* () {
392
381
  const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
393
382
  if (!journal) {
@@ -563,3 +552,31 @@ let miscOperations;
563
552
  (0, globals_1.expect)(financialEntry).toBeTruthy();
564
553
  (0, globals_1.expect)(financialEntry).toHaveProperty('journal_id', journal.id);
565
554
  }));
555
+ let folders = [];
556
+ (0, globals_1.test)('getFolders', () => __awaiter(void 0, void 0, void 0, function* () {
557
+ folders = yield consumer.accounting.getFolders();
558
+ (0, globals_1.expect)(folders).toBeInstanceOf(Array);
559
+ (0, globals_1.expect)(folders.length).toBeGreaterThan(0);
560
+ (0, globals_1.expect)(folders[0]).toHaveProperty('id', globals_1.expect.any(String));
561
+ (0, globals_1.expect)(folders[0]).toHaveProperty('name', globals_1.expect.any(String));
562
+ }));
563
+ globals_1.test.skip('getAttachments', () => __awaiter(void 0, void 0, void 0, function* () {
564
+ const attachments = yield consumer.accounting.getAttachments({
565
+ // TODO: Add documentId from test account
566
+ documentId: '',
567
+ type: 'invoice',
568
+ });
569
+ (0, globals_1.expect)(attachments).toBeInstanceOf(Array);
570
+ (0, globals_1.expect)(attachments.length).toBeGreaterThan(0);
571
+ (0, globals_1.expect)(attachments[0]).toHaveProperty('id', globals_1.expect.any(String));
572
+ (0, globals_1.expect)(attachments[0]).toHaveProperty('base64_string', globals_1.expect.any(String));
573
+ }));
574
+ globals_1.test.skip('matchEntries', () => __awaiter(void 0, void 0, void 0, function* () {
575
+ const match = yield consumer.accounting.matchEntries({
576
+ // TODO: Change params with test account values
577
+ entries: [],
578
+ partner_id: '',
579
+ });
580
+ (0, globals_1.expect)(match).toHaveProperty('matching_number', globals_1.expect.any(String));
581
+ (0, globals_1.expect)(match).toHaveProperty('balance', globals_1.expect.any(Number));
582
+ }));
@@ -122,9 +122,9 @@ let locations;
122
122
  (0, globals_1.expect)(product).toBeTruthy();
123
123
  (0, globals_1.expect)(product).toHaveProperty('available_quantity', globals_1.expect.any(Number));
124
124
  }));
125
- /*
126
- test('createOrder', async () => {
127
- const order = await consumer.ecommerce.createOrder({
125
+ // TODO: Fix create order test
126
+ globals_1.test.skip('createOrder', () => __awaiter(void 0, void 0, void 0, function* () {
127
+ const order = yield consumer.ecommerce.createOrder({
128
128
  customer: {
129
129
  email: 'test@test.com',
130
130
  },
@@ -155,10 +155,9 @@ test('createOrder', async () => {
155
155
  ],
156
156
  payment_method: 'bank-transfer',
157
157
  });
158
- expect(order).toBeTruthy();
159
- expect(order).toHaveProperty('id', expect.any(String));
160
- });
161
- */
158
+ (0, globals_1.expect)(order).toBeTruthy();
159
+ (0, globals_1.expect)(order).toHaveProperty('id', globals_1.expect.any(String));
160
+ }));
162
161
  let orders;
163
162
  (0, globals_1.test)('getOrders', () => __awaiter(void 0, void 0, void 0, function* () {
164
163
  orders = yield consumer.ecommerce.getOrders({
@@ -191,3 +190,31 @@ let orders;
191
190
  (0, globals_1.expect)(order).toHaveProperty('lines', globals_1.expect.any(Array));
192
191
  (0, globals_1.expect)(order).toHaveProperty('other_fees');
193
192
  }));
193
+ (0, globals_1.test)('getPaymentMethods', () => __awaiter(void 0, void 0, void 0, function* () {
194
+ const paymentMethods = yield consumer.ecommerce.getPaymentMethods();
195
+ (0, globals_1.expect)(paymentMethods).toBeInstanceOf(Array);
196
+ (0, globals_1.expect)(paymentMethods.length).toBeGreaterThan(0);
197
+ (0, globals_1.expect)(paymentMethods[0]).toHaveProperty('id', globals_1.expect.any(String));
198
+ (0, globals_1.expect)(paymentMethods[0]).toHaveProperty('name', globals_1.expect.any(String));
199
+ }));
200
+ (0, globals_1.test)('getProductCategories', () => __awaiter(void 0, void 0, void 0, function* () {
201
+ const productCategories = yield consumer.ecommerce.getProductCategories();
202
+ (0, globals_1.expect)(productCategories).toBeInstanceOf(Array);
203
+ (0, globals_1.expect)(productCategories.length).toBeGreaterThan(0);
204
+ (0, globals_1.expect)(productCategories[0]).toHaveProperty('id', globals_1.expect.any(String));
205
+ (0, globals_1.expect)(productCategories[0]).toHaveProperty('name', globals_1.expect.any(String));
206
+ }));
207
+ (0, globals_1.test)('getCountries', () => __awaiter(void 0, void 0, void 0, function* () {
208
+ const countries = yield consumer.ecommerce.getCountries();
209
+ (0, globals_1.expect)(countries).toBeInstanceOf(Array);
210
+ (0, globals_1.expect)(countries.length).toBeGreaterThan(0);
211
+ (0, globals_1.expect)(countries[0]).toHaveProperty('code', globals_1.expect.any(String));
212
+ (0, globals_1.expect)(countries[0]).toHaveProperty('name', globals_1.expect.any(String));
213
+ }));
214
+ (0, globals_1.test)('getTaxes', () => __awaiter(void 0, void 0, void 0, function* () {
215
+ const taxes = yield consumer.ecommerce.getTaxes();
216
+ (0, globals_1.expect)(taxes).toBeInstanceOf(Array);
217
+ (0, globals_1.expect)(taxes.length).toBeGreaterThan(0);
218
+ (0, globals_1.expect)(taxes[0]).toHaveProperty('id', globals_1.expect.any(String));
219
+ (0, globals_1.expect)(taxes[0]).toHaveProperty('rate', globals_1.expect.any(Number));
220
+ }));
@@ -45,14 +45,14 @@ const client = new chift.API({
45
45
  // Split testing between two APIs to support all endpoints
46
46
  const cashpadConsumerId = process.env.CHIFT_CASHPAD_CONSUMER_ID;
47
47
  const lightspeedConsumerId = process.env.CHIFT_LIGHTSPEED_CONSUMER_ID;
48
- const zeltyConsumerId = process.env.CHIFT_ZELTY_CONSUMER_ID;
48
+ const popinaConsumerId = process.env.CHIFT_POPINA_CONSUMER_ID;
49
49
  let cashpadConsumer;
50
50
  let lightspeedConsumer;
51
- let zeltyConsumer;
51
+ let popinaConsumer;
52
52
  (0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
53
53
  cashpadConsumer = yield client.Consumers.getConsumerById(cashpadConsumerId);
54
54
  lightspeedConsumer = yield client.Consumers.getConsumerById(lightspeedConsumerId);
55
- zeltyConsumer = yield client.Consumers.getConsumerById(zeltyConsumerId);
55
+ popinaConsumer = yield client.Consumers.getConsumerById(popinaConsumerId);
56
56
  }));
57
57
  (0, globals_1.test)('getLocations', () => __awaiter(void 0, void 0, void 0, function* () {
58
58
  const locations = yield lightspeedConsumer.pos.getLocations();
@@ -166,12 +166,17 @@ globals_1.test.skip('updateOrder', () => __awaiter(void 0, void 0, void 0, funct
166
166
  (0, globals_1.expect)(order).toHaveProperty('id', globals_1.expect.any(String));
167
167
  }));
168
168
  (0, globals_1.test)('getProducts', () => __awaiter(void 0, void 0, void 0, function* () {
169
- const products = yield zeltyConsumer.pos.getProducts();
169
+ const products = yield popinaConsumer.pos.getProducts();
170
170
  (0, globals_1.expect)(products).toBeInstanceOf(Array);
171
171
  (0, globals_1.expect)(products.length).toBeGreaterThan(0);
172
172
  }));
173
173
  (0, globals_1.test)('getProductCategories', () => __awaiter(void 0, void 0, void 0, function* () {
174
- const productCategories = yield zeltyConsumer.pos.getProductCategories();
174
+ const productCategories = yield popinaConsumer.pos.getProductCategories();
175
175
  (0, globals_1.expect)(productCategories).toBeInstanceOf(Array);
176
176
  (0, globals_1.expect)(productCategories.length).toBeGreaterThan(0);
177
177
  }));
178
+ (0, globals_1.test)('getAccountingCategories', () => __awaiter(void 0, void 0, void 0, function* () {
179
+ const accountingCategories = yield popinaConsumer.pos.getAccountingCategories();
180
+ (0, globals_1.expect)(accountingCategories).toBeInstanceOf(Array);
181
+ (0, globals_1.expect)(accountingCategories.length).toBeGreaterThan(0);
182
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chift/chift-nodejs",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dev": "chokidar src --command 'npm run build' --debounce=5000",
9
9
  "prepare": "husky install",
10
10
  "build": "tsc",
11
- "test": "jest"
11
+ "test": "jest --maxWorkers 1"
12
12
  },
13
13
  "keywords": [],
14
14
  "author": "Chift",
@@ -37,14 +37,20 @@ type getOutstandingsParams = Omit<
37
37
  >;
38
38
 
39
39
  const accountingFactory = {
40
- getAnalyticPlans(): RequestData<components['schemas']['AnalyticPlanItem'][]> {
40
+ getAnalyticPlans(
41
+ params: operations['accounting_get_analytic_plans']['parameters']['query']
42
+ ): RequestData<components['schemas']['AnalyticPlanItem'][]> {
41
43
  return {
44
+ params,
42
45
  method: 'get',
43
46
  url: '/consumers/{consumer_id}/accounting/analytic-plans',
44
47
  };
45
48
  },
46
- getClients(): RequestData<components['schemas']['ClientItemOut'][]> {
49
+ getClients(
50
+ params: operations['accounting_get_clients']['parameters']['query']
51
+ ): RequestData<components['schemas']['ClientItemOut'][]> {
47
52
  return {
53
+ params,
48
54
  method: 'get',
49
55
  url: '/consumers/{consumer_id}/accounting/clients',
50
56
  };
@@ -54,30 +60,39 @@ const accountingFactory = {
54
60
  params: operations['accounting_create_client']['parameters']['query']
55
61
  ): RequestData<components['schemas']['ClientItemOut']> {
56
62
  return {
63
+ params,
57
64
  method: 'post',
58
65
  url: '/consumers/{consumer_id}/accounting/clients',
59
66
  body: client,
60
- params: params,
61
67
  };
62
68
  },
63
- getClient(clientId: string): RequestData<components['schemas']['ClientItemOut']> {
69
+ getClient(
70
+ clientId: string,
71
+ params: operations['accounting_get_client']['parameters']['query']
72
+ ): RequestData<components['schemas']['ClientItemOut']> {
64
73
  return {
74
+ params,
65
75
  method: 'get',
66
76
  url: `/consumers/{consumer_id}/accounting/clients/${clientId}`,
67
77
  };
68
78
  },
69
79
  updateClient(
70
80
  clientId: string,
71
- client: components['schemas']['ClientItemUpdate']
81
+ client: components['schemas']['ClientItemUpdate'],
82
+ params: operations['accounting_update_client']['parameters']['query']
72
83
  ): RequestData<components['schemas']['ClientItemOut']> {
73
84
  return {
85
+ params,
74
86
  method: 'patch',
75
87
  url: `/consumers/{consumer_id}/accounting/clients/${clientId}`,
76
88
  body: client,
77
89
  };
78
90
  },
79
- getSuppliers(): RequestData<components['schemas']['SupplierItemOut'][]> {
91
+ getSuppliers(
92
+ params: operations['accounting_get_suppliers']['parameters']['query']
93
+ ): RequestData<components['schemas']['SupplierItemOut'][]> {
80
94
  return {
95
+ params,
81
96
  method: 'get',
82
97
  url: '/consumers/{consumer_id}/accounting/suppliers',
83
98
  };
@@ -87,23 +102,29 @@ const accountingFactory = {
87
102
  params: operations['accounting_create_supplier']['parameters']['query']
88
103
  ): RequestData<components['schemas']['SupplierItemOut']> {
89
104
  return {
105
+ params,
90
106
  method: 'post',
91
107
  url: '/consumers/{consumer_id}/accounting/suppliers',
92
108
  body: supplier,
93
- params: params,
94
109
  };
95
110
  },
96
- getSupplier(supplierId: string): RequestData<components['schemas']['SupplierItemOut']> {
111
+ getSupplier(
112
+ supplierId: string,
113
+ params: operations['accounting_get_supplier']['parameters']['query']
114
+ ): RequestData<components['schemas']['SupplierItemOut']> {
97
115
  return {
116
+ params,
98
117
  method: 'get',
99
118
  url: `/consumers/{consumer_id}/accounting/suppliers/${supplierId}`,
100
119
  };
101
120
  },
102
121
  updateSupplier(
103
122
  supplierId: string,
104
- supplier: components['schemas']['SupplierItemUpdate']
123
+ supplier: components['schemas']['SupplierItemUpdate'],
124
+ params: operations['accounting_update_supplier']['parameters']['query']
105
125
  ): RequestData<components['schemas']['SupplierItemOut']> {
106
126
  return {
127
+ params,
107
128
  method: 'patch',
108
129
  url: `/consumers/{consumer_id}/accounting/suppliers/${supplierId}`,
109
130
  body: supplier,
@@ -172,43 +193,54 @@ const accountingFactory = {
172
193
  };
173
194
  },
174
195
  createAnalyticAccount(
175
- analyticAccount: components['schemas']['AnalyticAccountItemIn']
196
+ analyticAccount: components['schemas']['AnalyticAccountItemIn'],
197
+ params: operations['accounting_create_analytic_account']['parameters']['query']
176
198
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
177
199
  return {
200
+ params,
178
201
  method: 'post',
179
202
  url: '/consumers/{consumer_id}/accounting/analytic-accounts',
180
203
  body: analyticAccount,
181
204
  };
182
205
  },
183
- getAnalyticAccounts(): RequestData<components['schemas']['AnalyticAccountItemOut'][]> {
206
+ getAnalyticAccounts(
207
+ params: operations['accounting_get_analytic_accounts']['parameters']['query']
208
+ ): RequestData<components['schemas']['AnalyticAccountItemOut'][]> {
184
209
  return {
210
+ params,
185
211
  method: 'get',
186
212
  url: '/consumers/{consumer_id}/accounting/analytic-accounts',
187
213
  };
188
214
  },
189
215
  createAnalyticAccountWithMultiplePlans(
190
216
  analytic_plan: string,
191
- analyticAccount: components['schemas']['AnalyticAccountItemIn']
217
+ analyticAccount: components['schemas']['AnalyticAccountItemIn'],
218
+ params: operations['accounting_create_analytic_account_multi_plans']['parameters']['query']
192
219
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
193
220
  return {
221
+ params,
194
222
  method: 'post',
195
223
  url: `/consumers/{consumer_id}/accounting/analytic-accounts/multi-analytic-plans/${analytic_plan}`,
196
224
  body: analyticAccount,
197
225
  };
198
226
  },
199
227
  getAnalyticAccount(
200
- analytic_account_id: string
228
+ analytic_account_id: string,
229
+ params: operations['accounting_get_analytic_account']['parameters']['query']
201
230
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
202
231
  return {
232
+ params,
203
233
  method: 'get',
204
234
  url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}`,
205
235
  };
206
236
  },
207
237
  updateAnalyticAccount(
208
238
  analytic_account_id: string,
209
- analyticAccount: components['schemas']['AnalyticAccountItemUpdate']
239
+ analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
240
+ params: operations['accounting_update_analytic_account']['parameters']['query']
210
241
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
211
242
  return {
243
+ params,
212
244
  method: 'patch',
213
245
  url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}`,
214
246
  body: analyticAccount,
@@ -216,9 +248,11 @@ const accountingFactory = {
216
248
  },
217
249
  getAnalyticAccountWithMultiplePlans(
218
250
  analytic_account_id: string,
219
- analytic_plan: string
251
+ analytic_plan: string,
252
+ params: operations['accounting_get_analytic_account_multi_plans']['parameters']['query']
220
253
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
221
254
  return {
255
+ params,
222
256
  method: 'get',
223
257
  url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}/multi-analytic-plans/${analytic_plan}`,
224
258
  };
@@ -226,30 +260,25 @@ const accountingFactory = {
226
260
  updateAnalyticAccountWithMultiplePlans(
227
261
  analytic_account_id: string,
228
262
  analytic_plan: string,
229
- analyticAccount: components['schemas']['AnalyticAccountItemUpdate']
263
+ analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
264
+ params: operations['accounting_update_analytic_account_multi_plans']['parameters']['query']
230
265
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
231
266
  return {
267
+ params,
232
268
  method: 'patch',
233
269
  url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}/multi-analytic-plans/${analytic_plan}`,
234
270
  body: analyticAccount,
235
271
  };
236
272
  },
237
- getAnalyticAccountsWithMultiplePlans(): RequestData<
238
- components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans'][]
239
- > {
273
+ getAnalyticAccountsWithMultiplePlans(
274
+ params: operations['accounting_get_analytic_accounts_multi_plans']['parameters']['query']
275
+ ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans'][]> {
240
276
  return {
277
+ params,
241
278
  method: 'get',
242
279
  url: '/consumers/{consumer_id}/accounting/analytic-accounts/multi-analytic-plans',
243
280
  };
244
281
  },
245
- getAnalyticLinesOfAccount(
246
- analytic_account_id: string
247
- ): RequestData<components['schemas']['AnalyticAccountLineItemOut'][]> {
248
- return {
249
- method: 'get',
250
- url: `/consumers/{consumer_id}/accounting/analytic-account-lines/account/${analytic_account_id}`,
251
- };
252
- },
253
282
  getJournalEntries(
254
283
  params: getJournalEntriesParams
255
284
  ): RequestData<components['schemas']['JournalEntryMonoAnalyticPlan'][]> {
@@ -268,20 +297,30 @@ const accountingFactory = {
268
297
  url: `/consumers/{consumer_id}/accounting/journal/entries/multi-analytic-plans`,
269
298
  };
270
299
  },
271
- getPaymentsByInvoiceId(invoice_id: string): RequestData<components['schemas']['Payment'][]> {
300
+ getPaymentsByInvoiceId(
301
+ invoice_id: string,
302
+ params: operations['accounting_get_payments_by_invoice']['parameters']['query']
303
+ ): RequestData<components['schemas']['Payment'][]> {
272
304
  return {
305
+ params,
273
306
  method: 'get',
274
307
  url: `/consumers/{consumer_id}/accounting/invoices/id/${invoice_id}/payments`,
275
308
  };
276
309
  },
277
- getJournals(): RequestData<components['schemas']['Journal'][]> {
310
+ getJournals(
311
+ params: operations['accounting_get_journals']['parameters']['query']
312
+ ): RequestData<components['schemas']['Journal'][]> {
278
313
  return {
314
+ params,
279
315
  method: 'get',
280
316
  url: `/consumers/{consumer_id}/accounting/journals`,
281
317
  };
282
318
  },
283
- getVatCodes(): RequestData<components['schemas']['app__routers__accounting__VatCode'][]> {
319
+ getVatCodes(
320
+ params: operations['accounting_get_vat_codes']['parameters']['query']
321
+ ): RequestData<components['schemas']['app__routers__accounting__VatCode'][]> {
284
322
  return {
323
+ params,
285
324
  method: 'get',
286
325
  url: `/consumers/{consumer_id}/accounting/vat-codes`,
287
326
  };
@@ -296,18 +335,22 @@ const accountingFactory = {
296
335
  };
297
336
  },
298
337
  createMiscOperation(
299
- operation: components['schemas']['MiscellaneousOperationIn']
338
+ operation: components['schemas']['MiscellaneousOperationIn'],
339
+ params: operations['accounting_create_miscellaneous_operation']['parameters']['query']
300
340
  ): RequestData<components['schemas']['MiscellaneousOperationOut']> {
301
341
  return {
342
+ params,
302
343
  method: 'post',
303
344
  url: '/consumers/{consumer_id}/accounting/miscellaneous-operation',
304
345
  body: operation,
305
346
  };
306
347
  },
307
348
  getMiscOperation(
308
- operation_id: string
349
+ operation_id: string,
350
+ params: operations['accounting_get_miscellaneous_operation']['parameters']['query']
309
351
  ): RequestData<components['schemas']['MiscellaneousOperationOut']> {
310
352
  return {
353
+ params,
311
354
  method: 'get',
312
355
  url: `/consumers/{consumer_id}/accounting/miscellaneous-operation/${operation_id}`,
313
356
  };
@@ -324,6 +367,15 @@ const accountingFactory = {
324
367
  body: attachment,
325
368
  };
326
369
  },
370
+ getAttachments(
371
+ params: operations['accounting_get_attachments']['parameters']['query']
372
+ ): RequestData<components['schemas']['AttachmentItem'][]> {
373
+ return {
374
+ params,
375
+ method: 'get',
376
+ url: `/consumers/{consumer_id}/accounting/attachments`,
377
+ };
378
+ },
327
379
  getChartOfAccounts(
328
380
  params: getChartOfAccountsParams
329
381
  ): RequestData<components['schemas']['AccountItem'][]> {
@@ -334,16 +386,21 @@ const accountingFactory = {
334
386
  };
335
387
  },
336
388
  getBalanceOfAccounts(
337
- filter: components['schemas']['AccountBalanceFilter']
389
+ filter: components['schemas']['AccountBalanceFilter'],
390
+ params: operations['accounting_get_accounts_balances']['parameters']['query']
338
391
  ): RequestData<components['schemas']['AccountBalance'][]> {
339
392
  return {
393
+ params,
340
394
  method: 'post',
341
395
  url: '/consumers/{consumer_id}/accounting/chart-of-accounts/balance',
342
396
  body: filter,
343
397
  };
344
398
  },
345
- getEmployees(): RequestData<components['schemas']['EmployeeItem'][]> {
399
+ getEmployees(
400
+ params: operations['accounting_get_employees']['parameters']['query']
401
+ ): RequestData<components['schemas']['EmployeeItem'][]> {
346
402
  return {
403
+ params,
347
404
  method: 'get',
348
405
  url: '/consumers/{consumer_id}/accounting/employees',
349
406
  };
@@ -382,7 +439,7 @@ const accountingFactory = {
382
439
  body: financial_entry,
383
440
  };
384
441
  },
385
- createJournalEntry(
442
+ createJournalEntryOld(
386
443
  journal_entry: components['schemas']['JournalEntryIn']
387
444
  ): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan']> {
388
445
  return {
@@ -391,6 +448,34 @@ const accountingFactory = {
391
448
  body: journal_entry,
392
449
  };
393
450
  },
451
+ createJournalEntry(
452
+ journal_entry: components['schemas']['GenericJournalEntry'],
453
+ params: operations['accounting_create_generic_journal_entry']['parameters']['query']
454
+ ): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan']> {
455
+ return {
456
+ params,
457
+ method: 'post',
458
+ url: '/consumers/{consumer_id}/accounting/journal-entries',
459
+ body: journal_entry,
460
+ };
461
+ },
462
+ matchEntries(
463
+ body: components['schemas']['MatchingIn'],
464
+ params: operations['accounting_match_entries']['parameters']['query']
465
+ ): RequestData<components['schemas']['MatchingOut']> {
466
+ return {
467
+ params,
468
+ body,
469
+ method: 'post',
470
+ url: '/consumers/{consumer_id}/accounting/matching',
471
+ };
472
+ },
473
+ getFolders(): RequestData<components['schemas']['FolderItem'][]> {
474
+ return {
475
+ method: 'get',
476
+ url: '/consumers/{consumer_id}/accounting/folders',
477
+ };
478
+ },
394
479
  };
395
480
 
396
481
  export { accountingFactory };
@@ -1,7 +1,7 @@
1
1
  import { AuthType } from '../types/api';
2
2
  import { InternalAPI } from './internalApi';
3
3
  import { Consumers } from './consumers';
4
- import { Syncs } from './syncs';
4
+ import { Syncs, SyncsAPI } from './syncs';
5
5
  import { Integrations } from './integrations';
6
6
  import { Webhooks } from './webhooks';
7
7
  import { DataStores } from './datastores';
@@ -11,7 +11,7 @@ export class API {
11
11
  token?: string;
12
12
  internalApi?: any;
13
13
  Consumers;
14
- Syncs;
14
+ Syncs: SyncsAPI;
15
15
  Integrations;
16
16
  Webhooks;
17
17
  DataStores;
@@ -80,6 +80,18 @@ const Consumer = (
80
80
  return data;
81
81
  };
82
82
 
83
+ const enableFlow = async (
84
+ syncId: string,
85
+ flowId: string,
86
+ body: components['schemas']['EnableFlowConsumer']
87
+ ) => {
88
+ const { data }: { data: SimpleResponseModel } = await _internalApi.post(
89
+ `/consumers/${consumerId}/syncs/${syncId}/flows/${flowId}/enable`,
90
+ body
91
+ );
92
+ return data;
93
+ };
94
+
83
95
  const getDataByDataStoreName = async (dataStoreName: string, params?: object) => {
84
96
  const { data }: { data: components['schemas']['DataStoreItem'][] } = await _internalApi.get(
85
97
  `/datastores`
@@ -135,6 +147,13 @@ const Consumer = (
135
147
  return response;
136
148
  };
137
149
 
150
+ const deleteDataStoreData = async (dataStoreId: string, dataStoreDataId: string) => {
151
+ const { data: response }: { data: SimpleResponseModel } = await _internalApi.delete(
152
+ `/consumers/${consumerId}/datastore/${dataStoreId}/data/${dataStoreDataId}`
153
+ );
154
+ return response;
155
+ };
156
+
138
157
  /**
139
158
  * This function is used to add logs related to a chainexecution (passed in the header)
140
159
  * INTERNAL USE only
@@ -155,6 +174,7 @@ const Consumer = (
155
174
  createConnection,
156
175
  updateConnection,
157
176
  deleteConnection,
177
+ enableFlow,
158
178
  getSyncUrl,
159
179
  name,
160
180
  redirect_url,
@@ -170,6 +190,7 @@ const Consumer = (
170
190
  getDataByDataStoreName,
171
191
  addDataByDataStoreName,
172
192
  updateDataStoreData,
193
+ deleteDataStoreData,
173
194
  logData,
174
195
  };
175
196
  };
@@ -6,6 +6,26 @@ type getOrdersParams = Omit<
6
6
  'page' | 'size'
7
7
  >;
8
8
 
9
+ type getPaymentMethodsParams = Omit<
10
+ operations['ecommerce_get_payments_methods']['parameters']['query'],
11
+ 'page' | 'size'
12
+ >;
13
+
14
+ type getProductCategoriesParams = Omit<
15
+ operations['ecommerce_get_product_categories']['parameters']['query'],
16
+ 'page' | 'size'
17
+ >;
18
+
19
+ type getTaxesParams = Omit<
20
+ operations['ecommerce_get_taxes']['parameters']['query'],
21
+ 'page' | 'size'
22
+ >;
23
+
24
+ type getCountriesParams = Omit<
25
+ operations['ecommerce_get_countries']['parameters']['query'],
26
+ 'page' | 'size'
27
+ >;
28
+
9
29
  const ecommerceFactory = {
10
30
  getCustomers(): RequestData<components['schemas']['CommerceCustomerItem'][]> {
11
31
  return {
@@ -77,6 +97,38 @@ const ecommerceFactory = {
77
97
  url: `/consumers/{consumer_id}/commerce/orders/${orderId}`,
78
98
  };
79
99
  },
100
+ getPaymentMethods(
101
+ params: getPaymentMethodsParams
102
+ ): RequestData<components['schemas']['PaymentMethodItem'][]> {
103
+ return {
104
+ params,
105
+ method: 'get',
106
+ url: `/consumers/{consumer_id}/commerce/payment-methods`,
107
+ };
108
+ },
109
+ getProductCategories(
110
+ params: getProductCategoriesParams
111
+ ): RequestData<components['schemas']['CategoryItem'][]> {
112
+ return {
113
+ params,
114
+ method: 'get',
115
+ url: `/consumers/{consumer_id}/commerce/product-categories`,
116
+ };
117
+ },
118
+ getTaxes(params: getTaxesParams): RequestData<components['schemas']['TaxRateItem'][]> {
119
+ return {
120
+ params,
121
+ method: 'get',
122
+ url: `/consumers/{consumer_id}/commerce/taxes`,
123
+ };
124
+ },
125
+ getCountries(params: getCountriesParams): RequestData<components['schemas']['CountryItem'][]> {
126
+ return {
127
+ params,
128
+ method: 'get',
129
+ url: `/consumers/{consumer_id}/commerce/countries`,
130
+ };
131
+ },
80
132
  };
81
133
 
82
134
  export { ecommerceFactory };