Module: DecisionReviewV1::Appeals::SupplementalClaimServices
- Includes:
- Helpers
- Included in:
- Service
- Defined in:
- lib/decision_review_v1/appeals/supplemental_claim_services.rb
Instance Method Summary collapse
-
#create_supplemental_claim(request_body:, user:) ⇒ Faraday::Response
Creates a new Supplemental Claim.
-
#get_supplemental_claim(uuid) ⇒ Faraday::Response
Returns all of the data associated with a specific Supplemental Claim.
-
#get_supplemental_claim_contestable_issues(user:, benefit_type:) ⇒ Faraday::Response
Returns all issues associated with a Veteran that have been decided as of the receiptDate.
-
#get_supplemental_claim_upload(uuid:) ⇒ Faraday::Response
Returns all of the data associated with a specific Supplemental Claim Evidence Submission.
-
#get_supplemental_claim_upload_url(sc_uuid:, file_number:) ⇒ Faraday::Response
Get the url to upload supporting evidence for a Supplemental Claim.
-
#process_form4142_submission(appeal_submission_id:, rejiggered_payload:) ⇒ Faraday::Response
Creates a new 4142(a) PDF, and sends to central mail.
-
#put_supplemental_claim_upload(upload_url:, file_upload:, metadata_string:) ⇒ Faraday::Response
Upload supporting evidence for a Supplemental Claim.
-
#queue_form4142(appeal_submission_id:, rejiggered_payload:, submitted_appeal_uuid:) ⇒ Object
Returns a sidekiq Job ID (jid) of the queued form4142 generation Sidekiq job is queued with the payload encrypted so there are no plaintext PII in the sidekiq job args.
-
#queue_submit_evidence_uploads(sc_evidences, appeal_submission_id) ⇒ String
Returns an array of Job IDs (jids) of the queued evidence submission jobs.
Methods included from Helpers
#create_supplemental_claims_headers, #get_and_rejigger_required_info, #middle_initial, #payload_encrypted_string
Methods included from LoggingUtils
#benchmark_to_log_data_hash, #log_formatted, #parse_form412_response_to_log_msg, #parse_lighthouse_response_to_log_msg, #run_and_benchmark_if_enabled
Instance Method Details
#create_supplemental_claim(request_body:, user:) ⇒ Faraday::Response
Creates a new Supplemental Claim
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 35 def create_supplemental_claim(request_body:, user:) with_monitoring_and_error_handling do request_body = request_body.to_json if request_body.is_a?(Hash) headers = create_supplemental_claims_headers(user) response, bm = run_and_benchmark_if_enabled do perform :post, 'supplemental_claims', request_body, headers end raise_schema_error_unless_200_status response.status validate_against_schema json: response.body, schema: SC_CREATE_RESPONSE_SCHEMA, append_to_error_class: ' (SC_V1)' = parse_lighthouse_response_to_log_msg(data: response.body['data'], bm:) ::Rails.logger.info() response end end |
#get_supplemental_claim(uuid) ⇒ Faraday::Response
Returns all of the data associated with a specific Supplemental Claim.
18 19 20 21 22 23 24 25 26 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 18 def get_supplemental_claim(uuid) with_monitoring_and_error_handling do response = perform :get, "supplemental_claims/#{uuid}", nil raise_schema_error_unless_200_status response.status validate_against_schema json: response.body, schema: SC_SHOW_RESPONSE_SCHEMA, append_to_error_class: ' (SC_V1)' response end end |
#get_supplemental_claim_contestable_issues(user:, benefit_type:) ⇒ Faraday::Response
Returns all issues associated with a Veteran that have been decided as of the receiptDate. Not all issues returned are guaranteed to be eligible for appeal.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 81 def get_supplemental_claim_contestable_issues(user:, benefit_type:) with_monitoring_and_error_handling do path = "contestable_issues/supplemental_claims?benefit_type=#{benefit_type}" headers = get_contestable_issues_headers(user) response = perform :get, path, nil, headers raise_schema_error_unless_200_status response.status validate_against_schema( json: response.body, schema: GET_CONTESTABLE_ISSUES_RESPONSE_SCHEMA, append_to_error_class: ' (SC_V1)' ) response end end |
#get_supplemental_claim_upload(uuid:) ⇒ Faraday::Response
Returns all of the data associated with a specific Supplemental Claim Evidence Submission.
149 150 151 152 153 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 149 def get_supplemental_claim_upload(uuid:) with_monitoring_and_error_handling do perform :get, "supplemental_claims/evidence_submissions/#{uuid}", nil end end |
#get_supplemental_claim_upload_url(sc_uuid:, file_number:) ⇒ Faraday::Response
Get the url to upload supporting evidence for a Supplemental Claim
103 104 105 106 107 108 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 103 def get_supplemental_claim_upload_url(sc_uuid:, file_number:) with_monitoring_and_error_handling do perform :post, 'supplemental_claims/evidence_submissions', { sc_uuid: }, { 'X-VA-SSN' => file_number.to_s.strip.presence } end end |
#process_form4142_submission(appeal_submission_id:, rejiggered_payload:) ⇒ Faraday::Response
Creates a new 4142(a) PDF, and sends to central mail
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 59 def process_form4142_submission(appeal_submission_id:, rejiggered_payload:) with_monitoring_and_error_handling do form4142_response, bm = run_and_benchmark_if_enabled do submit_form4142(form_data: rejiggered_payload) end = parse_form412_response_to_log_msg( appeal_submission_id:, data: form4142_response, bm: ) ::Rails.logger.info() form4142_response end end |
#put_supplemental_claim_upload(upload_url:, file_upload:, metadata_string:) ⇒ Faraday::Response
Upload supporting evidence for a Supplemental Claim
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 119 def put_supplemental_claim_upload(upload_url:, file_upload:, metadata_string:) content_tmpfile = Tempfile.new(file_upload.filename, encoding: file_upload.read.encoding) content_tmpfile.write(file_upload.read) content_tmpfile.rewind json_tmpfile = Tempfile.new('metadata.json', encoding: 'utf-8') json_tmpfile.write() json_tmpfile.rewind params = { metadata: Faraday::UploadIO.new(json_tmpfile.path, Mime[:json].to_s, 'metadata.json'), content: Faraday::UploadIO.new(content_tmpfile.path, Mime[:pdf].to_s, file_upload.filename) } # when we upgrade to Faraday >1.0 # params = { metadata: Faraday::FilePart.new(json_tmpfile, Mime[:json].to_s, 'metadata.json'), # content: Faraday::FilePart.new(content_tmpfile, Mime[:pdf].to_s, file_upload.filename) } with_monitoring_and_error_handling do perform :put, upload_url, params, { 'Content-Type' => 'multipart/form-data' } end ensure content_tmpfile.close content_tmpfile.unlink json_tmpfile.close json_tmpfile.unlink end |
#queue_form4142(appeal_submission_id:, rejiggered_payload:, submitted_appeal_uuid:) ⇒ Object
Returns a sidekiq Job ID (jid) of the queued form4142 generation Sidekiq job is queued with the payload encrypted so there are no plaintext PII in the sidekiq job args.
180 181 182 183 184 185 186 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 180 def queue_form4142(appeal_submission_id:, rejiggered_payload:, submitted_appeal_uuid:) DecisionReview::Form4142Submit.perform_async( appeal_submission_id, payload_encrypted_string(rejiggered_payload), submitted_appeal_uuid ) end |
#queue_submit_evidence_uploads(sc_evidences, appeal_submission_id) ⇒ String
Returns an array of Job IDs (jids) of the queued evidence submission jobs
162 163 164 165 166 167 168 169 |
# File 'lib/decision_review_v1/appeals/supplemental_claim_services.rb', line 162 def queue_submit_evidence_uploads(sc_evidences, appeal_submission_id) sc_evidences.map do |upload| asu = AppealSubmissionUpload.create!(decision_review_evidence_attachment_guid: upload['confirmationCode'], appeal_submission_id:) DecisionReview::SubmitUpload.perform_async(asu.id) end end |