Skip to content

Commit

Permalink
fix (tax-integrations): do not call update integration customer exter…
Browse files Browse the repository at this point in the history
…nal service for anrok (#2514)

## Context

For Anrok, we should not call the service that updates integration
customer data in external service
  • Loading branch information
lovrocolic authored Aug 30, 2024
1 parent 8863ce5 commit a6139e0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/services/integration_customers/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def call
result = super
return result if result.error

return result if integration_customer.type == 'IntegrationCustomers::AnrokCustomer'
return result.not_found_failure!(resource: 'integration_customer') unless integration_customer

integration_customer.update!(external_customer_id:) if external_customer_id.present?
Expand Down
17 changes: 17 additions & 0 deletions spec/services/integration_customers/update_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@
expect(result.integration_customer.subsidiary_id).to eq(subsidiary_id)
end
end

context 'with anrok customer' do
let(:external_customer_id) { SecureRandom.uuid }
let(:integration_customer) { create(:anrok_customer, integration:, customer:) }

it 'does not calls aggregator update service' do
service_call

expect(aggregator_contacts_update_service).not_to have_received(:call)
end

it 'does not update integration customer' do
service_call

expect(integration_customer.reload.external_customer_id).not_to eq(external_customer_id)
end
end
end

context 'when sync with provider is false' do
Expand Down

0 comments on commit a6139e0

Please sign in to comment.