Class: Sidekiq::Form526BackupSubmissionProcess::NonBreakeredProcessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/sidekiq/form526_backup_submission_process/processor.rb

Constant Summary

Constants inherited from Processor

Processor::BKUP_SETTINGS, Processor::DOCTYPE_MAPPING, Processor::DOCTYPE_NAMES, Processor::FLASHES, Processor::FORM_0781, Processor::FORM_4142, Processor::FORM_4142_DOC_TYPE, Processor::FORM_526, Processor::FORM_526_DOC_TYPE, Processor::FORM_526_UPLOADS, Processor::FORM_526_UPLOADS_DOC_TYPE, Processor::FORM_8940, Processor::SUB_METHOD

Instance Attribute Summary

Attributes inherited from Processor

#docs, #docs_gathered, #ignore_expiration, #initial_upload, #initial_upload_fetched, #initial_upload_location, #initial_upload_uuid, #lighthouse_service, #submission, #submission_id, #zip

Instance Method Summary collapse

Methods inherited from Processor

#bdd?, #choose_provider, #convert_doc_to_pdf, #convert_docs_to_pdf, #determine_zip, #evidence_526_split, #gather_docs!, #generate_attachments, #generate_zip_and_upload, #get_bdd_pdf, #get_form0781_pdf, #get_form4142_pdf, #get_form8940_pdf, #get_form_from_external_api, #get_meta_data, #get_uploads, #initialize, #instantiate_upload_info_from_lighthouse, #log_info, #log_resp, #new_s3_resource, #process!, #received_date, #return_upload_params_and_docs, #s3_bucket, #send_to_central_mail_through_lighthouse_claims_intake_api!, #submit_ancillary_payloads, #submit_as_one, #submit_initial_payload, #submit_to_lh_claims_intake_api, #upload_location_to_location_and_uuid, #upload_pdf_submission_to_s3, #write_to_tmp_file

Methods included from Logging::ThirdPartyTransaction::MethodWrapper

#wrap_with_logging

Constructor Details

This class inherits a constructor from Sidekiq::Form526BackupSubmissionProcess::Processor

Instance Method Details

#get_form526_pdfObject



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/sidekiq/form526_backup_submission_process/processor.rb', line 451

def get_form526_pdf
  headers = submission.auth_headers
  submission_create_date = submission.created_at.iso8601
  form_json = submission.form[FORM_526]
  form_json[FORM_526]['claimDate'] ||= submission_create_date
  form_json[FORM_526]['applicationExpirationDate'] = 365.days.from_now.iso8601 if @ignore_expiration

  form_version = submission.saved_claim.parsed_form['startedFormVersion']
  if form_version.present?
    resp = get_from_non_breakered_service(headers, ApiProviderFactory::API_PROVIDER[:lighthouse],
                                          form_json.to_json)
    content = resp.env.response_body
  else
    resp = get_from_non_breakered_service(headers, ApiProviderFactory::API_PROVIDER[:evss], form_json.to_json)
    b64_enc_body = resp.body['pdf']
    content = Base64.decode64(b64_enc_body)
  end
  file = write_to_tmp_file(content)
  docs << {
    type: FORM_526_DOC_TYPE,
    file:
  }
end