From aa76e26314b7a039ff356386cd674af73b2a0e74 Mon Sep 17 00:00:00 2001 From: Ivan Novosad Date: Tue, 19 Nov 2024 10:32:20 +0100 Subject: [PATCH] Fix specs and payment payload --- .../aggregator/payments/payloads/base_payload.rb | 7 +++++-- .../aggregator/payments/payloads/netsuite_spec.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/services/integrations/aggregator/payments/payloads/base_payload.rb b/app/services/integrations/aggregator/payments/payloads/base_payload.rb index 208e6746b26..7e440fafbe6 100644 --- a/app/services/integrations/aggregator/payments/payloads/base_payload.rb +++ b/app/services/integrations/aggregator/payments/payloads/base_payload.rb @@ -37,9 +37,12 @@ def invoice def integration_invoice integration_resource = - invoice.integration_resources.where(resource_type: 'invoice', syncable_type: 'Invoice').first + invoice.integration_resources + .where(integration:, resource_type: 'invoice', syncable_type: 'Invoice').first - raise Integrations::Aggregator::BasePayload::Failure.new(nil, code: 'invoice_missing') unless integration_resource + unless integration_resource + raise Integrations::Aggregator::BasePayload::Failure.new(nil, code: 'invoice_missing') + end integration_resource end diff --git a/spec/services/integrations/aggregator/payments/payloads/netsuite_spec.rb b/spec/services/integrations/aggregator/payments/payloads/netsuite_spec.rb index 88742bd6101..808e82b1913 100644 --- a/spec/services/integrations/aggregator/payments/payloads/netsuite_spec.rb +++ b/spec/services/integrations/aggregator/payments/payloads/netsuite_spec.rb @@ -9,7 +9,7 @@ let(:customer) { create(:customer, organization:) } let(:organization) { create(:organization) } let(:payment) { create(:payment, payable: invoice, amount_cents: 100) } - let(:integration_invoice) { create(:integration_resource, syncable: invoice) } + let(:integration_invoice) { create(:integration_resource, integration:, syncable: invoice) } let(:invoice) do create(