Class: BGS::SubmitForm674Job

Inherits:
Job
  • Object
show all
Includes:
SentryLogging, Sidekiq::Job
Defined in:
app/sidekiq/bgs/submit_form674_job.rb

Defined Under Namespace

Classes: Invalid674Claim

Constant Summary collapse

FORM_ID =
'686C-674'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods inherited from Job

#in_progress_form_copy, #normalize_names_and_addresses!, #salvage_save_in_progress_form

Methods included from Utilities::Helpers

#normalize_composite_characters, #remove_special_characters_from_name

Instance Attribute Details

#claimObject (readonly)

Returns the value of attribute claim.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def claim
  @claim
end

#in_progress_copyObject (readonly)

Returns the value of attribute in_progress_copy.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def in_progress_copy
  @in_progress_copy
end

#saved_claim_idObject (readonly)

Returns the value of attribute saved_claim_id.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def saved_claim_id
  @saved_claim_id
end

#userObject (readonly)

Returns the value of attribute user.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def user
  @user
end

#user_uuidObject (readonly)

Returns the value of attribute user_uuid.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def user_uuid
  @user_uuid
end

#vet_infoObject (readonly)

Returns the value of attribute vet_info.



12
13
14
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 12

def vet_info
  @vet_info
end

Instance Method Details

#perform(user_uuid, icn, saved_claim_id, vet_info, user_struct_hash = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/sidekiq/bgs/submit_form674_job.rb', line 30

def perform(user_uuid, icn, saved_claim_id, vet_info, user_struct_hash = {})
  Rails.logger.info('BGS::SubmitForm674Job running!', { user_uuid:, saved_claim_id:, icn: })

  @vet_info = vet_info
  @user = generate_user_struct(user_struct_hash)

  @user_uuid = user_uuid
  @saved_claim_id = saved_claim_id

  in_progress_form = InProgressForm.find_by(form_id: FORM_ID, user_uuid:)
  @in_progress_copy = in_progress_form_copy(in_progress_form)

  claim_data = normalize_names_and_addresses!(valid_claim_data)

  BGS::Form674.new(user, claim).submit(claim_data)

  send_confirmation_email
  in_progress_form&.destroy
  Rails.logger.info('BGS::SubmitForm674Job succeeded!', { user_uuid:, saved_claim_id:, icn: })
rescue => e
  Rails.logger.warn('BGS::SubmitForm674Job received error, retrying...',
                    { user_uuid:, saved_claim_id:, icn:, error: e.message })
  log_message_to_sentry(e, :warning, {}, { team: 'vfs-ebenefits' })
  @icn = icn

  raise
end