Class: BGS::SubmitForm674EncryptedJob
- Includes:
- SentryLogging, Sidekiq::Job
- Defined in:
- app/sidekiq/bgs/submit_form674_encrypted_job.rb
Defined Under Namespace
Classes: Invalid674Claim
Constant Summary collapse
- FORM_ID =
'686C-674'
Instance Attribute Summary collapse
-
#claim ⇒ Object
readonly
Returns the value of attribute claim.
-
#in_progress_copy ⇒ Object
readonly
Returns the value of attribute in_progress_copy.
-
#saved_claim_id ⇒ Object
readonly
Returns the value of attribute saved_claim_id.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#user_uuid ⇒ Object
readonly
Returns the value of attribute user_uuid.
-
#vet_info ⇒ Object
readonly
Returns the value of attribute vet_info.
Class Method 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
#claim ⇒ Object (readonly)
Returns the value of attribute claim.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def claim @claim end |
#in_progress_copy ⇒ Object (readonly)
Returns the value of attribute in_progress_copy.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def in_progress_copy @in_progress_copy end |
#saved_claim_id ⇒ Object (readonly)
Returns the value of attribute saved_claim_id.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def saved_claim_id @saved_claim_id end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def user @user end |
#user_uuid ⇒ Object (readonly)
Returns the value of attribute user_uuid.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def user_uuid @user_uuid end |
#vet_info ⇒ Object (readonly)
Returns the value of attribute vet_info.
12 13 14 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 12 def vet_info @vet_info end |
Class Method Details
.generate_user_struct(encrypted_user_struct, vet_info) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 57 def self.generate_user_struct(encrypted_user_struct, vet_info) if encrypted_user_struct.present? return OpenStruct.new(JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct))) end info = vet_info['veteran_information'] full_name = info['full_name'] OpenStruct.new( first_name: full_name['first'], last_name: full_name['last'], middle_name: full_name['middle'], ssn: info['ssn'], email: info['email'], va_profile_email: info['va_profile_email'], participant_id: info['participant_id'], icn: info['icn'], uuid: info['uuid'], common_name: info['common_name'] ) end |
Instance Method Details
#perform(user_uuid, icn, saved_claim_id, encrypted_vet_info, encrypted_user_struct_hash = nil) ⇒ Object
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 |
# File 'app/sidekiq/bgs/submit_form674_encrypted_job.rb', line 31 def perform(user_uuid, icn, saved_claim_id, encrypted_vet_info, encrypted_user_struct_hash = nil) @vet_info = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_vet_info)) Rails.logger.info('BGS::SubmitForm674Job running!', { user_uuid:, saved_claim_id:, icn: }) @user = BGS::SubmitForm674EncryptedJob.generate_user_struct(encrypted_user_struct_hash, @vet_info) @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. }) (e, :warning, {}, { team: 'vfs-ebenefits' }) salvage_save_in_progress_form(FORM_ID, user_uuid, @in_progress_copy) if @in_progress_copy.present? raise end |