fix(Invoice Ninja Node): Fix issue with custom invoice numbers not working with v5 (#8200)

## Summary
The v5 API expects the invoice number to under the `number` property
rather than `invoice_number`, At some point this month I am going to
bring in the big PR that fixes all of the v5 issues.

## Related tickets and issues
https://github.com/n8n-io/n8n/issues/8191
This commit is contained in:
Jon 2024-01-03 09:02:19 +00:00 committed by GitHub
parent cfe9525dd4
commit 3b6ae2d0a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View file

@ -418,7 +418,12 @@ export class InvoiceNinja implements INodeType {
body.invoice_date = additionalFields.invoiceDate as string;
}
if (additionalFields.invoiceNumber) {
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;
}
}
if (additionalFields.invoiceStatus) {
body.invoice_status_id = additionalFields.invoiceStatus as number;
@ -858,7 +863,12 @@ export class InvoiceNinja implements INodeType {
body.invoice_date = additionalFields.quouteDate as string;
}
if (additionalFields.quoteNumber) {
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;
}
}
if (additionalFields.invoiceStatus) {
body.invoice_status_id = additionalFields.invoiceStatus as number;

View file

@ -23,6 +23,8 @@ export interface IQuote {
invoice_items?: IItem[];
line_items?: IItem[];
invoice_number?: string;
// eslint-disable-next-line id-denylist
number?: string;
invoice_status_id?: number;
is_amount_discount?: boolean;
is_quote?: boolean;

View file

@ -23,6 +23,8 @@ export interface IInvoice {
invoice_items?: IItem[];
line_items?: IItem[];
invoice_number?: string;
// eslint-disable-next-line id-denylist
number?: string;
invoice_status_id?: number;
is_amount_discount?: boolean;
paid?: number;