Skip to content

Commit

Permalink
feat: added invoices service
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomiguelpinto committed Oct 2, 2024
1 parent 4fbb3f5 commit 1abe762
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def action_path

def call
return unless integration.type == 'Integrations::HubspotIntegration'
return result if integration.contacts_properties_version == VERSION

response = http_client.post_with_response(payload, headers)
if response.success?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@
end
end

context 'when contacts_properties_version is already up-to-date' do
before do
integration.contacts_properties_version = described_class::VERSION
integration.save!
end

it 'does not make an API call and keeps the version unchanged' do
deploy_contacts_service.call

aggregate_failures do
expect(LagoHttpClient::Client).not_to have_received(:new)
expect(http_client).not_to have_received(:post_with_response)
expect(integration.reload.contacts_properties_version).to eq(described_class::VERSION)
end
end
end

context 'when the API call fails' do
let(:response) { instance_double('Response', success?: false) }

Expand Down

0 comments on commit 1abe762

Please sign in to comment.