@chift/chift-nodejs 1.0.18 → 1.0.20
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/dist/src/helpers/openapi.d.ts +3 -0
- package/dist/src/helpers/openapi.js +18 -0
- package/dist/src/helpers/settings.d.ts +4 -0
- package/dist/src/helpers/settings.js +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/modules/accounting.d.ts +68 -0
- package/dist/src/modules/accounting.js +326 -0
- package/dist/src/modules/api.d.ts +18431 -0
- package/dist/src/modules/api.js +36 -0
- package/dist/src/modules/consumer.d.ts +3638 -0
- package/dist/src/modules/consumer.js +142 -0
- package/dist/src/modules/consumers.d.ts +18317 -0
- package/dist/src/modules/consumers.js +51 -0
- package/dist/src/modules/custom.d.ts +8 -0
- package/dist/src/modules/custom.js +36 -0
- package/dist/src/modules/datastores.d.ts +18 -0
- package/dist/src/modules/datastores.js +23 -0
- package/dist/src/modules/ecommerce.d.ts +24 -0
- package/dist/src/modules/ecommerce.js +97 -0
- package/dist/src/modules/flow.d.ts +15 -0
- package/dist/src/modules/flow.js +156 -0
- package/dist/src/modules/integrations.d.ts +23 -0
- package/dist/src/modules/integrations.js +23 -0
- package/dist/src/modules/internalApi.d.ts +24 -0
- package/dist/src/modules/internalApi.js +175 -0
- package/dist/src/modules/invoicing.d.ts +20 -0
- package/dist/src/modules/invoicing.js +90 -0
- package/dist/src/modules/payment.d.ts +14 -0
- package/dist/src/modules/payment.js +41 -0
- package/dist/src/modules/pms.d.ts +15 -0
- package/dist/src/modules/pms.js +47 -0
- package/dist/src/modules/pos.d.ts +26 -0
- package/dist/src/modules/pos.js +101 -0
- package/dist/src/modules/sync.d.ts +14718 -0
- package/dist/src/modules/sync.js +73 -0
- package/dist/src/modules/syncs.d.ts +11 -0
- package/dist/src/modules/syncs.js +39 -0
- package/dist/src/modules/webhooks.d.ts +58 -0
- package/dist/src/modules/webhooks.js +53 -0
- package/{src/types/api.ts → dist/src/types/api.d.ts} +4 -12
- package/dist/src/types/api.js +2 -0
- package/{src/types/consumers.ts → dist/src/types/consumers.d.ts} +0 -1
- package/dist/src/types/consumers.js +2 -0
- package/dist/src/types/public-api/mappings.js +2 -0
- package/dist/src/types/public-api/schema.d.ts +15334 -0
- package/{src/types/sync.ts → dist/src/types/sync.d.ts} +5 -6
- package/dist/src/types/sync.js +2 -0
- package/dist/test/modules/accounting.test.d.ts +1 -0
- package/dist/test/modules/accounting.test.js +590 -0
- package/dist/test/modules/consumer.test.d.ts +1 -0
- package/dist/test/modules/consumer.test.js +89 -0
- package/dist/test/modules/consumers.test.d.ts +1 -0
- package/dist/test/modules/consumers.test.js +109 -0
- package/dist/test/modules/ecommerce.test.d.ts +1 -0
- package/dist/test/modules/ecommerce.test.js +224 -0
- package/dist/test/modules/integrations.test.d.ts +1 -0
- package/dist/test/modules/integrations.test.js +54 -0
- package/dist/test/modules/invoicing.test.d.ts +1 -0
- package/dist/test/modules/invoicing.test.js +115 -0
- package/dist/test/modules/payment.test.d.ts +1 -0
- package/dist/test/modules/payment.test.js +88 -0
- package/dist/test/modules/pms.test.d.ts +1 -0
- package/dist/test/modules/pms.test.js +90 -0
- package/dist/test/modules/pos.test.d.ts +1 -0
- package/dist/test/modules/pos.test.js +179 -0
- package/dist/test/modules/sync.test.d.ts +1 -0
- package/dist/test/modules/sync.test.js +93 -0
- package/dist/test/modules/syncs.test.d.ts +1 -0
- package/dist/test/modules/syncs.test.js +53 -0
- package/dist/test/modules/webhooks.test.d.ts +1 -0
- package/dist/test/modules/webhooks.test.js +120 -0
- package/package.json +3 -2
- package/src/types/public-api/schema.d.ts +50 -10
- /package/{src/types/public-api/mappings.ts → dist/src/types/public-api/mappings.d.ts} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface FlowTriggerOptions {
|
|
2
2
|
autostart?: boolean;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
4
|
export interface FlowTrigger {
|
|
6
5
|
id: string;
|
|
7
6
|
type: 'event' | 'timer';
|
|
@@ -11,18 +10,18 @@ export interface FlowTrigger {
|
|
|
11
10
|
label?: string;
|
|
12
11
|
options?: FlowTriggerOptions;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
interface FlowConfig {
|
|
16
|
-
datastores?: {
|
|
14
|
+
datastores?: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}[];
|
|
17
18
|
definitionFields?: Record<string, unknown>[];
|
|
18
19
|
doorkeyFields?: Record<string, unknown>[];
|
|
19
20
|
}
|
|
20
|
-
|
|
21
21
|
export interface ExecutionType {
|
|
22
22
|
type: 'code' | 'module';
|
|
23
23
|
data?: any;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
export interface ContextType {
|
|
27
26
|
name: string;
|
|
28
27
|
description?: string;
|
|
@@ -30,9 +29,9 @@ export interface ContextType {
|
|
|
30
29
|
execution: ExecutionType;
|
|
31
30
|
config?: FlowConfig;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
export interface SimpleResponseModel {
|
|
35
33
|
status: string;
|
|
36
34
|
message: string;
|
|
37
35
|
data?: any;
|
|
38
36
|
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,590 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const globals_1 = require("@jest/globals");
|
|
39
|
+
const chift = __importStar(require("../../src/index"));
|
|
40
|
+
const dotenv = __importStar(require("dotenv"));
|
|
41
|
+
const fs_1 = __importDefault(require("fs"));
|
|
42
|
+
dotenv.config();
|
|
43
|
+
const client = new chift.API({
|
|
44
|
+
baseUrl: process.env.CHIFT_BACKBONE_API,
|
|
45
|
+
clientId: process.env.CHIFT_TESTING_CLIENTID,
|
|
46
|
+
clientSecret: process.env.CHIFT_TESTING_CLIENTSECRET,
|
|
47
|
+
accountId: process.env.CHIFT_TESTING_ACCOUNTID,
|
|
48
|
+
});
|
|
49
|
+
const consumerId = process.env.CHIFT_ACCOUNTING_CONSUMER_ID;
|
|
50
|
+
let consumer;
|
|
51
|
+
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
consumer = yield client.Consumers.getConsumerById(consumerId);
|
|
53
|
+
}));
|
|
54
|
+
let analyticPlans;
|
|
55
|
+
(0, globals_1.test)('getAnalyticPlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
analyticPlans = yield consumer.accounting.getAnalyticPlans();
|
|
57
|
+
(0, globals_1.expect)(analyticPlans).toBeInstanceOf(Array);
|
|
58
|
+
(0, globals_1.expect)(analyticPlans.length).toBeGreaterThan(0);
|
|
59
|
+
(0, globals_1.expect)(analyticPlans[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
60
|
+
(0, globals_1.expect)(analyticPlans[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
61
|
+
(0, globals_1.expect)(analyticPlans[0]).toHaveProperty('active', globals_1.expect.any(Boolean));
|
|
62
|
+
}));
|
|
63
|
+
let journals;
|
|
64
|
+
(0, globals_1.test)('getJournals', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
journals = yield consumer.accounting.getJournals();
|
|
66
|
+
(0, globals_1.expect)(journals).toBeInstanceOf(Array);
|
|
67
|
+
(0, globals_1.expect)(journals.length).toBeGreaterThan(0);
|
|
68
|
+
(0, globals_1.expect)(journals[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
69
|
+
(0, globals_1.expect)(journals[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
70
|
+
(0, globals_1.expect)(journals[0]).toHaveProperty('journal_type', globals_1.expect.any(String));
|
|
71
|
+
}));
|
|
72
|
+
let vatCodes;
|
|
73
|
+
(0, globals_1.test)('getVatCodes', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
vatCodes = yield consumer.accounting.getVatCodes();
|
|
75
|
+
(0, globals_1.expect)(vatCodes).toBeInstanceOf(Array);
|
|
76
|
+
(0, globals_1.expect)(vatCodes.length).toBeGreaterThan(0);
|
|
77
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
78
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('code');
|
|
79
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('label', globals_1.expect.any(String));
|
|
80
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('scope', globals_1.expect.any(String));
|
|
81
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('rate', globals_1.expect.any(Number));
|
|
82
|
+
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('type', globals_1.expect.any(String));
|
|
83
|
+
}));
|
|
84
|
+
(0, globals_1.test)('createClient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
const body = {
|
|
86
|
+
external_reference: 'sdk test',
|
|
87
|
+
name: 'John Doe',
|
|
88
|
+
currency: 'EUR',
|
|
89
|
+
active: false,
|
|
90
|
+
is_company: true,
|
|
91
|
+
addresses: [
|
|
92
|
+
{
|
|
93
|
+
address_type: 'main',
|
|
94
|
+
street: 'Main Street',
|
|
95
|
+
city: 'Brussels',
|
|
96
|
+
postal_code: '1000',
|
|
97
|
+
country: 'BE',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
const client = yield consumer.accounting.createClient(body);
|
|
102
|
+
(0, globals_1.expect)(client).toBeTruthy();
|
|
103
|
+
(0, globals_1.expect)(client).toHaveProperty('name', 'John Doe');
|
|
104
|
+
}));
|
|
105
|
+
let clients;
|
|
106
|
+
(0, globals_1.test)('getClients', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
clients = yield consumer.accounting.getClients();
|
|
108
|
+
(0, globals_1.expect)(clients).toBeInstanceOf(Array);
|
|
109
|
+
(0, globals_1.expect)(clients.length).toBeGreaterThan(0);
|
|
110
|
+
(0, globals_1.expect)(clients[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
111
|
+
}));
|
|
112
|
+
(0, globals_1.test)('getClient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
const client = yield consumer.accounting.getClient(clients[0].id);
|
|
114
|
+
(0, globals_1.expect)(client).toBeTruthy();
|
|
115
|
+
(0, globals_1.expect)(client).toHaveProperty('external_reference');
|
|
116
|
+
(0, globals_1.expect)(client).toHaveProperty('first_name');
|
|
117
|
+
(0, globals_1.expect)(client).toHaveProperty('last_name');
|
|
118
|
+
(0, globals_1.expect)(client).toHaveProperty('name');
|
|
119
|
+
(0, globals_1.expect)(client).toHaveProperty('function');
|
|
120
|
+
(0, globals_1.expect)(client).toHaveProperty('is_company');
|
|
121
|
+
(0, globals_1.expect)(client).toHaveProperty('company_id');
|
|
122
|
+
(0, globals_1.expect)(client).toHaveProperty('phone');
|
|
123
|
+
(0, globals_1.expect)(client).toHaveProperty('mobile');
|
|
124
|
+
(0, globals_1.expect)(client).toHaveProperty('email');
|
|
125
|
+
(0, globals_1.expect)(client).toHaveProperty('language');
|
|
126
|
+
(0, globals_1.expect)(client).toHaveProperty('internal_notes');
|
|
127
|
+
(0, globals_1.expect)(client).toHaveProperty('website');
|
|
128
|
+
(0, globals_1.expect)(client).toHaveProperty('vat');
|
|
129
|
+
(0, globals_1.expect)(client).toHaveProperty('iban');
|
|
130
|
+
(0, globals_1.expect)(client).toHaveProperty('bank_account');
|
|
131
|
+
(0, globals_1.expect)(client).toHaveProperty('currency');
|
|
132
|
+
(0, globals_1.expect)(client).toHaveProperty('active', globals_1.expect.any(Boolean));
|
|
133
|
+
(0, globals_1.expect)(client).toHaveProperty('addresses', globals_1.expect.any(Array));
|
|
134
|
+
}));
|
|
135
|
+
globals_1.test.skip('updateClient', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
+
const client = clients.find((client) => client.external_reference === 'sdk test');
|
|
137
|
+
const updatedClient = yield consumer.accounting.updateClient(client === null || client === void 0 ? void 0 : client.id, {
|
|
138
|
+
website: 'https://test.com',
|
|
139
|
+
});
|
|
140
|
+
(0, globals_1.expect)(updatedClient).toBeTruthy();
|
|
141
|
+
(0, globals_1.expect)(updatedClient).toHaveProperty('website', 'https://test.com');
|
|
142
|
+
}));
|
|
143
|
+
(0, globals_1.test)('createSupplier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
+
const body = {
|
|
145
|
+
external_reference: 'sdk test',
|
|
146
|
+
name: 'Jane Doe',
|
|
147
|
+
currency: 'EUR',
|
|
148
|
+
active: false,
|
|
149
|
+
is_company: true,
|
|
150
|
+
addresses: [
|
|
151
|
+
{
|
|
152
|
+
address_type: 'main',
|
|
153
|
+
street: 'Main Street',
|
|
154
|
+
city: 'Brussels',
|
|
155
|
+
postal_code: '1000',
|
|
156
|
+
country: 'BE',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
const supplier = yield consumer.accounting.createSupplier(body);
|
|
161
|
+
(0, globals_1.expect)(supplier).toBeTruthy();
|
|
162
|
+
(0, globals_1.expect)(supplier).toHaveProperty('name', 'Jane Doe');
|
|
163
|
+
}));
|
|
164
|
+
let suppliers;
|
|
165
|
+
(0, globals_1.test)('getSuppliers', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
|
+
suppliers = yield consumer.accounting.getSuppliers();
|
|
167
|
+
(0, globals_1.expect)(suppliers).toBeInstanceOf(Array);
|
|
168
|
+
(0, globals_1.expect)(suppliers.length).toBeGreaterThan(0);
|
|
169
|
+
}));
|
|
170
|
+
(0, globals_1.test)('getSupplier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
+
const supplier = yield consumer.accounting.getSupplier(suppliers[0].id);
|
|
172
|
+
(0, globals_1.expect)(supplier).toBeTruthy();
|
|
173
|
+
(0, globals_1.expect)(supplier).toHaveProperty('external_reference');
|
|
174
|
+
(0, globals_1.expect)(supplier).toHaveProperty('first_name');
|
|
175
|
+
(0, globals_1.expect)(supplier).toHaveProperty('last_name');
|
|
176
|
+
(0, globals_1.expect)(supplier).toHaveProperty('name');
|
|
177
|
+
(0, globals_1.expect)(supplier).toHaveProperty('function');
|
|
178
|
+
(0, globals_1.expect)(supplier).toHaveProperty('is_company');
|
|
179
|
+
(0, globals_1.expect)(supplier).toHaveProperty('company_id');
|
|
180
|
+
(0, globals_1.expect)(supplier).toHaveProperty('phone');
|
|
181
|
+
(0, globals_1.expect)(supplier).toHaveProperty('mobile');
|
|
182
|
+
(0, globals_1.expect)(supplier).toHaveProperty('email');
|
|
183
|
+
(0, globals_1.expect)(supplier).toHaveProperty('language');
|
|
184
|
+
(0, globals_1.expect)(supplier).toHaveProperty('internal_notes');
|
|
185
|
+
(0, globals_1.expect)(supplier).toHaveProperty('website');
|
|
186
|
+
(0, globals_1.expect)(supplier).toHaveProperty('vat');
|
|
187
|
+
(0, globals_1.expect)(supplier).toHaveProperty('iban');
|
|
188
|
+
(0, globals_1.expect)(supplier).toHaveProperty('bank_account');
|
|
189
|
+
(0, globals_1.expect)(supplier).toHaveProperty('currency');
|
|
190
|
+
(0, globals_1.expect)(supplier).toHaveProperty('active', globals_1.expect.any(Boolean));
|
|
191
|
+
(0, globals_1.expect)(supplier).toHaveProperty('addresses', globals_1.expect.any(Array));
|
|
192
|
+
}));
|
|
193
|
+
globals_1.test.skip('updateSupplier', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
194
|
+
const supplier = suppliers.find((supplier) => supplier.external_reference === 'sdk test');
|
|
195
|
+
const updatedSupplier = yield consumer.accounting.updateSupplier(supplier === null || supplier === void 0 ? void 0 : supplier.id, {
|
|
196
|
+
name: 'Jane Updated Doe',
|
|
197
|
+
});
|
|
198
|
+
(0, globals_1.expect)(updatedSupplier).toBeTruthy();
|
|
199
|
+
(0, globals_1.expect)(updatedSupplier).toHaveProperty('name', 'Jane Updated Doe');
|
|
200
|
+
}));
|
|
201
|
+
(0, globals_1.test)('createInvoice', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
202
|
+
var _a;
|
|
203
|
+
const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
|
|
204
|
+
if (!journal) {
|
|
205
|
+
throw new Error('No journal with type "customer_invoice" found to create invoice');
|
|
206
|
+
}
|
|
207
|
+
const vatCode = vatCodes.find((vatCode) => vatCode.type === 'sale' && vatCode.rate === 21);
|
|
208
|
+
if (!(vatCode === null || vatCode === void 0 ? void 0 : vatCode.id)) {
|
|
209
|
+
throw new Error('No vat code with type "sale" and rate 21 found to create invoice');
|
|
210
|
+
}
|
|
211
|
+
const body = {
|
|
212
|
+
invoice_type: 'customer_invoice',
|
|
213
|
+
invoice_date: '2022-12-01',
|
|
214
|
+
due_date: '2022-12-31',
|
|
215
|
+
currency: 'EUR',
|
|
216
|
+
untaxed_amount: 100,
|
|
217
|
+
tax_amount: 21,
|
|
218
|
+
total: 121,
|
|
219
|
+
partner_id: (_a = clients[0]) === null || _a === void 0 ? void 0 : _a.id,
|
|
220
|
+
journal_id: journal.id,
|
|
221
|
+
status: 'draft',
|
|
222
|
+
currency_exchange_rate: 1,
|
|
223
|
+
lines: [
|
|
224
|
+
{
|
|
225
|
+
description: 'Test',
|
|
226
|
+
unit_price: 100,
|
|
227
|
+
quantity: 1,
|
|
228
|
+
untaxed_amount: 100,
|
|
229
|
+
tax_rate: 21,
|
|
230
|
+
tax_amount: 21,
|
|
231
|
+
total: 121,
|
|
232
|
+
account_number: '700000',
|
|
233
|
+
tax_code: vatCode.id,
|
|
234
|
+
line_number: 1,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
const invoice = yield consumer.accounting.createInvoice(body);
|
|
239
|
+
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
240
|
+
(0, globals_1.expect)(invoice).toHaveProperty('total', 121);
|
|
241
|
+
}));
|
|
242
|
+
let invoices;
|
|
243
|
+
(0, globals_1.test)('getInvoicesByType', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
244
|
+
invoices = yield consumer.accounting.getInvoicesByType('customer_invoice', {
|
|
245
|
+
date_from: '2022-12-01',
|
|
246
|
+
date_to: '2022-12-31',
|
|
247
|
+
});
|
|
248
|
+
(0, globals_1.expect)(invoices).toBeInstanceOf(Array);
|
|
249
|
+
(0, globals_1.expect)(invoices.length).toBeGreaterThan(0);
|
|
250
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
251
|
+
}));
|
|
252
|
+
(0, globals_1.test)('getInvoicesByTypeWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
253
|
+
const invoicesWithMultiplePlans = yield consumer.accounting.getInvoicesByTypeWithMultiplePlans('customer_invoice', {
|
|
254
|
+
date_from: '2022-12-01',
|
|
255
|
+
date_to: '2022-12-31',
|
|
256
|
+
});
|
|
257
|
+
(0, globals_1.expect)(invoicesWithMultiplePlans).toBeInstanceOf(Array);
|
|
258
|
+
(0, globals_1.expect)(invoicesWithMultiplePlans.length).toBeGreaterThan(0);
|
|
259
|
+
(0, globals_1.expect)(invoicesWithMultiplePlans[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
260
|
+
}));
|
|
261
|
+
(0, globals_1.test)('getInvoice', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
262
|
+
const invoice = yield consumer.accounting.getInvoice(invoices[0].id, {
|
|
263
|
+
include_payments: true,
|
|
264
|
+
});
|
|
265
|
+
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
266
|
+
(0, globals_1.expect)(invoice).toHaveProperty('id', invoices[0].id);
|
|
267
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('invoice_type', globals_1.expect.any(String));
|
|
268
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('invoice_number');
|
|
269
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('partner_id', globals_1.expect.any(String));
|
|
270
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('invoice_date', globals_1.expect.any(String));
|
|
271
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('due_date', globals_1.expect.any(String));
|
|
272
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('currency', globals_1.expect.any(String));
|
|
273
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('untaxed_amount', globals_1.expect.any(Number));
|
|
274
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('tax_amount', globals_1.expect.any(Number));
|
|
275
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('total', globals_1.expect.any(Number));
|
|
276
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('reference');
|
|
277
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('payment_communication');
|
|
278
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('customer_memo');
|
|
279
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('id');
|
|
280
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('journal_id', globals_1.expect.any(String));
|
|
281
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('payments');
|
|
282
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('status');
|
|
283
|
+
(0, globals_1.expect)(invoices[0]).toHaveProperty('lines', globals_1.expect.any(Array));
|
|
284
|
+
}));
|
|
285
|
+
(0, globals_1.test)('createInvoiceWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
286
|
+
var _b;
|
|
287
|
+
const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
|
|
288
|
+
if (!journal) {
|
|
289
|
+
throw new Error('No journal with type customer_invoice found to create Invoice With Multiple Plans');
|
|
290
|
+
}
|
|
291
|
+
const vatCode = vatCodes.find((vatCode) => vatCode.type === 'sale' && vatCode.rate === 21);
|
|
292
|
+
if (!(vatCode === null || vatCode === void 0 ? void 0 : vatCode.id)) {
|
|
293
|
+
throw new Error('No vat code with type "sale" and rate 21 found to create invoice');
|
|
294
|
+
}
|
|
295
|
+
const body = {
|
|
296
|
+
invoice_type: 'customer_invoice',
|
|
297
|
+
invoice_date: '2022-12-01',
|
|
298
|
+
due_date: '2022-12-31',
|
|
299
|
+
currency: 'EUR',
|
|
300
|
+
untaxed_amount: 100,
|
|
301
|
+
tax_amount: 21,
|
|
302
|
+
total: 121,
|
|
303
|
+
partner_id: (_b = clients[0]) === null || _b === void 0 ? void 0 : _b.id,
|
|
304
|
+
journal_id: journal.id,
|
|
305
|
+
status: 'draft',
|
|
306
|
+
currency_exchange_rate: 1,
|
|
307
|
+
lines: [
|
|
308
|
+
{
|
|
309
|
+
description: 'Test',
|
|
310
|
+
unit_price: 100,
|
|
311
|
+
quantity: 1,
|
|
312
|
+
untaxed_amount: 100,
|
|
313
|
+
tax_rate: 21,
|
|
314
|
+
tax_amount: 21,
|
|
315
|
+
total: 121,
|
|
316
|
+
account_number: '700000',
|
|
317
|
+
tax_code: vatCode.id,
|
|
318
|
+
line_number: 1,
|
|
319
|
+
},
|
|
320
|
+
],
|
|
321
|
+
};
|
|
322
|
+
const invoice = yield consumer.accounting.createInvoiceWithMultiplePlans(body);
|
|
323
|
+
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
324
|
+
}));
|
|
325
|
+
(0, globals_1.test)('getInvoiceWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
326
|
+
const invoice = yield consumer.accounting.getInvoiceWithMultiplePlans(invoices[0].id, {
|
|
327
|
+
include_payments: true,
|
|
328
|
+
});
|
|
329
|
+
(0, globals_1.expect)(invoice).toBeTruthy();
|
|
330
|
+
}));
|
|
331
|
+
(0, globals_1.test)('createAnalyticAccount', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
332
|
+
const body = {
|
|
333
|
+
active: false,
|
|
334
|
+
code: '4000',
|
|
335
|
+
name: 'sdk test',
|
|
336
|
+
currency: 'EUR',
|
|
337
|
+
};
|
|
338
|
+
const analyticAccount = yield consumer.accounting.createAnalyticAccount(body);
|
|
339
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
340
|
+
(0, globals_1.expect)(analyticAccount).toHaveProperty('name', 'sdk test');
|
|
341
|
+
}));
|
|
342
|
+
let analyticAccounts;
|
|
343
|
+
(0, globals_1.test)('getAnalyticAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
344
|
+
analyticAccounts = yield consumer.accounting.getAnalyticAccounts();
|
|
345
|
+
(0, globals_1.expect)(analyticAccounts).toBeInstanceOf(Array);
|
|
346
|
+
(0, globals_1.expect)(analyticAccounts.length).toBeGreaterThan(0);
|
|
347
|
+
(0, globals_1.expect)(analyticAccounts[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
348
|
+
}));
|
|
349
|
+
globals_1.test.skip('createAnalyticAccountWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
350
|
+
if (analyticPlans.length === 0) {
|
|
351
|
+
throw new Error('No analytic plans found to create analytic account with multiple plans');
|
|
352
|
+
}
|
|
353
|
+
const analyticAccount = yield consumer.accounting.createAnalyticAccountWithMultiplePlans(analyticPlans[0].id, {
|
|
354
|
+
code: '4000',
|
|
355
|
+
name: 'sdk test',
|
|
356
|
+
currency: 'EUR',
|
|
357
|
+
});
|
|
358
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
359
|
+
}));
|
|
360
|
+
(0, globals_1.test)('getAnalyticAccount', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
361
|
+
if (analyticAccounts.length === 0) {
|
|
362
|
+
throw new Error('No analytic accounts found to get analytic account');
|
|
363
|
+
}
|
|
364
|
+
const analyticAccount = yield consumer.accounting.getAnalyticAccount(analyticAccounts[0].id);
|
|
365
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
366
|
+
}));
|
|
367
|
+
globals_1.test.skip('updateAnalyticAccount', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
368
|
+
if (analyticAccounts.length === 0) {
|
|
369
|
+
throw new Error('No analytic accounts found to update analytic account');
|
|
370
|
+
}
|
|
371
|
+
const testAnalyticAccount = analyticAccounts.find((account) => account.name === 'sdk test');
|
|
372
|
+
const analyticAccount = yield consumer.accounting.updateAnalyticAccount(testAnalyticAccount === null || testAnalyticAccount === void 0 ? void 0 : testAnalyticAccount.id, { name: 'test sdk update' });
|
|
373
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
374
|
+
(0, globals_1.expect)(analyticAccount).toHaveProperty('name', 'test sdk update');
|
|
375
|
+
}));
|
|
376
|
+
globals_1.test.skip('getAnalyticAccountWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
377
|
+
if (analyticPlans.length === 0) {
|
|
378
|
+
throw new Error('No analytic plans found to get analytic account with multiple plans');
|
|
379
|
+
}
|
|
380
|
+
const analyticAccount = yield consumer.accounting.getAnalyticAccountWithMultiplePlans(analyticAccounts[0].id, analyticPlans[0].id);
|
|
381
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
382
|
+
}));
|
|
383
|
+
globals_1.test.skip('updateAnalyticAccountWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
384
|
+
if (!analyticAccounts.length) {
|
|
385
|
+
throw new Error('No analytic accounts found to update analytic account with multiple plans');
|
|
386
|
+
}
|
|
387
|
+
const testAnalyticAccount = analyticAccounts.find((account) => account.name === 'test sdk update');
|
|
388
|
+
const analyticAccount = yield consumer.accounting.updateAnalyticAccountWithMultiplePlans(testAnalyticAccount === null || testAnalyticAccount === void 0 ? void 0 : testAnalyticAccount.id, '1', { name: 'test sdk update 2' });
|
|
389
|
+
(0, globals_1.expect)(analyticAccount).toBeTruthy();
|
|
390
|
+
(0, globals_1.expect)(analyticAccount).toHaveProperty('name', 'test sdk update 2');
|
|
391
|
+
}));
|
|
392
|
+
globals_1.test.skip('getAnalyticAccountsWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
393
|
+
const analyticAccountsWithMultiplePlans = yield consumer.accounting.getAnalyticAccountsWithMultiplePlans();
|
|
394
|
+
(0, globals_1.expect)(analyticAccountsWithMultiplePlans).toBeInstanceOf(Array);
|
|
395
|
+
}));
|
|
396
|
+
globals_1.test.skip('createJournalEntry', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
397
|
+
const journal = journals.find((journal) => journal.journal_type === 'customer_invoice');
|
|
398
|
+
if (!journal) {
|
|
399
|
+
throw new Error('No journal with type "customer_invoice" found to create journal entry');
|
|
400
|
+
}
|
|
401
|
+
if (!clients.length) {
|
|
402
|
+
throw new Error('No clients found to create journal entry');
|
|
403
|
+
}
|
|
404
|
+
const journalEntry = yield consumer.accounting.createJournalEntry({
|
|
405
|
+
journal_id: journal.id,
|
|
406
|
+
number: new Date().valueOf(),
|
|
407
|
+
currency: 'EUR',
|
|
408
|
+
date: '2022-01-01',
|
|
409
|
+
items: [
|
|
410
|
+
{
|
|
411
|
+
account_type: 'customer_account',
|
|
412
|
+
account: clients[0].id,
|
|
413
|
+
credit: 0,
|
|
414
|
+
debit: 10,
|
|
415
|
+
currency: 'EUR',
|
|
416
|
+
prioritise_thirdparty_account: false,
|
|
417
|
+
analytic_distribution: [],
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
});
|
|
421
|
+
(0, globals_1.expect)(journalEntry).toBeTruthy();
|
|
422
|
+
(0, globals_1.expect)(journalEntry).toHaveProperty('journal_id', journal.id);
|
|
423
|
+
}));
|
|
424
|
+
(0, globals_1.test)('getJournalEntries', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
425
|
+
const journalEntries = yield consumer.accounting.getJournalEntries({
|
|
426
|
+
unposted_allowed: true,
|
|
427
|
+
date_from: '2022-01-01',
|
|
428
|
+
date_to: '2022-01-31',
|
|
429
|
+
journal_id: journals[0].id,
|
|
430
|
+
});
|
|
431
|
+
(0, globals_1.expect)(journalEntries).toBeInstanceOf(Array);
|
|
432
|
+
}));
|
|
433
|
+
(0, globals_1.test)('getJournalEntriesWithMultiplePlans', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
434
|
+
const journalEntries = yield consumer.accounting.getJournalEntriesWithMultiplePlans({
|
|
435
|
+
unposted_allowed: true,
|
|
436
|
+
date_from: '2022-01-01',
|
|
437
|
+
date_to: '2022-01-31',
|
|
438
|
+
journal_id: journals[0].id,
|
|
439
|
+
});
|
|
440
|
+
(0, globals_1.expect)(journalEntries).toBeInstanceOf(Array);
|
|
441
|
+
}));
|
|
442
|
+
(0, globals_1.test)('getPaymentsByInvoiceId', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
443
|
+
const payments = yield consumer.accounting.getPaymentsByInvoiceId(invoices[0].id);
|
|
444
|
+
(0, globals_1.expect)(payments).toBeInstanceOf(Array);
|
|
445
|
+
}));
|
|
446
|
+
let miscOperations;
|
|
447
|
+
(0, globals_1.test)('getMiscOperations', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
448
|
+
miscOperations = yield consumer.accounting.getMiscOperations();
|
|
449
|
+
(0, globals_1.expect)(miscOperations).toBeInstanceOf(Array);
|
|
450
|
+
(0, globals_1.expect)(miscOperations.length).toBeGreaterThan(0);
|
|
451
|
+
(0, globals_1.expect)(miscOperations[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
452
|
+
}));
|
|
453
|
+
(0, globals_1.test)('createMiscOperation', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
454
|
+
var _c;
|
|
455
|
+
const data = {
|
|
456
|
+
operation_date: '2023-04-29',
|
|
457
|
+
currency: 'EUR',
|
|
458
|
+
lines: [
|
|
459
|
+
{
|
|
460
|
+
line_number: 1,
|
|
461
|
+
description: 'test line',
|
|
462
|
+
amount: 0,
|
|
463
|
+
type: 'general_account',
|
|
464
|
+
account_number: '400000',
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
journal_id: (_c = journals === null || journals === void 0 ? void 0 : journals.find((journal) => journal.journal_type === 'miscellaneous_operation')) === null || _c === void 0 ? void 0 : _c.id,
|
|
468
|
+
status: 'draft',
|
|
469
|
+
};
|
|
470
|
+
const miscOperation = yield consumer.accounting.createMiscOperation(data);
|
|
471
|
+
(0, globals_1.expect)(miscOperation).toBeTruthy();
|
|
472
|
+
}));
|
|
473
|
+
(0, globals_1.test)('getMiscOperation', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
474
|
+
const miscOperation = yield consumer.accounting.getMiscOperation(miscOperations[0].id);
|
|
475
|
+
(0, globals_1.expect)(miscOperation).toBeTruthy();
|
|
476
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('operation_number');
|
|
477
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('operation_date', globals_1.expect.any(String));
|
|
478
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('currency', globals_1.expect.any(String));
|
|
479
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('lines', globals_1.expect.any(Array));
|
|
480
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('journal_id', globals_1.expect.any(String));
|
|
481
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('status', globals_1.expect.any(String));
|
|
482
|
+
(0, globals_1.expect)(miscOperation).toHaveProperty('id', globals_1.expect.any(String));
|
|
483
|
+
}));
|
|
484
|
+
(0, globals_1.test)('attachPDF', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
485
|
+
const pdfData = fs_1.default.readFileSync('test/data/accounting_invoice.pdf');
|
|
486
|
+
yield consumer.accounting.attachPDF(invoices[0].id, { base64_string: pdfData.toString('base64') }, { overwrite_existing: true });
|
|
487
|
+
}));
|
|
488
|
+
(0, globals_1.test)('getChartOfAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
489
|
+
const chartOfAccounts = yield consumer.accounting.getChartOfAccounts({
|
|
490
|
+
classes: '6,7',
|
|
491
|
+
});
|
|
492
|
+
(0, globals_1.expect)(chartOfAccounts).toBeTruthy();
|
|
493
|
+
}));
|
|
494
|
+
globals_1.test.skip('getBalanceOfAccounts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
495
|
+
const balanceOfAccounts = yield consumer.accounting.getBalanceOfAccounts({
|
|
496
|
+
accounts: ['7'],
|
|
497
|
+
start: '2022-01-01',
|
|
498
|
+
end: '2022-12-31',
|
|
499
|
+
});
|
|
500
|
+
(0, globals_1.expect)(balanceOfAccounts).toBeTruthy();
|
|
501
|
+
(0, globals_1.expect)(balanceOfAccounts).toHaveProperty('items');
|
|
502
|
+
(0, globals_1.expect)(balanceOfAccounts.items).toBeInstanceOf(Array);
|
|
503
|
+
}));
|
|
504
|
+
(0, globals_1.test)('getEmployees', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
505
|
+
const employees = yield consumer.accounting.getEmployees();
|
|
506
|
+
(0, globals_1.expect)(employees).toBeTruthy();
|
|
507
|
+
}));
|
|
508
|
+
globals_1.test.skip('getOutstandings', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
509
|
+
const outstandings = yield consumer.accounting.getOutstandings({
|
|
510
|
+
type: 'client',
|
|
511
|
+
unposted_allowed: false,
|
|
512
|
+
});
|
|
513
|
+
(0, globals_1.expect)(outstandings).toBeTruthy();
|
|
514
|
+
(0, globals_1.expect)(outstandings.items).toBeInstanceOf(Array);
|
|
515
|
+
}));
|
|
516
|
+
(0, globals_1.test)('createFinancialEntry', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
517
|
+
const journal = journals.find((journal) => journal.journal_type === 'financial_operation');
|
|
518
|
+
if (!journal) {
|
|
519
|
+
throw new Error('No journal with type "financial_operation" found to create financial entry');
|
|
520
|
+
}
|
|
521
|
+
if (!clients.length) {
|
|
522
|
+
throw new Error('No clients found to create journal entry');
|
|
523
|
+
}
|
|
524
|
+
const financialEntry = yield consumer.accounting.createFinancialEntry({
|
|
525
|
+
date: '2022-01-01',
|
|
526
|
+
journal_id: journal.id,
|
|
527
|
+
currency: 'EUR',
|
|
528
|
+
items: [
|
|
529
|
+
{
|
|
530
|
+
account_type: 'customer_account',
|
|
531
|
+
account: clients[0].id,
|
|
532
|
+
amount: 10,
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
});
|
|
536
|
+
(0, globals_1.expect)(financialEntry).toBeTruthy();
|
|
537
|
+
(0, globals_1.expect)(financialEntry).toHaveProperty('journal_id', journal.id);
|
|
538
|
+
}));
|
|
539
|
+
/**
|
|
540
|
+
* @deprecated replaced by createFinancialEntry
|
|
541
|
+
*/
|
|
542
|
+
(0, globals_1.test)('createFinancialEntryOld', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
543
|
+
const journal = journals.find((journal) => journal.journal_type === 'financial_operation');
|
|
544
|
+
if (!journal) {
|
|
545
|
+
throw new Error('No journal with type "financial_operation" found to create financial entry');
|
|
546
|
+
}
|
|
547
|
+
const financialEntry = yield consumer.accounting.createFinancialEntryOld({
|
|
548
|
+
date: '2022-01-01',
|
|
549
|
+
journal_id: journal.id,
|
|
550
|
+
currency: 'EUR',
|
|
551
|
+
items: [
|
|
552
|
+
{
|
|
553
|
+
type: 'customer_account',
|
|
554
|
+
account_number: clients[0].account_number,
|
|
555
|
+
partner_id: clients[0].id,
|
|
556
|
+
amount: 10,
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
});
|
|
560
|
+
(0, globals_1.expect)(financialEntry).toBeTruthy();
|
|
561
|
+
(0, globals_1.expect)(financialEntry).toHaveProperty('journal_id', journal.id);
|
|
562
|
+
}));
|
|
563
|
+
let folders = [];
|
|
564
|
+
(0, globals_1.test)('getFolders', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
565
|
+
folders = yield consumer.accounting.getFolders();
|
|
566
|
+
(0, globals_1.expect)(folders).toBeInstanceOf(Array);
|
|
567
|
+
(0, globals_1.expect)(folders.length).toBeGreaterThan(0);
|
|
568
|
+
(0, globals_1.expect)(folders[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
569
|
+
(0, globals_1.expect)(folders[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
570
|
+
}));
|
|
571
|
+
globals_1.test.skip('getAttachments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
572
|
+
const attachments = yield consumer.accounting.getAttachments({
|
|
573
|
+
// TODO: Add documentId from test account
|
|
574
|
+
documentId: '',
|
|
575
|
+
type: 'invoice',
|
|
576
|
+
});
|
|
577
|
+
(0, globals_1.expect)(attachments).toBeInstanceOf(Array);
|
|
578
|
+
(0, globals_1.expect)(attachments.length).toBeGreaterThan(0);
|
|
579
|
+
(0, globals_1.expect)(attachments[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
580
|
+
(0, globals_1.expect)(attachments[0]).toHaveProperty('base64_string', globals_1.expect.any(String));
|
|
581
|
+
}));
|
|
582
|
+
globals_1.test.skip('matchEntries', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
583
|
+
const match = yield consumer.accounting.matchEntries({
|
|
584
|
+
// TODO: Change params with test account values
|
|
585
|
+
entries: [],
|
|
586
|
+
partner_id: '',
|
|
587
|
+
});
|
|
588
|
+
(0, globals_1.expect)(match).toHaveProperty('matching_number', globals_1.expect.any(String));
|
|
589
|
+
(0, globals_1.expect)(match).toHaveProperty('balance', globals_1.expect.any(Number));
|
|
590
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|