Class: Lighthouse526DocumentUpload

Inherits:
ApplicationRecord show all
Includes:
AASM
Defined in:
app/models/lighthouse526_document_upload.rb

Constant Summary collapse

POLLING_WINDOW =
1.hour
VETERAN_UPLOAD_DOCUMENT_TYPE =
'Veteran Upload'
BDD_INSTRUCTIONS_DOCUMENT_TYPE =
'BDD Instructions'
FORM_0781_DOCUMENT_TYPE =
'Form 0781'
FORM_0781A_DOCUMENT_TYPE =
'Form 0781a'
VALID_DOCUMENT_TYPES =
[
  BDD_INSTRUCTIONS_DOCUMENT_TYPE,
  FORM_0781_DOCUMENT_TYPE,
  FORM_0781A_DOCUMENT_TYPE,
  VETERAN_UPLOAD_DOCUMENT_TYPE
].freeze

Instance Method Summary collapse

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#end_time_saved?Boolean (private)

Returns:

  • (Boolean)


59
60
61
# File 'app/models/lighthouse526_document_upload.rb', line 59

def end_time_saved?
  lighthouse_processing_ended_at != nil
end

#error_message_saved?Boolean (private)

Returns:

  • (Boolean)


63
64
65
# File 'app/models/lighthouse526_document_upload.rb', line 63

def error_message_saved?
  error_message != nil
end

#form0781_types?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/models/lighthouse526_document_upload.rb', line 49

def form0781_types?
  [FORM_0781_DOCUMENT_TYPE, FORM_0781A_DOCUMENT_TYPE].include?(document_type)
end

#handle_failureObject (private)



67
68
69
70
71
72
# File 'app/models/lighthouse526_document_upload.rb', line 67

def handle_failure
  # Do not enable until 100 percent of Lighthouse document upload migration is complete!
  if Flipper.enabled?(:disability_compensation_email_veteran_on_polled_lighthouse_doc_failure)
    BenefitsDocuments::Form526::PolledDocumentFailureHandler.call(self)
  end
end

#veteran_upload?Boolean (private)

Returns:

  • (Boolean)


55
56
57
# File 'app/models/lighthouse526_document_upload.rb', line 55

def veteran_upload?
  document_type == VETERAN_UPLOAD_DOCUMENT_TYPE
end