feat(invoice-ninja): add create payment action

This commit is contained in:
Rıdvan Akca
2023-10-11 15:51:13 +03:00
parent 0121661ad0
commit f0de42fa63
6 changed files with 194 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import listClients from './list-clients';
import listInvoices from './list-invoices';
export default [listClients];
export default [listClients, listInvoices];

View File

@@ -0,0 +1,35 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List invoices',
key: 'listInvoices',
async run($: IGlobalVariable) {
const invoices: {
data: IJSONObject[];
} = {
data: [],
};
const params = {
sort: 'created_at|desc',
};
const {
data: { data },
} = await $.http.get('/v1/invoices', { params });
if (!data?.length) {
return;
}
for (const invoice of data) {
invoices.data.push({
value: invoice.id,
name: invoice.number,
});
}
return invoices;
},
};