@chift/chift-nodejs 1.0.22 → 1.0.24
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 +37 -0
- package/dist/src/modules/accounting.d.ts +46 -42
- package/dist/src/modules/accounting.js +117 -42
- package/dist/src/modules/api.d.ts +13477 -11015
- package/dist/src/modules/banking.d.ts +13 -0
- package/dist/src/modules/banking.js +38 -0
- package/dist/src/modules/consumer.d.ts +2639 -2163
- package/dist/src/modules/consumer.js +3 -0
- package/dist/src/modules/consumers.d.ts +13432 -10982
- package/dist/src/modules/custom.d.ts +4 -4
- package/dist/src/modules/custom.js +6 -3
- package/dist/src/modules/datastores.d.ts +12 -6
- package/dist/src/modules/ecommerce.d.ts +18 -15
- package/dist/src/modules/ecommerce.js +32 -14
- package/dist/src/modules/flow.d.ts +2 -2
- package/dist/src/modules/integrations.d.ts +4 -2
- package/dist/src/modules/internalApi.js +8 -0
- package/dist/src/modules/invoicing.d.ts +16 -16
- package/dist/src/modules/invoicing.js +33 -18
- package/dist/src/modules/payment.d.ts +6 -6
- package/dist/src/modules/payment.js +10 -5
- package/dist/src/modules/pms.d.ts +8 -8
- package/dist/src/modules/pms.js +16 -8
- package/dist/src/modules/pos.d.ts +15 -15
- package/dist/src/modules/pos.js +29 -15
- package/dist/src/modules/sync.d.ts +10804 -8842
- package/dist/src/modules/webhooks.d.ts +12 -12
- package/dist/src/types/api.d.ts +8 -0
- package/dist/src/types/public-api/mappings.d.ts +128 -1
- package/dist/src/types/public-api/schema.d.ts +4575 -1985
- package/dist/test/modules/accounting.test.js +101 -28
- package/dist/test/modules/banking.test.d.ts +1 -0
- package/dist/test/modules/banking.test.js +94 -0
- package/dist/test/modules/client-request-id.test.d.ts +1 -0
- package/dist/test/modules/client-request-id.test.js +135 -0
- package/dist/test/modules/consumer.test.js +2 -2
- package/dist/test/modules/ecommerce.test.js +2 -1
- package/dist/test/modules/invoicing-pdf.test.d.ts +1 -0
- package/dist/test/modules/invoicing-pdf.test.js +34 -0
- package/dist/test/modules/invoicing.test.js +3 -1
- package/dist/test/modules/payment.test.js +5 -4
- package/dist/test/modules/raw-data.test.d.ts +1 -0
- package/dist/test/modules/raw-data.test.js +55 -0
- package/package.json +1 -1
- package/src/types/public-api/schema.d.ts +4575 -1985
|
@@ -110,6 +110,8 @@ let clients;
|
|
|
110
110
|
(0, globals_1.expect)(clients[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
111
111
|
}));
|
|
112
112
|
(0, globals_1.test)('getClient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
if (!clients[0].id)
|
|
114
|
+
throw new Error('Client ID is required');
|
|
113
115
|
const client = yield consumer.accounting.getClient(clients[0].id);
|
|
114
116
|
(0, globals_1.expect)(client).toBeTruthy();
|
|
115
117
|
(0, globals_1.expect)(client).toHaveProperty('external_reference');
|
|
@@ -134,8 +136,21 @@ let clients;
|
|
|
134
136
|
}));
|
|
135
137
|
globals_1.test.skip('updateClient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
138
|
const client = clients.find((client) => client.external_reference === 'sdk test');
|
|
137
|
-
|
|
139
|
+
if (!(client === null || client === void 0 ? void 0 : client.id))
|
|
140
|
+
throw new Error('Client id not found');
|
|
141
|
+
const updatedClient = yield consumer.accounting.updateClient(client.id, {
|
|
138
142
|
website: 'https://test.com',
|
|
143
|
+
is_company: true,
|
|
144
|
+
active: true,
|
|
145
|
+
addresses: [
|
|
146
|
+
{
|
|
147
|
+
address_type: 'main',
|
|
148
|
+
street: 'Main Street',
|
|
149
|
+
city: 'Brussels',
|
|
150
|
+
postal_code: '1000',
|
|
151
|
+
country: 'BE',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
139
154
|
});
|
|
140
155
|
(0, globals_1.expect)(updatedClient).toBeTruthy();
|
|
141
156
|
(0, globals_1.expect)(updatedClient).toHaveProperty('website', 'https://test.com');
|
|
@@ -168,7 +183,8 @@ let suppliers;
|
|
|
168
183
|
(0, globals_1.expect)(suppliers.length).toBeGreaterThan(0);
|
|
169
184
|
}));
|
|
170
185
|
(0, globals_1.test)('getSupplier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
-
|
|
186
|
+
var _a;
|
|
187
|
+
const supplier = yield consumer.accounting.getSupplier(((_a = suppliers[0]) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
172
188
|
(0, globals_1.expect)(supplier).toBeTruthy();
|
|
173
189
|
(0, globals_1.expect)(supplier).toHaveProperty('external_reference');
|
|
174
190
|
(0, globals_1.expect)(supplier).toHaveProperty('first_name');
|
|
@@ -192,14 +208,28 @@ let suppliers;
|
|
|
192
208
|
}));
|
|
193
209
|
globals_1.test.skip('updateSupplier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
194
210
|
const supplier = suppliers.find((supplier) => supplier.external_reference === 'sdk test');
|
|
195
|
-
|
|
211
|
+
if (!(supplier === null || supplier === void 0 ? void 0 : supplier.id)) {
|
|
212
|
+
throw new Error('Supplier not found');
|
|
213
|
+
}
|
|
214
|
+
const updatedSupplier = yield consumer.accounting.updateSupplier(supplier.id, {
|
|
196
215
|
name: 'Jane Updated Doe',
|
|
216
|
+
is_company: true,
|
|
217
|
+
active: true,
|
|
218
|
+
addresses: [
|
|
219
|
+
{
|
|
220
|
+
address_type: 'main',
|
|
221
|
+
street: 'Main Street',
|
|
222
|
+
city: 'Brussels',
|
|
223
|
+
postal_code: '1000',
|
|
224
|
+
country: 'BE',
|
|
225
|
+
},
|
|
226
|
+
],
|
|
197
227
|
});
|
|
198
228
|
(0, globals_1.expect)(updatedSupplier).toBeTruthy();
|
|
199
229
|
(0, globals_1.expect)(updatedSupplier).toHaveProperty('name', 'Jane Updated Doe');
|
|
200
230
|
}));
|
|
201
231
|
(0, globals_1.test)('createInvoice', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
202
|
-
var
|
|
232
|
+
var _b;
|
|
203
233
|
const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
|
|
204
234
|
if (!journal) {
|
|
205
235
|
throw new Error('No journal with type "customer_invoice" found to create invoice');
|
|
@@ -216,7 +246,7 @@ globals_1.test.skip('updateSupplier', () => __awaiter(void 0, void 0, void 0, fu
|
|
|
216
246
|
untaxed_amount: 100,
|
|
217
247
|
tax_amount: 21,
|
|
218
248
|
total: 121,
|
|
219
|
-
partner_id: (
|
|
249
|
+
partner_id: (_b = clients[0]) === null || _b === void 0 ? void 0 : _b.id,
|
|
220
250
|
journal_id: journal.id,
|
|
221
251
|
status: 'draft',
|
|
222
252
|
currency_exchange_rate: 1,
|
|
@@ -259,8 +289,10 @@ let invoices;
|
|
|
259
289
|
(0, globals_1.expect)(invoicesWithMultiplePlans[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
260
290
|
}));
|
|
261
291
|
(0, globals_1.test)('getInvoice', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
292
|
+
if (!(invoices === null || invoices === void 0 ? void 0 : invoices[0].id))
|
|
293
|
+
throw new Error('Invoice ID is required');
|
|
262
294
|
const invoice = yield consumer.accounting.getInvoice(invoices[0].id, {
|
|
263
|
-
include_payments: true,
|
|
295
|
+
include_payments: 'true',
|
|
264
296
|
});
|
|
265
297
|
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
266
298
|
(0, globals_1.expect)(invoice).toHaveProperty('id', invoices[0].id);
|
|
@@ -283,7 +315,7 @@ let invoices;
|
|
|
283
315
|
(0, globals_1.expect)(invoices[0]).toHaveProperty('lines', globals_1.expect.any(Array));
|
|
284
316
|
}));
|
|
285
317
|
(0, globals_1.test)('createInvoiceWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
286
|
-
var
|
|
318
|
+
var _c;
|
|
287
319
|
const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
|
|
288
320
|
if (!journal) {
|
|
289
321
|
throw new Error('No journal with type customer_invoice found to create Invoice With Multiple Plans');
|
|
@@ -300,7 +332,7 @@ let invoices;
|
|
|
300
332
|
untaxed_amount: 100,
|
|
301
333
|
tax_amount: 21,
|
|
302
334
|
total: 121,
|
|
303
|
-
partner_id: (
|
|
335
|
+
partner_id: (_c = clients[0]) === null || _c === void 0 ? void 0 : _c.id,
|
|
304
336
|
journal_id: journal.id,
|
|
305
337
|
status: 'draft',
|
|
306
338
|
currency_exchange_rate: 1,
|
|
@@ -316,6 +348,7 @@ let invoices;
|
|
|
316
348
|
account_number: '700000',
|
|
317
349
|
tax_code: vatCode.id,
|
|
318
350
|
line_number: 1,
|
|
351
|
+
analytic_distribution: [],
|
|
319
352
|
},
|
|
320
353
|
],
|
|
321
354
|
};
|
|
@@ -323,8 +356,10 @@ let invoices;
|
|
|
323
356
|
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
324
357
|
}));
|
|
325
358
|
(0, globals_1.test)('getInvoiceWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
359
|
+
if (!(invoices === null || invoices === void 0 ? void 0 : invoices[0].id))
|
|
360
|
+
throw new Error('Invoice ID is required');
|
|
326
361
|
const invoice = yield consumer.accounting.getInvoiceWithMultiplePlans(invoices[0].id, {
|
|
327
|
-
include_payments: true,
|
|
362
|
+
include_payments: 'true',
|
|
328
363
|
});
|
|
329
364
|
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
330
365
|
}));
|
|
@@ -351,6 +386,7 @@ globals_1.test.skip('createAnalyticAccountWithMultiplePlans', () => __awaiter(vo
|
|
|
351
386
|
throw new Error('No analytic plans found to create analytic account with multiple plans');
|
|
352
387
|
}
|
|
353
388
|
const analyticAccount = yield consumer.accounting.createAnalyticAccountWithMultiplePlans(analyticPlans[0].id, {
|
|
389
|
+
active: false,
|
|
354
390
|
code: '4000',
|
|
355
391
|
name: 'sdk test',
|
|
356
392
|
currency: 'EUR',
|
|
@@ -369,7 +405,10 @@ globals_1.test.skip('updateAnalyticAccount', () => __awaiter(void 0, void 0, voi
|
|
|
369
405
|
throw new Error('No analytic accounts found to update analytic account');
|
|
370
406
|
}
|
|
371
407
|
const testAnalyticAccount = analyticAccounts.find((account) => account.name === 'sdk test');
|
|
372
|
-
|
|
408
|
+
if (!(testAnalyticAccount === null || testAnalyticAccount === void 0 ? void 0 : testAnalyticAccount.id)) {
|
|
409
|
+
throw new Error('No analytic account with name "sdk test" found to update');
|
|
410
|
+
}
|
|
411
|
+
const analyticAccount = yield consumer.accounting.updateAnalyticAccount(testAnalyticAccount.id, { active: true, name: 'test sdk update' });
|
|
373
412
|
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
374
413
|
(0, globals_1.expect)(analyticAccount).toHaveProperty('name', 'test sdk update');
|
|
375
414
|
}));
|
|
@@ -385,7 +424,10 @@ globals_1.test.skip('updateAnalyticAccountWithMultiplePlans', () => __awaiter(vo
|
|
|
385
424
|
throw new Error('No analytic accounts found to update analytic account with multiple plans');
|
|
386
425
|
}
|
|
387
426
|
const testAnalyticAccount = analyticAccounts.find((account) => account.name === 'test sdk update');
|
|
388
|
-
|
|
427
|
+
if (!(testAnalyticAccount === null || testAnalyticAccount === void 0 ? void 0 : testAnalyticAccount.id)) {
|
|
428
|
+
throw new Error('No analytic account with name "test sdk update" found to update');
|
|
429
|
+
}
|
|
430
|
+
const analyticAccount = yield consumer.accounting.updateAnalyticAccountWithMultiplePlans(testAnalyticAccount.id, '1', { name: 'test sdk update 2', active: true });
|
|
389
431
|
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
390
432
|
(0, globals_1.expect)(analyticAccount).toHaveProperty('name', 'test sdk update 2');
|
|
391
433
|
}));
|
|
@@ -401,18 +443,22 @@ globals_1.test.skip('createJournalEntry', () => __awaiter(void 0, void 0, void 0
|
|
|
401
443
|
if (!clients.length) {
|
|
402
444
|
throw new Error('No clients found to create journal entry');
|
|
403
445
|
}
|
|
446
|
+
if (!clients[0].id) {
|
|
447
|
+
throw new Error('No client found to create journal entry');
|
|
448
|
+
}
|
|
404
449
|
const journalEntry = yield consumer.accounting.createJournalEntry({
|
|
405
450
|
journal_id: journal.id,
|
|
406
|
-
number: new Date().valueOf(),
|
|
451
|
+
number: new Date().valueOf().toString(),
|
|
407
452
|
currency: 'EUR',
|
|
408
453
|
date: '2022-01-01',
|
|
454
|
+
currency_exchange_rate: 0,
|
|
455
|
+
posted: false,
|
|
409
456
|
items: [
|
|
410
457
|
{
|
|
411
458
|
account_type: 'customer_account',
|
|
412
459
|
account: clients[0].id,
|
|
413
460
|
credit: 0,
|
|
414
461
|
debit: 10,
|
|
415
|
-
currency: 'EUR',
|
|
416
462
|
prioritise_thirdparty_account: false,
|
|
417
463
|
analytic_distribution: [],
|
|
418
464
|
},
|
|
@@ -421,9 +467,10 @@ globals_1.test.skip('createJournalEntry', () => __awaiter(void 0, void 0, void 0
|
|
|
421
467
|
(0, globals_1.expect)(journalEntry).toBeTruthy();
|
|
422
468
|
(0, globals_1.expect)(journalEntry).toHaveProperty('journal_id', journal.id);
|
|
423
469
|
}));
|
|
470
|
+
let journalEntries;
|
|
424
471
|
(0, globals_1.test)('getJournalEntries', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
425
|
-
|
|
426
|
-
unposted_allowed: true,
|
|
472
|
+
journalEntries = yield consumer.accounting.getJournalEntries({
|
|
473
|
+
unposted_allowed: 'true',
|
|
427
474
|
date_from: '2022-01-01',
|
|
428
475
|
date_to: '2022-01-31',
|
|
429
476
|
journal_id: journals[0].id,
|
|
@@ -432,7 +479,7 @@ globals_1.test.skip('createJournalEntry', () => __awaiter(void 0, void 0, void 0
|
|
|
432
479
|
}));
|
|
433
480
|
(0, globals_1.test)('getJournalEntriesWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
434
481
|
const journalEntries = yield consumer.accounting.getJournalEntriesWithMultiplePlans({
|
|
435
|
-
unposted_allowed: true,
|
|
482
|
+
unposted_allowed: 'true',
|
|
436
483
|
date_from: '2022-01-01',
|
|
437
484
|
date_to: '2022-01-31',
|
|
438
485
|
journal_id: journals[0].id,
|
|
@@ -440,6 +487,8 @@ globals_1.test.skip('createJournalEntry', () => __awaiter(void 0, void 0, void 0
|
|
|
440
487
|
(0, globals_1.expect)(journalEntries).toBeInstanceOf(Array);
|
|
441
488
|
}));
|
|
442
489
|
(0, globals_1.test)('getPaymentsByInvoiceId', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
490
|
+
if (!(invoices === null || invoices === void 0 ? void 0 : invoices[0].id))
|
|
491
|
+
throw new Error('Invoice ID is required');
|
|
443
492
|
const payments = yield consumer.accounting.getPaymentsByInvoiceId(invoices[0].id);
|
|
444
493
|
(0, globals_1.expect)(payments).toBeInstanceOf(Array);
|
|
445
494
|
}));
|
|
@@ -451,10 +500,11 @@ let miscOperations;
|
|
|
451
500
|
(0, globals_1.expect)(miscOperations[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
452
501
|
}));
|
|
453
502
|
(0, globals_1.test)('createMiscOperation', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
454
|
-
var
|
|
503
|
+
var _d;
|
|
455
504
|
const data = {
|
|
456
505
|
operation_date: '2023-04-29',
|
|
457
506
|
currency: 'EUR',
|
|
507
|
+
currency_exchange_rate: 1,
|
|
458
508
|
lines: [
|
|
459
509
|
{
|
|
460
510
|
line_number: 1,
|
|
@@ -464,7 +514,7 @@ let miscOperations;
|
|
|
464
514
|
account_number: '400000',
|
|
465
515
|
},
|
|
466
516
|
],
|
|
467
|
-
journal_id: (
|
|
517
|
+
journal_id: (_d = journals === null || journals === void 0 ? void 0 : journals.find((journal) => journal.journal_type === 'miscellaneous_operation')) === null || _d === void 0 ? void 0 : _d.id,
|
|
468
518
|
status: 'draft',
|
|
469
519
|
};
|
|
470
520
|
const miscOperation = yield consumer.accounting.createMiscOperation(data);
|
|
@@ -483,7 +533,9 @@ let miscOperations;
|
|
|
483
533
|
}));
|
|
484
534
|
(0, globals_1.test)('attachPDF', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
485
535
|
const pdfData = fs_1.default.readFileSync('test/data/accounting_invoice.pdf');
|
|
486
|
-
|
|
536
|
+
if (!(invoices === null || invoices === void 0 ? void 0 : invoices[0].id))
|
|
537
|
+
throw new Error('Invoice ID is required');
|
|
538
|
+
yield consumer.accounting.attachPDF(invoices[0].id, { base64_string: pdfData.toString('base64') }, { overwrite_existing: 'true' });
|
|
487
539
|
}));
|
|
488
540
|
(0, globals_1.test)('getChartOfAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
489
541
|
const chartOfAccounts = yield consumer.accounting.getChartOfAccounts({
|
|
@@ -491,40 +543,41 @@ let miscOperations;
|
|
|
491
543
|
});
|
|
492
544
|
(0, globals_1.expect)(chartOfAccounts).toBeTruthy();
|
|
493
545
|
}));
|
|
494
|
-
globals_1.test
|
|
546
|
+
(0, globals_1.test)('getBalanceOfAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
495
547
|
const balanceOfAccounts = yield consumer.accounting.getBalanceOfAccounts({
|
|
496
548
|
accounts: ['7'],
|
|
497
549
|
start: '2022-01-01',
|
|
498
550
|
end: '2022-12-31',
|
|
499
551
|
});
|
|
500
552
|
(0, globals_1.expect)(balanceOfAccounts).toBeTruthy();
|
|
501
|
-
(0, globals_1.expect)(balanceOfAccounts).
|
|
502
|
-
(0, globals_1.expect)(balanceOfAccounts.items).toBeInstanceOf(Array);
|
|
553
|
+
(0, globals_1.expect)(balanceOfAccounts).toBeInstanceOf(Array);
|
|
503
554
|
}));
|
|
504
555
|
(0, globals_1.test)('getEmployees', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
505
556
|
const employees = yield consumer.accounting.getEmployees();
|
|
506
557
|
(0, globals_1.expect)(employees).toBeTruthy();
|
|
507
558
|
}));
|
|
508
|
-
globals_1.test
|
|
559
|
+
(0, globals_1.test)('getOutstandings', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
509
560
|
const outstandings = yield consumer.accounting.getOutstandings({
|
|
510
561
|
type: 'client',
|
|
511
|
-
unposted_allowed: false,
|
|
562
|
+
unposted_allowed: 'false',
|
|
512
563
|
});
|
|
513
564
|
(0, globals_1.expect)(outstandings).toBeTruthy();
|
|
514
|
-
(0, globals_1.expect)(outstandings
|
|
565
|
+
(0, globals_1.expect)(outstandings).toBeInstanceOf(Array);
|
|
515
566
|
}));
|
|
516
567
|
(0, globals_1.test)('createFinancialEntry', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
568
|
+
var _e;
|
|
517
569
|
const journal = journals.find((journal) => journal.journal_type === 'financial_operation');
|
|
518
570
|
if (!journal) {
|
|
519
571
|
throw new Error('No journal with type "financial_operation" found to create financial entry');
|
|
520
572
|
}
|
|
521
|
-
if (!clients.
|
|
522
|
-
throw new Error('No
|
|
573
|
+
if (!((_e = clients === null || clients === void 0 ? void 0 : clients[0]) === null || _e === void 0 ? void 0 : _e.id)) {
|
|
574
|
+
throw new Error('No client ID found to create journal entry');
|
|
523
575
|
}
|
|
524
576
|
const financialEntry = yield consumer.accounting.createFinancialEntry({
|
|
525
577
|
date: '2022-01-01',
|
|
526
578
|
journal_id: journal.id,
|
|
527
579
|
currency: 'EUR',
|
|
580
|
+
currency_exchange_rate: 1,
|
|
528
581
|
items: [
|
|
529
582
|
{
|
|
530
583
|
account_type: 'customer_account',
|
|
@@ -540,14 +593,19 @@ globals_1.test.skip('getOutstandings', () => __awaiter(void 0, void 0, void 0, f
|
|
|
540
593
|
* @deprecated replaced by createFinancialEntry
|
|
541
594
|
*/
|
|
542
595
|
(0, globals_1.test)('createFinancialEntryOld', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
596
|
+
var _f;
|
|
543
597
|
const journal = journals.find((journal) => journal.journal_type === 'financial_operation');
|
|
544
598
|
if (!journal) {
|
|
545
599
|
throw new Error('No journal with type "financial_operation" found to create financial entry');
|
|
546
600
|
}
|
|
601
|
+
if (!((_f = clients === null || clients === void 0 ? void 0 : clients[0]) === null || _f === void 0 ? void 0 : _f.account_number)) {
|
|
602
|
+
throw new Error('[DEPRECATED] No client account_number found to create financial entry');
|
|
603
|
+
}
|
|
547
604
|
const financialEntry = yield consumer.accounting.createFinancialEntryOld({
|
|
548
605
|
date: '2022-01-01',
|
|
549
606
|
journal_id: journal.id,
|
|
550
607
|
currency: 'EUR',
|
|
608
|
+
currency_exchange_rate: 1,
|
|
551
609
|
items: [
|
|
552
610
|
{
|
|
553
611
|
type: 'customer_account',
|
|
@@ -571,7 +629,7 @@ let folders = [];
|
|
|
571
629
|
globals_1.test.skip('getAttachments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
572
630
|
const attachments = yield consumer.accounting.getAttachments({
|
|
573
631
|
// TODO: Add documentId from test account
|
|
574
|
-
|
|
632
|
+
document_id: '',
|
|
575
633
|
type: 'invoice',
|
|
576
634
|
});
|
|
577
635
|
(0, globals_1.expect)(attachments).toBeInstanceOf(Array);
|
|
@@ -592,3 +650,18 @@ globals_1.test.skip('matchEntries', () => __awaiter(void 0, void 0, void 0, func
|
|
|
592
650
|
const bookyears = yield consumer.accounting.getBookyears();
|
|
593
651
|
(0, globals_1.expect)(bookyears).toBeInstanceOf(Array);
|
|
594
652
|
}));
|
|
653
|
+
(0, globals_1.test)('createLedgerAccount', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
654
|
+
const body = {
|
|
655
|
+
name: 'sdk test',
|
|
656
|
+
number: '1324',
|
|
657
|
+
};
|
|
658
|
+
const ledgerAccount = yield consumer.accounting.createLedgerAccount(body);
|
|
659
|
+
(0, globals_1.expect)(ledgerAccount).toBeTruthy();
|
|
660
|
+
(0, globals_1.expect)(ledgerAccount).toHaveProperty('name', 'sdk test');
|
|
661
|
+
}));
|
|
662
|
+
(0, globals_1.test)('getJournalEntry', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
663
|
+
if (!(journalEntries === null || journalEntries === void 0 ? void 0 : journalEntries[0].id))
|
|
664
|
+
throw new Error('Journal entry ID is required');
|
|
665
|
+
const journalEntry = yield consumer.accounting.getJournalEntry(journalEntries[0].id);
|
|
666
|
+
(0, globals_1.expect)(journalEntry).toBeTruthy();
|
|
667
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const globals_1 = require("@jest/globals");
|
|
36
|
+
const chift = __importStar(require("../../src/index"));
|
|
37
|
+
const dotenv = __importStar(require("dotenv"));
|
|
38
|
+
dotenv.config();
|
|
39
|
+
const client = new chift.API({
|
|
40
|
+
baseUrl: process.env.CHIFT_BACKBONE_API,
|
|
41
|
+
clientId: process.env.CHIFT_TESTING_CLIENTID,
|
|
42
|
+
clientSecret: process.env.CHIFT_TESTING_CLIENTSECRET,
|
|
43
|
+
accountId: process.env.CHIFT_TESTING_ACCOUNTID,
|
|
44
|
+
});
|
|
45
|
+
const consumerId = process.env.CHIFT_BANKING_CONSUMER_ID;
|
|
46
|
+
let consumer;
|
|
47
|
+
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
consumer = yield client.Consumers.getConsumerById(consumerId);
|
|
49
|
+
}));
|
|
50
|
+
let financialInstitutions;
|
|
51
|
+
(0, globals_1.test)('getFinancialInstitutions', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
financialInstitutions = yield consumer.banking.getFinancialInstitutions();
|
|
53
|
+
(0, globals_1.expect)(financialInstitutions).toBeInstanceOf(Array);
|
|
54
|
+
(0, globals_1.expect)(financialInstitutions.length).toBeGreaterThan(0);
|
|
55
|
+
(0, globals_1.expect)(financialInstitutions[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
56
|
+
(0, globals_1.expect)(financialInstitutions[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
57
|
+
(0, globals_1.expect)(financialInstitutions[0]).toHaveProperty('country');
|
|
58
|
+
(0, globals_1.expect)(financialInstitutions[0]).toHaveProperty('bic');
|
|
59
|
+
}));
|
|
60
|
+
let accounts;
|
|
61
|
+
(0, globals_1.test)('getAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
accounts = yield consumer.banking.getAccounts();
|
|
63
|
+
(0, globals_1.expect)(accounts).toBeInstanceOf(Array);
|
|
64
|
+
(0, globals_1.expect)(accounts.length).toBeGreaterThan(0);
|
|
65
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
66
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('currency', globals_1.expect.any(String));
|
|
67
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('current_balance', globals_1.expect.any(Number));
|
|
68
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('available_balance', globals_1.expect.any(Number));
|
|
69
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('description', globals_1.expect.any(String));
|
|
70
|
+
(0, globals_1.expect)(accounts[0]).toHaveProperty('reference', globals_1.expect.any(String));
|
|
71
|
+
}));
|
|
72
|
+
let transactions;
|
|
73
|
+
(0, globals_1.test)('getAccountTransactions', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
if (!accounts.length) {
|
|
75
|
+
throw new Error('No accounts found to test getAccountTransactions');
|
|
76
|
+
}
|
|
77
|
+
transactions = yield consumer.banking.getAccountTransactions(accounts[0].id);
|
|
78
|
+
(0, globals_1.expect)(transactions).toBeInstanceOf(Array);
|
|
79
|
+
if (transactions.length > 0) {
|
|
80
|
+
(0, globals_1.expect)(transactions[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
81
|
+
(0, globals_1.expect)(transactions[0]).toHaveProperty('amount', globals_1.expect.any(Number));
|
|
82
|
+
(0, globals_1.expect)(transactions[0]).toHaveProperty('currency', globals_1.expect.any(String));
|
|
83
|
+
(0, globals_1.expect)(transactions[0]).toHaveProperty('creation_date', globals_1.expect.any(String));
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
let counterparts;
|
|
87
|
+
(0, globals_1.test)('getAccountCounterparts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
counterparts = yield consumer.banking.getAccountCounterparts();
|
|
89
|
+
(0, globals_1.expect)(counterparts).toBeInstanceOf(Array);
|
|
90
|
+
if (counterparts.length > 0) {
|
|
91
|
+
(0, globals_1.expect)(counterparts[0]).toHaveProperty('name');
|
|
92
|
+
(0, globals_1.expect)(counterparts[0]).toHaveProperty('reference');
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const globals_1 = require("@jest/globals");
|
|
4
|
+
const accounting_1 = require("../../src/modules/accounting");
|
|
5
|
+
const ecommerce_1 = require("../../src/modules/ecommerce");
|
|
6
|
+
const invoicing_1 = require("../../src/modules/invoicing");
|
|
7
|
+
const pos_1 = require("../../src/modules/pos");
|
|
8
|
+
const custom_1 = require("../../src/modules/custom");
|
|
9
|
+
(0, globals_1.test)('accounting factory methods support clientRequestId parameter for create operations', () => {
|
|
10
|
+
// Test that createClient supports clientRequestId parameter
|
|
11
|
+
const createClientRequest = accounting_1.accountingFactory.createClient({ name: 'Test Client' }, undefined, { clientRequestId: 'test-request-id-123' });
|
|
12
|
+
(0, globals_1.expect)(createClientRequest).toHaveProperty('clientRequestId', 'test-request-id-123');
|
|
13
|
+
(0, globals_1.expect)(createClientRequest).toHaveProperty('method', 'post');
|
|
14
|
+
(0, globals_1.expect)(createClientRequest).toHaveProperty('url', '/consumers/{consumer_id}/accounting/clients');
|
|
15
|
+
(0, globals_1.expect)(createClientRequest).toHaveProperty('body', { name: 'Test Client' });
|
|
16
|
+
// Test that createInvoice supports clientRequestId parameter
|
|
17
|
+
const createInvoiceRequest = accounting_1.accountingFactory.createInvoice({ number: 'INV-001' }, undefined, { clientRequestId: 'test-invoice-request-id-789' });
|
|
18
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('clientRequestId', 'test-invoice-request-id-789');
|
|
19
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('method', 'post');
|
|
20
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('url', '/consumers/{consumer_id}/accounting/invoices');
|
|
21
|
+
// Test that createSupplier supports clientRequestId parameter
|
|
22
|
+
const createSupplierRequest = accounting_1.accountingFactory.createSupplier({ name: 'Test Supplier' }, undefined, { clientRequestId: 'test-supplier-request-id-456' });
|
|
23
|
+
(0, globals_1.expect)(createSupplierRequest).toHaveProperty('clientRequestId', 'test-supplier-request-id-456');
|
|
24
|
+
(0, globals_1.expect)(createSupplierRequest).toHaveProperty('method', 'post');
|
|
25
|
+
(0, globals_1.expect)(createSupplierRequest).toHaveProperty('url', '/consumers/{consumer_id}/accounting/suppliers');
|
|
26
|
+
});
|
|
27
|
+
(0, globals_1.test)('accounting factory methods support clientRequestId parameter for update operations', () => {
|
|
28
|
+
// Test that updateClient supports clientRequestId parameter
|
|
29
|
+
const updateClientRequest = accounting_1.accountingFactory.updateClient('client-123', { name: 'Updated Client' }, undefined, { clientRequestId: 'test-update-request-id-456' });
|
|
30
|
+
(0, globals_1.expect)(updateClientRequest).toHaveProperty('clientRequestId', 'test-update-request-id-456');
|
|
31
|
+
(0, globals_1.expect)(updateClientRequest).toHaveProperty('method', 'patch');
|
|
32
|
+
(0, globals_1.expect)(updateClientRequest).toHaveProperty('url', '/consumers/{consumer_id}/accounting/clients/client-123');
|
|
33
|
+
(0, globals_1.expect)(updateClientRequest).toHaveProperty('body', { name: 'Updated Client' });
|
|
34
|
+
});
|
|
35
|
+
(0, globals_1.test)('ecommerce factory methods support clientRequestId parameter', () => {
|
|
36
|
+
// Test that createOrder supports clientRequestId parameter
|
|
37
|
+
const createOrderRequest = ecommerce_1.ecommerceFactory.createOrder({ customer_id: 'cust-123' }, {
|
|
38
|
+
clientRequestId: 'test-ecommerce-order-id-123',
|
|
39
|
+
});
|
|
40
|
+
(0, globals_1.expect)(createOrderRequest).toHaveProperty('clientRequestId', 'test-ecommerce-order-id-123');
|
|
41
|
+
(0, globals_1.expect)(createOrderRequest).toHaveProperty('method', 'post');
|
|
42
|
+
(0, globals_1.expect)(createOrderRequest).toHaveProperty('url', '/consumers/{consumer_id}/commerce/orders');
|
|
43
|
+
(0, globals_1.expect)(createOrderRequest).toHaveProperty('body', { customer_id: 'cust-123' });
|
|
44
|
+
// Test that updateAvailableQuantity supports clientRequestId parameter
|
|
45
|
+
const updateQuantityRequest = ecommerce_1.ecommerceFactory.updateAvailableQuantity('variant-123', { quantity: 10 }, { clientRequestId: 'test-quantity-update-id-456' });
|
|
46
|
+
(0, globals_1.expect)(updateQuantityRequest).toHaveProperty('clientRequestId', 'test-quantity-update-id-456');
|
|
47
|
+
(0, globals_1.expect)(updateQuantityRequest).toHaveProperty('method', 'post');
|
|
48
|
+
(0, globals_1.expect)(updateQuantityRequest).toHaveProperty('url', '/consumers/{consumer_id}/commerce/variants/set_quantity/variant-123');
|
|
49
|
+
(0, globals_1.expect)(updateQuantityRequest).toHaveProperty('body', { quantity: 10 });
|
|
50
|
+
});
|
|
51
|
+
(0, globals_1.test)('invoicing factory methods support clientRequestId parameter', () => {
|
|
52
|
+
// Test that createInvoice supports clientRequestId parameter
|
|
53
|
+
const createInvoiceRequest = invoicing_1.invoicingFactory.createInvoice({ number: 'INV-001' }, {
|
|
54
|
+
clientRequestId: 'test-invoicing-invoice-id-123',
|
|
55
|
+
});
|
|
56
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('clientRequestId', 'test-invoicing-invoice-id-123');
|
|
57
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('method', 'post');
|
|
58
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('url', '/consumers/{consumer_id}/invoicing/invoices');
|
|
59
|
+
(0, globals_1.expect)(createInvoiceRequest).toHaveProperty('body', { number: 'INV-001' });
|
|
60
|
+
// Test that createProduct supports clientRequestId parameter
|
|
61
|
+
const createProductRequest = invoicing_1.invoicingFactory.createProduct({ name: 'Test Product' }, {
|
|
62
|
+
clientRequestId: 'test-invoicing-product-id-456',
|
|
63
|
+
});
|
|
64
|
+
(0, globals_1.expect)(createProductRequest).toHaveProperty('clientRequestId', 'test-invoicing-product-id-456');
|
|
65
|
+
(0, globals_1.expect)(createProductRequest).toHaveProperty('method', 'post');
|
|
66
|
+
(0, globals_1.expect)(createProductRequest).toHaveProperty('url', '/consumers/{consumer_id}/invoicing/products');
|
|
67
|
+
(0, globals_1.expect)(createProductRequest).toHaveProperty('body', { name: 'Test Product' });
|
|
68
|
+
// Test that createContact supports clientRequestId parameter
|
|
69
|
+
const createContactRequest = invoicing_1.invoicingFactory.createContact({ name: 'Test Contact' }, {
|
|
70
|
+
clientRequestId: 'test-invoicing-contact-id-789',
|
|
71
|
+
});
|
|
72
|
+
(0, globals_1.expect)(createContactRequest).toHaveProperty('clientRequestId', 'test-invoicing-contact-id-789');
|
|
73
|
+
(0, globals_1.expect)(createContactRequest).toHaveProperty('method', 'post');
|
|
74
|
+
(0, globals_1.expect)(createContactRequest).toHaveProperty('url', '/consumers/{consumer_id}/invoicing/contacts');
|
|
75
|
+
(0, globals_1.expect)(createContactRequest).toHaveProperty('body', { name: 'Test Contact' });
|
|
76
|
+
});
|
|
77
|
+
(0, globals_1.test)('pos factory methods support clientRequestId parameter', () => {
|
|
78
|
+
// Test that createCustomer supports clientRequestId parameter
|
|
79
|
+
const createCustomerRequest = pos_1.posFactory.createCustomer({ name: 'Test Customer' }, {
|
|
80
|
+
clientRequestId: 'test-pos-customer-id-123',
|
|
81
|
+
});
|
|
82
|
+
(0, globals_1.expect)(createCustomerRequest).toHaveProperty('clientRequestId', 'test-pos-customer-id-123');
|
|
83
|
+
(0, globals_1.expect)(createCustomerRequest).toHaveProperty('method', 'post');
|
|
84
|
+
(0, globals_1.expect)(createCustomerRequest).toHaveProperty('url', '/consumers/{consumer_id}/pos/customers');
|
|
85
|
+
(0, globals_1.expect)(createCustomerRequest).toHaveProperty('body', { name: 'Test Customer' });
|
|
86
|
+
// Test that updateOrder supports clientRequestId parameter
|
|
87
|
+
const updateOrderRequest = pos_1.posFactory.updateOrder('order-123', { status: 'completed' }, {
|
|
88
|
+
clientRequestId: 'test-pos-order-update-id-456',
|
|
89
|
+
});
|
|
90
|
+
(0, globals_1.expect)(updateOrderRequest).toHaveProperty('clientRequestId', 'test-pos-order-update-id-456');
|
|
91
|
+
(0, globals_1.expect)(updateOrderRequest).toHaveProperty('method', 'patch');
|
|
92
|
+
(0, globals_1.expect)(updateOrderRequest).toHaveProperty('url', '/consumers/{consumer_id}/pos/orders/order-123');
|
|
93
|
+
(0, globals_1.expect)(updateOrderRequest).toHaveProperty('body', { status: 'completed' });
|
|
94
|
+
});
|
|
95
|
+
(0, globals_1.test)('custom factory methods support clientRequestId parameter', () => {
|
|
96
|
+
// Test that post supports clientRequestId parameter
|
|
97
|
+
const postRequest = custom_1.customFactory.post('test-integration', 'test-resource', { data: 'test' }, undefined, { clientRequestId: 'test-custom-post-id-123' });
|
|
98
|
+
(0, globals_1.expect)(postRequest).toHaveProperty('clientRequestId', 'test-custom-post-id-123');
|
|
99
|
+
(0, globals_1.expect)(postRequest).toHaveProperty('method', 'post');
|
|
100
|
+
(0, globals_1.expect)(postRequest).toHaveProperty('url', '/consumers/{consumer_id}/custom/test-integration/test-resource');
|
|
101
|
+
(0, globals_1.expect)(postRequest).toHaveProperty('body', { data: 'test' });
|
|
102
|
+
// Test that patch supports clientRequestId parameter
|
|
103
|
+
const patchRequest = custom_1.customFactory.patch('test-integration', 'test-resource', { data: 'updated' }, undefined, { clientRequestId: 'test-custom-patch-id-456' });
|
|
104
|
+
(0, globals_1.expect)(patchRequest).toHaveProperty('clientRequestId', 'test-custom-patch-id-456');
|
|
105
|
+
(0, globals_1.expect)(patchRequest).toHaveProperty('method', 'patch');
|
|
106
|
+
(0, globals_1.expect)(patchRequest).toHaveProperty('url', '/consumers/{consumer_id}/custom/test-integration/test-resource');
|
|
107
|
+
(0, globals_1.expect)(patchRequest).toHaveProperty('body', { data: 'updated' });
|
|
108
|
+
});
|
|
109
|
+
(0, globals_1.test)('additional accounting factory methods support clientRequestId parameter', () => {
|
|
110
|
+
// Test that createJournal supports clientRequestId parameter
|
|
111
|
+
const createJournalRequest = accounting_1.accountingFactory.createJournal({ name: 'Test Journal' }, undefined, { clientRequestId: 'test-journal-request-id-111' });
|
|
112
|
+
(0, globals_1.expect)(createJournalRequest).toHaveProperty('clientRequestId', 'test-journal-request-id-111');
|
|
113
|
+
(0, globals_1.expect)(createJournalRequest).toHaveProperty('method', 'post');
|
|
114
|
+
// Test that createBankAccount supports clientRequestId parameter
|
|
115
|
+
const createBankAccountRequest = accounting_1.accountingFactory.createBankAccount({ name: 'Test Bank Account' }, undefined, { clientRequestId: 'test-bank-account-request-id-222' });
|
|
116
|
+
(0, globals_1.expect)(createBankAccountRequest).toHaveProperty('clientRequestId', 'test-bank-account-request-id-222');
|
|
117
|
+
(0, globals_1.expect)(createBankAccountRequest).toHaveProperty('method', 'post');
|
|
118
|
+
// Test that updateSupplier supports clientRequestId parameter
|
|
119
|
+
const updateSupplierRequest = accounting_1.accountingFactory.updateSupplier('supplier-123', { name: 'Updated Supplier' }, undefined, { clientRequestId: 'test-update-supplier-id-333' });
|
|
120
|
+
(0, globals_1.expect)(updateSupplierRequest).toHaveProperty('clientRequestId', 'test-update-supplier-id-333');
|
|
121
|
+
(0, globals_1.expect)(updateSupplierRequest).toHaveProperty('method', 'patch');
|
|
122
|
+
});
|
|
123
|
+
(0, globals_1.test)('clientRequestId parameter defaults to undefined when not specified', () => {
|
|
124
|
+
// Test that clientRequestId is undefined when not specified
|
|
125
|
+
const createClientRequest = accounting_1.accountingFactory.createClient({ name: 'Test Client' });
|
|
126
|
+
(0, globals_1.expect)(createClientRequest.clientRequestId).toBeUndefined();
|
|
127
|
+
const createOrderRequest = ecommerce_1.ecommerceFactory.createOrder({ customer_id: 'cust-123' });
|
|
128
|
+
(0, globals_1.expect)(createOrderRequest.clientRequestId).toBeUndefined();
|
|
129
|
+
const createInvoiceRequest = invoicing_1.invoicingFactory.createInvoice({ number: 'INV-001' });
|
|
130
|
+
(0, globals_1.expect)(createInvoiceRequest.clientRequestId).toBeUndefined();
|
|
131
|
+
const createCustomerRequest = pos_1.posFactory.createCustomer({ name: 'Test Customer' });
|
|
132
|
+
(0, globals_1.expect)(createCustomerRequest.clientRequestId).toBeUndefined();
|
|
133
|
+
const customPostRequest = custom_1.customFactory.post('test', 'resource', { data: 'test' });
|
|
134
|
+
(0, globals_1.expect)(customPostRequest.clientRequestId).toBeUndefined();
|
|
135
|
+
});
|
|
@@ -47,7 +47,6 @@ const email = 'support@chift.eu';
|
|
|
47
47
|
const redirect_url = 'https://chift.eu';
|
|
48
48
|
let syncConsumer;
|
|
49
49
|
let consumer;
|
|
50
|
-
let connection;
|
|
51
50
|
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
51
|
consumer = yield client.Consumers.createConsumer({
|
|
53
52
|
email,
|
|
@@ -70,11 +69,12 @@ globals_1.test.skip('updateConnection', () => __awaiter(void 0, void 0, void 0,
|
|
|
70
69
|
var _a;
|
|
71
70
|
const updatedConnection = yield syncConsumer.updateConnection((_a = connections[0]) === null || _a === void 0 ? void 0 : _a.connectionid, {
|
|
72
71
|
name: 'updated connection name',
|
|
72
|
+
redirect: false,
|
|
73
73
|
});
|
|
74
74
|
(0, globals_1.expect)(updatedConnection).toHaveProperty('name', 'updated connection name');
|
|
75
75
|
}));
|
|
76
76
|
globals_1.test.skip('deleteConnection', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
yield consumer.deleteConnection(
|
|
77
|
+
yield consumer.deleteConnection(connections[0].connectionid);
|
|
78
78
|
}));
|
|
79
79
|
(0, globals_1.test)('getSyncUrl', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
80
|
const result = yield syncConsumer.getSyncUrl({
|
|
@@ -91,10 +91,11 @@ let products;
|
|
|
91
91
|
}));
|
|
92
92
|
let productVariant;
|
|
93
93
|
globals_1.test.skip('getProductVariantById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
var _a;
|
|
94
95
|
if (!(products === null || products === void 0 ? void 0 : products.length)) {
|
|
95
96
|
throw new Error('No product to test');
|
|
96
97
|
}
|
|
97
|
-
if (!products[0].variants.length) {
|
|
98
|
+
if (!((_a = products[0].variants) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
98
99
|
throw new Error('No product variant to test');
|
|
99
100
|
}
|
|
100
101
|
productVariant = yield consumer.ecommerce.getProductVariantById(products[0].variants[0].id);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|