Skip to content

Commit

Permalink
fix(Invoice Ninja Node): Fix line items not being correctly set for q…
Browse files Browse the repository at this point in the history
…uotes and invoices (#5304)
  • Loading branch information
parasdaryanani authored Feb 2, 2023
1 parent 04c058a commit 3b5e1d1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
28 changes: 24 additions & 4 deletions packages/nodes-base/nodes/InvoiceNinja/InvoiceNinja.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,25 @@ export class InvoiceNinja implements INodeType {
cost: itemValue.cost as number,
notes: itemValue.description as string,
product_key: itemValue.service as string,
qty: itemValue.hours as number,
tax_rate1: itemValue.taxRate1 as number,
tax_rate2: itemValue.taxRate2 as number,
tax_name1: itemValue.taxName1 as string,
tax_name2: itemValue.taxName2 as string,
};
if (apiVersion === 'v4') {
item.qty = itemValue.hours as number;
}
if (apiVersion === 'v5') {
item.quantity = itemValue.hours as number;
}
invoiceItems.push(item);
}
body.invoice_items = invoiceItems;
if (apiVersion === 'v4') {
body.invoice_items = invoiceItems;
}
if (apiVersion === 'v5') {
body.line_items = invoiceItems;
}
}
responseData = await invoiceNinjaApiRequest.call(
this,
Expand Down Expand Up @@ -902,15 +912,25 @@ export class InvoiceNinja implements INodeType {
cost: itemValue.cost as number,
notes: itemValue.description as string,
product_key: itemValue.service as string,
qty: itemValue.hours as number,
tax_rate1: itemValue.taxRate1 as number,
tax_rate2: itemValue.taxRate2 as number,
tax_name1: itemValue.taxName1 as string,
tax_name2: itemValue.taxName2 as string,
};
if (apiVersion === 'v4') {
item.qty = itemValue.hours as number;
}
if (apiVersion === 'v5') {
item.quantity = itemValue.hours as number;
}
invoiceItems.push(item);
}
body.invoice_items = invoiceItems;
if (apiVersion === 'v4') {
body.invoice_items = invoiceItems;
}
if (apiVersion === 'v5') {
body.line_items = invoiceItems;
}
}
responseData = await invoiceNinjaApiRequest.call(
this,
Expand Down
2 changes: 2 additions & 0 deletions packages/nodes-base/nodes/InvoiceNinja/QuoteInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface IItem {
notes?: string;
product_key?: string;
qty?: number;
quantity?: number;
tax_rate1?: number;
tax_rate2?: number;
tax_name1?: string;
Expand All @@ -20,6 +21,7 @@ export interface IQuote {
email?: string;
invoice_date?: string;
invoice_items?: IItem[];
line_items?: IItem[];
invoice_number?: string;
invoice_status_id?: number;
is_amount_discount?: boolean;
Expand Down
2 changes: 2 additions & 0 deletions packages/nodes-base/nodes/InvoiceNinja/invoiceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface IItem {
notes?: string;
product_key?: string;
qty?: number;
quantity?: number;
tax_rate1?: number;
tax_rate2?: number;
tax_name1?: string;
Expand All @@ -20,6 +21,7 @@ export interface IInvoice {
due_date?: string;
invoice_date?: string;
invoice_items?: IItem[];
line_items?: IItem[];
invoice_number?: string;
invoice_status_id?: number;
is_amount_discount?: boolean;
Expand Down

0 comments on commit 3b5e1d1

Please sign in to comment.