n8n-nodes-qonto-api 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.
- package/dist/credentials/QontoApi.credentials.js +1 -1
- package/dist/credentials/QontoApi.credentials.js.map +1 -1
- package/dist/credentials/QontoOAuth2Api.credentials.js +1 -1
- package/dist/credentials/QontoOAuth2Api.credentials.js.map +1 -1
- package/dist/nodes/Qonto/Qonto.node.js +999 -92
- package/dist/nodes/Qonto/Qonto.node.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/AttachmentDescriptions.js +5 -15
- package/dist/nodes/Qonto/descriptions/AttachmentDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/AttachmentsInATransactionDescriptions.js +11 -33
- package/dist/nodes/Qonto/descriptions/AttachmentsInATransactionDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/BankAccountsDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/BankAccountsDescriptions.js +88 -0
- package/dist/nodes/Qonto/descriptions/BankAccountsDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/BeneficiariesDescriptions.js +169 -48
- package/dist/nodes/Qonto/descriptions/BeneficiariesDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/CardsDescriptions.js +421 -74
- package/dist/nodes/Qonto/descriptions/CardsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/ClientsDescriptions.js +315 -87
- package/dist/nodes/Qonto/descriptions/ClientsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/ClientsInvoicesDescriptions.js +785 -120
- package/dist/nodes/Qonto/descriptions/ClientsInvoicesDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/CreditNotesDescriptions.js +10 -30
- package/dist/nodes/Qonto/descriptions/CreditNotesDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/EinvoicingDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/EinvoicingDescriptions.js +25 -0
- package/dist/nodes/Qonto/descriptions/EinvoicingDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/ExternalTransfersDescriptions.js +50 -150
- package/dist/nodes/Qonto/descriptions/ExternalTransfersDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/InsuranceContractsDescriptions.js +295 -121
- package/dist/nodes/Qonto/descriptions/InsuranceContractsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/InternalTransactionsDescriptions.js +13 -39
- package/dist/nodes/Qonto/descriptions/InternalTransactionsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/InternationalTransfersDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/InternationalTransfersDescriptions.js +154 -0
- package/dist/nodes/Qonto/descriptions/InternationalTransfersDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/LabelsDescriptions.js +8 -24
- package/dist/nodes/Qonto/descriptions/LabelsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/MembershipsDescriptions.js +35 -74
- package/dist/nodes/Qonto/descriptions/MembershipsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/OrganizationsDescriptions.js +3 -9
- package/dist/nodes/Qonto/descriptions/OrganizationsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/PaymentLinksDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/PaymentLinksDescriptions.js +112 -0
- package/dist/nodes/Qonto/descriptions/PaymentLinksDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/QuotesDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/QuotesDescriptions.js +94 -0
- package/dist/nodes/Qonto/descriptions/QuotesDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/RequestsDescriptions.js +160 -56
- package/dist/nodes/Qonto/descriptions/RequestsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/SepaTransfersDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/SepaTransfersDescriptions.js +233 -0
- package/dist/nodes/Qonto/descriptions/SepaTransfersDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/StatementsDescriptions.js +10 -30
- package/dist/nodes/Qonto/descriptions/StatementsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/SupplierInvoicesDescriptions.js +31 -36
- package/dist/nodes/Qonto/descriptions/SupplierInvoicesDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/TeamsDescriptions.js +21 -50
- package/dist/nodes/Qonto/descriptions/TeamsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/TransactionsDescriptions.js +12 -36
- package/dist/nodes/Qonto/descriptions/TransactionsDescriptions.js.map +1 -1
- package/dist/nodes/Qonto/descriptions/WebhookSubscriptionsDescriptions.d.ts +2 -0
- package/dist/nodes/Qonto/descriptions/WebhookSubscriptionsDescriptions.js +100 -0
- package/dist/nodes/Qonto/descriptions/WebhookSubscriptionsDescriptions.js.map +1 -0
- package/dist/nodes/Qonto/descriptions/index.d.ts +7 -0
- package/dist/nodes/Qonto/descriptions/index.js +7 -0
- package/dist/nodes/Qonto/descriptions/index.js.map +1 -1
- package/dist/nodes/Qonto/helpers.d.ts +1 -0
- package/dist/nodes/Qonto/helpers.js +6 -1
- package/dist/nodes/Qonto/helpers.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4,16 +4,32 @@ exports.Qonto = void 0;
|
|
|
4
4
|
const helpers_1 = require("./helpers");
|
|
5
5
|
const descriptions_1 = require("./descriptions");
|
|
6
6
|
function isEmpty(value) {
|
|
7
|
-
return value === null ||
|
|
8
|
-
|
|
7
|
+
return (value === null ||
|
|
8
|
+
value === undefined ||
|
|
9
|
+
(typeof value === 'object' && Object.keys(value).length === 0));
|
|
9
10
|
}
|
|
10
11
|
function uuid() {
|
|
11
12
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
12
|
-
const r = Math.random() * 16 | 0;
|
|
13
|
-
const v = c === 'x' ? r : (r & 0x3 | 0x8
|
|
13
|
+
const r = (Math.random() * 16) | 0;
|
|
14
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
14
15
|
return v.toString(16);
|
|
15
16
|
});
|
|
16
17
|
}
|
|
18
|
+
function parseJsonParameter(value) {
|
|
19
|
+
if (typeof value === 'string') {
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(value);
|
|
22
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (value && typeof value === 'object') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
17
33
|
class Qonto {
|
|
18
34
|
constructor() {
|
|
19
35
|
this.description = {
|
|
@@ -76,21 +92,28 @@ class Qonto {
|
|
|
76
92
|
{ name: 'Attachment', value: 'attachment' },
|
|
77
93
|
{ name: 'Attachments in a Transaction', value: 'attachmentsInATransaction' },
|
|
78
94
|
{ name: 'Beneficiary', value: 'beneficiaries' },
|
|
95
|
+
{ name: 'Business Account', value: 'bankAccounts' },
|
|
79
96
|
{ name: 'Card', value: 'cards' },
|
|
80
97
|
{ name: 'Client', value: 'clients' },
|
|
81
98
|
{ name: 'Client Invoice', value: 'clientsInvoices' },
|
|
82
99
|
{ name: 'Credit Note', value: 'creditNotes' },
|
|
100
|
+
{ name: 'E-Invoicing', value: 'einvoicing' },
|
|
83
101
|
{ name: 'External Transfer', value: 'externalTransfers' },
|
|
84
102
|
{ name: 'Insurance Contract', value: 'insuranceContracts' },
|
|
85
103
|
{ name: 'Internal Transaction', value: 'internalTransactions' },
|
|
104
|
+
{ name: 'International Transfer', value: 'internationalTransfers' },
|
|
86
105
|
{ name: 'Label', value: 'labels' },
|
|
87
106
|
{ name: 'Membership', value: 'memberships' },
|
|
88
107
|
{ name: 'Organization', value: 'organizations' },
|
|
108
|
+
{ name: 'Payment Link', value: 'paymentLinks' },
|
|
109
|
+
{ name: 'Quote', value: 'quotes' },
|
|
89
110
|
{ name: 'Request', value: 'requests' },
|
|
111
|
+
{ name: 'SEPA Transfer', value: 'sepaTransfers' },
|
|
90
112
|
{ name: 'Statement', value: 'statements' },
|
|
91
113
|
{ name: 'Supplier Invoice', value: 'supplierInvoices' },
|
|
92
114
|
{ name: 'Team', value: 'teams' },
|
|
93
115
|
{ name: 'Transaction', value: 'transactions' },
|
|
116
|
+
{ name: 'Webhook Subscription', value: 'webhookSubscriptions' },
|
|
94
117
|
],
|
|
95
118
|
default: 'organizations',
|
|
96
119
|
required: true,
|
|
@@ -102,16 +125,23 @@ class Qonto {
|
|
|
102
125
|
...descriptions_1.membershipsOperations,
|
|
103
126
|
...descriptions_1.organizationsOperations,
|
|
104
127
|
...descriptions_1.attachmentsInATransactionOperations,
|
|
128
|
+
...descriptions_1.bankAccountsOperations,
|
|
105
129
|
...descriptions_1.transactionsOperations,
|
|
106
130
|
...descriptions_1.internalTransactionsOperations,
|
|
107
131
|
...descriptions_1.requestsOperations,
|
|
132
|
+
...descriptions_1.sepaTransfersOperations,
|
|
108
133
|
...descriptions_1.supplierInvoicesOperations,
|
|
109
134
|
...descriptions_1.clientsInvoicesOperations,
|
|
110
135
|
...descriptions_1.creditNotesOperations,
|
|
136
|
+
...descriptions_1.einvoicingOperations,
|
|
111
137
|
...descriptions_1.clientsOperations,
|
|
112
138
|
...descriptions_1.teamsOperations,
|
|
113
139
|
...descriptions_1.statementsOperations,
|
|
114
140
|
...descriptions_1.insuranceContractsOperations,
|
|
141
|
+
...descriptions_1.internationalTransfersOperations,
|
|
142
|
+
...descriptions_1.webhookSubscriptionsOperations,
|
|
143
|
+
...descriptions_1.paymentLinksOperations,
|
|
144
|
+
...descriptions_1.quotesOperations,
|
|
115
145
|
...descriptions_1.cardsOperations,
|
|
116
146
|
],
|
|
117
147
|
};
|
|
@@ -145,7 +175,7 @@ class Qonto {
|
|
|
145
175
|
reference: this.getNodeParameter('reference', i),
|
|
146
176
|
note: this.getNodeParameter('note', i),
|
|
147
177
|
currency: this.getNodeParameter('currency', i),
|
|
148
|
-
scheduled_date: (0, helpers_1.
|
|
178
|
+
scheduled_date: (0, helpers_1.formatDate)(this.getNodeParameter('scheduled_date', i)),
|
|
149
179
|
amount: this.getNodeParameter('amount', i),
|
|
150
180
|
attachment_ids: this.getNodeParameter('attachment_ids', i),
|
|
151
181
|
};
|
|
@@ -169,7 +199,7 @@ class Qonto {
|
|
|
169
199
|
reference: this.getNodeParameter('reference', i),
|
|
170
200
|
note: this.getNodeParameter('note', i),
|
|
171
201
|
currency: this.getNodeParameter('currency', i),
|
|
172
|
-
scheduled_date: (0, helpers_1.
|
|
202
|
+
scheduled_date: (0, helpers_1.formatDate)(this.getNodeParameter('scheduled_date', i)),
|
|
173
203
|
amount: this.getNodeParameter('amount', i),
|
|
174
204
|
attachment_ids: this.getNodeParameter('attachment_ids', i),
|
|
175
205
|
};
|
|
@@ -184,10 +214,10 @@ class Qonto {
|
|
|
184
214
|
const filters = this.getNodeParameter('filters', i);
|
|
185
215
|
if (!isEmpty(filters)) {
|
|
186
216
|
if (filters.scheduled_date_from) {
|
|
187
|
-
query.scheduled_date_from = (0, helpers_1.
|
|
217
|
+
query.scheduled_date_from = (0, helpers_1.formatDate)(filters.scheduled_date_from);
|
|
188
218
|
}
|
|
189
219
|
if (filters.scheduled_date_to) {
|
|
190
|
-
query.scheduled_date_to = (0, helpers_1.
|
|
220
|
+
query.scheduled_date_to = (0, helpers_1.formatDate)(filters.scheduled_date_to);
|
|
191
221
|
}
|
|
192
222
|
if (filters.status && filters.status.length > 0) {
|
|
193
223
|
query['status[]'] = filters.status;
|
|
@@ -202,11 +232,13 @@ class Qonto {
|
|
|
202
232
|
query['beneficiary_ids[]'] = filters.beneficiary_ids;
|
|
203
233
|
}
|
|
204
234
|
if (filters.ids) {
|
|
205
|
-
const ids = filters.ids.split(',').map(id => id.trim());
|
|
235
|
+
const ids = filters.ids.split(',').map((id) => id.trim());
|
|
206
236
|
query['ids[]'] = ids;
|
|
207
237
|
}
|
|
208
238
|
if (filters.recurring_transfer_ids) {
|
|
209
|
-
const rIds = filters.recurring_transfer_ids
|
|
239
|
+
const rIds = filters.recurring_transfer_ids
|
|
240
|
+
.split(',')
|
|
241
|
+
.map((id) => id.trim());
|
|
210
242
|
query['recurring_transfer_ids[]'] = rIds;
|
|
211
243
|
}
|
|
212
244
|
if (filters.sort_by) {
|
|
@@ -216,9 +248,148 @@ class Qonto {
|
|
|
216
248
|
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, query, i);
|
|
217
249
|
}
|
|
218
250
|
}
|
|
251
|
+
if (resource === 'sepaTransfers') {
|
|
252
|
+
if (operation === 'listSepaTransfers') {
|
|
253
|
+
const endpoint = 'sepa/transfers';
|
|
254
|
+
const queryParams = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
255
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, queryParams, i);
|
|
256
|
+
}
|
|
257
|
+
if (operation === 'showSepaTransfer') {
|
|
258
|
+
const transferId = this.getNodeParameter('transferId', i);
|
|
259
|
+
const endpoint = `sepa/transfers/${transferId}`;
|
|
260
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
261
|
+
}
|
|
262
|
+
if (operation === 'createSepaTransfer') {
|
|
263
|
+
const endpoint = 'sepa/transfers';
|
|
264
|
+
const body = parseJsonParameter(this.getNodeParameter('transferPayload', i));
|
|
265
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
266
|
+
}
|
|
267
|
+
if (operation === 'cancelSepaTransfer') {
|
|
268
|
+
const transferId = this.getNodeParameter('transferId', i);
|
|
269
|
+
const endpoint = `sepa/transfers/${transferId}/cancel`;
|
|
270
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
271
|
+
}
|
|
272
|
+
if (operation === 'downloadSepaTransferProof') {
|
|
273
|
+
const transferId = this.getNodeParameter('transferId', i);
|
|
274
|
+
const endpoint = `sepa/transfers/${transferId}/download_proof`;
|
|
275
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
276
|
+
}
|
|
277
|
+
if (operation === 'listSepaBulkTransfers') {
|
|
278
|
+
const endpoint = 'sepa/bulk_transfers';
|
|
279
|
+
const queryParams = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
280
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, queryParams, i);
|
|
281
|
+
}
|
|
282
|
+
if (operation === 'showSepaBulkTransfer') {
|
|
283
|
+
const bulkTransferId = this.getNodeParameter('bulkTransferId', i);
|
|
284
|
+
const endpoint = `sepa/bulk_transfers/${bulkTransferId}`;
|
|
285
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
286
|
+
}
|
|
287
|
+
if (operation === 'createSepaBulkTransfer') {
|
|
288
|
+
const endpoint = 'sepa/bulk_transfers';
|
|
289
|
+
const body = parseJsonParameter(this.getNodeParameter('bulkTransferPayload', i));
|
|
290
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
291
|
+
}
|
|
292
|
+
if (operation === 'listSepaRecurringTransfers') {
|
|
293
|
+
const endpoint = 'sepa/recurring_transfers';
|
|
294
|
+
const queryParams = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
295
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, queryParams, i);
|
|
296
|
+
}
|
|
297
|
+
if (operation === 'showSepaRecurringTransfer') {
|
|
298
|
+
const recurringTransferId = this.getNodeParameter('recurringTransferId', i);
|
|
299
|
+
const endpoint = `sepa/recurring_transfers/${recurringTransferId}`;
|
|
300
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
301
|
+
}
|
|
302
|
+
if (operation === 'createSepaRecurringTransfer') {
|
|
303
|
+
const endpoint = 'sepa/recurring_transfers';
|
|
304
|
+
const body = parseJsonParameter(this.getNodeParameter('recurringTransferPayload', i));
|
|
305
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
306
|
+
}
|
|
307
|
+
if (operation === 'cancelSepaRecurringTransfer') {
|
|
308
|
+
const recurringTransferId = this.getNodeParameter('recurringTransferId', i);
|
|
309
|
+
const endpoint = `sepa/recurring_transfers/${recurringTransferId}/cancel`;
|
|
310
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
311
|
+
}
|
|
312
|
+
if (operation === 'verifySepaPayee') {
|
|
313
|
+
const endpoint = 'sepa/verify_payee';
|
|
314
|
+
const body = parseJsonParameter(this.getNodeParameter('verifyPayeePayload', i));
|
|
315
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
316
|
+
}
|
|
317
|
+
if (operation === 'bulkVerifySepaPayee') {
|
|
318
|
+
const endpoint = 'sepa/bulk_verify_payee';
|
|
319
|
+
const body = parseJsonParameter(this.getNodeParameter('bulkVerifyPayeePayload', i));
|
|
320
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
321
|
+
}
|
|
322
|
+
if (operation === 'skipVerifySepaPayee') {
|
|
323
|
+
const endpoint = 'sepa/skip_verify_payee';
|
|
324
|
+
const body = parseJsonParameter(this.getNodeParameter('skipVerifyPayeePayload', i));
|
|
325
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (resource === 'internationalTransfers') {
|
|
329
|
+
if (operation === 'checkInternationalEligibility') {
|
|
330
|
+
const endpoint = 'international/eligibility';
|
|
331
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
332
|
+
}
|
|
333
|
+
if (operation === 'getInternationalCurrencies') {
|
|
334
|
+
const source = this.getNodeParameter('source', i, '');
|
|
335
|
+
const q = {};
|
|
336
|
+
if (source) {
|
|
337
|
+
q.source = source;
|
|
338
|
+
}
|
|
339
|
+
const endpoint = 'international/currencies';
|
|
340
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, q);
|
|
341
|
+
}
|
|
342
|
+
if (operation === 'createInternationalQuote') {
|
|
343
|
+
const endpoint = 'international/quotes';
|
|
344
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
345
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
346
|
+
}
|
|
347
|
+
if (operation === 'listInternationalBeneficiaryRequirements') {
|
|
348
|
+
const endpoint = 'international/beneficiaries/requirements';
|
|
349
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
350
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
351
|
+
}
|
|
352
|
+
if (operation === 'listInternationalBeneficiaries') {
|
|
353
|
+
const endpoint = 'international/beneficiaries';
|
|
354
|
+
const q = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
355
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, q, i);
|
|
356
|
+
}
|
|
357
|
+
if (operation === 'createInternationalBeneficiary') {
|
|
358
|
+
const endpoint = 'international/beneficiaries';
|
|
359
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
360
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
361
|
+
}
|
|
362
|
+
if (operation === 'updateInternationalBeneficiary') {
|
|
363
|
+
const beneficiaryId = this.getNodeParameter('beneficiaryId', i);
|
|
364
|
+
const endpoint = `international/beneficiaries/${beneficiaryId}`;
|
|
365
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
366
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, body, {});
|
|
367
|
+
}
|
|
368
|
+
if (operation === 'deleteInternationalBeneficiary') {
|
|
369
|
+
const beneficiaryId = this.getNodeParameter('beneficiaryId', i);
|
|
370
|
+
const endpoint = `international/beneficiaries/${beneficiaryId}`;
|
|
371
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
372
|
+
}
|
|
373
|
+
if (operation === 'createInternationalTransfer') {
|
|
374
|
+
const endpoint = 'international/transfers';
|
|
375
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
376
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
377
|
+
}
|
|
378
|
+
if (operation === 'listInternationalTransferRequirements') {
|
|
379
|
+
const endpoint = 'international/transfers/requirements';
|
|
380
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
381
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (resource === 'einvoicing') {
|
|
385
|
+
if (operation === 'getEinvoicingSettings') {
|
|
386
|
+
const endpoint = 'einvoicing/settings';
|
|
387
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
219
390
|
if (resource === 'beneficiaries') {
|
|
220
391
|
if (operation === 'listBeneficiaries') {
|
|
221
|
-
const endpoint = 'beneficiaries';
|
|
392
|
+
const endpoint = 'sepa/beneficiaries';
|
|
222
393
|
const filters = this.getNodeParameter('filters', i);
|
|
223
394
|
if (!isEmpty(filters)) {
|
|
224
395
|
if (filters.iban) {
|
|
@@ -244,17 +415,75 @@ class Qonto {
|
|
|
244
415
|
}
|
|
245
416
|
if (operation === 'showBeneficiary') {
|
|
246
417
|
const id = this.getNodeParameter('id', i);
|
|
247
|
-
const endpoint = `beneficiaries/${id}`;
|
|
418
|
+
const endpoint = `sepa/beneficiaries/${id}`;
|
|
248
419
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
249
420
|
}
|
|
250
421
|
if (operation === 'untrustBeneficiaries') {
|
|
251
|
-
const endpoint = 'beneficiaries/untrust';
|
|
252
|
-
const
|
|
422
|
+
const endpoint = 'sepa/beneficiaries/untrust';
|
|
423
|
+
const idsRaw = this.getNodeParameter('ids', i);
|
|
424
|
+
const ids = idsRaw.split(',').map((id) => id.trim());
|
|
253
425
|
const body = {
|
|
254
426
|
ids,
|
|
255
427
|
};
|
|
256
428
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
257
429
|
}
|
|
430
|
+
if (operation === 'trustBeneficiaries') {
|
|
431
|
+
const endpoint = 'sepa/beneficiaries/trust';
|
|
432
|
+
const idsRaw = this.getNodeParameter('ids', i);
|
|
433
|
+
const ids = idsRaw.split(',').map((id) => id.trim());
|
|
434
|
+
const body = {
|
|
435
|
+
ids,
|
|
436
|
+
};
|
|
437
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
438
|
+
}
|
|
439
|
+
if (operation === 'createBeneficiary') {
|
|
440
|
+
const endpoint = 'sepa/beneficiaries';
|
|
441
|
+
const beneficiaryData = {
|
|
442
|
+
name: this.getNodeParameter('beneficiaryName', i),
|
|
443
|
+
iban: this.getNodeParameter('iban', i),
|
|
444
|
+
};
|
|
445
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
446
|
+
if (additionalOptions.bic) {
|
|
447
|
+
beneficiaryData.bic = additionalOptions.bic;
|
|
448
|
+
}
|
|
449
|
+
if (additionalOptions.email) {
|
|
450
|
+
beneficiaryData.email = additionalOptions.email;
|
|
451
|
+
}
|
|
452
|
+
if (additionalOptions.activityTag) {
|
|
453
|
+
beneficiaryData.activity_tag = additionalOptions.activityTag;
|
|
454
|
+
}
|
|
455
|
+
const body = {
|
|
456
|
+
beneficiary: beneficiaryData,
|
|
457
|
+
};
|
|
458
|
+
headers = {
|
|
459
|
+
...headers,
|
|
460
|
+
'Content-Type': 'application/json',
|
|
461
|
+
};
|
|
462
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
463
|
+
}
|
|
464
|
+
if (operation === 'updateBeneficiary') {
|
|
465
|
+
const id = this.getNodeParameter('id', i);
|
|
466
|
+
const endpoint = `sepa/beneficiaries/${id}`;
|
|
467
|
+
const updateFields = this.getNodeParameter('updateFields', i, {});
|
|
468
|
+
const beneficiaryData = {};
|
|
469
|
+
if (updateFields.name) {
|
|
470
|
+
beneficiaryData.name = updateFields.name;
|
|
471
|
+
}
|
|
472
|
+
if (updateFields.email) {
|
|
473
|
+
beneficiaryData.email = updateFields.email;
|
|
474
|
+
}
|
|
475
|
+
if (updateFields.activityTag) {
|
|
476
|
+
beneficiaryData.activity_tag = updateFields.activityTag;
|
|
477
|
+
}
|
|
478
|
+
const body = {
|
|
479
|
+
beneficiary: beneficiaryData,
|
|
480
|
+
};
|
|
481
|
+
headers = {
|
|
482
|
+
...headers,
|
|
483
|
+
'Content-Type': 'application/json',
|
|
484
|
+
};
|
|
485
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
486
|
+
}
|
|
258
487
|
}
|
|
259
488
|
if (resource === 'attachment') {
|
|
260
489
|
if (operation === 'uploadAttachment') {
|
|
@@ -304,9 +533,8 @@ class Qonto {
|
|
|
304
533
|
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, {}, i);
|
|
305
534
|
}
|
|
306
535
|
if (operation === 'getMembership') {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, {}, i);
|
|
536
|
+
const endpoint = 'membership';
|
|
537
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
310
538
|
}
|
|
311
539
|
if (operation === 'createMembership') {
|
|
312
540
|
const endpoint = 'memberships/invite_employee_or_accountant';
|
|
@@ -340,6 +568,43 @@ class Qonto {
|
|
|
340
568
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, query);
|
|
341
569
|
}
|
|
342
570
|
}
|
|
571
|
+
if (resource === 'bankAccounts') {
|
|
572
|
+
if (operation === 'listBankAccounts') {
|
|
573
|
+
const endpoint = 'bank_accounts';
|
|
574
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, {}, i);
|
|
575
|
+
}
|
|
576
|
+
if (operation === 'createBankAccount') {
|
|
577
|
+
const endpoint = 'bank_accounts';
|
|
578
|
+
const accountName = this.getNodeParameter('accountName', i);
|
|
579
|
+
const body = {
|
|
580
|
+
bank_account: {
|
|
581
|
+
name: accountName,
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
585
|
+
}
|
|
586
|
+
if (operation === 'showBankAccount') {
|
|
587
|
+
const accountId = this.getNodeParameter('accountId', i);
|
|
588
|
+
const endpoint = `bank_accounts/${accountId}`;
|
|
589
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
590
|
+
}
|
|
591
|
+
if (operation === 'updateBankAccount') {
|
|
592
|
+
const accountId = this.getNodeParameter('accountId', i);
|
|
593
|
+
const accountName = this.getNodeParameter('accountName', i);
|
|
594
|
+
const endpoint = `bank_accounts/${accountId}`;
|
|
595
|
+
const body = {
|
|
596
|
+
bank_account: {
|
|
597
|
+
name: accountName,
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
601
|
+
}
|
|
602
|
+
if (operation === 'closeBankAccount') {
|
|
603
|
+
const accountId = this.getNodeParameter('accountId', i);
|
|
604
|
+
const endpoint = `bank_accounts/${accountId}/close`;
|
|
605
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
343
608
|
if (resource === 'attachmentsInATransaction') {
|
|
344
609
|
if (operation === 'uploadAttachmentToATransaction') {
|
|
345
610
|
const transactionId = this.getNodeParameter('transaction_id', i);
|
|
@@ -362,12 +627,13 @@ class Qonto {
|
|
|
362
627
|
},
|
|
363
628
|
};
|
|
364
629
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, formData, {}, true);
|
|
365
|
-
if (!responseData ||
|
|
630
|
+
if (!responseData ||
|
|
631
|
+
(typeof responseData === 'object' && Object.keys(responseData).length === 0)) {
|
|
366
632
|
responseData = {
|
|
367
633
|
success: true,
|
|
368
634
|
message: 'Attachment uploaded successfully to transaction',
|
|
369
635
|
transaction_id: transactionId,
|
|
370
|
-
uploaded_at: new Date().toISOString()
|
|
636
|
+
uploaded_at: new Date().toISOString(),
|
|
371
637
|
};
|
|
372
638
|
}
|
|
373
639
|
}
|
|
@@ -476,6 +742,82 @@ class Qonto {
|
|
|
476
742
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
477
743
|
}
|
|
478
744
|
}
|
|
745
|
+
if (resource === 'paymentLinks') {
|
|
746
|
+
if (operation === 'connectPaymentLinksProvider') {
|
|
747
|
+
const endpoint = 'payment_links/connections';
|
|
748
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
749
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
750
|
+
}
|
|
751
|
+
if (operation === 'getPaymentLinksConnectionStatus') {
|
|
752
|
+
const endpoint = 'payment_links/connections';
|
|
753
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
754
|
+
}
|
|
755
|
+
if (operation === 'createPaymentLink') {
|
|
756
|
+
const endpoint = 'payment_links';
|
|
757
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
758
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
759
|
+
}
|
|
760
|
+
if (operation === 'listPaymentLinks') {
|
|
761
|
+
const endpoint = 'payment_links';
|
|
762
|
+
const q = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
763
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, q, i);
|
|
764
|
+
}
|
|
765
|
+
if (operation === 'showPaymentLink') {
|
|
766
|
+
const paymentLinkId = this.getNodeParameter('paymentLinkId', i);
|
|
767
|
+
const endpoint = `payment_links/${paymentLinkId}`;
|
|
768
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
769
|
+
}
|
|
770
|
+
if (operation === 'deactivatePaymentLink') {
|
|
771
|
+
const paymentLinkId = this.getNodeParameter('paymentLinkId', i);
|
|
772
|
+
const endpoint = `payment_links/${paymentLinkId}/deactivate`;
|
|
773
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, {}, {});
|
|
774
|
+
}
|
|
775
|
+
if (operation === 'listPaymentLinkPayments') {
|
|
776
|
+
const paymentLinkId = this.getNodeParameter('paymentLinkId', i);
|
|
777
|
+
const endpoint = `payment_links/${paymentLinkId}/payments`;
|
|
778
|
+
const q = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
779
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, q, i);
|
|
780
|
+
}
|
|
781
|
+
if (operation === 'listPaymentLinkMethods') {
|
|
782
|
+
const endpoint = 'payment_links/payment_methods';
|
|
783
|
+
const q = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
784
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, q);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
if (resource === 'quotes') {
|
|
788
|
+
if (operation === 'listQuotes') {
|
|
789
|
+
const endpoint = 'quotes';
|
|
790
|
+
const q = parseJsonParameter(this.getNodeParameter('query', i, {}));
|
|
791
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, q, i);
|
|
792
|
+
}
|
|
793
|
+
if (operation === 'createQuote') {
|
|
794
|
+
const endpoint = 'quotes';
|
|
795
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
796
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
797
|
+
}
|
|
798
|
+
if (operation === 'sendQuote') {
|
|
799
|
+
const quoteId = this.getNodeParameter('quoteId', i);
|
|
800
|
+
const endpoint = `quotes/${quoteId}/send`;
|
|
801
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
802
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
803
|
+
}
|
|
804
|
+
if (operation === 'showQuote') {
|
|
805
|
+
const quoteId = this.getNodeParameter('quoteId', i);
|
|
806
|
+
const endpoint = `quotes/${quoteId}`;
|
|
807
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
808
|
+
}
|
|
809
|
+
if (operation === 'updateQuote') {
|
|
810
|
+
const quoteId = this.getNodeParameter('quoteId', i);
|
|
811
|
+
const endpoint = `quotes/${quoteId}`;
|
|
812
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
813
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
814
|
+
}
|
|
815
|
+
if (operation === 'deleteQuote') {
|
|
816
|
+
const quoteId = this.getNodeParameter('quoteId', i);
|
|
817
|
+
const endpoint = `quotes/${quoteId}`;
|
|
818
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
819
|
+
}
|
|
820
|
+
}
|
|
479
821
|
if (resource === 'requests') {
|
|
480
822
|
if (operation === 'listRequests') {
|
|
481
823
|
const endpoint = 'requests';
|
|
@@ -496,6 +838,40 @@ class Qonto {
|
|
|
496
838
|
}
|
|
497
839
|
responseData = await helpers_1.qontoApiRequest.call(this, {}, 'GET', endpoint, {}, query);
|
|
498
840
|
}
|
|
841
|
+
if (operation === 'createFlashCardRequest') {
|
|
842
|
+
const endpoint = 'requests/flash_cards';
|
|
843
|
+
const body = {
|
|
844
|
+
request_flash_card: {
|
|
845
|
+
note: this.getNodeParameter('note', i, ''),
|
|
846
|
+
payment_lifespan_limit: this.getNodeParameter('payment_lifespan_limit', i),
|
|
847
|
+
pre_expires_at: (0, helpers_1.formatDateTime)(this.getNodeParameter('pre_expires_at', i)),
|
|
848
|
+
},
|
|
849
|
+
};
|
|
850
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
851
|
+
}
|
|
852
|
+
if (operation === 'createVirtualCardRequest') {
|
|
853
|
+
const endpoint = 'requests/virtual_cards';
|
|
854
|
+
const body = {
|
|
855
|
+
request_virtual_card: {
|
|
856
|
+
note: this.getNodeParameter('note', i, ''),
|
|
857
|
+
payment_monthly_limit: this.getNodeParameter('payment_monthly_limit', i),
|
|
858
|
+
},
|
|
859
|
+
};
|
|
860
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
861
|
+
}
|
|
862
|
+
if (operation === 'createMultiTransferRequest') {
|
|
863
|
+
const endpoint = 'requests/multi_transfers';
|
|
864
|
+
const transfers = this.getNodeParameter('transfers', i);
|
|
865
|
+
const body = {
|
|
866
|
+
request_multi_transfer: {
|
|
867
|
+
note: this.getNodeParameter('note', i, ''),
|
|
868
|
+
debit_iban: this.getNodeParameter('debit_iban', i),
|
|
869
|
+
scheduled_date: (0, helpers_1.formatDate)(this.getNodeParameter('scheduled_date', i)),
|
|
870
|
+
transfers,
|
|
871
|
+
},
|
|
872
|
+
};
|
|
873
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
874
|
+
}
|
|
499
875
|
if (operation === 'approveARequest') {
|
|
500
876
|
const requestId = this.getNodeParameter('id', i);
|
|
501
877
|
const requestType = this.getNodeParameter('request_type', i);
|
|
@@ -546,6 +922,11 @@ class Qonto {
|
|
|
546
922
|
}
|
|
547
923
|
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, query, i);
|
|
548
924
|
}
|
|
925
|
+
if (operation === 'showSupplierInvoice') {
|
|
926
|
+
const supplierInvoiceId = this.getNodeParameter('supplierInvoiceId', i);
|
|
927
|
+
const endpoint = `supplier_invoices/${supplierInvoiceId}`;
|
|
928
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
929
|
+
}
|
|
549
930
|
if (operation === 'createSupplierInvoices') {
|
|
550
931
|
const endpoint = 'supplier_invoices/bulk';
|
|
551
932
|
const invoices = this.getNodeParameter('supplierInvoices', i);
|
|
@@ -572,8 +953,8 @@ class Qonto {
|
|
|
572
953
|
const endpoint = 'client_invoices';
|
|
573
954
|
const filters = this.getNodeParameter('filters', i);
|
|
574
955
|
if (!isEmpty(filters)) {
|
|
575
|
-
if (filters.status
|
|
576
|
-
query['filter[status]'] = filters.status
|
|
956
|
+
if (filters.status) {
|
|
957
|
+
query['filter[status]'] = filters.status;
|
|
577
958
|
}
|
|
578
959
|
if (filters.created_at_from) {
|
|
579
960
|
query['filter[created_at_from]'] = (0, helpers_1.formatDateTime)(filters.created_at_from);
|
|
@@ -587,15 +968,6 @@ class Qonto {
|
|
|
587
968
|
if (filters.updated_at_to) {
|
|
588
969
|
query['filter[updated_at_to]'] = (0, helpers_1.formatDateTime)(filters.updated_at_to);
|
|
589
970
|
}
|
|
590
|
-
if (filters.due_date) {
|
|
591
|
-
query['filter[due_date]'] = (0, helpers_1.formatDateTime)(filters.due_date);
|
|
592
|
-
}
|
|
593
|
-
if (filters.due_date_from) {
|
|
594
|
-
query['filter[due_date_from]'] = (0, helpers_1.formatDateTime)(filters.due_date_from);
|
|
595
|
-
}
|
|
596
|
-
if (filters.due_date_to) {
|
|
597
|
-
query['filter[due_date_to]'] = (0, helpers_1.formatDateTime)(filters.due_date_to);
|
|
598
|
-
}
|
|
599
971
|
if (typeof filters.exclude_imported !== 'undefined') {
|
|
600
972
|
query.exclude_imported = filters.exclude_imported;
|
|
601
973
|
}
|
|
@@ -607,25 +979,165 @@ class Qonto {
|
|
|
607
979
|
}
|
|
608
980
|
if (operation === 'createClientInvoice') {
|
|
609
981
|
const endpoint = 'client_invoices';
|
|
610
|
-
const
|
|
611
|
-
const
|
|
982
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
983
|
+
const issueDate = (0, helpers_1.formatDate)(this.getNodeParameter('issueDate', i));
|
|
984
|
+
const dueDate = (0, helpers_1.formatDate)(this.getNodeParameter('dueDate', i));
|
|
985
|
+
const currency = this.getNodeParameter('currency', i);
|
|
986
|
+
const paymentIban = this.getNodeParameter('paymentIban', i);
|
|
987
|
+
const itemsData = this.getNodeParameter('items', i);
|
|
988
|
+
const items = [];
|
|
989
|
+
if (itemsData.item && Array.isArray(itemsData.item)) {
|
|
990
|
+
for (const item of itemsData.item) {
|
|
991
|
+
const invoiceItem = {
|
|
992
|
+
title: item.title,
|
|
993
|
+
quantity: item.quantity,
|
|
994
|
+
unit_price: {
|
|
995
|
+
value: item.unitPriceValue,
|
|
996
|
+
currency: item.unitPriceCurrency,
|
|
997
|
+
},
|
|
998
|
+
vat_rate: item.vatRate,
|
|
999
|
+
};
|
|
1000
|
+
if (item.description) {
|
|
1001
|
+
invoiceItem.description = item.description;
|
|
1002
|
+
}
|
|
1003
|
+
if (item.unit) {
|
|
1004
|
+
invoiceItem.unit = item.unit;
|
|
1005
|
+
}
|
|
1006
|
+
items.push(invoiceItem);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
612
1009
|
const body = {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
currency: clientInvoice.currency,
|
|
620
|
-
description: clientInvoice.description,
|
|
1010
|
+
client_id: clientId,
|
|
1011
|
+
issue_date: issueDate,
|
|
1012
|
+
due_date: dueDate,
|
|
1013
|
+
currency,
|
|
1014
|
+
payment_methods: {
|
|
1015
|
+
iban: paymentIban,
|
|
621
1016
|
},
|
|
1017
|
+
items,
|
|
622
1018
|
};
|
|
1019
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
1020
|
+
if (additionalOptions.status) {
|
|
1021
|
+
body.status = additionalOptions.status;
|
|
1022
|
+
}
|
|
1023
|
+
if (additionalOptions.number) {
|
|
1024
|
+
body.number = additionalOptions.number;
|
|
1025
|
+
}
|
|
1026
|
+
if (additionalOptions.purchaseOrder) {
|
|
1027
|
+
body.purchase_order = additionalOptions.purchaseOrder;
|
|
1028
|
+
}
|
|
1029
|
+
if (additionalOptions.termsAndConditions) {
|
|
1030
|
+
body.terms_and_conditions = additionalOptions.termsAndConditions;
|
|
1031
|
+
}
|
|
1032
|
+
if (additionalOptions.header) {
|
|
1033
|
+
body.header = additionalOptions.header;
|
|
1034
|
+
}
|
|
1035
|
+
if (additionalOptions.footer) {
|
|
1036
|
+
body.footer = additionalOptions.footer;
|
|
1037
|
+
}
|
|
1038
|
+
if (additionalOptions.performanceStartDate) {
|
|
1039
|
+
body.performance_start_date = (0, helpers_1.formatDate)(additionalOptions.performanceStartDate);
|
|
1040
|
+
}
|
|
1041
|
+
if (additionalOptions.performanceEndDate) {
|
|
1042
|
+
body.performance_end_date = (0, helpers_1.formatDate)(additionalOptions.performanceEndDate);
|
|
1043
|
+
}
|
|
623
1044
|
headers = {
|
|
624
1045
|
...headers,
|
|
625
1046
|
'Content-Type': 'application/json',
|
|
626
1047
|
};
|
|
627
1048
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
628
1049
|
}
|
|
1050
|
+
if (operation === 'updateClientInvoice') {
|
|
1051
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1052
|
+
const endpoint = `client_invoices/${invoiceId}`;
|
|
1053
|
+
const updateFields = this.getNodeParameter('updateFields', i, {});
|
|
1054
|
+
const body = {};
|
|
1055
|
+
if (updateFields.clientId) {
|
|
1056
|
+
body.client_id = updateFields.clientId;
|
|
1057
|
+
}
|
|
1058
|
+
if (updateFields.issueDate) {
|
|
1059
|
+
body.issue_date = (0, helpers_1.formatDate)(updateFields.issueDate);
|
|
1060
|
+
}
|
|
1061
|
+
if (updateFields.dueDate) {
|
|
1062
|
+
body.due_date = (0, helpers_1.formatDate)(updateFields.dueDate);
|
|
1063
|
+
}
|
|
1064
|
+
if (updateFields.number) {
|
|
1065
|
+
body.number = updateFields.number;
|
|
1066
|
+
}
|
|
1067
|
+
if (updateFields.purchaseOrder) {
|
|
1068
|
+
body.purchase_order = updateFields.purchaseOrder;
|
|
1069
|
+
}
|
|
1070
|
+
if (updateFields.termsAndConditions) {
|
|
1071
|
+
body.terms_and_conditions = updateFields.termsAndConditions;
|
|
1072
|
+
}
|
|
1073
|
+
if (updateFields.header) {
|
|
1074
|
+
body.header = updateFields.header;
|
|
1075
|
+
}
|
|
1076
|
+
if (updateFields.footer) {
|
|
1077
|
+
body.footer = updateFields.footer;
|
|
1078
|
+
}
|
|
1079
|
+
if (updateFields.paymentIban) {
|
|
1080
|
+
body.payment_methods = { iban: updateFields.paymentIban };
|
|
1081
|
+
}
|
|
1082
|
+
headers = {
|
|
1083
|
+
...headers,
|
|
1084
|
+
'Content-Type': 'application/json',
|
|
1085
|
+
};
|
|
1086
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1087
|
+
}
|
|
1088
|
+
if (operation === 'showClientInvoice') {
|
|
1089
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1090
|
+
const endpoint = `client_invoices/${invoiceId}`;
|
|
1091
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
1092
|
+
}
|
|
1093
|
+
if (operation === 'deleteClientInvoice') {
|
|
1094
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1095
|
+
const endpoint = `client_invoices/${invoiceId}`;
|
|
1096
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
1097
|
+
}
|
|
1098
|
+
if (operation === 'finalizeClientInvoice') {
|
|
1099
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1100
|
+
const endpoint = `client_invoices/${invoiceId}/finalize`;
|
|
1101
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
1102
|
+
}
|
|
1103
|
+
if (operation === 'cancelClientInvoice') {
|
|
1104
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1105
|
+
const endpoint = `client_invoices/${invoiceId}/mark_as_canceled`;
|
|
1106
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
1107
|
+
}
|
|
1108
|
+
if (operation === 'unmarkClientInvoiceAsPaid') {
|
|
1109
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1110
|
+
const endpoint = `client_invoices/${invoiceId}/unmark_as_paid`;
|
|
1111
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, {}, {});
|
|
1112
|
+
}
|
|
1113
|
+
if (operation === 'markClientInvoiceAsPaid') {
|
|
1114
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1115
|
+
const endpoint = `client_invoices/${invoiceId}/mark_as_paid`;
|
|
1116
|
+
const paidAt = this.getNodeParameter('paidAt', i);
|
|
1117
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, { paid_at: (0, helpers_1.formatDate)(paidAt) }, {});
|
|
1118
|
+
}
|
|
1119
|
+
if (operation === 'sendClientInvoice') {
|
|
1120
|
+
const invoiceId = this.getNodeParameter('invoiceId', i);
|
|
1121
|
+
const endpoint = `client_invoices/${invoiceId}/send`;
|
|
1122
|
+
const sendToRaw = this.getNodeParameter('sendTo', i);
|
|
1123
|
+
const send_to = sendToRaw
|
|
1124
|
+
.split(',')
|
|
1125
|
+
.map((email) => email.trim())
|
|
1126
|
+
.filter(Boolean);
|
|
1127
|
+
const body = {
|
|
1128
|
+
send_to,
|
|
1129
|
+
copy_to_self: this.getNodeParameter('copyToSelf', i),
|
|
1130
|
+
};
|
|
1131
|
+
const emailTitle = this.getNodeParameter('emailTitle', i, '');
|
|
1132
|
+
const emailBody = this.getNodeParameter('emailBody', i, '');
|
|
1133
|
+
if (emailTitle) {
|
|
1134
|
+
body.email_title = emailTitle;
|
|
1135
|
+
}
|
|
1136
|
+
if (emailBody) {
|
|
1137
|
+
body.email_body = emailBody;
|
|
1138
|
+
}
|
|
1139
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
1140
|
+
}
|
|
629
1141
|
}
|
|
630
1142
|
if (resource === 'creditNotes') {
|
|
631
1143
|
if (operation === 'getListCreditNotes') {
|
|
@@ -677,41 +1189,172 @@ class Qonto {
|
|
|
677
1189
|
}
|
|
678
1190
|
if (operation === 'createClient') {
|
|
679
1191
|
const endpoint = 'clients';
|
|
680
|
-
const
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
address: this.getNodeParameter('address', i, null),
|
|
686
|
-
};
|
|
1192
|
+
const kind = this.getNodeParameter('kind', i);
|
|
1193
|
+
const clientName = this.getNodeParameter('clientName', i, '');
|
|
1194
|
+
const firstName = this.getNodeParameter('firstName', i, '');
|
|
1195
|
+
const lastName = this.getNodeParameter('lastName', i, '');
|
|
1196
|
+
const email = this.getNodeParameter('email', i, '');
|
|
687
1197
|
const body = {
|
|
688
|
-
|
|
689
|
-
client: clientData,
|
|
1198
|
+
kind,
|
|
690
1199
|
};
|
|
1200
|
+
if (clientName) {
|
|
1201
|
+
body.name = clientName;
|
|
1202
|
+
}
|
|
1203
|
+
if (firstName) {
|
|
1204
|
+
body.first_name = firstName;
|
|
1205
|
+
}
|
|
1206
|
+
if (lastName) {
|
|
1207
|
+
body.last_name = lastName;
|
|
1208
|
+
}
|
|
1209
|
+
if (email) {
|
|
1210
|
+
body.email = email;
|
|
1211
|
+
}
|
|
1212
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
1213
|
+
if (additionalOptions.vatNumber) {
|
|
1214
|
+
body.vat_number = additionalOptions.vatNumber;
|
|
1215
|
+
}
|
|
1216
|
+
if (additionalOptions.taxIdentificationNumber) {
|
|
1217
|
+
body.tax_identification_number = additionalOptions.taxIdentificationNumber;
|
|
1218
|
+
}
|
|
1219
|
+
if (additionalOptions.currency) {
|
|
1220
|
+
body.currency = additionalOptions.currency;
|
|
1221
|
+
}
|
|
1222
|
+
if (additionalOptions.locale) {
|
|
1223
|
+
body.locale = additionalOptions.locale;
|
|
1224
|
+
}
|
|
1225
|
+
if (additionalOptions.recipientCode) {
|
|
1226
|
+
body.recipient_code = additionalOptions.recipientCode;
|
|
1227
|
+
}
|
|
1228
|
+
if (additionalOptions.eInvoicingAddress) {
|
|
1229
|
+
body.e_invoicing_address = additionalOptions.eInvoicingAddress;
|
|
1230
|
+
}
|
|
1231
|
+
if (additionalOptions.phoneCountryCode || additionalOptions.phoneNumber) {
|
|
1232
|
+
body.phone = {
|
|
1233
|
+
country_code: additionalOptions.phoneCountryCode || '',
|
|
1234
|
+
number: additionalOptions.phoneNumber || '',
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
if (additionalOptions.extraEmails) {
|
|
1238
|
+
body.extra_emails = additionalOptions.extraEmails
|
|
1239
|
+
.split(',')
|
|
1240
|
+
.map((e) => e.trim());
|
|
1241
|
+
}
|
|
1242
|
+
if (additionalOptions.billingStreetAddress ||
|
|
1243
|
+
additionalOptions.billingCity ||
|
|
1244
|
+
additionalOptions.billingZipCode ||
|
|
1245
|
+
additionalOptions.billingCountryCode) {
|
|
1246
|
+
body.billing_address = {};
|
|
1247
|
+
if (additionalOptions.billingStreetAddress) {
|
|
1248
|
+
body.billing_address.street_address =
|
|
1249
|
+
additionalOptions.billingStreetAddress;
|
|
1250
|
+
}
|
|
1251
|
+
if (additionalOptions.billingCity) {
|
|
1252
|
+
body.billing_address.city = additionalOptions.billingCity;
|
|
1253
|
+
}
|
|
1254
|
+
if (additionalOptions.billingZipCode) {
|
|
1255
|
+
body.billing_address.zip_code = additionalOptions.billingZipCode;
|
|
1256
|
+
}
|
|
1257
|
+
if (additionalOptions.billingProvinceCode) {
|
|
1258
|
+
body.billing_address.province_code =
|
|
1259
|
+
additionalOptions.billingProvinceCode;
|
|
1260
|
+
}
|
|
1261
|
+
if (additionalOptions.billingCountryCode) {
|
|
1262
|
+
body.billing_address.country_code =
|
|
1263
|
+
additionalOptions.billingCountryCode;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
691
1266
|
headers = {
|
|
692
1267
|
...headers,
|
|
693
1268
|
'Content-Type': 'application/json',
|
|
694
1269
|
};
|
|
695
1270
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
696
1271
|
}
|
|
1272
|
+
if (operation === 'updateClient') {
|
|
1273
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
1274
|
+
const endpoint = `clients/${clientId}`;
|
|
1275
|
+
const updateFields = this.getNodeParameter('updateFields', i, {});
|
|
1276
|
+
const body = {};
|
|
1277
|
+
if (updateFields.name) {
|
|
1278
|
+
body.name = updateFields.name;
|
|
1279
|
+
}
|
|
1280
|
+
if (updateFields.firstName) {
|
|
1281
|
+
body.first_name = updateFields.firstName;
|
|
1282
|
+
}
|
|
1283
|
+
if (updateFields.lastName) {
|
|
1284
|
+
body.last_name = updateFields.lastName;
|
|
1285
|
+
}
|
|
1286
|
+
if (updateFields.email) {
|
|
1287
|
+
body.email = updateFields.email;
|
|
1288
|
+
}
|
|
1289
|
+
if (updateFields.vatNumber) {
|
|
1290
|
+
body.vat_number = updateFields.vatNumber;
|
|
1291
|
+
}
|
|
1292
|
+
if (updateFields.taxIdentificationNumber) {
|
|
1293
|
+
body.tax_identification_number = updateFields.taxIdentificationNumber;
|
|
1294
|
+
}
|
|
1295
|
+
if (updateFields.currency) {
|
|
1296
|
+
body.currency = updateFields.currency;
|
|
1297
|
+
}
|
|
1298
|
+
if (updateFields.locale) {
|
|
1299
|
+
body.locale = updateFields.locale;
|
|
1300
|
+
}
|
|
1301
|
+
if (updateFields.recipientCode) {
|
|
1302
|
+
body.recipient_code = updateFields.recipientCode;
|
|
1303
|
+
}
|
|
1304
|
+
if (updateFields.eInvoicingAddress) {
|
|
1305
|
+
body.e_invoicing_address = updateFields.eInvoicingAddress;
|
|
1306
|
+
}
|
|
1307
|
+
if (updateFields.phoneCountryCode || updateFields.phoneNumber) {
|
|
1308
|
+
body.phone = {
|
|
1309
|
+
country_code: updateFields.phoneCountryCode || '',
|
|
1310
|
+
number: updateFields.phoneNumber || '',
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
if (updateFields.billingStreetAddress ||
|
|
1314
|
+
updateFields.billingCity ||
|
|
1315
|
+
updateFields.billingZipCode ||
|
|
1316
|
+
updateFields.billingCountryCode) {
|
|
1317
|
+
body.billing_address = {};
|
|
1318
|
+
if (updateFields.billingStreetAddress) {
|
|
1319
|
+
body.billing_address.street_address =
|
|
1320
|
+
updateFields.billingStreetAddress;
|
|
1321
|
+
}
|
|
1322
|
+
if (updateFields.billingCity) {
|
|
1323
|
+
body.billing_address.city = updateFields.billingCity;
|
|
1324
|
+
}
|
|
1325
|
+
if (updateFields.billingZipCode) {
|
|
1326
|
+
body.billing_address.zip_code = updateFields.billingZipCode;
|
|
1327
|
+
}
|
|
1328
|
+
if (updateFields.billingProvinceCode) {
|
|
1329
|
+
body.billing_address.province_code =
|
|
1330
|
+
updateFields.billingProvinceCode;
|
|
1331
|
+
}
|
|
1332
|
+
if (updateFields.billingCountryCode) {
|
|
1333
|
+
body.billing_address.country_code =
|
|
1334
|
+
updateFields.billingCountryCode;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
headers = {
|
|
1338
|
+
...headers,
|
|
1339
|
+
'Content-Type': 'application/json',
|
|
1340
|
+
};
|
|
1341
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1342
|
+
}
|
|
1343
|
+
if (operation === 'deleteClient') {
|
|
1344
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
1345
|
+
const endpoint = `clients/${clientId}`;
|
|
1346
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
1347
|
+
}
|
|
697
1348
|
}
|
|
698
1349
|
if (resource === 'teams') {
|
|
699
1350
|
if (operation === 'listTeams') {
|
|
700
1351
|
const endpoint = 'teams';
|
|
701
|
-
const organizationId = this.getNodeParameter('organizationId', i);
|
|
702
|
-
query.organization_id = organizationId;
|
|
703
1352
|
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, query, i);
|
|
704
1353
|
}
|
|
705
1354
|
if (operation === 'createTeam') {
|
|
706
1355
|
const endpoint = 'teams';
|
|
707
|
-
const organizationId = this.getNodeParameter('organizationId', i);
|
|
708
|
-
const teamData = {
|
|
709
|
-
name: this.getNodeParameter('teamName', i),
|
|
710
|
-
description: this.getNodeParameter('teamDescription', i, null),
|
|
711
|
-
};
|
|
712
1356
|
const body = {
|
|
713
|
-
|
|
714
|
-
team: teamData,
|
|
1357
|
+
name: this.getNodeParameter('teamName', i),
|
|
715
1358
|
};
|
|
716
1359
|
headers = {
|
|
717
1360
|
...headers,
|
|
@@ -726,11 +1369,11 @@ class Qonto {
|
|
|
726
1369
|
const filters = this.getNodeParameter('filters', i);
|
|
727
1370
|
if (!isEmpty(filters)) {
|
|
728
1371
|
if (filters.bank_account_ids) {
|
|
729
|
-
const ids = filters.bank_account_ids.split(',').map(id => id.trim());
|
|
1372
|
+
const ids = filters.bank_account_ids.split(',').map((id) => id.trim());
|
|
730
1373
|
query['bank_account_ids[]'] = ids;
|
|
731
1374
|
}
|
|
732
1375
|
if (filters.ibans) {
|
|
733
|
-
const ibans = filters.ibans.split(',').map(iban => iban.trim());
|
|
1376
|
+
const ibans = filters.ibans.split(',').map((iban) => iban.trim());
|
|
734
1377
|
query['ibans[]'] = ibans;
|
|
735
1378
|
}
|
|
736
1379
|
if (filters.period_from) {
|
|
@@ -754,17 +1397,41 @@ class Qonto {
|
|
|
754
1397
|
if (resource === 'insuranceContracts') {
|
|
755
1398
|
if (operation === 'createInsuranceContract') {
|
|
756
1399
|
const endpoint = 'insurance_contracts';
|
|
757
|
-
const organizationId = this.getNodeParameter('organizationId', i);
|
|
758
|
-
const endDate = this.getNodeParameter('endDate', i, null);
|
|
759
1400
|
const contractData = {
|
|
760
1401
|
name: this.getNodeParameter('contractName', i),
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1402
|
+
contract_id: this.getNodeParameter('contractId', i),
|
|
1403
|
+
origin: this.getNodeParameter('origin', i),
|
|
1404
|
+
provider_slug: this.getNodeParameter('providerSlug', i),
|
|
1405
|
+
type: this.getNodeParameter('contractType', i),
|
|
1406
|
+
status: this.getNodeParameter('status', i),
|
|
764
1407
|
};
|
|
1408
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
1409
|
+
if (additionalOptions.troubleshootingUrl) {
|
|
1410
|
+
contractData.troubleshooting_url = additionalOptions.troubleshootingUrl;
|
|
1411
|
+
}
|
|
1412
|
+
if (additionalOptions.serviceUrl) {
|
|
1413
|
+
contractData.service_url = additionalOptions.serviceUrl;
|
|
1414
|
+
}
|
|
1415
|
+
if (additionalOptions.expirationDate) {
|
|
1416
|
+
contractData.expiration_date = (0, helpers_1.formatDate)(additionalOptions.expirationDate);
|
|
1417
|
+
}
|
|
1418
|
+
if (additionalOptions.startDate) {
|
|
1419
|
+
contractData.start_date = (0, helpers_1.formatDate)(additionalOptions.startDate);
|
|
1420
|
+
}
|
|
1421
|
+
if (additionalOptions.renewalDate) {
|
|
1422
|
+
contractData.renewal_date = (0, helpers_1.formatDate)(additionalOptions.renewalDate);
|
|
1423
|
+
}
|
|
1424
|
+
if (additionalOptions.paymentFrequency) {
|
|
1425
|
+
contractData.payment_frequency = additionalOptions.paymentFrequency;
|
|
1426
|
+
}
|
|
1427
|
+
if (additionalOptions.priceValue || additionalOptions.priceCurrency) {
|
|
1428
|
+
contractData.price = {
|
|
1429
|
+
value: additionalOptions.priceValue || '',
|
|
1430
|
+
currency: additionalOptions.priceCurrency || 'EUR',
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
765
1433
|
const body = {
|
|
766
|
-
|
|
767
|
-
contract: contractData,
|
|
1434
|
+
insurance_contract: contractData,
|
|
768
1435
|
};
|
|
769
1436
|
headers = {
|
|
770
1437
|
...headers,
|
|
@@ -778,16 +1445,54 @@ class Qonto {
|
|
|
778
1445
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
779
1446
|
}
|
|
780
1447
|
if (operation === 'updateInsuranceContract') {
|
|
781
|
-
const
|
|
782
|
-
const endpoint = `insurance_contracts/${
|
|
783
|
-
const
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1448
|
+
const contractIdToUpdate = this.getNodeParameter('contractIdToUpdate', i);
|
|
1449
|
+
const endpoint = `insurance_contracts/${contractIdToUpdate}`;
|
|
1450
|
+
const updateFields = this.getNodeParameter('updateFields', i, {});
|
|
1451
|
+
const contractData = {};
|
|
1452
|
+
if (updateFields.name) {
|
|
1453
|
+
contractData.name = updateFields.name;
|
|
1454
|
+
}
|
|
1455
|
+
if (updateFields.contractId) {
|
|
1456
|
+
contractData.contract_id = updateFields.contractId;
|
|
1457
|
+
}
|
|
1458
|
+
if (updateFields.origin) {
|
|
1459
|
+
contractData.origin = updateFields.origin;
|
|
1460
|
+
}
|
|
1461
|
+
if (updateFields.providerSlug) {
|
|
1462
|
+
contractData.provider_slug = updateFields.providerSlug;
|
|
1463
|
+
}
|
|
1464
|
+
if (updateFields.type) {
|
|
1465
|
+
contractData.type = updateFields.type;
|
|
1466
|
+
}
|
|
1467
|
+
if (updateFields.status) {
|
|
1468
|
+
contractData.status = updateFields.status;
|
|
1469
|
+
}
|
|
1470
|
+
if (updateFields.troubleshootingUrl) {
|
|
1471
|
+
contractData.troubleshooting_url = updateFields.troubleshootingUrl;
|
|
1472
|
+
}
|
|
1473
|
+
if (updateFields.serviceUrl) {
|
|
1474
|
+
contractData.service_url = updateFields.serviceUrl;
|
|
1475
|
+
}
|
|
1476
|
+
if (updateFields.expirationDate) {
|
|
1477
|
+
contractData.expiration_date = (0, helpers_1.formatDate)(updateFields.expirationDate);
|
|
1478
|
+
}
|
|
1479
|
+
if (updateFields.startDate) {
|
|
1480
|
+
contractData.start_date = (0, helpers_1.formatDate)(updateFields.startDate);
|
|
1481
|
+
}
|
|
1482
|
+
if (updateFields.renewalDate) {
|
|
1483
|
+
contractData.renewal_date = (0, helpers_1.formatDate)(updateFields.renewalDate);
|
|
1484
|
+
}
|
|
1485
|
+
if (updateFields.paymentFrequency) {
|
|
1486
|
+
contractData.payment_frequency = updateFields.paymentFrequency;
|
|
1487
|
+
}
|
|
1488
|
+
if (updateFields.priceValue || updateFields.priceCurrency) {
|
|
1489
|
+
contractData.price = {
|
|
1490
|
+
value: updateFields.priceValue || '',
|
|
1491
|
+
currency: updateFields.priceCurrency || 'EUR',
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
789
1494
|
const body = {
|
|
790
|
-
|
|
1495
|
+
insurance_contract: contractData,
|
|
791
1496
|
};
|
|
792
1497
|
headers = {
|
|
793
1498
|
...headers,
|
|
@@ -795,19 +1500,56 @@ class Qonto {
|
|
|
795
1500
|
};
|
|
796
1501
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
797
1502
|
}
|
|
798
|
-
if (operation === '
|
|
1503
|
+
if (operation === 'uploadInsuranceDocument') {
|
|
799
1504
|
const contractId = this.getNodeParameter('contractId', i);
|
|
800
|
-
const
|
|
801
|
-
const endpoint = `insurance_contracts/${contractId}/
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1505
|
+
const binaryProperty = this.getNodeParameter('binaryProperty', i);
|
|
1506
|
+
const endpoint = `insurance_contracts/${contractId}/attachments`;
|
|
1507
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryProperty);
|
|
1508
|
+
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
|
1509
|
+
const formData = {
|
|
1510
|
+
file: {
|
|
1511
|
+
value: dataBuffer,
|
|
1512
|
+
options: {
|
|
1513
|
+
filename: binaryData.fileName || 'attachment',
|
|
1514
|
+
contentType: binaryData.mimeType || 'application/octet-stream',
|
|
1515
|
+
},
|
|
1516
|
+
},
|
|
808
1517
|
};
|
|
1518
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, formData, {}, true);
|
|
1519
|
+
}
|
|
1520
|
+
if (operation === 'deleteInsuranceDocument') {
|
|
1521
|
+
const contractId = this.getNodeParameter('contractId', i);
|
|
1522
|
+
const attachmentId = this.getNodeParameter('attachmentId', i);
|
|
1523
|
+
const endpoint = `insurance_contracts/${contractId}/attachments/${attachmentId}`;
|
|
1524
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
if (resource === 'webhookSubscriptions') {
|
|
1528
|
+
if (operation === 'listWebhookSubscriptions') {
|
|
1529
|
+
const endpoint = 'webhook_subscriptions';
|
|
1530
|
+
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, {}, i);
|
|
1531
|
+
}
|
|
1532
|
+
if (operation === 'createWebhookSubscription') {
|
|
1533
|
+
const endpoint = 'webhook_subscriptions';
|
|
1534
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
809
1535
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
810
1536
|
}
|
|
1537
|
+
if (operation === 'showWebhookSubscription') {
|
|
1538
|
+
const subscriptionId = this.getNodeParameter('subscriptionId', i);
|
|
1539
|
+
const endpoint = `webhook_subscriptions/${subscriptionId}`;
|
|
1540
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
1541
|
+
}
|
|
1542
|
+
if (operation === 'updateWebhookSubscription') {
|
|
1543
|
+
const subscriptionId = this.getNodeParameter('subscriptionId', i);
|
|
1544
|
+
const endpoint = `webhook_subscriptions/${subscriptionId}`;
|
|
1545
|
+
const body = parseJsonParameter(this.getNodeParameter('payload', i));
|
|
1546
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, body, {});
|
|
1547
|
+
}
|
|
1548
|
+
if (operation === 'deleteWebhookSubscription') {
|
|
1549
|
+
const subscriptionId = this.getNodeParameter('subscriptionId', i);
|
|
1550
|
+
const endpoint = `webhook_subscriptions/${subscriptionId}`;
|
|
1551
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'DELETE', endpoint, {}, {});
|
|
1552
|
+
}
|
|
811
1553
|
}
|
|
812
1554
|
if (resource === 'cards') {
|
|
813
1555
|
if (operation === 'listCards') {
|
|
@@ -823,17 +1565,62 @@ class Qonto {
|
|
|
823
1565
|
}
|
|
824
1566
|
responseData = await helpers_1.handleListing.call(this, headers, 'GET', endpoint, {}, query, i);
|
|
825
1567
|
}
|
|
826
|
-
if (operation === '
|
|
1568
|
+
if (operation === 'createCard') {
|
|
827
1569
|
const endpoint = 'cards';
|
|
828
|
-
const organizationId = this.getNodeParameter('organizationId', i);
|
|
829
1570
|
const cardData = {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
1571
|
+
holder_id: this.getNodeParameter('holderId', i),
|
|
1572
|
+
bank_account_id: this.getNodeParameter('bankAccountId', i),
|
|
1573
|
+
card_level: this.getNodeParameter('cardLevel', i),
|
|
1574
|
+
payment_monthly_limit: this.getNodeParameter('paymentMonthlyLimit', i),
|
|
834
1575
|
};
|
|
1576
|
+
const additionalOptions = this.getNodeParameter('additionalOptions', i, {});
|
|
1577
|
+
if (additionalOptions.organizationId) {
|
|
1578
|
+
cardData.organization_id = additionalOptions.organizationId;
|
|
1579
|
+
}
|
|
1580
|
+
if (additionalOptions.initiatorId) {
|
|
1581
|
+
cardData.initiator_id = additionalOptions.initiatorId;
|
|
1582
|
+
}
|
|
1583
|
+
if (additionalOptions.atmOption !== undefined) {
|
|
1584
|
+
cardData.atm_option = additionalOptions.atmOption;
|
|
1585
|
+
}
|
|
1586
|
+
if (additionalOptions.atmMonthlyLimit) {
|
|
1587
|
+
cardData.atm_monthly_limit = additionalOptions.atmMonthlyLimit;
|
|
1588
|
+
}
|
|
1589
|
+
if (additionalOptions.atmDailyLimitOption !== undefined) {
|
|
1590
|
+
cardData.atm_daily_limit_option = additionalOptions.atmDailyLimitOption;
|
|
1591
|
+
}
|
|
1592
|
+
if (additionalOptions.atmDailyLimit) {
|
|
1593
|
+
cardData.atm_daily_limit = additionalOptions.atmDailyLimit;
|
|
1594
|
+
}
|
|
1595
|
+
if (additionalOptions.nfcOption !== undefined) {
|
|
1596
|
+
cardData.nfc_option = additionalOptions.nfcOption;
|
|
1597
|
+
}
|
|
1598
|
+
if (additionalOptions.onlineOption !== undefined) {
|
|
1599
|
+
cardData.online_option = additionalOptions.onlineOption;
|
|
1600
|
+
}
|
|
1601
|
+
if (additionalOptions.foreignOption !== undefined) {
|
|
1602
|
+
cardData.foreign_option = additionalOptions.foreignOption;
|
|
1603
|
+
}
|
|
1604
|
+
if (additionalOptions.paymentDailyLimitOption !== undefined) {
|
|
1605
|
+
cardData.payment_daily_limit_option = additionalOptions.paymentDailyLimitOption;
|
|
1606
|
+
}
|
|
1607
|
+
if (additionalOptions.paymentDailyLimit) {
|
|
1608
|
+
cardData.payment_daily_limit = additionalOptions.paymentDailyLimit;
|
|
1609
|
+
}
|
|
1610
|
+
if (additionalOptions.paymentTransactionLimitOption !== undefined) {
|
|
1611
|
+
cardData.payment_transaction_limit_option =
|
|
1612
|
+
additionalOptions.paymentTransactionLimitOption;
|
|
1613
|
+
}
|
|
1614
|
+
if (additionalOptions.paymentTransactionLimit) {
|
|
1615
|
+
cardData.payment_transaction_limit = additionalOptions.paymentTransactionLimit;
|
|
1616
|
+
}
|
|
1617
|
+
if (additionalOptions.shipToBusiness !== undefined) {
|
|
1618
|
+
cardData.ship_to_business = additionalOptions.shipToBusiness;
|
|
1619
|
+
}
|
|
1620
|
+
if (additionalOptions.cardDesign) {
|
|
1621
|
+
cardData.card_design = additionalOptions.cardDesign;
|
|
1622
|
+
}
|
|
835
1623
|
const body = {
|
|
836
|
-
organization_id: organizationId,
|
|
837
1624
|
card: cardData,
|
|
838
1625
|
};
|
|
839
1626
|
headers = {
|
|
@@ -842,6 +1629,126 @@ class Qonto {
|
|
|
842
1629
|
};
|
|
843
1630
|
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
844
1631
|
}
|
|
1632
|
+
if (operation === 'createCardsBulk') {
|
|
1633
|
+
const endpoint = 'cards/bulk';
|
|
1634
|
+
const cards = this.getNodeParameter('cardsPayload', i);
|
|
1635
|
+
const body = {
|
|
1636
|
+
cards,
|
|
1637
|
+
};
|
|
1638
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'POST', endpoint, body, {});
|
|
1639
|
+
}
|
|
1640
|
+
if (operation === 'retrieveCard') {
|
|
1641
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1642
|
+
const endpoint = `cards/${cardId}/data_view`;
|
|
1643
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'GET', endpoint, {}, {});
|
|
1644
|
+
}
|
|
1645
|
+
if (operation === 'updateCardLimits') {
|
|
1646
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1647
|
+
const endpoint = `cards/${cardId}/limits`;
|
|
1648
|
+
const updateLimits = this.getNodeParameter('updateLimits', i, {});
|
|
1649
|
+
const cardData = {};
|
|
1650
|
+
if (updateLimits.paymentMonthlyLimit !== undefined) {
|
|
1651
|
+
cardData.payment_monthly_limit = updateLimits.paymentMonthlyLimit;
|
|
1652
|
+
}
|
|
1653
|
+
if (updateLimits.atmMonthlyLimit !== undefined) {
|
|
1654
|
+
cardData.atm_monthly_limit = updateLimits.atmMonthlyLimit;
|
|
1655
|
+
}
|
|
1656
|
+
if (updateLimits.atmDailyLimitOption !== undefined) {
|
|
1657
|
+
cardData.atm_daily_limit_option = updateLimits.atmDailyLimitOption;
|
|
1658
|
+
}
|
|
1659
|
+
if (updateLimits.atmDailyLimit !== undefined) {
|
|
1660
|
+
cardData.atm_daily_limit = updateLimits.atmDailyLimit;
|
|
1661
|
+
}
|
|
1662
|
+
if (updateLimits.paymentDailyLimitOption !== undefined) {
|
|
1663
|
+
cardData.payment_daily_limit_option = updateLimits.paymentDailyLimitOption;
|
|
1664
|
+
}
|
|
1665
|
+
if (updateLimits.paymentDailyLimit !== undefined) {
|
|
1666
|
+
cardData.payment_daily_limit = updateLimits.paymentDailyLimit;
|
|
1667
|
+
}
|
|
1668
|
+
if (updateLimits.paymentTransactionLimitOption !== undefined) {
|
|
1669
|
+
cardData.payment_transaction_limit_option =
|
|
1670
|
+
updateLimits.paymentTransactionLimitOption;
|
|
1671
|
+
}
|
|
1672
|
+
if (updateLimits.paymentTransactionLimit !== undefined) {
|
|
1673
|
+
cardData.payment_transaction_limit = updateLimits.paymentTransactionLimit;
|
|
1674
|
+
}
|
|
1675
|
+
const body = {
|
|
1676
|
+
card: cardData,
|
|
1677
|
+
};
|
|
1678
|
+
headers = {
|
|
1679
|
+
...headers,
|
|
1680
|
+
'Content-Type': 'application/json',
|
|
1681
|
+
};
|
|
1682
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1683
|
+
}
|
|
1684
|
+
if (operation === 'updateCardOptions') {
|
|
1685
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1686
|
+
const endpoint = `cards/${cardId}/options`;
|
|
1687
|
+
const updateOptions = this.getNodeParameter('updateOptions', i, {});
|
|
1688
|
+
const cardData = {};
|
|
1689
|
+
if (updateOptions.atmOption !== undefined) {
|
|
1690
|
+
cardData.atm_option = updateOptions.atmOption;
|
|
1691
|
+
}
|
|
1692
|
+
if (updateOptions.nfcOption !== undefined) {
|
|
1693
|
+
cardData.nfc_option = updateOptions.nfcOption;
|
|
1694
|
+
}
|
|
1695
|
+
if (updateOptions.onlineOption !== undefined) {
|
|
1696
|
+
cardData.online_option = updateOptions.onlineOption;
|
|
1697
|
+
}
|
|
1698
|
+
if (updateOptions.foreignOption !== undefined) {
|
|
1699
|
+
cardData.foreign_option = updateOptions.foreignOption;
|
|
1700
|
+
}
|
|
1701
|
+
const body = {
|
|
1702
|
+
card: cardData,
|
|
1703
|
+
};
|
|
1704
|
+
headers = {
|
|
1705
|
+
...headers,
|
|
1706
|
+
'Content-Type': 'application/json',
|
|
1707
|
+
};
|
|
1708
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1709
|
+
}
|
|
1710
|
+
if (operation === 'lockCard') {
|
|
1711
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1712
|
+
const endpoint = `cards/${cardId}/lock`;
|
|
1713
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, {}, {});
|
|
1714
|
+
}
|
|
1715
|
+
if (operation === 'unlockCard') {
|
|
1716
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1717
|
+
const endpoint = `cards/${cardId}/unlock`;
|
|
1718
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, {}, {});
|
|
1719
|
+
}
|
|
1720
|
+
if (operation === 'reportCardLost') {
|
|
1721
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1722
|
+
const endpoint = `cards/${cardId}/lost`;
|
|
1723
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, {}, {});
|
|
1724
|
+
}
|
|
1725
|
+
if (operation === 'reportCardStolen') {
|
|
1726
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1727
|
+
const endpoint = `cards/${cardId}/stolen`;
|
|
1728
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, {}, {});
|
|
1729
|
+
}
|
|
1730
|
+
if (operation === 'discardVirtualCard') {
|
|
1731
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1732
|
+
const endpoint = `cards/${cardId}/discard`;
|
|
1733
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PUT', endpoint, {}, {});
|
|
1734
|
+
}
|
|
1735
|
+
if (operation === 'updateCardRestrictions') {
|
|
1736
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1737
|
+
const endpoint = `cards/${cardId}/restrictions`;
|
|
1738
|
+
const body = this.getNodeParameter('restrictionsPayload', i);
|
|
1739
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1740
|
+
}
|
|
1741
|
+
if (operation === 'updateCardNickname') {
|
|
1742
|
+
const cardId = this.getNodeParameter('cardId', i);
|
|
1743
|
+
const endpoint = `cards/${cardId}/nickname`;
|
|
1744
|
+
const nickname = this.getNodeParameter('nickname', i);
|
|
1745
|
+
const body = {
|
|
1746
|
+
card: {
|
|
1747
|
+
nickname,
|
|
1748
|
+
},
|
|
1749
|
+
};
|
|
1750
|
+
responseData = await helpers_1.qontoApiRequest.call(this, headers, 'PATCH', endpoint, body, {});
|
|
1751
|
+
}
|
|
845
1752
|
}
|
|
846
1753
|
}
|
|
847
1754
|
catch (error) {
|