mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Invoice Ninja Node): Fix emailing and marking invoice as paid / sent (#9589)
This commit is contained in:
parent
757feaf585
commit
908ddd8a24
|
@ -158,6 +158,12 @@ export const invoiceFields: INodeProperties[] = [
|
|||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Mark Sent',
|
||||
name: 'markSent',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Paid',
|
||||
name: 'paid',
|
||||
|
|
|
@ -421,7 +421,6 @@ export class InvoiceNinja implements INodeType {
|
|||
if (apiVersion === 'v4') {
|
||||
body.invoice_number = additionalFields.invoiceNumber as string;
|
||||
} else if (apiVersion === 'v5') {
|
||||
// eslint-disable-next-line id-denylist
|
||||
body.number = additionalFields.invoiceNumber as string;
|
||||
}
|
||||
}
|
||||
|
@ -462,10 +461,21 @@ export class InvoiceNinja implements INodeType {
|
|||
body.discount = additionalFields.discount as number;
|
||||
}
|
||||
if (additionalFields.paid) {
|
||||
body.paid = additionalFields.paid as number;
|
||||
if (apiVersion === 'v4') {
|
||||
body.paid = additionalFields.paid as number;
|
||||
} else if (apiVersion === 'v5') {
|
||||
qs.amount_paid = additionalFields.paid as number;
|
||||
}
|
||||
}
|
||||
if (additionalFields.emailInvoice) {
|
||||
body.email_invoice = additionalFields.emailInvoice as boolean;
|
||||
if (apiVersion === 'v4') {
|
||||
body.email_invoice = additionalFields.emailInvoice as boolean;
|
||||
} else if (apiVersion === 'v5') {
|
||||
qs.send_email = additionalFields.emailInvoice as boolean;
|
||||
}
|
||||
}
|
||||
if (additionalFields.markSent) {
|
||||
qs.mark_sent = additionalFields.markSent as boolean;
|
||||
}
|
||||
const invoceItemsValues = (this.getNodeParameter('invoiceItemsUi', i) as IDataObject)
|
||||
.invoiceItemsValues as IDataObject[];
|
||||
|
@ -501,6 +511,7 @@ export class InvoiceNinja implements INodeType {
|
|||
'POST',
|
||||
'/invoices',
|
||||
body as IDataObject,
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
|
@ -879,7 +890,6 @@ export class InvoiceNinja implements INodeType {
|
|||
if (apiVersion === 'v4') {
|
||||
body.invoice_number = additionalFields.quoteNumber as string;
|
||||
} else if (apiVersion === 'v5') {
|
||||
// eslint-disable-next-line id-denylist
|
||||
body.number = additionalFields.quoteNumber as string;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export const quoteOperations: INodeProperties[] = [
|
|||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
description: 'Email an quote',
|
||||
description: 'Email a quote',
|
||||
action: 'Email a quote',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -15,10 +15,10 @@ export interface IInvoice {
|
|||
client_id?: number;
|
||||
custom_value1?: number;
|
||||
custom_value2?: number;
|
||||
email_invoice?: boolean;
|
||||
email?: string;
|
||||
discount?: number;
|
||||
due_date?: string;
|
||||
email_invoice?: boolean;
|
||||
email?: string;
|
||||
invoice_date?: string;
|
||||
invoice_items?: IItem[];
|
||||
line_items?: IItem[];
|
||||
|
|
Loading…
Reference in a new issue