Class: EVSS::DisabilityCompensationForm::SubmitForm526

Inherits:
Job
  • Object
show all
Extended by:
Logging::ThirdPartyTransaction::MethodWrapper
Defined in:
app/sidekiq/evss/disability_compensation_form/submit_form526.rb

Direct Known Subclasses

SubmitForm526AllClaim

Constant Summary collapse

RETRY =

Sidekiq has built in exponential back-off functionality for retries A max retry attempt of 15 will result in a run time of ~36 hours Changed from 15 -> 14 ~ Jan 19, 2023 This change reduces the run-time from ~36 hours to ~24 hours

14
STATSD_KEY_PREFIX =
'worker.evss.submit_form526'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging::ThirdPartyTransaction::MethodWrapper

wrap_with_logging

Methods included from Sidekiq::Form526JobStatusTracker::JobTracker

#job_success, #job_try, #with_tracking

Methods included from Sidekiq::Form526JobStatusTracker::BackupSubmission

#send_backup_submission_if_enabled

Methods included from SentryLogging

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

Instance Attribute Details

#submission_idObject

Returns the value of attribute submission_id.



14
15
16
# File 'app/sidekiq/evss/disability_compensation_form/submit_form526.rb', line 14

def submission_id
  @submission_id
end

Instance Method Details

#perform(submission_id) ⇒ Object

Performs an asynchronous job for submitting a form526 to an upstream submission service (currently EVSS)

rubocop:disable Metrics/MethodLength

Parameters:



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'app/sidekiq/evss/disability_compensation_form/submit_form526.rb', line 79

def perform(submission_id)
  @submission_id = submission_id

  Raven.tags_context(source: '526EZ-all-claims')
  super(submission_id)

  submission.prepare_for_evss!
  with_tracking('Form526 Submission', submission.saved_claim_id, submission.id, submission.bdd?) do
    # This instantiates the service as defined by the inheriting object
    # TODO: this meaningless variable assignment is required for the specs to pass, which
    # indicates a problematic coupling of implementation and test logic.  This should eventually
    # be addressed to make this service and test more robust and readable.
    service = service(submission.auth_headers)
    submission.mark_birls_id_as_tried!

    # send submission data to either EVSS or lighthouse
    if Flipper.enabled?(:disability_compensation_lighthouse_submit_migration)
      # submit 526 through Lighthouse API
      # 1. get user's ICN
       = UserAccount.find_by(id: submission.) ||
                     Account.find_by(idme_uuid: submission.user_uuid)
      icn = .icn
      # 2. transform submission data to Lighthouse format
      transform_service = EVSS::DisabilityCompensationForm::Form526ToLighthouseTransform.new
      body = transform_service.transform(submission.form['form526'])
      # 3. send transformed submission data to Lighthouse endpoint
      service = BenefitsClaims::Service.new(icn)
      raw_response = service.submit526(body)
      # 4. convert raw response from Lighthouse to a FormSubmitResponse for further processing (claim_id, status)
      raw_response_struct = OpenStruct.new({
                                             body: { claim_id: raw_response.body },
                                             status: raw_response.status
                                           })
      response = EVSS::DisabilityCompensationForm::FormSubmitResponse
                 .new(raw_response_struct.status, raw_response_struct)
    else

      response = service.submit_form526(submission.form_to_json(Form526Submission::FORM_526))
    end

    response_handler(response)
  end
  submission.send_post_evss_notifications!
rescue Common::Exceptions::BackendServiceException,
       Common::Exceptions::GatewayTimeout,
       Breakers::OutageException,
       EVSS::DisabilityCompensationForm::ServiceUnavailableException => e
  retryable_error_handler(submission, e)
rescue EVSS::DisabilityCompensationForm::ServiceException => e
  # retry submitting the form for specific upstream errors
  retry_form526_error_handler!(submission, e)
rescue => e
  non_retryable_error_handler(submission, e)
end