Class: BenefitsDocuments::Form526::PolledDocumentFailureHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



10
11
12
# File 'lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb', line 10

def self.call(*)
  new.call(*)
end

Instance Method Details

#call(lighthouse526_document_upload) ⇒ Object

queried at Lighthouse that Lighthouse has marked failed



16
17
18
19
# File 'lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb', line 16

def call(lighthouse526_document_upload)
  @lighthouse526_document_upload = lighthouse526_document_upload
  enqueue_veteran_failure_mailer
end

#enqueue_0781_failure_mailerObject (private)



43
44
45
46
# File 'lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb', line 43

def enqueue_0781_failure_mailer
  EVSS::DisabilityCompensationForm::Form0781DocumentUploadFailureEmail
    .perform_async(@lighthouse526_document_upload.form526_submission_id)
end

#enqueue_veteran_evidence_failure_mailerObject (private)



35
36
37
38
39
40
41
# File 'lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb', line 35

def enqueue_veteran_evidence_failure_mailer
  form526_submission_id = @lighthouse526_document_upload.form526_submission_id
  form_attachment_guid = @lighthouse526_document_upload.form_attachment.guid

  EVSS::DisabilityCompensationForm::Form526DocumentUploadFailureEmail
    .perform_async(form526_submission_id, form_attachment_guid)
end

#enqueue_veteran_failure_mailerObject (private)

Enqueues a mailer to send to the Veteran to inform them a document has failed to finish processing, and that they will need to take manual steps to address the situation. The mailer we send is based on the type of document that failed.



26
27
28
29
30
31
32
33
# File 'lib/lighthouse/benefits_documents/form526/polled_document_failure_handler.rb', line 26

def enqueue_veteran_failure_mailer
  case @lighthouse526_document_upload.document_type
  when Lighthouse526DocumentUpload::VETERAN_UPLOAD_DOCUMENT_TYPE
    enqueue_veteran_evidence_failure_mailer
  when Lighthouse526DocumentUpload::FORM_0781_DOCUMENT_TYPE, Lighthouse526DocumentUpload::FORM_0781A_DOCUMENT_TYPE
    enqueue_0781_failure_mailer
  end
end