From 3927cd196be9c48878b0b64bce59da3128886536 Mon Sep 17 00:00:00 2001 From: Ivan Novosad Date: Fri, 15 Nov 2024 11:00:45 +0100 Subject: [PATCH] fix(netsuite): Add amount to invoice line items --- .../integrations/aggregator/invoices/payloads/netsuite.rb | 1 + .../integrations/aggregator/invoices/create_service_spec.rb | 3 +++ .../integrations/aggregator/invoices/payloads/netsuite_spec.rb | 3 +++ 3 files changed, 7 insertions(+) diff --git a/app/services/integrations/aggregator/invoices/payloads/netsuite.rb b/app/services/integrations/aggregator/invoices/payloads/netsuite.rb index dcacc69e752..6020c4d9a90 100644 --- a/app/services/integrations/aggregator/invoices/payloads/netsuite.rb +++ b/app/services/integrations/aggregator/invoices/payloads/netsuite.rb @@ -103,6 +103,7 @@ def item(fee) 'account' => mapped_item.external_account_code, 'quantity' => fee.units, 'rate' => limited_rate(fee.precise_unit_amount), + 'amount' => limited_rate(amount(fee.amount_cents, resource: invoice)), 'taxdetailsreference' => fee.id } end diff --git a/spec/services/integrations/aggregator/invoices/create_service_spec.rb b/spec/services/integrations/aggregator/invoices/create_service_spec.rb index 23e033f2144..a4004027ad3 100644 --- a/spec/services/integrations/aggregator/invoices/create_service_spec.rb +++ b/spec/services/integrations/aggregator/invoices/create_service_spec.rb @@ -158,6 +158,7 @@ 'account' => '33', 'quantity' => 0.0, 'rate' => 0.0, + 'amount' => 2.0, 'taxdetailsreference' => anything }, { @@ -165,6 +166,7 @@ 'account' => '44', 'quantity' => 0.0, 'rate' => 0.0, + 'amount' => 2.0, 'taxdetailsreference' => anything }, { @@ -172,6 +174,7 @@ 'account' => 'm22', 'quantity' => 2, 'rate' => 4.1212121212334, + 'amount' => 2.0, 'taxdetailsreference' => anything }, { diff --git a/spec/services/integrations/aggregator/invoices/payloads/netsuite_spec.rb b/spec/services/integrations/aggregator/invoices/payloads/netsuite_spec.rb index 5e1d75cb016..5a468083450 100644 --- a/spec/services/integrations/aggregator/invoices/payloads/netsuite_spec.rb +++ b/spec/services/integrations/aggregator/invoices/payloads/netsuite_spec.rb @@ -167,6 +167,7 @@ 'account' => '33', 'quantity' => 0.0, 'rate' => 0.0, + 'amount' => 100.0, 'taxdetailsreference' => fee_sub.id }, { @@ -174,6 +175,7 @@ 'account' => '44', 'quantity' => 0.0, 'rate' => 0.0, + 'amount' => 2.0, 'taxdetailsreference' => minimum_commitment_fee.id }, { @@ -181,6 +183,7 @@ 'account' => 'm22', 'quantity' => 2, 'rate' => 4.1212121212334, + 'amount' => 2.0, 'taxdetailsreference' => charge_fee.id }, {