diff --git a/app/interactors/datapass_webhook/find_or_create_authorization_request.rb b/app/interactors/datapass_webhook/find_or_create_authorization_request.rb index 32d0165a3..a16dcfb1d 100644 --- a/app/interactors/datapass_webhook/find_or_create_authorization_request.rb +++ b/app/interactors/datapass_webhook/find_or_create_authorization_request.rb @@ -28,7 +28,7 @@ def reopening_event? end def should_update_authorization_request? - !context.reopening || (context.reopening && %w[approve validate].include?(context.event)) + !context.reopening || (context.reopening && %w[transfer approve validate].include?(context.event)) end def create_or_update_contacts_with_roles diff --git a/spec/interactors/datapass_webhook/find_or_create_authorization_request_spec.rb b/spec/interactors/datapass_webhook/find_or_create_authorization_request_spec.rb index 64bdbac7d..35ef0d0bd 100644 --- a/spec/interactors/datapass_webhook/find_or_create_authorization_request_spec.rb +++ b/spec/interactors/datapass_webhook/find_or_create_authorization_request_spec.rb @@ -92,7 +92,7 @@ create(:authorization_request, :with_all_contacts, status: 'validated', external_id: authorization_id) end - context 'when event is not approve or validate' do + context 'when event is not approve, validate or transfer' do let!(:event) { 'draft' } it { is_expected.to be_a_success } @@ -108,7 +108,7 @@ end end - context 'when event is approve or validate' do + context 'when event is validate' do let!(:event) { 'validate' } it { is_expected.to be_a_success } @@ -119,6 +119,18 @@ }.to change { authorization_request.reload.last_update.to_i } end end + + context 'when event is transfer' do + let!(:event) { 'transfer' } + + it { is_expected.to be_a_success } + + it 'updates the authorization request' do + expect { + subject + }.to change { authorization_request.reload.last_update.to_i } + end + end end end