index
int64 0
0
| repo_id
stringclasses 829
values | file_path
stringlengths 34
254
| content
stringlengths 6
5.38M
|
|---|---|---|---|
0
|
code_files/vets-api-private/app/sidekiq/education_form/templates
|
code_files/vets-api-private/app/sidekiq/education_form/templates/1990-disclosure/_CH33_30.erb
|
EDUCATION BENEFIT BEING APPLIED FOR: Chapter 33
|
0
|
code_files/vets-api-private/app/sidekiq/education_form/templates
|
code_files/vets-api-private/app/sidekiq/education_form/templates/1990-disclosure/_CH33_1606.erb
|
EDUCATION BENEFIT BEING APPLIED FOR: Chapter 33
|
0
|
code_files/vets-api-private/app/sidekiq/education_form/templates
|
code_files/vets-api-private/app/sidekiq/education_form/templates/1990-disclosure/_CH33_1607.erb
|
EDUCATION BENEFIT BEING APPLIED FOR: Chapter 33
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/submit_career_counseling_job.rb
|
# frozen_string_literal: true
require 'pcpg/monitor'
module Lighthouse
class SubmitCareerCounselingJob
include Sidekiq::Job
# retry for 2d 1h 47m 12s
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
RETRY = 16
STATSD_KEY_PREFIX = 'worker.lighthouse.submit_career_counseling_job'
sidekiq_options retry: RETRY
sidekiq_retries_exhausted do |msg, _ex|
begin
claim = SavedClaim.find(msg['args'].first)
rescue
claim = nil
end
Lighthouse::SubmitCareerCounselingJob.trigger_failure_events(msg, claim) if Flipper.enabled?(:pcpg_trigger_action_needed_email) # rubocop:disable Layout/LineLength
end
def perform(claim_id, user_uuid = nil)
begin
@claim = SavedClaim.find(claim_id)
@claim.send_to_benefits_intake!
send_confirmation_email(user_uuid)
rescue => e
Rails.logger.warn('SubmitCareerCounselingJob failed, retrying...', { error_message: e.message })
raise
end
Rails.logger.info('Successfully submitted form 25-8832', { uuid: user_uuid })
end
def send_confirmation_email(user_uuid)
email = if user_uuid.present? && (found_email = User.find(user_uuid)&.va_profile_email)
found_email
else
@claim.parsed_form.dig('claimantInformation', 'emailAddress')
end
if email.blank?
Rails.logger.info("No email to send confirmation regarding submitted form 25-8832 for uuid: #{user_uuid}")
return
end
VANotify::EmailJob.perform_async(
email,
Settings.vanotify.services.va_gov.template_id.career_counseling_confirmation_email,
{
'first_name' => @claim.parsed_form.dig('claimantInformation', 'fullName', 'first')&.upcase.presence,
'date' => Time.zone.today.strftime('%B %d, %Y')
}
)
end
def self.trigger_failure_events(msg, claim)
pcpg_monitor = PCPG::Monitor.new
email = claim.parsed_form.dig('claimantInformation', 'emailAddress')
pcpg_monitor.track_submission_exhaustion(msg, claim, email)
claim.send_failure_email(email) if claim.present?
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/document_upload_synchronous.rb
|
# frozen_string_literal: true
require 'datadog'
require 'timeout'
require 'lighthouse/benefits_documents/worker_service'
class Lighthouse::DocumentUploadSynchronous
def self.upload(user_icn, document_hash)
client = BenefitsDocuments::WorkerService.new
document, file_body, uploader = nil
Datadog::Tracing.trace('Config/Initialize Synchronous Upload Document') do
Sentry.set_tags(source: 'documents-upload')
document = LighthouseDocument.new document_hash
raise Common::Exceptions::ValidationErrors, document_data unless document.valid?
uploader = LighthouseDocumentUploader.new(user_icn, document.uploader_ids)
uploader.retrieve_from_store!(document.file_name)
end
Datadog::Tracing.trace('Synchronous read_for_upload') do
file_body = uploader.read_for_upload
end
Datadog::Tracing.trace('Synchronous Upload Document') do |span|
span.set_tag('Document File Size', file_body.size)
client.upload_document(file_body, document)
end
Datadog::Tracing.trace('Remove Upload Document') do
uploader.remove!
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/failure_notification.rb
|
# frozen_string_literal: true
require 'vets/shared_logging'
class Lighthouse::FailureNotification
include Sidekiq::Job
include Vets::SharedLogging
NOTIFY_SETTINGS = Settings.vanotify.services.benefits_management_tools
MAILER_TEMPLATE_ID = NOTIFY_SETTINGS.template_id.evidence_submission_failure_email
# retry for one day
sidekiq_options retry: 14, queue: 'low'
# Set minimum retry time to ~1 hour
sidekiq_retry_in do |count, _exception|
rand(3600..3660) if count < 9
end
sidekiq_retries_exhausted do
message = 'Lighthouse::FailureNotification email could not be sent'
::Rails.logger.info(message)
StatsD.increment('silent_failure', tags: ['service:claim-status', "function: #{message}"])
end
def notify_client
VaNotify::Service.new(
NOTIFY_SETTINGS.api_key,
{ callback_klass: 'Lighthouse::EvidenceSubmissions::VANotifyEmailStatusCallback' }
)
end
def perform(icn, personalisation)
# NOTE: The filename in the personalisation that is passed in is obscured
notify_client.send_email(
recipient_identifier: { id_value: icn, id_type: 'ICN' },
template_id: MAILER_TEMPLATE_ID,
personalisation:
)
::Rails.logger.info('Lighthouse::FailureNotification email sent')
rescue => e
::Rails.logger.error('Lighthouse::FailureNotification email error',
{ message: e.message })
log_exception_to_sentry(e)
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/form526_document_upload_polling_job.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_documents/form526/documents_status_polling_service'
require 'lighthouse/benefits_documents/form526/update_documents_status_service'
module Lighthouse
class Form526DocumentUploadPollingJob
include Sidekiq::Job
# Job runs every hour; ensure retries happen within the same window to prevent duplicate polling of documents
# 7 retries = retry for ~42 minutes
# See Sidekiq documentation for exponential retry formula:
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling#automatic-job-retry
sidekiq_options retry: 7
POLLED_BATCH_DOCUMENT_COUNT = 100
STATSD_KEY_PREFIX = 'worker.lighthouse.poll_form526_document_uploads'
STATSD_PENDING_DOCUMENTS_POLLED_KEY = 'pending_documents_polled'
STATSD_PENDING_DOCUMENTS_MARKED_SUCCESS_KEY = 'pending_documents_marked_completed'
STATSD_PENDING_DOCUMENTS_MARKED_FAILED_KEY = 'pending_documents_marked_failed'
sidekiq_retries_exhausted do |msg, _ex|
job_id = msg['jid']
error_class = msg['error_class']
error_message = msg['error_message']
StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")
Rails.logger.warn(
'Lighthouse::Form526DocumentUploadPollingJob retries exhausted',
{ job_id:, error_class:, error_message:, timestamp: Time.now.utc }
)
rescue => e
Rails.logger.error(
'Failure in Form526DocumentUploadPollingJob#sidekiq_retries_exhausted',
{
messaged_content: e.message,
job_id:,
pre_exhaustion_failure: {
error_class:,
error_message:
}
}
)
end
def perform
successful_documents_before_polling = Lighthouse526DocumentUpload.completed.count
failed_documents_before_polling = Lighthouse526DocumentUpload.failed.count
documents_to_poll = Lighthouse526DocumentUpload.pending.status_update_required
StatsD.gauge("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_POLLED_KEY}", documents_to_poll.count)
documents_to_poll.in_batches(
of: POLLED_BATCH_DOCUMENT_COUNT
) do |document_batch|
lighthouse_document_request_ids = document_batch.pluck(:lighthouse_document_request_id)
update_document_batch(document_batch, lighthouse_document_request_ids)
rescue Faraday::ResourceNotFound => e
response_struct = OpenStruct.new(e.response)
handle_error(response_struct, lighthouse_document_request_ids)
end
documents_marked_success = Lighthouse526DocumentUpload.completed.count - successful_documents_before_polling
StatsD.gauge("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_MARKED_SUCCESS_KEY}", documents_marked_success)
documents_marked_failed = Lighthouse526DocumentUpload.failed.count - failed_documents_before_polling
StatsD.gauge("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_MARKED_FAILED_KEY}", documents_marked_failed)
end
private
def update_document_batch(document_batch, lighthouse_document_request_ids)
response = BenefitsDocuments::Form526::DocumentsStatusPollingService.call(lighthouse_document_request_ids)
if response.status == 200
result = BenefitsDocuments::Form526::UpdateDocumentsStatusService.call(document_batch, response.body)
if result && !result[:success]
response_struct = OpenStruct.new(result[:response])
handle_error(response_struct, response_struct.unknown_ids.map(&:to_s))
end
else
handle_error(response, lighthouse_document_request_ids)
end
end
def handle_error(response, lighthouse_document_request_ids)
StatsD.increment("#{STATSD_KEY_PREFIX}.polling_error")
Rails.logger.warn(
'Lighthouse::Form526DocumentUploadPollingJob status endpoint error',
{
response_status: response.status,
response_body: response.body,
lighthouse_document_request_ids:,
timestamp: Time.now.utc
}
)
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/poll_form526_pdf.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_claims/service'
require 'vets/shared_logging'
require 'logging/third_party_transaction'
require 'sidekiq/form526_job_status_tracker/job_tracker'
require 'sidekiq/form526_job_status_tracker/metrics'
module Lighthouse
# rubocop:disable Metrics/MethodLength
class PollForm526PdfError < StandardError; end
class PollForm526PdfStatus
def self.update_job_status(form_job_status:, message:, error_class:, error_message:, status:)
timestamp = Time.now.utc
form526_submission_id = form_job_status.form526_submission_id
job_id = form_job_status.job_id
bgjob_errors = form_job_status.bgjob_errors || {}
new_error = {
"#{timestamp.to_i}": {
caller_method: __method__.to_s,
error_class:,
error_message:,
timestamp:,
form526_submission_id:
}
}
form_job_status.update(
status:,
bgjob_errors: bgjob_errors.merge(new_error),
error_class:,
error_message: message
)
::Rails.logger.warn(
message,
{ job_id:, error_class:, error_message:, timestamp:, form526_submission_id: }
)
end
end
class PollForm526Pdf
include Sidekiq::Job
include Sidekiq::Form526JobStatusTracker::JobTracker
extend ActiveSupport::Concern
extend Vets::SharedLogging
extend Logging::ThirdPartyTransaction::MethodWrapper
attr_accessor :submission_id
STATSD_KEY_PREFIX = 'worker.lighthouse.poll_form526_pdf'
wrap_with_logging(
additional_class_logs: {
action: 'Begin check for 526 supporting docs'
},
additional_instance_logs: {
submission_id: %i[submission_id]
}
)
sidekiq_options retry_for: 96.hours
# This callback cannot be tested due to the limitations of `Sidekiq::Testing.fake!`
# :nocov:
sidekiq_retries_exhausted do |msg, _ex|
# log, mark Form526JobStatus for submission as "pdf_not_found"
job_id = msg['jid']
error_class = msg['error_class']
error_message = msg['error_message']
form_job_status = Form526JobStatus.find_by(job_id:)
PollForm526PdfStatus.update_job_status(
form_job_status:,
message: 'Poll for Form 526 PDF: Retries exhausted',
error_class:,
error_message:,
status: Form526JobStatus::STATUS[:pdf_not_found]
)
rescue => e
log_exception_to_rails(e)
end
# :nocov:
# Checks claims status for supporting documents for a submission and exits out when found.
# If the timeout period is exceeded (96 hours), then the 'pdf_not_found' status is written to Form526JobStatus
#
# @param submission_id [Integer] The {Form526Submission} id
#
def perform(submission_id)
@submission_id = submission_id
with_tracking('Form526 Submission', submission.saved_claim_id, submission.id, submission.bdd?) do
form526_pdf = get_form526_pdf(submission)
if form526_pdf.present?
Rails.logger.info('Poll for form 526 PDF: PDF found')
if Flipper.enabled?(:disability_526_call_received_email_from_polling)
submission.send_received_email('PollForm526Pdf#perform pdf_found')
end
return
else
form_job_status = submission.form526_job_statuses.find_by(job_class: 'PollForm526Pdf')
update_job_status_based_on_age(form_job_status, submission)
end
end
end
# Evaluate the submission's creation date:
# - Log a warning if the submission is between 1 and 4 days old.
# - If the submission is older than 4 days:
# - Update the job status to 'pdf_not_found'.
# - Exit the job immediately.
def update_job_status_based_on_age(form_job_status, submission)
if submission.created_at.between?(DateTime.now - 4.days, DateTime.now - 1.day)
PollForm526PdfStatus.update_job_status(
form_job_status:,
message: 'Poll for form 526 PDF: Submission creation date is over 1 day old for submission_id ' \
"#{submission.id}",
error_class: 'PollForm526PdfError',
error_message: 'Poll for form 526 PDF: Submission creation date is over 1 day old for submission_id ' \
"#{submission.id}",
status: Form526JobStatus::STATUS[:try]
)
elsif submission.created_at <= DateTime.now - 4.days
PollForm526PdfStatus.update_job_status(
form_job_status:,
message: 'Poll for form 526 PDF: Submission creation date is over 4 days old. Exiting...',
error_class: 'PollForm526PdfError',
error_message: 'Poll for form 526 PDF: Submission creation date is over 4 days old. Exiting...',
status: Form526JobStatus::STATUS[:pdf_not_found]
)
return
end
raise Lighthouse::PollForm526PdfError, 'Poll for form 526 PDF: Keep on retrying!'
end
private
def submission
@submission ||= Form526Submission.find(@submission_id)
end
def get_form526_pdf(submission)
icn = submission.account.icn
service = BenefitsClaims::Service.new(icn)
raw_response = service.get_claim(submission.submitted_claim_id)
raw_response_body = if raw_response.is_a? String
JSON.parse(raw_response)
else
raw_response
end
supporting_documents = raw_response_body.dig('data', 'attributes', 'supportingDocuments')
supporting_documents.find do |d|
d['documentTypeLabel'] == 'VA 21-526 Veterans Application for Compensation or Pension'
end
end
end
# rubocop:enable Metrics/MethodLength
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/create_intent_to_file_job.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_claims/service'
require 'lighthouse/benefits_claims/intent_to_file/monitor'
module Lighthouse
class CreateIntentToFileJob
include Sidekiq::Job
attr_reader :form, :itf_type
class MissingICNError < StandardError; end
class MissingParticipantIDError < StandardError; end
class FormNotFoundError < StandardError; end
class InvalidITFTypeError < StandardError; end
# Only pension form configured to create async ITFs for now
ITF_FORMS = {
# '21-526EZ' => 'compensation',
# '21P-530EZ' => 'survivor',
'21P-527EZ' => 'pension'
}.freeze
# retry for 2d 1h 47m 12s
# exhausted attempts will be logged in intent_to_file_queue_exhaustions table
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
sidekiq_options retry: 16, queue: 'low'
sidekiq_retries_exhausted do |msg, error|
::Rails.logger.info("Create Intent to File Job exhausted all retries for in_progress_form_id: #{msg['args'][0]}")
in_progress_form_id, veteran_icn = msg['args']
in_progress_form = InProgressForm.find(in_progress_form_id)
form_type = in_progress_form&.form_id
itf_type = ITF_FORMS[form_type]
monitor = BenefitsClaims::IntentToFile::Monitor.new
monitor.track_create_itf_exhaustion(itf_type, in_progress_form, error)
# create ITF queue exhaustion entry
exhaustion = IntentToFileQueueExhaustion.create({
form_type:,
form_start_date: in_progress_form&.created_at,
veteran_icn:
})
::Rails.logger.info(
"IntentToFileQueueExhaustion id: #{exhaustion&.id} entry created", {
intent_to_file_queue_exhaustion: exhaustion
}
)
end
# Create an Intent to File using the Lighthouse ITF endpoint for given in progress form, ICN, and PID
# On success/failure log and increment the respective Datadog counter
# @see BenefitsClaims::Service#get_intent_to_file
# @see BenefitsClaims::Service#create_intent_to_file
#
# @param in_progress_form_id [Integer]
# @param veteran_icn [String] veteran's ICN
# @param participant_id [String] veteran's participant ID
#
# @return [Hash] 'data' response from BenefitsClaims::Service
def perform(in_progress_form_id, veteran_icn, participant_id)
init(in_progress_form_id, veteran_icn, participant_id)
service = BenefitsClaims::Service.new(veteran_icn)
begin
itf_found = service.get_intent_to_file(itf_type)
if itf_found&.dig('data', 'attributes', 'status') == 'active'
monitor.track_create_itf_active_found(itf_type, form&.created_at&.to_s, form&.user_account_id, itf_found)
return itf_found
end
rescue Common::Exceptions::ResourceNotFound
# do nothing, continue with creation
end
monitor.track_create_itf_begun(itf_type, form&.created_at&.to_s, form&.user_account_id)
itf_created = service.create_intent_to_file(itf_type, '')
monitor.track_create_itf_success(itf_type, form&.created_at&.to_s, form&.user_account_id)
itf_created
rescue => e
triage_rescued_error(e)
end
private
# Instantiate instance variables for _this_ job
#
# @param (see #perform)
def init(in_progress_form_id, veteran_icn, participant_id)
raise MissingICNError, 'Init failed. No veteran ICN provided' if veteran_icn.blank?
raise MissingParticipantIDError, 'Init failed. No veteran participant ID provided' if participant_id.blank?
@form = InProgressForm.find(in_progress_form_id)
raise FormNotFoundError, 'Init failed. Form not found for given ID' if form.blank?
@itf_type = ITF_FORMS[form&.form_id]
if form.user_account.blank? || form.user_account&.icn != veteran_icn
raise ActiveRecord::RecordNotFound, 'Init failed. User account not found for given veteran ICN'
end
raise InvalidITFTypeError, 'Init failed. Form type not supported for auto ITF' if itf_type.blank?
end
# Track error, prevent retry if will result in known failure, raise again otherwise
#
# @param exception [Exception] error thrown within #perform
def triage_rescued_error(exception)
if exception.instance_of?(MissingICNError)
monitor.track_missing_user_icn(form, exception)
elsif exception.instance_of?(MissingParticipantIDError)
monitor.track_missing_user_pid(form, exception)
elsif exception.instance_of?(InvalidITFTypeError)
monitor.track_invalid_itf_type(form, exception)
elsif exception.instance_of?(FormNotFoundError)
monitor.track_missing_form(form, exception)
else
monitor.track_create_itf_failure(itf_type, form&.created_at&.to_s, form&.user_account_id, exception)
raise exception
end
end
# retreive a monitor for tracking
#
# @return [BenefitsClaims::IntentToFile::Monitor]
def monitor
@monitor ||= BenefitsClaims::IntentToFile::Monitor.new
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/lighthouse/submit_benefits_intake_claim.rb
|
# frozen_string_literal: true
require 'vets/shared_logging'
require 'central_mail/service'
require 'pdf_utilities/datestamp_pdf'
require 'pcpg/monitor'
require 'benefits_intake_service/service'
require 'lighthouse/benefits_intake/metadata'
require 'pdf_info'
module Lighthouse
class SubmitBenefitsIntakeClaim
include Sidekiq::Job
include Vets::SharedLogging
class BenefitsIntakeClaimError < StandardError; end
FOREIGN_POSTALCODE = '00000'
STATSD_KEY_PREFIX = 'worker.lighthouse.submit_benefits_intake_claim'
# retry for 2d 1h 47m 12s
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
RETRY = 16
sidekiq_options retry: RETRY
sidekiq_retries_exhausted do |msg, _ex|
Rails.logger.error(
"Failed all retries on Lighthouse::SubmitBenefitsIntakeClaim, last error: #{msg['error_message']}"
)
StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")
end
def perform(saved_claim_id)
init(saved_claim_id)
# Create document stamps
@pdf_path = process_record(@claim)
@attachment_paths = @claim.persistent_attachments.map { |record| process_record(record) }
create_form_submission_attempt
response = @lighthouse_service.upload_doc(**lighthouse_service_upload_payload)
raise BenefitsIntakeClaimError, response.body unless response.success?
Rails.logger.info('Lighthouse::SubmitBenefitsIntakeClaim succeeded', generate_log_details)
StatsD.increment("#{STATSD_KEY_PREFIX}.success")
send_confirmation_email
@lighthouse_service.uuid
rescue => e
Rails.logger.warn('Lighthouse::SubmitBenefitsIntakeClaim failed, retrying...', generate_log_details(e))
StatsD.increment("#{STATSD_KEY_PREFIX}.failure")
@form_submission_attempt&.fail!
raise
ensure
cleanup_file_paths
end
def init(saved_claim_id)
@claim = SavedClaim.find(saved_claim_id)
@lighthouse_service = BenefitsIntakeService::Service.new(with_upload_location: true)
end
def generate_metadata
md = @claim.metadata_for_benefits_intake
::BenefitsIntake::Metadata.generate(md[:veteranFirstName], md[:veteranLastName], md[:fileNumber],
md[:zipCode], "#{@claim.class} va.gov", @claim.form_id,
md[:businessLine])
end
def process_record(record)
document = stamp_pdf(record)
@lighthouse_service.valid_document?(document:)
rescue => e
StatsD.increment("#{STATSD_KEY_PREFIX}.document_upload_error")
raise e
end
def stamp_pdf(record)
pdf_path = record.to_pdf
# coordinates 0, 0 is bottom left of the PDF
# This is the bottom left of the form, right under the form date, e.g. "AUG 2022"
stamped_path = PDFUtilities::DatestampPdf.new(pdf_path).run(text: 'VA.GOV', x: 5, y: 5,
timestamp: record.created_at)
# This is the top right of the PDF, above "OMB approved line"
PDFUtilities::DatestampPdf.new(stamped_path).run(
text: 'FDC Reviewed - va.gov Submission',
x: 400,
y: 770,
text_only: true
)
end
def split_file_and_path(path)
{ file: path, file_name: path.split('/').last }
end
private
def lighthouse_service_upload_payload
{
upload_url: @lighthouse_service.location,
file: split_file_and_path(@pdf_path),
metadata: generate_metadata.to_json,
attachments: @attachment_paths.map(&method(:split_file_and_path))
}
end
def generate_log_details(e = nil)
details = {
claim_id: @claim&.id,
benefits_intake_uuid: @lighthouse_service&.uuid,
confirmation_number: @claim&.confirmation_number,
form_id: @claim&.form_id
}
details['error'] = e.message if e
details
end
def create_form_submission_attempt
Rails.logger.info('Lighthouse::SubmitBenefitsIntakeClaim job starting', {
claim_id: @claim.id,
benefits_intake_uuid: @lighthouse_service.uuid,
confirmation_number: @claim.confirmation_number
})
FormSubmissionAttempt.transaction do
form_submission = FormSubmission.create(
form_type: @claim.form_id,
form_data: @claim.to_json,
saved_claim: @claim,
saved_claim_id: @claim.id
)
@form_submission_attempt = FormSubmissionAttempt.create(form_submission:,
benefits_intake_uuid: @lighthouse_service.uuid)
end
end
def cleanup_file_paths
Common::FileHelpers.delete_file_if_exists(@pdf_path) if @pdf_path
@attachment_paths&.each { |p| Common::FileHelpers.delete_file_if_exists(p) }
end
def check_zipcode(address)
address['country'].upcase.in?(%w[USA US])
end
def send_confirmation_email
@claim.respond_to?(:send_confirmation_email) && @claim.send_confirmation_email
rescue => e
Rails.logger.warn('Lighthouse::SubmitBenefitsIntakeClaim send_confirmation_email failed',
generate_log_details(e))
StatsD.increment("#{STATSD_KEY_PREFIX}.send_confirmation_email.failure")
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/benefits_intake/submit_central_form686c_job.rb
|
# frozen_string_literal: true
require 'central_mail/service'
require 'benefits_intake_service/service'
require 'pdf_utilities/datestamp_pdf'
require 'pdf_info'
require 'simple_forms_api_submission/metadata_validator'
require 'dependents/monitor'
module Lighthouse
module BenefitsIntake
class SubmitCentralForm686cJob
include Sidekiq::Job
FOREIGN_POSTALCODE = '00000'
FORM_ID = '686C-674'
FORM_ID_V2 = '686C-674-V2'
FORM_ID_674 = '21-674'
FORM_ID_674_V2 = '21-674-V2'
STATSD_KEY_PREFIX = 'worker.submit_686c_674_backup_submission'
ZSF_DD_TAG_FUNCTION = 'submit_686c_674_backup_submission'
# retry for 2d 1h 47m 12s
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
RETRY = 16
attr_reader :claim, :form_path, :attachment_paths
class BenefitsIntakeResponseError < StandardError; end
def extract_uuid_from_central_mail_message(data)
data.body[/(?<=\[).*?(?=\])/].split(': ').last if data.body.present?
end
sidekiq_options retry: RETRY
sidekiq_retries_exhausted do |msg, _ex|
Lighthouse::BenefitsIntake::SubmitCentralForm686cJob.trigger_failure_events(msg)
end
def perform(saved_claim_id, encrypted_vet_info, encrypted_user_struct)
vet_info = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_vet_info))
user_struct = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct))
@monitor = init_monitor(saved_claim_id)
@monitor.track_event('info', 'Lighthouse::BenefitsIntake::SubmitCentralForm686cJob running!',
"#{STATSD_KEY_PREFIX}.begin")
# if the 686c-674 has failed we want to call this central mail job (credit to submit_saved_claim_job.rb)
# have to re-find the claim and add the relevant veteran info
@claim = SavedClaim::DependencyClaim.find(saved_claim_id)
claim.add_veteran_info(vet_info)
get_files_from_claim
result = upload_to_lh
check_success(result, saved_claim_id, user_struct)
rescue => e
# if we fail, update the associated central mail record to failed and send the user the failure email
@monitor.track_event('warn', 'Lighthouse::BenefitsIntake::SubmitCentralForm686cJob failed!',
"#{STATSD_KEY_PREFIX}.failure", { error: e.message })
update_submission('failed')
raise
ensure
cleanup_file_paths
end
def upload_to_lh
Rails.logger.info({ message: 'SubmitCentralForm686cJob Lighthouse Initiate Submission Attempt',
claim_id: claim.id })
lighthouse_service = BenefitsIntakeService::Service.new(with_upload_location: true)
uuid = lighthouse_service.uuid
@monitor.track_event('info', 'SubmitCentralForm686cJob Lighthouse Submission Attempt',
"#{STATSD_KEY_PREFIX}.attempt", { uuid: })
response = lighthouse_service.upload_form(
main_document: split_file_and_path(form_path),
attachments: attachment_paths.map(&method(:split_file_and_path)),
form_metadata: generate_metadata_lh
)
create_form_submission_attempt(uuid)
@monitor.track_event('info', 'SubmitCentralForm686cJob Lighthouse Submission Successful',
"#{STATSD_KEY_PREFIX}.success", { uuid: })
response
end
def create_form_submission_attempt(intake_uuid)
form_type = claim.submittable_686? ? FORM_ID : FORM_ID_674
FormSubmissionAttempt.transaction do
form_submission = FormSubmission.create(
form_type:,
saved_claim: claim,
user_account: UserAccount.find_by(icn: claim.parsed_form['veteran_information']['icn'])
)
FormSubmissionAttempt.create(form_submission:, benefits_intake_uuid: intake_uuid)
end
end
def get_files_from_claim
# process the main pdf record and the attachments as we would for a vbms submission
if claim.submittable_674?
form_674_paths = []
form_674_paths << process_pdf(claim.to_pdf(form_id: FORM_ID_674), claim.created_at, FORM_ID_674)
end
form_id = FORM_ID
form_686c_path = process_pdf(claim.to_pdf(form_id:), claim.created_at, form_id) if claim.submittable_686?
# set main form_path to be first 674 in array if needed
@form_path = form_686c_path || form_674_paths.first
@attachment_paths = claim.persistent_attachments.map { |pa| process_pdf(pa.to_pdf, claim.created_at) }
# Treat 674 as first attachment
if form_686c_path.present? && form_674_paths.present?
attachment_paths.unshift(*form_674_paths)
elsif form_674_paths.present? && form_674_paths.size > 1
attachment_paths.unshift(*form_674_paths.drop(1))
end
end
def cleanup_file_paths
Common::FileHelpers.delete_file_if_exists(form_path)
attachment_paths.each { |p| Common::FileHelpers.delete_file_if_exists(p) }
end
def check_success(response, saved_claim_id, user_struct)
if response.success?
Rails.logger.info('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob succeeded!',
{ user_uuid: user_struct['uuid'], saved_claim_id: })
update_submission('success')
send_confirmation_email(OpenStruct.new(user_struct))
else
Rails.logger.info('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob Unsuccessful',
{ response: response['message'].presence || response['errors'] })
raise BenefitsIntakeResponseError
end
end
def create_request_body
body = {
'metadata' => generate_metadata.to_json
}
body['document'] = to_faraday_upload(form_path)
i = 0
attachment_paths.each do |file_path|
body["attachment#{i += 1}"] = to_faraday_upload(file_path)
end
body
end
def update_submission(state)
claim.central_mail_submission.update!(state:) if claim.respond_to?(:central_mail_submission)
end
def to_faraday_upload(file_path)
Faraday::UploadIO.new(
file_path,
Mime[:pdf].to_s
)
end
def process_pdf(pdf_path, timestamp = nil, form_id = nil)
stamped_path1 = PDFUtilities::DatestampPdf.new(pdf_path).run(text: 'VA.GOV', x: 5, y: 5, timestamp:)
stamped_path2 = PDFUtilities::DatestampPdf.new(stamped_path1).run(
text: 'FDC Reviewed - va.gov Submission',
x: 400,
y: 770,
text_only: true
)
if form_id.present?
stamped_pdf_with_form(form_id, stamped_path2, timestamp)
else
stamped_path2
end
end
def get_hash_and_pages(file_path)
{
hash: Digest::SHA256.file(file_path).hexdigest,
pages: PdfInfo::Metadata.read(file_path).pages
}
end
def generate_metadata # rubocop:disable Metrics/MethodLength
form = claim.parsed_form['dependents_application']
veteran_information = form['veteran_information'].presence || claim.parsed_form['veteran_information']
form_pdf_metadata = get_hash_and_pages(form_path)
address = form['veteran_contact_information']['veteran_address']
is_usa = address['country_name'] == 'USA'
zip_code = address['zip_code']
metadata = {
'veteranFirstName' => veteran_information['full_name']['first'],
'veteranLastName' => veteran_information['full_name']['last'],
'fileNumber' => veteran_information['file_number'] || veteran_information['ssn'],
'receiveDt' => claim.created_at.in_time_zone('Central Time (US & Canada)').strftime('%Y-%m-%d %H:%M:%S'),
'uuid' => claim.guid,
'zipCode' => is_usa ? zip_code : FOREIGN_POSTALCODE,
'source' => 'va.gov',
'hashV' => form_pdf_metadata[:hash],
'numberAttachments' => attachment_paths.size,
'docType' => claim.form_id,
'numberPages' => form_pdf_metadata[:pages]
}
validated_metadata = SimpleFormsApiSubmission::MetadataValidator.validate(
metadata,
zip_code_is_us_based: is_usa
)
validated_metadata.merge(generate_attachment_metadata(attachment_paths))
end
def generate_metadata_lh
form = claim.parsed_form['dependents_application']
# sometimes veteran_information is not in dependents_application, but claim.add_veteran_info will make sure
# it's in the outer layer of parsed_form
veteran_information = form['veteran_information'].presence || claim.parsed_form['veteran_information']
address = form['veteran_contact_information']['veteran_address']
{
veteran_first_name: veteran_information['full_name']['first'],
veteran_last_name: veteran_information['full_name']['last'],
file_number: veteran_information['file_number'] || veteran_information['ssn'],
zip: address['country_name'] == 'USA' ? address['zip_code'] : FOREIGN_POSTALCODE,
doc_type: claim.form_id,
claim_date: claim.created_at,
source: 'va.gov backup dependent claim submission',
business_line: 'CMP'
}
end
def generate_attachment_metadata(attachment_paths)
attachment_metadata = {}
i = 0
attachment_paths.each do |file_path|
i += 1
attachment_pdf_metadata = get_hash_and_pages(file_path)
attachment_metadata["ahash#{i}"] = attachment_pdf_metadata[:hash]
attachment_metadata["numberPages#{i}"] = attachment_pdf_metadata[:pages]
end
attachment_metadata
end
def send_confirmation_email(user)
claim.send_received_email(user)
end
def self.trigger_failure_events(msg)
saved_claim_id, _, encrypted_user_struct = msg['args']
user_struct = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct)) if encrypted_user_struct.present?
claim = SavedClaim::DependencyClaim.find(saved_claim_id)
email = claim.parsed_form.dig('dependents_application', 'veteran_contact_information', 'email_address') ||
user_struct.try(:va_profile_email)
Dependents::Monitor.new(claim.id).track_submission_exhaustion(msg, email)
claim.send_failure_email(email)
rescue => e
# If we fail in the above failure events, this is a critical error and silent failure.
v2 = false
Rails.logger.error('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob silent failure!', { e:, msg:, v2: })
StatsD.increment("#{Lighthouse::BenefitsIntake::SubmitCentralForm686cJob::STATSD_KEY_PREFIX}.silent_failure")
end
private
def stamped_pdf_with_form(form_id, path, timestamp)
PDFUtilities::DatestampPdf.new(path).run(
text: 'Application Submitted on va.gov',
x: 400,
y: 675,
text_only: true, # passing as text only because we override how the date is stamped in this instance
timestamp:,
page_number: %w[686C-674 686C-674-V2].include?(form_id) ? 6 : 0,
template: "lib/pdf_fill/forms/pdfs/#{form_id}.pdf",
multistamp: true
)
end
def valid_claim_data(saved_claim_id, vet_info)
claim = SavedClaim::DependencyClaim.find(saved_claim_id)
claim.add_veteran_info(vet_info)
raise Invalid686cClaim unless claim.valid?(:run_686_form_jobs)
claim.formatted_686_data(vet_info)
end
def split_file_and_path(path)
{ file: path, file_name: path.split('/').last }
end
def init_monitor(saved_claim_id)
@monitor ||= Dependents::Monitor.new(saved_claim_id)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/benefits_intake/submit_central_form686c_v2_job.rb
|
# frozen_string_literal: true
require 'central_mail/service'
require 'benefits_intake_service/service'
require 'pdf_utilities/datestamp_pdf'
require 'pdf_info'
require 'simple_forms_api_submission/metadata_validator'
require 'dependents/monitor'
module Lighthouse
module BenefitsIntake
class SubmitCentralForm686cV2Job
include Sidekiq::Job
FOREIGN_POSTALCODE = '00000'
FORM_ID_V2 = '686C-674-V2'
FORM_ID_674_V2 = '21-674-V2'
STATSD_KEY_PREFIX = 'worker.submit_686c_674_backup_submission'
ZSF_DD_TAG_FUNCTION = 'submit_686c_674_backup_submission'
# retry for 2d 1h 47m 12s
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
RETRY = 16
attr_reader :claim, :form_path, :attachment_paths
class BenefitsIntakeResponseError < StandardError; end
def extract_uuid_from_central_mail_message(data)
data.body[/(?<=\[).*?(?=\])/].split(': ').last if data.body.present?
end
sidekiq_options retry: RETRY
sidekiq_retries_exhausted do |msg, _ex|
Lighthouse::BenefitsIntake::SubmitCentralForm686cV2Job.trigger_failure_events(msg)
end
def perform(saved_claim_id, encrypted_vet_info, encrypted_user_struct)
vet_info = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_vet_info))
user_struct = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct))
@monitor = init_monitor(saved_claim_id)
@monitor.track_event('info', 'Lighthouse::BenefitsIntake::SubmitCentralForm686cJob running!',
"#{STATSD_KEY_PREFIX}.begin")
# if the 686c-674 has failed we want to call this central mail job (credit to submit_saved_claim_job.rb)
# have to re-find the claim and add the relevant veteran info
@claim = SavedClaim::DependencyClaim.find(saved_claim_id)
claim.add_veteran_info(vet_info)
get_files_from_claim
result = upload_to_lh
check_success(result, saved_claim_id, user_struct)
rescue => e
# if we fail, update the associated central mail record to failed and send the user the failure email
@monitor.track_event('warn', 'Lighthouse::BenefitsIntake::SubmitCentralForm686cJob failed!',
"#{STATSD_KEY_PREFIX}.failure", { error: e.message })
update_submission('failed')
raise
ensure
cleanup_file_paths
end
def upload_to_lh
@monitor.track_event('info', 'SubmitCentralForm686cJob Lighthouse Initiate Submission Attempt',
"#{STATSD_KEY_PREFIX}.init_attempt")
lighthouse_service = BenefitsIntakeService::Service.new(with_upload_location: true)
uuid = lighthouse_service.uuid
@monitor.track_event('info', 'SubmitCentralForm686cJob Lighthouse Submission Attempt',
"#{STATSD_KEY_PREFIX}.attempt", { uuid: })
response = lighthouse_service.upload_form(
main_document: split_file_and_path(form_path),
attachments: attachment_paths.map(&method(:split_file_and_path)),
form_metadata: generate_metadata_lh
)
create_form_submission_attempt(uuid)
@monitor.track_event('info', 'SubmitCentralForm686cJob Lighthouse Submission Successful',
"#{STATSD_KEY_PREFIX}.success", { uuid: })
response
end
def create_form_submission_attempt(intake_uuid)
form_type = claim.submittable_686? ? FORM_ID_V2 : FORM_ID_674_V2
FormSubmissionAttempt.transaction do
form_submission = FormSubmission.create(
form_type:,
saved_claim: claim,
user_account: UserAccount.find_by(icn: claim.parsed_form['veteran_information']['icn'])
)
FormSubmissionAttempt.create(form_submission:, benefits_intake_uuid: intake_uuid)
end
end
def get_files_from_claim
# process the main pdf record and the attachments as we would for a vbms submission
if claim.submittable_674?
form_674_paths = []
claim.parsed_form['dependents_application']['student_information'].each do |student|
form_674_paths << process_pdf(claim.to_pdf(form_id: FORM_ID_674_V2, student:), claim.created_at, FORM_ID_674_V2) # rubocop:disable Layout/LineLength
end
end
form_id = FORM_ID_V2
form_686c_path = process_pdf(claim.to_pdf(form_id:), claim.created_at, form_id) if claim.submittable_686?
# set main form_path to be first 674 in array if needed
@form_path = form_686c_path || form_674_paths.first
@attachment_paths = claim.persistent_attachments.map { |pa| process_pdf(pa.to_pdf, claim.created_at) }
# Treat 674 as first attachment
if form_686c_path.present? && form_674_paths.present?
attachment_paths.unshift(*form_674_paths)
elsif form_674_paths.present? && form_674_paths.size > 1
attachment_paths.unshift(*form_674_paths.drop(1))
end
end
def cleanup_file_paths
Common::FileHelpers.delete_file_if_exists(form_path)
attachment_paths.each { |p| Common::FileHelpers.delete_file_if_exists(p) }
end
def check_success(response, saved_claim_id, user_struct)
if response.success?
Rails.logger.info('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob succeeded!',
{ user_uuid: user_struct['uuid'], saved_claim_id: })
update_submission('success')
send_confirmation_email(OpenStruct.new(user_struct))
else
Rails.logger.info('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob Unsuccessful',
{ response: response['message'].presence || response['errors'] })
raise BenefitsIntakeResponseError
end
end
def create_request_body
body = {
'metadata' => generate_metadata.to_json
}
body['document'] = to_faraday_upload(form_path)
i = 0
attachment_paths.each do |file_path|
body["attachment#{i += 1}"] = to_faraday_upload(file_path)
end
body
end
def update_submission(state)
claim.central_mail_submission.update!(state:) if claim.respond_to?(:central_mail_submission)
end
def to_faraday_upload(file_path)
Faraday::UploadIO.new(
file_path,
Mime[:pdf].to_s
)
end
def process_pdf(pdf_path, timestamp = nil, form_id = nil)
stamped_path1 = PDFUtilities::DatestampPdf.new(pdf_path).run(text: 'VA.GOV', x: 5, y: 5, timestamp:)
stamped_path2 = PDFUtilities::DatestampPdf.new(stamped_path1).run(
text: 'FDC Reviewed - va.gov Submission',
x: 400,
y: 770,
text_only: true
)
if form_id.present?
stamped_pdf_with_form(form_id, stamped_path2, timestamp)
else
stamped_path2
end
end
def get_hash_and_pages(file_path)
{
hash: Digest::SHA256.file(file_path).hexdigest,
pages: PdfInfo::Metadata.read(file_path).pages
}
end
def generate_metadata # rubocop:disable Metrics/MethodLength
form = claim.parsed_form['dependents_application']
veteran_information = form['veteran_information'].presence || claim.parsed_form['veteran_information']
file_number = veteran_information['file_number'] || veteran_information['ssn'] ||
claim.parsed_form['veteran_information']['file_number'] ||
claim.parsed_form['veteran_information']['ssn']
form_pdf_metadata = get_hash_and_pages(form_path)
address = form['veteran_contact_information']['veteran_address']
is_usa = address['country_name'] == 'USA'
zip_code = address['postal_code']
metadata = {
'veteranFirstName' => veteran_information['full_name']['first'],
'veteranLastName' => veteran_information['full_name']['last'],
'fileNumber' => file_number,
'receiveDt' => claim.created_at.in_time_zone('Central Time (US & Canada)').strftime('%Y-%m-%d %H:%M:%S'),
'uuid' => claim.guid,
'zipCode' => is_usa ? zip_code : FOREIGN_POSTALCODE,
'source' => 'va.gov',
'hashV' => form_pdf_metadata[:hash],
'numberAttachments' => attachment_paths.size,
'docType' => claim.form_id,
'numberPages' => form_pdf_metadata[:pages]
}
validated_metadata = SimpleFormsApiSubmission::MetadataValidator.validate(
metadata,
zip_code_is_us_based: is_usa
)
validated_metadata.merge(generate_attachment_metadata(attachment_paths))
end
def generate_metadata_lh
form = claim.parsed_form['dependents_application']
# sometimes veteran_information is not in dependents_application, but claim.add_veteran_info will make sure
# it's in the outer layer of parsed_form
veteran_information = form['veteran_information'].presence || claim.parsed_form['veteran_information']
file_number = veteran_information['file_number'] || veteran_information['ssn'] ||
claim.parsed_form['veteran_information']['file_number'] ||
claim.parsed_form['veteran_information']['ssn']
address = form['veteran_contact_information']['veteran_address']
{
veteran_first_name: veteran_information['full_name']['first'],
veteran_last_name: veteran_information['full_name']['last'],
file_number:,
zip: address['country_name'] == 'USA' ? address['zip_code'] : FOREIGN_POSTALCODE,
doc_type: claim.form_id,
claim_date: claim.created_at,
source: 'va.gov backup dependent claim submission',
business_line: 'CMP'
}
end
def generate_attachment_metadata(attachment_paths)
attachment_metadata = {}
i = 0
attachment_paths.each do |file_path|
i += 1
attachment_pdf_metadata = get_hash_and_pages(file_path)
attachment_metadata["ahash#{i}"] = attachment_pdf_metadata[:hash]
attachment_metadata["numberPages#{i}"] = attachment_pdf_metadata[:pages]
end
attachment_metadata
end
def send_confirmation_email(user)
claim.send_received_email(user)
end
def self.trigger_failure_events(msg)
saved_claim_id, _, encrypted_user_struct = msg['args']
user_struct = JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user_struct)) if encrypted_user_struct.present?
claim = SavedClaim::DependencyClaim.find(saved_claim_id)
email = claim.parsed_form.dig('dependents_application', 'veteran_contact_information', 'email_address') ||
user_struct.try(:va_profile_email)
Dependents::Monitor.new(claim.id).track_submission_exhaustion(msg, email)
claim.send_failure_email(email)
rescue => e
# If we fail in the above failure events, this is a critical error and silent failure.
v2 = true
Rails.logger.error('Lighthouse::BenefitsIntake::SubmitCentralForm686cJob silent failure!', { e:, msg:, v2: })
StatsD.increment("#{Lighthouse::BenefitsIntake::SubmitCentralForm686cV2Job::STATSD_KEY_PREFIX}}.silent_failure")
end
private
def stamped_pdf_with_form(form_id, path, timestamp)
PDFUtilities::DatestampPdf.new(path).run(
text: 'Application Submitted on va.gov',
x: 400,
y: 675,
text_only: true, # passing as text only because we override how the date is stamped in this instance
timestamp:,
page_number: %w[686C-674-V2].include?(form_id) ? 6 : 0,
template: "lib/pdf_fill/forms/pdfs/#{form_id}.pdf",
multistamp: true
)
end
def valid_claim_data(saved_claim_id, vet_info)
claim = SavedClaim::DependencyClaim.find(saved_claim_id)
claim.add_veteran_info(vet_info)
raise Invalid686cClaim unless claim.valid?(:run_686_form_jobs)
claim.formatted_686_data(vet_info)
end
def split_file_and_path(path)
{ file: path, file_name: path.split('/').last }
end
def init_monitor(saved_claim_id)
@monitor ||= Dependents::Monitor.new(saved_claim_id)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/benefits_intake/delete_old_claims.rb
|
# frozen_string_literal: true
module Lighthouse
module BenefitsIntake
class DeleteOldClaims
include Sidekiq::Job
sidekiq_options retry: false
EXPIRATION_TIME = 2.months
def perform
CentralMailClaim.joins(:central_mail_submission).where.not(
central_mail_submissions: { state: 'pending' }
).where(
'created_at < ?', EXPIRATION_TIME.ago
).find_each(&:destroy!)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/benefits_discovery/log_eligible_benefits_job.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_discovery/service'
require 'lighthouse/benefits_discovery/params'
module Lighthouse
module BenefitsDiscovery
class LogEligibleBenefitsJob
include Sidekiq::Job
sidekiq_options retry: false
def perform(user_uuid, service_history)
start_time = Time.current
user = User.find(user_uuid)
raise Common::Exceptions::RecordNotFound, "User with UUID #{user_uuid} not found" if user.nil?
prepared_params = ::BenefitsDiscovery::Params.new(user).build_from_service_history(service_history)
service = ::BenefitsDiscovery::Service.new(
api_key: Settings.lighthouse.benefits_discovery.x_api_key,
app_id: Settings.lighthouse.benefits_discovery.x_app_id
)
eligible_benefits = service.get_eligible_benefits(prepared_params)
execution_time = Time.current - start_time
StatsD.measure(self.class.name, execution_time)
sorted_benefits = sort_benefits(eligible_benefits)
formatted_benefits = format_benefits(sorted_benefits)
StatsD.increment('benefits_discovery_logging', tags: ["eligible_benefits:#{formatted_benefits}"])
rescue => e
Rails.logger.error("Failed to process eligible benefits for user: #{user_uuid}, error: #{e.message}")
raise e
end
private
def sort_benefits(benefit_recommendations)
benefit_recommendations.transform_values do |benefits|
benefits.map { |benefit| benefit['benefit_name'] }.sort
end.sort
end
# datadog converts most non-alphanumeric characters into underscores
# this series of substitutions is being done to make the tag more readable
def format_benefits(sorted)
sorted.to_h.to_s.tr('\/"{}=>', '').tr('[', '/').gsub('], ', '/').gsub(', ', ':').tr(']', '/')
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/evidence_submissions/evidence_submission_document_upload_polling_job.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_documents/documents_status_polling_service'
require 'lighthouse/benefits_documents/update_documents_status_service'
module Lighthouse
module EvidenceSubmissions
class EvidenceSubmissionDocumentUploadPollingJob
include Sidekiq::Job
# Job runs every hour with 0 retries
sidekiq_options retry: 0
POLLED_BATCH_DOCUMENT_COUNT = 100
STATSD_KEY_PREFIX = 'worker.lighthouse.cst_document_uploads'
STATSD_PENDING_DOCUMENTS_POLLED_KEY = 'pending_documents_polled'
STATSD_PENDING_DOCUMENTS_MARKED_SUCCESS_KEY = 'pending_documents_marked_completed'
STATSD_PENDING_DOCUMENTS_MARKED_FAILED_KEY = 'pending_documents_marked_failed'
def perform
successful_documents_before_polling = EvidenceSubmission.completed.count
failed_documents_before_polling = EvidenceSubmission.failed.count
pending_evidence_submissions = EvidenceSubmission.pending
StatsD.increment("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_POLLED_KEY}",
pending_evidence_submissions.count)
pending_evidence_submissions.in_batches(
of: POLLED_BATCH_DOCUMENT_COUNT
) do |pending_evidence_submission_batch|
lighthouse_document_request_ids = pending_evidence_submission_batch.pluck(:request_id)
update_batch(pending_evidence_submission_batch, lighthouse_document_request_ids)
rescue Faraday::ResourceNotFound => e
response_struct = OpenStruct.new(e.response)
handle_error(response_struct, lighthouse_document_request_ids)
end
documents_marked_success = EvidenceSubmission.completed.count - successful_documents_before_polling
StatsD.increment("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_MARKED_SUCCESS_KEY}",
documents_marked_success)
documents_marked_failed = EvidenceSubmission.failed.count - failed_documents_before_polling
StatsD.increment("#{STATSD_KEY_PREFIX}.#{STATSD_PENDING_DOCUMENTS_MARKED_FAILED_KEY}", documents_marked_failed)
end
private
# This method does the following:
# Calls BenefitsDocuments::DocumentsStatusPollingService which makes a post call to
# Lighthouse to get the staus of the document upload
# Calls BenefitsDocuments::UpdateDocumentsStatusService when the call to lighthouse was successful
# and updates each evidence_submission record in the batch with the status that lighthouse returned
def update_batch(pending_evidence_submission_batch, lighthouse_document_request_ids)
response = BenefitsDocuments::DocumentsStatusPollingService.call(lighthouse_document_request_ids)
if response.status == 200
result = BenefitsDocuments::UpdateDocumentsStatusService.call(
pending_evidence_submission_batch, response.body
)
if result && !result[:success]
response_struct = OpenStruct.new(result[:response])
handle_error(response_struct, response_struct.unknown_ids.map(&:to_s))
end
else
handle_error(response, lighthouse_document_request_ids)
end
end
def handle_error(response, lighthouse_document_request_ids)
StatsD.increment("#{STATSD_KEY_PREFIX}.polling_error")
Rails.logger.warn(
'Lighthouse::EvidenceSubmissionDocumentUploadPollingJob status endpoint error',
{
response_status: response.status,
response_body: response.body,
lighthouse_document_request_ids:,
timestamp: Time.now.utc
}
)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/evidence_submissions/delete_evidence_submission_records_job.rb
|
# frozen_string_literal: true
require 'sidekiq'
require 'lighthouse/benefits_documents/constants'
module Lighthouse
module EvidenceSubmissions
class DeleteEvidenceSubmissionRecordsJob
include Sidekiq::Job
# No need to retry since the schedule will run this periodically
sidekiq_options retry: 0
STATSD_KEY_PREFIX = 'worker.cst.delete_evidence_submission_records'
def perform
record_count = EvidenceSubmission.all.count
deleted_records = EvidenceSubmission.where(
delete_date: ..DateTime.current,
upload_status: BenefitsDocuments::Constants::UPLOAD_STATUS[:SUCCESS]
).destroy_all
StatsD.increment("#{STATSD_KEY_PREFIX}.count", deleted_records.size)
Rails.logger.info("#{self.class} deleted #{deleted_records.size} of #{record_count} EvidenceSubmission records")
nil
rescue => e
StatsD.increment("#{STATSD_KEY_PREFIX}.error")
Rails.logger.error("#{self.class} error: ", e.message)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/evidence_submissions/va_notify_email_status_callback.rb
|
# frozen_string_literal: true
require 'lighthouse/benefits_documents/constants'
module Lighthouse
module EvidenceSubmissions
class VANotifyEmailStatusCallback
def self.call(notification)
es = EvidenceSubmission.find_by(va_notify_id: notification.notification_id)
api_service_name = get_api_service_name(es.job_class)
status = notification.status
case status
when 'delivered'
# success
es.update(va_notify_status: BenefitsDocuments::Constants::VANOTIFY_STATUS[:SUCCESS])
when 'permanent-failure'
# delivery failed
es.update(va_notify_status: BenefitsDocuments::Constants::VANOTIFY_STATUS[:FAILED])
end
add_metrics(status, api_service_name)
add_log(notification, es) if notification.status != 'delivered'
end
def self.add_log(notification, evidence_submission)
context = {
notification_id: notification.notification_id,
source_location: notification.source_location,
status: notification.status,
status_reason: notification.status_reason,
notification_type: notification.notification_type,
request_id: evidence_submission.request_id,
job_class: evidence_submission.job_class
}
Rails.logger.error(name, context)
end
def self.add_metrics(status, api_service_name)
case status
when 'delivered'
StatsD.increment('api.vanotify.notifications.delivered')
StatsD.increment('callbacks.cst_document_uploads.va_notify.notifications.delivered')
tags = ['service:claim-status', "function: #{api_service_name} - VA Notify evidence upload failure email"]
StatsD.increment('silent_failure_avoided', tags:)
when 'permanent-failure'
StatsD.increment('api.vanotify.notifications.permanent_failure')
StatsD.increment('callbacks.cst_document_uploads.va_notify.notifications.permanent_failure')
tags = ['service:claim-status', "function: #{api_service_name} - VA Notify evidence upload failure email"]
StatsD.increment('silent_failure', tags:)
when 'temporary-failure'
StatsD.increment('api.vanotify.notifications.temporary_failure')
StatsD.increment('callbacks.cst_document_uploads.va_notify.notifications.temporary_failure')
else
StatsD.increment('api.vanotify.notifications.other')
StatsD.increment('callbacks.cst_document_uploads.va_notify.notifications.other')
end
end
def self.get_api_service_name(job_class)
api_service_name = ''
if job_class == 'EVSSClaimService'
api_service_name = 'EVSS'
elsif job_class == 'BenefitsDocuments::Service'
api_service_name = 'Lighthouse'
end
api_service_name
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/evidence_submissions/document_upload.rb
|
# frozen_string_literal: true
require 'datadog'
require 'timeout'
require 'lighthouse/benefits_documents/worker_service'
require 'lighthouse/benefits_documents/constants'
require 'lighthouse/benefits_documents/utilities/helpers'
module Lighthouse
module EvidenceSubmissions
class DocumentUpload
include Sidekiq::Job
attr_accessor :user_icn, :document_hash
# retry for 2d 1h 47m 12s
# https://github.com/sidekiq/sidekiq/wiki/Error-Handling
sidekiq_options retry: 16, queue: 'low'
# Set minimum retry time to ~1 hour
sidekiq_retry_in do |count, _exception|
rand(3600..3660) if count < 9
end
sidekiq_retries_exhausted do |msg, _ex|
verify_msg(msg)
# Grab the evidence_submission_id from the msg args
evidence_submission = EvidenceSubmission.find_by(id: msg['args'][2])
if can_update_evidence_submission(evidence_submission)
update_evidence_submission_for_failure(evidence_submission, msg)
else
call_failure_notification(msg)
end
end
def perform(user_icn, document_hash, evidence_submission_id = nil)
@user_icn = user_icn
document_hash.delete('file_obj')
document_hash.delete(:file_obj)
@document_hash = document_hash
initialize_upload_document
evidence_submission = EvidenceSubmission.find_by(id: evidence_submission_id)
if self.class.can_update_evidence_submission(evidence_submission)
update_evidence_submission_with_job_details(evidence_submission)
end
perform_document_upload_to_lighthouse(evidence_submission)
clean_up!
end
def self.verify_msg(msg)
raise StandardError, "Missing fields in #{name}" if invalid_msg_fields?(msg) || invalid_msg_args?(msg['args'])
end
def self.invalid_msg_fields?(msg)
!(%w[jid args created_at failed_at] - msg.keys).empty?
end
def self.invalid_msg_args?(args)
return true unless args[1].is_a?(Hash)
!(%w[first_name claim_id document_type file_name tracked_item_id] - args[1].keys).empty?
end
def self.update_evidence_submission_for_failure(evidence_submission, msg)
current_personalisation = JSON.parse(evidence_submission.template_metadata)['personalisation']
evidence_submission.update!(
upload_status: BenefitsDocuments::Constants::UPLOAD_STATUS[:FAILED],
failed_date: DateTime.current,
acknowledgement_date: (DateTime.current + 30.days),
error_message: 'Lighthouse::EvidenceSubmissions::DocumentUpload document upload failure',
template_metadata: {
personalisation: update_personalisation(current_personalisation, msg['failed_at'])
}.to_json
)
add_log('FAILED', evidence_submission.claim_id, evidence_submission.id, msg['jid'])
rescue => e
error_message = "#{name} failed to update EvidenceSubmission"
::Rails.logger.error(error_message, { message: e.message })
StatsD.increment('silent_failure', tags: ['service:claim-status', "function: #{error_message}"])
end
def self.call_failure_notification(msg)
return unless Flipper.enabled?(:cst_send_evidence_failure_emails)
icn = msg['args'].first
Lighthouse::FailureNotification.perform_async(icn, create_personalisation(msg))
::Rails.logger.info("#{name} exhaustion handler email queued")
rescue => e
::Rails.logger.error("#{name} exhaustion handler email error",
{ message: e.message })
StatsD.increment('silent_failure', tags: ['service:claim-status', 'function: evidence upload to Lighthouse'])
log_exception_to_sentry(e)
end
# Update personalisation here since an evidence submission record was previously created
def self.update_personalisation(current_personalisation, failed_at)
personalisation = current_personalisation.clone
personalisation['date_failed'] = helpers.format_date_for_mailers(failed_at)
personalisation
end
# This will be used by Lighthouse::FailureNotification
def self.create_personalisation(msg)
first_name = msg['args'][1]['first_name'].titleize unless msg['args'][1]['first_name'].nil?
document_type = LighthouseDocument.new(msg['args'][1]).description
# Obscure the file name here since this will be used to generate a failed email
# NOTE: the template that we use for va_notify.send_email uses `filename` but we can also pass in `file_name`
filename = helpers.generate_obscured_file_name(msg['args'][1]['file_name'])
date_submitted = helpers.format_date_for_mailers(msg['created_at'])
date_failed = helpers.format_date_for_mailers(msg['failed_at'])
{ first_name:, document_type:, filename:, date_submitted:, date_failed: }
end
def self.helpers
BenefitsDocuments::Utilities::Helpers
end
def self.add_log(type, claim_id, evidence_submission_id, job_id)
::Rails.logger.info("LH - Updated Evidence Submission Record to #{type}", {
claim_id:,
evidence_submission_id:,
job_id:
})
end
def self.can_update_evidence_submission(evidence_submission)
Flipper.enabled?(:cst_send_evidence_submission_failure_emails) && !evidence_submission.nil?
end
private
def initialize_upload_document
Datadog::Tracing.trace('Config/Initialize Upload Document') do
Sentry.set_tags(source: 'documents-upload')
validate_document!
uploader.retrieve_from_store!(document.file_name)
end
end
def validate_document!
raise Common::Exceptions::ValidationErrors, document unless document.valid?
end
def perform_document_upload_to_lighthouse(evidence_submission)
Datadog::Tracing.trace('Sidekiq Upload Document') do |span|
span.set_tag('Document File Size', file_body.size)
response = client.upload_document(file_body, document) # returns upload response which includes requestId
if self.class.can_update_evidence_submission(evidence_submission)
update_evidence_submission_for_in_progress(response, evidence_submission)
end
end
end
def clean_up!
Datadog::Tracing.trace('Remove Upload Document') do
uploader.remove!
end
end
def client
@client ||= BenefitsDocuments::WorkerService.new
end
def document
@document ||= LighthouseDocument.new(document_hash)
end
def uploader
@uploader ||= LighthouseDocumentUploader.new(user_icn, document.uploader_ids)
end
def perform_initial_file_read
Datadog::Tracing.trace('Sidekiq read_for_upload') do
uploader.read_for_upload
end
end
def file_body
@file_body ||= perform_initial_file_read
end
def update_evidence_submission_with_job_details(evidence_submission)
evidence_submission.update!(
upload_status: BenefitsDocuments::Constants::UPLOAD_STATUS[:QUEUED],
job_id: jid,
job_class: self.class
)
StatsD.increment('cst.lighthouse.document_uploads.evidence_submission_record_updated.queued')
self.class.add_log('QUEUED', evidence_submission.claim_id, evidence_submission.id, jid)
end
# For lighthouse uploads if the response is successful then we leave the upload_status as PENDING
# and the polling job in Lighthouse::EvidenceSubmissions::EvidenceSubmissionDocumentUploadPollingJob
# will then make a call to lighthouse later to check on the status of the upload and update accordingly
def update_evidence_submission_for_in_progress(response, evidence_submission)
request_successful = response.body.dig('data', 'success')
if request_successful
request_id = response.body.dig('data', 'requestId')
evidence_submission.update!(
request_id:,
upload_status: BenefitsDocuments::Constants::UPLOAD_STATUS[:PENDING]
)
StatsD.increment('cst.lighthouse.document_uploads.evidence_submission_record_updated.added_request_id')
self.class.add_log('PENDING', evidence_submission.claim_id, evidence_submission.id, jid)
else
raise StandardError
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq/lighthouse
|
code_files/vets-api-private/app/sidekiq/lighthouse/evidence_submissions/failure_notification_email_job.rb
|
# frozen_string_literal: true
require 'vets/shared_logging'
require 'sidekiq'
require 'lighthouse/benefits_documents/constants'
require 'lighthouse/benefits_documents/utilities/helpers'
module Lighthouse
module EvidenceSubmissions
class FailureNotificationEmailJob
include Sidekiq::Job
include Vets::SharedLogging
# Job runs daily with 0 retries
sidekiq_options retry: 0
NOTIFY_SETTINGS = Settings.vanotify.services.benefits_management_tools
MAILER_TEMPLATE_ID = NOTIFY_SETTINGS.template_id.evidence_submission_failure_email
def perform
return unless should_perform?
send_failed_evidence_submissions
nil
end
def should_perform?
failed_uploads.present?
end
# Fetches FAILED evidence submission records for BenefitsDocuments that dont have a va_notify_date
def failed_uploads
@failed_uploads ||= EvidenceSubmission.va_notify_email_not_queued
end
def notify_client
VaNotify::Service.new(NOTIFY_SETTINGS.api_key,
{ callback_klass: 'Lighthouse::EvidenceSubmissions::VANotifyEmailStatusCallback' })
end
def send_failed_evidence_submissions
failed_uploads.each do |upload|
personalisation = BenefitsDocuments::Utilities::Helpers.create_personalisation_from_upload(upload)
# NOTE: The file_name in the personalisation that is passed in is obscured
response = notify_client.send_email(
recipient_identifier: { id_value: upload.user_account.icn, id_type: 'ICN' },
template_id: MAILER_TEMPLATE_ID,
personalisation:
)
record_email_send_success(upload, response)
rescue => e
record_email_send_failure(upload, e)
end
nil
end
def record_email_send_success(upload, response)
# Update evidence_submissions table record with the va_notify_id and va_notify_date
upload.update(va_notify_id: response.id, va_notify_date: DateTime.current)
message = "#{upload.job_class} va notify failure email queued"
::Rails.logger.info(message)
end
def record_email_send_failure(upload, error)
error_message = "#{upload.job_class} va notify failure email errored"
::Rails.logger.error(error_message, { message: error.message })
StatsD.increment('silent_failure', tags: ['service:claim-status', "function: #{error_message}"])
log_exception_to_sentry(error)
end
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/pager_duty/cache_global_downtime.rb
|
# frozen_string_literal: true
require 'vets/shared_logging'
require 'pagerduty/maintenance_client'
require 'pagerduty/maintenance_windows_uploader'
module PagerDuty
class CacheGlobalDowntime
include Sidekiq::Job
include Vets::SharedLogging
sidekiq_options retry: 1, queue: 'critical'
def perform
client = PagerDuty::MaintenanceClient.new
options = { 'service_ids' => [global_service_id] }
maintenance_windows = client.get_all(options)
file_path = 'tmp/maintenance_windows.json'
File.open(file_path, 'w') do |f|
f << maintenance_windows.to_json
end
PagerDuty::MaintenanceWindowsUploader.upload_file(file_path)
rescue Common::Exceptions::BackendServiceException, Common::Client::Errors::ClientError => e
log_exception_to_sentry(e)
log_exception_to_rails(e)
end
private
def global_service_id
Settings.maintenance.services&.to_hash&.dig(:global)
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/pager_duty/poll_maintenance_windows.rb
|
# frozen_string_literal: true
require 'pagerduty/maintenance_client'
require 'vets/shared_logging'
module PagerDuty
class PollMaintenanceWindows
include Sidekiq::Job
include Vets::SharedLogging
sidekiq_options retry: 1, queue: 'critical'
MESSAGE_INDICATOR = 'USER_MESSAGE:'
def parse_user_message(raw_description)
raw_description.partition(MESSAGE_INDICATOR)[2].strip
end
def perform
client = PagerDuty::MaintenanceClient.new
pd_windows = client.get_all
# Add or update-in-place any open PagerDuty maintenance windows
pd_windows.each do |pd_win|
pd_win[:description] = parse_user_message(pd_win[:description])
window = MaintenanceWindow.find_or_initialize_by(pagerduty_id: pd_win[:pagerduty_id],
external_service: pd_win[:external_service])
window.update(pd_win)
end
# Delete any existing records that are not present in the PagerDuty API results
# These indicate deleted maintenance windows so we want to stop reporting them
open_ids = pd_windows.pluck(:pagerduty_id)
MaintenanceWindow.end_after(Time.zone.now).each do |api_win|
api_win.delete unless open_ids.include?(api_win.pagerduty_id)
end
rescue Common::Exceptions::BackendServiceException, Common::Client::Errors::ClientError => e
log_exception_to_sentry(e)
log_exception_to_rails(e)
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/central_mail/submit_form4142_job.rb
|
# frozen_string_literal: true
require 'central_mail/service'
require 'common/exceptions'
require 'evss/disability_compensation_form/metrics'
require 'evss/disability_compensation_form/form4142_processor'
require 'logging/call_location'
require 'logging/third_party_transaction'
require 'zero_silent_failures/monitor'
# TODO: Update Namespace once we are 100% done with CentralMail here
module CentralMail
class SubmitForm4142Job < EVSS::DisabilityCompensationForm::Job
INITIAL_FAILURE_EMAIL = :form526_send_4142_failure_notification
POLLING_FLIPPER_KEY = :disability_526_form4142_polling_records
POLLED_FAILURE_EMAIL = :disability_526_form4142_polling_record_failure_email
FORM4142_FORMSUBMISSION_TYPE = "#{Form526Submission::FORM_526}_#{Form526Submission::FORM_4142}".freeze
ZSF_DD_TAG_FUNCTION = '526_form_4142_upload_failure_email_queuing'
extend Logging::ThirdPartyTransaction::MethodWrapper
# this is required to make instance variables available to logs via
# the wrap_with_logging method
attr_accessor :submission_id
wrap_with_logging(
:upload_to_central_mail,
:upload_to_lighthouse,
additional_instance_logs: {
submission_id: [:submission_id]
}
)
CENTRAL_MAIL_STATSD_KEY_PREFIX = 'worker.evss.submit_form4142'
LIGHTHOUSE_STATSD_KEY_PREFIX = 'worker.lighthouse.submit_form4142'
class BenefitsIntake4142Error < StandardError; end
class CentralMailResponseError < Common::Exceptions::BackendServiceException; end
sidekiq_retries_exhausted do |msg, _ex|
job_id = msg['jid']
error_class = msg['error_class']
error_message = msg['error_message']
timestamp = Time.now.utc
form526_submission_id = msg['args'].first
log_info = { job_id:, error_class:, error_message:, timestamp:, form526_submission_id: }
::Rails.logger.warn('Submit Form 4142 Retries exhausted', log_info)
form_job_status = Form526JobStatus.find_by(job_id:)
bgjob_errors = form_job_status.bgjob_errors || {}
new_error = {
"#{timestamp.to_i}": {
caller_method: __method__.to_s,
error_class:,
error_message:,
timestamp:,
form526_submission_id:
}
}
form_job_status.update(
status: Form526JobStatus::STATUS[:exhausted],
bgjob_errors: bgjob_errors.merge(new_error)
)
api_statsd_key = if Flipper.enabled?(:disability_compensation_form4142_supplemental)
LIGHTHOUSE_STATSD_KEY_PREFIX
else
CENTRAL_MAIL_STATSD_KEY_PREFIX
end
StatsD.increment("#{api_statsd_key}.exhausted")
if Flipper.enabled?(:form526_send_4142_failure_notification)
EVSS::DisabilityCompensationForm::Form4142DocumentUploadFailureEmail.perform_async(form526_submission_id)
end
# NOTE: do NOT add any additional code here between the failure email being enqueued and the rescue block.
# The mailer prevents an upload from failing silently, since we notify the veteran and provide a workaround.
# The rescue will catch any errors in the sidekiq_retries_exhausted block and mark a "silent failure".
# This shouldn't happen if an email was sent; there should be no code here to throw an additional exception.
# The mailer should be the last thing that can fail.
rescue => e
cl = caller_locations.first
call_location = Logging::CallLocation.new(ZSF_DD_TAG_FUNCTION, cl.path, cl.lineno)
zsf_monitor = ZeroSilentFailures::Monitor.new(Form526Submission::ZSF_DD_TAG_SERVICE)
user_account_id = begin
Form526Submission.find(form526_submission_id).user_account_id
rescue
nil
end
zsf_monitor.log_silent_failure(log_info, user_account_id, call_location:)
::Rails.logger.error(
'Failure in SubmitForm4142#sidekiq_retries_exhausted',
{
messaged_content: e.message,
job_id:,
submission_id: form526_submission_id,
pre_exhaustion_failure: {
error_class:,
error_message:
}
}
)
raise e
end
# Performs an asynchronous job for submitting a Form 4142 to central mail service
#
# @param submission_id [Integer] the {Form526Submission} id
#
def perform(submission_id)
@submission_id = submission_id
Sentry.set_tags(source: '526EZ-all-claims')
super(submission_id)
with_tracking('Form4142 Submission', submission.saved_claim_id, submission.id) do
@pdf_path = processor.pdf_path
response = upload_to_api
handle_service_exception(response) if response_can_be_logged(response)
end
rescue => e
# Cannot move job straight to dead queue dynamically within an executing job
# raising error for all the exceptions as sidekiq will then move into dead queue
# after all retries are exhausted
retryable_error_handler(e)
raise e
ensure
File.delete(@pdf_path) if File.exist?(@pdf_path.to_s)
end
private
def response_can_be_logged(response)
response.present? &&
response.respond_to?(:status) &&
response.status.respond_to?(:between?) &&
response.status.between?(201, 600)
end
def processor
@processor ||= EVSS::DisabilityCompensationForm::Form4142Processor.new(submission, jid)
end
def upload_to_api
if Flipper.enabled?(:disability_compensation_form4142_supplemental)
upload_to_lighthouse
else
upload_to_central_mail
end
end
def upload_to_central_mail
CentralMail::Service.new.upload(processor.request_body)
end
def lighthouse_service
@lighthouse_service ||= BenefitsIntakeService::Service.new(with_upload_location: true)
end
def payload_hash(lighthouse_service_location)
{
upload_url: lighthouse_service_location,
file: { file: @pdf_path, file_name: @pdf_path.split('/').last },
metadata: generate_metadata.to_json,
attachments: []
}
end
def upload_to_lighthouse
log_info = { benefits_intake_uuid: lighthouse_service.uuid, submission_id: @submission_id }
Rails.logger.info(
'Successful Form4142 Upload Intake UUID acquired from Lighthouse',
log_info
)
payload = payload_hash(lighthouse_service.location)
response = lighthouse_service.upload_doc(**payload)
if Flipper.enabled?(POLLING_FLIPPER_KEY)
form526_submission = Form526Submission.find(@submission_id)
form_submission_attempt = create_form_submission_attempt(form526_submission)
log_info[:form_submission_id] = form_submission_attempt.form_submission.id
end
Rails.logger.info('Successful Form4142 Submission to Lighthouse', log_info)
response
end
def generate_metadata
vet_name = submission.full_name
filenumber = submission.auth_headers['va_eauth_birlsfilenumber']
metadata = {
'veteranFirstName' => vet_name[:first],
'veteranLastName' => vet_name[:last],
'zipCode' => determine_zip,
'source' => 'Form526Submission va.gov',
'docType' => '4142',
'businessLine' => '',
'fileNumber' => filenumber
}
SimpleFormsApiSubmission::MetadataValidator
.validate(metadata, zip_code_is_us_based: usa_based?)
end
def determine_zip
submission.form.dig('form526', 'form526', 'veteran', 'currentMailingAddress', 'zipFirstFive') ||
submission.form.dig('form526', 'form526', 'veteran', 'mailingAddress', 'zipFirstFive') ||
'00000'
end
def usa_based?
country =
submission.form.dig('form526', 'form526', 'veteran', 'currentMailingAddress', 'country') ||
submission.form.dig('form526', 'form526', 'veteran', 'mailingAddress', 'country')
%w[USA US].include?(country&.upcase)
end
# Cannot move job straight to dead queue dynamically within an executing job
# raising error for all the exceptions as sidekiq will then move into dead queue
# after all retries are exhausted
def handle_service_exception(response)
error = create_service_error(nil, self.class, response)
raise error
end
def create_service_error(key, source, response, _error = nil)
response_values = response_values(key, source, response.status, response.body)
CentralMailResponseError.new(key, response_values, nil, nil)
end
def response_values(key, source, status, detail)
{
status:,
detail:,
code: key,
source: source.to_s
}
end
def create_form_submission_attempt(form526_submission)
form_submission = form526_submission.saved_claim.form_submissions.find_by(form_type: FORM4142_FORMSUBMISSION_TYPE)
if form_submission.blank?
form_submission = FormSubmission.create(
form_type: FORM4142_FORMSUBMISSION_TYPE, # form526_form4142
form_data: '{}', # we have this already in the Form526Submission.form['form4142']
user_account: form526_submission.user_account,
saved_claim: form526_submission.saved_claim
)
end
FormSubmissionAttempt.create(form_submission:, benefits_intake_uuid: lighthouse_service.uuid)
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/income_limits/std_zipcode_import.rb
|
# frozen_string_literal: true
# rubocop:disable Metrics/MethodLength
require 'net/http'
require 'csv'
module IncomeLimits
class StdZipcodeImport
include Sidekiq::Job
def fetch_csv_data
csv_url = 'https://sitewide-public-websites-income-limits-data.s3-us-gov-west-1.amazonaws.com/std_zipcode.csv'
uri = URI(csv_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body if response.code == '200'
end
def perform
ActiveRecord::Base.transaction do
data = fetch_csv_data
if data
CSV.parse(data, headers: true) do |row|
created = DateTime.strptime(row['CREATED'], '%F %H:%M:%S %z').to_s
updated = DateTime.strptime(row['UPDATED'], '%F %H:%M:%S %z').to_s if row['UPDATED']
std_zipcode = StdZipcode.find_by(id: row['ID'].to_i)
if std_zipcode
std_zipcode.update(zip_code: row['ZIPCODE'].to_s) if std_zipcode.zip_code != row['ZIPCODE'].to_s
else
std_zipcode = StdZipcode.find_or_initialize_by(zip_code: row['ZIPCODE'].to_s)
std_zipcode.assign_attributes(
id: row['ID'].to_i,
zip_classification_id: row['ZIPCLASSIFICATION_ID']&.to_i,
preferred_zip_place_id: row['PREFERREDZIPPLACE_ID']&.to_i,
state_id: row['STATE_ID'].to_i,
county_number: row['COUNTYNUMBER'].to_i,
version: row['VERSION'].to_i,
created:,
updated:,
created_by: row['CREATEDBY'],
updated_by: row['UPDATEDBY']
)
std_zipcode.save!
end
end
else
raise 'Failed to fetch CSV data'
end
end
rescue => e
ActiveRecord::Base.rollback_transaction
raise "error: #{e}"
end
end
end
# rubocop:enable Metrics/MethodLength
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/income_limits/std_income_threshold_import.rb
|
# frozen_string_literal: true
# rubocop:disable Metrics/MethodLength
require 'net/http'
require 'csv'
module IncomeLimits
class StdIncomeThresholdImport
include Sidekiq::Job
def fetch_csv_data
csv_url = 'https://sitewide-public-websites-income-limits-data.s3-us-gov-west-1.amazonaws.com/std_incomethreshold.csv'
uri = URI(csv_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body if response.code == '200'
end
def perform
ActiveRecord::Base.transaction do
data = fetch_csv_data
if data
CSV.parse(data, headers: true) do |row|
created = DateTime.strptime(row['CREATED'], '%F %H:%M:%S %z').to_s
updated = DateTime.strptime(row['UPDATED'], '%F %H:%M:%S %z').to_s if row['UPDATED']
std_income_threshold = StdIncomeThreshold.find_or_initialize_by(id: row['ID'].to_i)
next unless std_income_threshold.new_record?
std_income_threshold.assign_attributes(
income_threshold_year: row['INCOME_THRESHOLD_YEAR'].to_i,
exempt_amount: row['EXEMPT_AMOUNT'].to_i,
medical_expense_deductible: row['MEDICAL_EXPENSE_DEDUCTIBLE'].to_i,
child_income_exclusion: row['CHILD_INCOME_EXCLUSION'].to_i,
dependent: row['DEPENDENT'].to_i,
add_dependent_threshold: row['ADD_DEPENDENT_THRESHOLD'].to_i,
property_threshold: row['PROPERTY_THRESHOLD'].to_i,
pension_threshold: row['PENSION_THRESHOLD']&.to_i,
pension_1_dependent: row['PENSION_1_DEPENDENT']&.to_i,
add_dependent_pension: row['ADD_DEPENDENT_PENSION']&.to_i,
ninety_day_hospital_copay: row['NINETY_DAY_HOSPITAL_COPAY']&.to_i,
add_ninety_day_hospital_copay: row['ADD_90_DAY_HOSPITAL_COPAY']&.to_i,
outpatient_basic_care_copay: row['OUTPATIENT_BASIC_CARE_COPAY']&.to_i,
outpatient_specialty_copay: row['OUTPATIENT_SPECIALTY_COPAY']&.to_i,
threshold_effective_date: row['THRESHOLD_EFFECTIVE_DATE'],
aid_and_attendance_threshold: row['AID_AND_ATTENDANCE_THRESHOLD']&.to_i,
outpatient_preventive_copay: row['OUTPATIENT_PREVENTIVE_COPAY']&.to_i,
medication_copay: row['MEDICATION_COPAY']&.to_i,
medication_copay_annual_cap: row['MEDICATIN_COPAY_ANNUAL_CAP']&.to_i,
ltc_inpatient_copay: row['LTC_INPATIENT_COPAY']&.to_i,
ltc_outpatient_copay: row['LTC_OUTPATIENT_COPAY']&.to_i,
ltc_domiciliary_copay: row['LTC_DOMICILIARY_COPAY']&.to_i,
inpatient_per_diem: row['INPATIENT_PER_DIEM']&.to_i,
description: row['DESCRIPTION'],
version: row['VERSION'].to_i,
created:,
updated:,
created_by: row['CREATED_BY'],
updated_by: row['UPDATED_BY']
)
std_income_threshold.save!
end
else
raise "Failed to fetch CSV data. Response code: #{response.code}"
end
end
rescue => e
ActiveRecord::Base.rollback_transaction
raise "error: #{e}"
end
end
end
# rubocop:enable Metrics/MethodLength
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/income_limits/std_county_import.rb
|
# frozen_string_literal: true
require 'net/http'
require 'csv'
module IncomeLimits
class StdCountyImport
include Sidekiq::Job
def fetch_csv_data
csv_url = 'https://sitewide-public-websites-income-limits-data.s3-us-gov-west-1.amazonaws.com/std_county.csv'
uri = URI(csv_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body if response.code == '200'
end
def perform
ActiveRecord::Base.transaction do
data = fetch_csv_data
if data
CSV.parse(data, headers: true) do |row|
std_county = StdCounty.find_or_initialize_by(id: row['ID'].to_i)
next unless std_county.new_record?
std_county.assign_attributes(std_county_attributes(row))
std_county.save!
end
else
raise 'Failed to fetch CSV data.'
end
end
rescue => e
ActiveRecord::Base.rollback_transaction
raise "error: #{e}"
end
private
def std_county_attributes(row)
{
name: row['NAME'].to_s,
county_number: row['COUNTYNUMBER'].to_i,
description: row['DESCRIPTION'],
state_id: row['STATE_ID'].to_i,
version: row['VERSION'].to_i,
created: date_formatter(row['CREATED']),
updated: date_formatter(row['UPDATED']),
created_by: row['CREATEDBY'].to_s,
updated_by: row['UPDATEDBY'].to_s
}
end
def date_formatter(date)
return nil unless date
DateTime.strptime(date, '%F %H:%M:%S %z').to_s
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/income_limits/gmt_thresholds_import.rb
|
# frozen_string_literal: true
require 'net/http'
require 'csv'
module IncomeLimits
class GmtThresholdsImport
include Sidekiq::Job
def fetch_csv_data
csv_url = 'https://sitewide-public-websites-income-limits-data.s3-us-gov-west-1.amazonaws.com/std_gmtthresholds.csv'
uri = URI(csv_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body if response.code == '200'
end
def perform
ActiveRecord::Base.transaction do
data = fetch_csv_data
if data
CSV.parse(data, headers: true) do |row|
gmt_threshold = GmtThreshold.find_or_initialize_by(id: row['ID'].to_i)
next unless gmt_threshold.new_record?
gmt_threshold.assign_attributes(gmt_threshold_attributes(row))
gmt_threshold.save!
end
else
raise 'Failed to fetch CSV data.'
end
end
rescue => e
ActiveRecord::Base.rollback_transaction
raise "error: #{e}"
end
private
def gmt_threshold_attributes(row)
{
effective_year: row['EFFECTIVEYEAR'].to_i,
state_name: row['STATENAME'],
county_name: row['COUNTYNAME'],
fips: row['FIPS'].to_i,
trhd1: row['TRHD1'].to_i,
trhd2: row['TRHD2'].to_i,
trhd3: row['TRHD3'].to_i,
trhd4: row['TRHD4'].to_i,
trhd5: row['TRHD5'].to_i,
trhd6: row['TRHD6'].to_i,
trhd7: row['TRHD7'].to_i,
trhd8: row['TRHD8'].to_i,
msa: row['MSA'].to_i,
msa_name: row['MSANAME'],
version: row['VERSION'].to_i
}.merge(date_attributes(row))
end
def date_attributes(row)
{
created: date_formatter(row['CREATED']),
updated: date_formatter(row['UPDATED']),
created_by: row['CREATEDBY'],
updated_by: row['UPDATEDBY']
}
end
def date_formatter(date)
return nil unless date
DateTime.strptime(date, '%F %H:%M:%S %z').to_s
end
end
end
|
0
|
code_files/vets-api-private/app/sidekiq
|
code_files/vets-api-private/app/sidekiq/income_limits/std_state_import.rb
|
# frozen_string_literal: true
# rubocop:disable Metrics/MethodLength
require 'net/http'
require 'csv'
module IncomeLimits
class StdStateImport
include Sidekiq::Job
def fetch_csv_data
csv_url = 'https://sitewide-public-websites-income-limits-data.s3-us-gov-west-1.amazonaws.com/std_state.csv'
uri = URI(csv_url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body if response.code == '200'
end
def perform
ActiveRecord::Base.transaction do
data = fetch_csv_data
if data
CSV.parse(data, headers: true) do |row|
created = DateTime.strptime(row['CREATED'], '%F %H:%M:%S %z').to_s
updated = DateTime.strptime(row['UPDATED'], '%F %H:%M:%S %z').to_s if row['UPDATED']
std_state = StdState.find_or_initialize_by(id: row['ID'].to_i)
next unless std_state.new_record?
std_state.assign_attributes(
id: row['ID'].to_i,
name: row['NAME'],
postal_name: row['POSTALNAME'],
fips_code: row['FIPSCODE'].to_i,
country_id: row['COUNTRY_ID'].to_i,
version: row['VERSION'].to_i,
created:,
updated:,
created_by: row['CREATEDBY'],
updated_by: row['UPDATEDBY']
)
std_state.save!
end
else
raise 'Failed to fetch CSV data'
end
end
rescue => e
ActiveRecord::Base.rollback_transaction
raise "error: #{e}"
end
end
end
# rubocop:enable Metrics/MethodLength
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/spool_submissions_report_mailer.rb
|
# frozen_string_literal: true
require 'reports/uploader'
class SpoolSubmissionsReportMailer < ApplicationMailer
REPORT_TEXT = 'Spool submissions report'
def build(report_file)
url = Reports::Uploader.get_s3_link(report_file)
opt = {}
opt[:to] =
if FeatureFlipper.staging_email?
Settings.reports.spool_submission.staging_emails.dup
else
Settings.reports.spool_submission.emails.dup
end
mail(
opt.merge(
subject: REPORT_TEXT,
body: "#{REPORT_TEXT} (link expires in one week)<br>#{url}"
)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/veteran_readiness_employment_mailer.rb
|
# frozen_string_literal: true
class VeteranReadinessEmploymentMailer < ApplicationMailer
def build(pid, email_addr, routed_to_cmp)
email_addr = 'kcrawford@governmentcio.com' if FeatureFlipper.staging_email?
@submission_date = Time.current.in_time_zone('America/New_York').strftime('%m/%d/%Y')
@pid = pid
cmp = '_cmp' if routed_to_cmp
file_path = Rails.root.join('app', 'mailers', 'views', "veteran_readiness_employment#{cmp}.html.erb")
template = File.read(file_path)
mail(
to: email_addr,
subject: 'VR&E Counseling Request Confirmation',
body: ERB.new(template).result(binding)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/stem_applicant_confirmation_mailer.rb
|
# frozen_string_literal: true
class StemApplicantConfirmationMailer < TransactionalEmailMailer
SUBJECT = 'VA Rogers STEM Scholarship, Application Confirmation'
GA_CAMPAIGN_NAME = 'stem_applicant_confirmation-10203-submission-notification'
GA_DOCUMENT_PATH = '/email/form'
GA_LABEL = 'stem-applicant-confirmation-10203-submission-notification'
TEMPLATE = 'stem_applicant_confirmation'
def application_date
@claim.created_at.strftime('%b %d, %Y')
end
def region_name
EducationForm::EducationFacility::EMAIL_NAMES[region]
end
def region_address
EducationForm::EducationFacility::ADDRESSES[region][0]
end
def region_city_state_zip
EducationForm::EducationFacility::ADDRESSES[region][1]
end
def confirmation_number
@claim.education_benefits_claim.confirmation_number
end
def build(claim, ga_client_id)
@applicant = claim.open_struct_form
@claim = claim
super([@applicant.email], ga_client_id, {})
end
private
def region
@claim.education_benefits_claim.regional_processing_office.to_sym
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/dependents_application_failure_mailer.rb
|
# frozen_string_literal: true
class DependentsApplicationFailureMailer < ApplicationMailer
def build(user)
opt = {}
opt[:to] = [
user.email
]
template = File.read('app/mailers/views/dependents_application_failure.erb')
mail(
opt.merge(
subject: t('dependency_claim_failure_mailer.subject'),
body: ERB.new(template).result(binding)
)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/create_excel_files_mailer.rb
|
# frozen_string_literal: true
class CreateExcelFilesMailer < ApplicationMailer
def build(filename)
date = Time.zone.now.strftime('%m/%d/%Y')
recipients = nil
subject = nil
if Settings.vsp_environment.eql?('production')
recipients = Settings.edu.production_excel_contents.emails
subject = "22-10282 Form CSV file for #{date}"
else
recipients = Settings.edu.staging_excel_contents.emails
subject = "(Staging) 22-10282 CSV file for #{date}"
end
attachments[filename] = File.read("tmp/#{filename}")
mail(
to: recipients,
subject:
) do |format|
format.text { render plain: "CSV file for #{date} is attached." }
format.html { render html: "CSV file for #{date} is attached." }
end
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/stem_applicant_sco_mailer.rb
|
# frozen_string_literal: true
class StemApplicantScoMailer < TransactionalEmailMailer
SUBJECT = 'Outreach to School Certifying Official for VA Rogers STEM Scholarship'
GA_CAMPAIGN_NAME = 'school-certifying-officials-10203-submission-notification'
GA_DOCUMENT_PATH = '/email/form'
GA_LABEL = 'school-certifying-officials-10203-submission-notification'
TEMPLATE = 'stem_applicant_sco'
def build(claim_id, ga_client_id)
@applicant = SavedClaim::EducationBenefits::VA10203.find(claim_id).open_struct_form
super([@applicant.email], ga_client_id, {})
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/create_staging_spool_files_mailer.rb
|
# frozen_string_literal: true
require 'reports/uploader'
class CreateStagingSpoolFilesMailer < ApplicationMailer
def build(contents)
date = Time.zone.now.strftime('%m%d%Y')
opt = {}
opt[:to] = Settings.edu.staging_spool_contents.emails.dup
note_str = '*** note: to see in the correct format, right-click on the contents and select "View Source" ***'
mail(
opt.merge(
subject: "Staging Spool file on #{date}",
body: "The staging spool file for #{date} #{note_str}\n\n\n#{contents}"
)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/rrd_alert_mailer.rb
|
# frozen_string_literal: true
class RrdAlertMailer < ApplicationMailer
def build(submission, subject, message, error = nil, to = Settings.rrd.alerts.recipients)
@id = submission.id
@message = message
@error = error
template = File.read('app/mailers/views/rrd_alert_mailer.html.erb')
environment = "[#{Settings.vsp_environment}] " unless Settings.vsp_environment == 'production'
mail(
to:,
subject:,
body: ERB.new(template).result(binding)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/transactional_email_mailer.rb
|
# frozen_string_literal: true
class TransactionalEmailMailer < ApplicationMailer
def build(email, google_analytics_client_id, opt = {})
@google_analytics_client_id = google_analytics_client_id
@google_analytics_tracking_id = Settings.google_analytics.tracking_id
mail(
opt.merge(
to: email,
subject: self.class::SUBJECT,
content_type: 'text/html',
body: template
)
)
end
def first_initial_last_name(name)
return '' if name.nil?
"#{name.first[0, 1]} #{name.last}"
end
def first_and_last_name(name)
return '' if name.nil?
"#{name.first} #{name.last}"
end
def template(name = self.class::TEMPLATE)
template_file = File.read("app/mailers/views/#{name}.html.erb")
ERB.new(template_file).result(binding)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/rrd_mas_notification_mailer.rb
|
# frozen_string_literal: true
class RrdMasNotificationMailer < ApplicationMailer
def build(submission, recipients = Settings.rrd.mas_tracking.recipients)
@id = submission.id
@submitted_claim_id = submission.submitted_claim_id
@created_at = submission.created_at
@created_at = submission.created_at
@disabilities = submission.disabilities
template = File.read('app/mailers/views/rrd_mas_notification_mailer.html.erb')
mail(
to: recipients,
subject: "MA claim - #{submission.diagnostic_codes.join(', ')}",
body: ERB.new(template).result(binding)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/school_certifying_officials_mailer.rb
|
# frozen_string_literal: true
class SchoolCertifyingOfficialsMailer < TransactionalEmailMailer
SUBJECT = 'Applicant for VA Rogers STEM Scholarship'
GA_CAMPAIGN_NAME = 'school-certifying-officials-10203-submission-notification'
GA_DOCUMENT_PATH = '/email/form'
GA_LABEL = 'school-certifying-officials-10203-submission-notification'
TEMPLATE = 'school_certifying_officials'
def build(claim_id, recipients, ga_client_id)
@applicant = SavedClaim::EducationBenefits::VA10203.find(claim_id).open_struct_form
super(recipients, ga_client_id, {})
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/application_mailer.rb
|
# frozen_string_literal: true
require 'feature_flipper'
class ApplicationMailer < ActionMailer::Base
default from: "#{FeatureFlipper.staging_email? ? 'stage.' : ''}va-notifications@public.govdelivery.com"
layout false
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/direct_deposit_mailer.rb
|
# frozen_string_literal: true
class DirectDepositMailer < TransactionalEmailMailer
SUBJECT = 'Confirmation - Your direct deposit information changed on VA.gov'
GA_CAMPAIGN_NAME = 'direct-deposit-update'
GA_DOCUMENT_PATH = '/email/profile'
GA_LABEL = 'direct-deposit-update'
TEMPLATE = 'direct_deposit'
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/year_to_date_report_mailer.rb
|
# frozen_string_literal: true
require 'reports/uploader'
class YearToDateReportMailer < ApplicationMailer
REPORT_TEXT = 'Year to date report'
def build(report_file)
url = Reports::Uploader.get_s3_link(report_file)
opt = {}
opt[:to] = if FeatureFlipper.staging_email?
Settings.reports.year_to_date_report.staging_emails.dup
else
Settings.reports.year_to_date_report.emails.dup
end
mail(
opt.merge(
subject: REPORT_TEXT,
body: "#{REPORT_TEXT} (link expires in one week)<br>#{url}"
)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/spool10203_submissions_report_mailer.rb
|
# frozen_string_literal: true
require 'reports/uploader'
class Spool10203SubmissionsReportMailer < ApplicationMailer
REPORT_TEXT = '10203 spool submissions report'
def build(report_file)
url = Reports::Uploader.get_s3_link(report_file)
opt = {}
opt[:to] =
if FeatureFlipper.staging_email?
Settings.reports.spool10203_submission.staging_emails.dup
else
Settings.reports.spool10203_submission.emails.dup
end
mail(
opt.merge(
subject: REPORT_TEXT,
body: "#{REPORT_TEXT} (link expires in one week)<br>#{url}"
)
)
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/stem_applicant_denial_mailer.rb
|
# frozen_string_literal: true
class StemApplicantDenialMailer < TransactionalEmailMailer
SUBJECT = "We've reached a decision on your STEM Scholarship application"
GA_CAMPAIGN_NAME = 'stem_applicant_denial-10203-submission-notification'
GA_DOCUMENT_PATH = '/email/form'
GA_LABEL = 'stem-applicant-denial-10203-submission-notification'
TEMPLATE = 'stem_applicant_denial'
def application_date
@claim.saved_claim.created_at.strftime('%b %d, %Y')
end
def your_claims_status_url
env = FeatureFlipper.staging_email? ? 'staging.' : ''
"https://#{env}va.gov/track-claims/your-stem-claims/#{@claim.id}/status?utm_medium=email&utm_campaign=stem_scholarship_decision"
end
def build(claim, ga_client_id)
@applicant = claim.saved_claim.open_struct_form
@claim = claim
super([@applicant.email], ga_client_id, {})
end
end
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/mailers/create_daily_spool_files_mailer.rb
|
# frozen_string_literal: true
require 'reports/uploader'
class CreateDailySpoolFilesMailer < ApplicationMailer
def build(region = nil)
date = Time.zone.now.strftime('%m%d%Y')
rpo_msg = if region.nil?
'files'
else
"file for #{EducationForm::EducationFacility.rpo_name(region:)}"
end
opt = {}
opt[:to] =
if FeatureFlipper.staging_email?
Settings.edu.spool_error.staging_emails.dup
else
Settings.edu.spool_error.emails.dup
end
mail(
opt.merge(
subject: "Error Generating Spool file on #{date}",
body: "There was an error generating the spool #{rpo_msg} on #{date}"
)
)
end
end
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/veteran_readiness_employment.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>
<b>Submitted Application</b><br>
Veteran's PID: <%= @pid %><br>
Type of Form Submitted: 28-1900<br>
Submitted Date: <%= @submission_date %><br>
</p>
<p>Sent from: VA.gov</p>
<p><i>Note: This is an automated message sent from an unmonitored email account.</i></p>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/rrd_alert_mailer.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
Environment: <%= Settings.vsp_environment %><br/>
Form526Submission.id: <%= @id %><br/>
<br/>
<%= @message %><br/>
<br/>
<%= "Error backtrace:\n #{@error.backtrace.join(",<br/>\n ")}" if @error %>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/stem_applicant_confirmation.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>Dear <%= first_and_last_name(@applicant.veteranFullName) %>,</p>
<p>VA received your application for the Rogers STEM scholarship on <%= application_date %>.</p>
<p>We usually process applications within 30 days. We may contact you if we need more information or documents.</p>
<p>
<b>Rogers STEM Scholarship (Form 22-10203)</b>
<br>
for <%= first_and_last_name(@applicant.veteranFullName) %>
<br>
Confirmation number <%= confirmation_number %>
<br>
Date received <%= application_date %>
</p>
<p>
<b>Your claim was sent to:</b>
<br />
<%= region_name %>
<br />
VA Regional Office
<br />
<%= region_address %>
<br />
<%= region_city_state_zip %>
</p>
<p>
<b>What happens after I apply?</b>
<br />
We usually decide on applications within 30 days.
<br />
You’ll get a Certificate of Eligibility (COE) or decision letter in the mail. If we’ve approved your application, you can bring the COE to the VA certifying official at your school.
<br />
<a href="https://www.va.gov/education/after-you-apply/?utm_source=confirmation_email&utm_medium=email&utm_campaign=what_happens_after_you_apply">More about what happens after you apply</a>
</p>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/stem_applicant_denial.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>Dear STEM Scholarship applicant,</p>
<p>Thank you for applying for the Edith Nourse Rogers STEM Scholarship.</p>
<p>To check your application status, go to <a href="<%= your_claims_status_url %>"><%= your_claims_status_url %></a> and sign into our claim status tool.</p>
<div style="background-color: #f1f1f1; display: inline-block; padding: 1em;">
<p>
<b>Your application details are below:</b>
<p>Rogers STEM Scholarship application</p>
</p>
<p>
<b>Date submitted</b>
<br />
<p><%= application_date %></p>
</p>
</div>
<p>
<p>Thank you for your service,</p>
<p>Rogers STEM Scholarship Team</p>
<p>VA Buffalo Regional Processing Office</p>
</p>
<hr>
<p>You are receiving this email because we've made a decision on your application for the Rogers STEM Scholarship. Please do not reply to this email. If you need to contact us, please visit <a href="https://va.gov">https://va.gov</a>.</p>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/direct_deposit.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>
<b>Your direct deposit information changed.</b>
</p>
<p>
We're sending this email to confirm that you've recently changed your direct deposit information in your VA.gov account profile. We'll use your updated information to deposit any benefits you may receive.
</p>
<p>
<b>If you didn't make this change, please call us right away.</b>
</p>
<p>
Call <a href="tel:1-800-827-1000">800-827-1000</a> (TTY: <a href="tel:1-800-829-4833">800-829-4833</a>). We're here Monday through Friday, 8:00 a.m. to 9:00 p.m. ET. We can help you take the steps you need to protect your bank account information and prevent fraud.
</p>
<p>
<a href="https://www.va.gov/profile?utm_source=gov-delivery&utm_medium=email&utm_campaign=<%=self.class::GA_CAMPAIGN_NAME %>">Go to your VA.gov profile</a>
</p>
<img src="https://www.google-analytics.com/collect?v=1&tid=<%=@google_analytics_tracking_id%>&cid=<%=@google_analytics_client_id%>&t=event&ec=email&el=<%=self.class::GA_LABEL %>&ea=open&cn=<%=self.class::GA_CAMPAIGN_NAME %>&cm=email&cs=gov-delivery&dp=<%=self.class::GA_DOCUMENT_PATH %>"/>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/stem_applicant_sco.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>Dear <%= first_and_last_name(@applicant.veteranFullName) %>,</p>
<p>We sent the email below to the School Certifying Official (SCO) at <%= @applicant.schoolName %> to gather information for your Edith Nourse Rogers STEM Scholarship application.</p>
<p>We’ll follow-up with the SCO for any additional information we need when we process your application.</p>
<p>Thank you,</p>
<p>
Rogers STEM Scholarship Team<br>
VA Buffalo Regional Processing Office
</p>
<hr>
<%= template(SchoolCertifyingOfficialsMailer::TEMPLATE) %>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/dependents_application_failure.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
</head>
<body>
<p>Dear <%= user.first_name %> <%= user.last_name %></p>
<%= t( 'dependency_claim_failure_mailer.body_html' ) %>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/ch31_submissions_report.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<table>
<tr>
<th style="white-space:nowrap; text-align:left; width:5%">Count</th>
<th style="white-space:nowrap; text-align:left; width:20%">Regional Office</th>
<th style="white-space:nowrap; text-align:left; width:15%">PID</th>
<th style="white-space:nowrap; text-align:left; width:20%">Date Application Received</th>
<th style="white-space:nowrap; text-align:left; width:15%">Type of Form</th>
<th style="white-space:nowrap; text-align:left; width:10%">e-VA</th>
<th style="white-space:nowrap; text-align:left; width:10%">Tele-counseling</th>
<th style="white-space:nowrap; text-align:left; width:5%">Total</th>
</tr>
<% @submitted_claims.each.with_index do |claim, index|
parsed_form = claim.parsed_form
%>
<tr>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(index + 1) %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(parsed_form['veteranInformation']['regionalOffice']) %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(parsed_form['veteranInformation']['pid']) %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(claim.created_at.to_s) %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(claim.form_id) %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(parsed_form['useEva'] ? 'Yes' : 'No') %></td>
<td style="white-space:nowrap"><%= ERB::Util.html_escape(parsed_form['useTelecounseling'] ? 'Yes' : 'No') %></td>
<td style="white-space:nowrap"><%= @total %></td>
</tr>
<% end %>
</table>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/veteran_readiness_employment_cmp.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>
<b>Submitted Application via VA.gov was not successful.</b><br>
<b>Application routed to the Centralized Mail Portal</b><br>
Veteran's PID: <%= @pid %><br>
Type of Form Submitted: 28-1900<br>
Submitted Date: <%= @submission_date %><br>
</p>
<p>Sent from: VA.gov</p>
<p><i>Note: This is an automated message sent from an unmonitored email account.</i></p>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/school_certifying_officials.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<p>Dear VA School Certifying Official,</p>
<p>
A student enrolled at your school or training facility has applied for the Edith Nourse Rogers STEM Scholarship. The student will also receive a copy of this letter. We can't make a formal determination on the student's eligibility for the STEM Scholarship until we receive the following information from you.
</p>
<p>
<b>Rogers STEM Scholarship Applicant</b>
<br>
Student's name: <%= first_initial_last_name(@applicant.veteranFullName) %>
<br>
Student's school email address: <%= @applicant.schoolEmailAddress %>
<br>
Student's school ID number: <%= @applicant.schoolStudentId %>
</p>
<p>
<b>If the applicant is an undergraduate</b>
<br>
If the student is currently enrolled in an undergraduate program, please provide the following:
<ul>
<li>
Is the student pursuing a bachelor's degree in an approved STEM program?
(<a href="https://www.va.gov/resources/approved-fields-of-study-for-the-stem-scholarship?utm_source=confirmation_email&utm_medium=email&utm_campaign=stem_approved_programs">Programs approved for the Rogers STEM Scholarship</a>)
</li>
<li>Name of STEM program student is enrolled in:</li>
<li>6-digit CIP Code for the program:</li>
<li>Credit hours completed toward this STEM program (specify semester or quarter and exclude in-progress credits):</li>
<li>Total required credits for STEM degree program (specify semester or quarter):</li>
</ul>
</p>
<p>
Note: If the student is enrolled in a dual degree program, at least one of the degrees must
include an undergraduate degree in an approved STEM field. For dual degree programs, please provide
the total credit hours required for the dual degree program as well as the credits completed toward
the dual degree program when responding above.
</p>
<p>
<b>If the applicant is a teaching certificate candidate</b>
<br>
If the student already has an undergraduate degree and is seeking a teaching certification, please provide the following:
<ul>
<li>
Has the student earned a bachelor's degree in an approved STEM program?
(<a href="https://www.va.gov/resources/approved-fields-of-study-for-the-stem-scholarship?utm_source=confirmation_email&utm_medium=email&utm_campaign=stem_approved_programs">Programs approved for the Rogers STEM Scholarship</a>)
</li>
<li>Name of STEM program of degree conferred:</li>
<li>6-digit CIP Code of degree conferred:</li>
<li>Is the student currently enrolled in a program leading to a teaching certification?</li>
</ul>
</p>
<p>
<b>If the applicant is in a clinical training program for health care professionals</b>
</br>
If the student already has a bachelor's or graduate degree and is pursuing a clinical training program, please provide the following:
<ul>
<li>
Has the student earned a bachelor’s or graduate degree in an approved STEM program?
(<a href="https://www.va.gov/resources/approved-fields-of-study-for-the-stem-scholarship?utm_source=confirmation_email&utm_medium=email&utm_campaign=stem_approved_programs">Programs approved for the Rogers STEM Scholarship</a>)
</li>
<li>Name of STEM program of degree conferred:</li>
<li>
Is the student currently pursuing a covered clinical training program for health care professionals?
(<a href="https://www.va.gov/resources/approved-fields-of-study-for-the-stem-scholarship?utm_source=confirmation_email&utm_medium=email&utm_campaign=stem_approved_programs">Programs approved for the Rogers STEM Scholarship</a>)
</li>
<li>Total length of clinical training program (in months or years):</li>
<li>Amount of clinical training program completed to date (in months or years):</li>
</ul>
</p>
<p>
<b>A reply is requested as soon as possible, preferably within 14 days.</b>
Please submit your response to <a href="mailto:STEM.VBABUF@va.gov">STEM.VBABUF@va.gov</a>. If we don't receive a response, we won't be able to process the student's application for the Rogers STEM Scholarship, and we may follow up for the required information.
</p>
<p>Please submit any questions or concerns to <a href="mailto:STEM.VBABUF@va.gov">STEM.VBABUF@va.gov</a>. Please account for the 14-day time request when submitting questions.</p>
<p>Thank you,</p>
<p>
Rogers STEM Scholarship Team<br>
VA Buffalo Regional Processing Office<br>
<br>
<br>
VA Form Number: 22-10203<br>
Respondent Burden: 15 minutes<br>
OMB Control Number: 2900-0878<br>
OMB Expiration Date: 6/30/2023<br>
<a href="https://www.va.gov/education/other-va-education-benefits/stem-scholarship/apply-for-scholarship-form-22-10203/introduction#privacy_policy/?utm_source=confirmation_email&utm_medium=email&utm_campaign=privacy_policy">Privacy Act Statement (available online)</a><br>
</p>
</body>
</html>
|
0
|
code_files/vets-api-private/app/mailers
|
code_files/vets-api-private/app/mailers/views/rrd_mas_notification_mailer.html.erb
|
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<%= @disabilities.pluck('diagnosticCode').join(', ') %>
<table border="1" cellspacing="1" cellpadding="5"><thead>
<tr>
<td>Benefit Claim Id</td>
<td>Submission Date</td>
<td>Submission Time</td>
<td>Submission ID</td>
</tr>
</thead><tbody>
<tr>
<td><%= @submitted_claim_id %></td>
<td><%= @created_at.to_date %></td>
<td><%= @created_at.strftime '%H:%M:%S' %></td>
<td><%= @id %></td>
</tr>
</tbody>
</table>
</body>
</html>
|
0
|
code_files/vets-api-private/app
|
code_files/vets-api-private/app/swagger/readme.md
|
# Display the Swagger Doc
[We host the SwaggerUI here](https://department-of-veterans-affairs.github.io/va-digital-services-platform-docs/api-reference/#/)
To view locally go to http://localhost:3000/v0/swagger/ and "Select a definition" on the upper right.
- The Swagger 2.0 doc is served from the endpoint: `GET` `/v0/apidocs`
- The OpenAPI 3.0 doc is served from `GET` `/v0/openapi`
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/errors.rb
|
# frozen_string_literal: true
class Swagger::V1::Schemas::Errors
include Swagger::Blocks
swagger_schema :Errors do
key :required, [:errors]
property :errors do
key :type, :array
items do
key :$ref, :Error
end
end
end
swagger_schema :Error do
key :required, %i[title detail code status]
property :title, type: :string
property :detail, type: :string
property :code, type: :string
property :status, type: :string
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/income_limits.rb
|
# frozen_string_literal: true
class Swagger::V1::Schemas::IncomeLimits
include Swagger::Blocks
swagger_schema :IncomeLimitThresholds do
key :required, [:data]
property :data do
key :type, :array
items do
property :pension_threshold, type: :integer, example: 19_320
property :national_threshold, type: :integer, example: 43_990
property :gmt_threshold, type: :integer, example: 61_900
end
end
end
swagger_schema :ZipCodeIsValid do
property :zip_is_valid, type: :boolean
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/gibct/version_public_exports.rb
|
# frozen_string_literal: true
module Swagger
module V1
module Schemas
module Gibct
class VersionPublicExports
include Swagger::Blocks
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/appeals/supplemental_claims.rb
|
# frozen_string_literal: true
require 'decision_review/schemas'
module Swagger
module V1
module Schemas
module Appeals
class SupplementalClaims
include Swagger::Blocks
VetsJsonSchema::SCHEMAS.fetch('SC-CREATE-REQUEST-BODY-FOR-VA-GOV')['definitions'].each do |k, v|
v.delete('oneOf') if k == 'centralMailAddress'
if k == 'scCreate'
# remove draft-07 specific schema items, they won't validate with swagger
attrs = v['properties']['data']['properties']['attributes']
attrs['properties']['evidenceSubmission'].delete('if')
attrs['properties']['evidenceSubmission'].delete('then')
attrs['properties']['evidenceSubmission']['properties']['evidenceType'].delete('if')
attrs['properties']['evidenceSubmission']['properties']['evidenceType'].delete('then')
attrs['properties']['evidenceSubmission']['properties']['evidenceType'].delete('else')
attrs.delete('allOf')
end
swagger_schema k, v
end
swagger_schema 'scCreate' do
example VetsJsonSchema::EXAMPLES.fetch('SC-CREATE-REQUEST-BODY-FOR-VA-GOV')
end
VetsJsonSchema::SCHEMAS.fetch('SC-SHOW-RESPONSE-200_V2')['definitions'].each do |key, value|
swagger_schema(key == 'root' ? 'scShowRoot' : key, value) {}
end
swagger_schema 'scShowRoot' do
example VetsJsonSchema::EXAMPLES.fetch('SC-SHOW-RESPONSE-200_V2')
end
swagger_schema 'scContestableIssues' do
example VetsJsonSchema::EXAMPLES.fetch('DECISION-REVIEW-GET-CONTESTABLE-ISSUES-RESPONSE-200_V1')
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/appeals/requests.rb
|
# frozen_string_literal: true
module Swagger
module V1
module Schemas
module Appeals
class Requests
include Swagger::Blocks
swagger_schema :Appeals do
key :type, :object
key :required, %i[data]
property :data, type: :array do
items type: :object do
end
end
end
swagger_schema :AppealsErrors do
key :type, :object
items do
key :type, :object
property :title, type: :string
property :detail, type: :string
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/appeals/notice_of_disagreement.rb
|
# frozen_string_literal: true
require 'decision_review/schemas'
module Swagger
module V1
module Schemas
module Appeals
class NoticeOfDisagreement
include Swagger::Blocks
VetsJsonSchema::SCHEMAS.fetch('NOD-CREATE-REQUEST-BODY_V1')['definitions'].each do |k, v|
if k == 'nodCreate'
# remove draft-07 specific schema items, they won't validate with swagger
attrs = v['properties']['data']['properties']['attributes']
attrs['properties']['veteran']['properties']['timezone'].delete('$comment')
attrs['properties']['veteran'].delete('if')
attrs['properties']['veteran'].delete('then')
attrs.delete('if')
attrs.delete('then')
end
swagger_schema k, v
end
swagger_schema 'nodCreate' do
example VetsJsonSchema::EXAMPLES.fetch('NOD-CREATE-REQUEST-BODY_V1')
end
VetsJsonSchema::SCHEMAS.fetch('NOD-SHOW-RESPONSE-200_V2')['definitions'].each do |key, value|
swagger_schema(key == 'root' ? 'nodShowRoot' : key, value) {}
end
swagger_schema 'nodShowRoot' do
example VetsJsonSchema::EXAMPLES.fetch('NOD-SHOW-RESPONSE-200_V2')
end
swagger_schema 'nodContestableIssues' do
example VetsJsonSchema::EXAMPLES.fetch('DECISION-REVIEW-GET-CONTESTABLE-ISSUES-RESPONSE-200_V1')
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/appeals/higher_level_review.rb
|
# frozen_string_literal: true
module Swagger
module V1
module Schemas
module Appeals
class HigherLevelReview
include Swagger::Blocks
VetsJsonSchema::SCHEMAS.fetch('HLR-CREATE-REQUEST-BODY_V1')['definitions'].each do |k, v|
v.delete('$comment')
if k == 'hlrCreateDataAttributes'
v['oneOf'][1].delete('$comment')
schema = { description: v['description'] }.merge v['oneOf'][1]
swagger_schema 'hlrCreateDataAttributes', schema
next
end
if k == 'hlrCreateVeteran'
v['properties']['timezone'].delete('$comment')
swagger_schema 'hlrCreateVeteran', v
next
end
if k == 'hlrCreate'
# remove draft-07 specific schema items, they won't validate with swagger
attrs = v['properties']['data']['properties']['attributes']
attrs['properties']['veteran']['properties']['timezone'].delete('$comment')
attrs['properties']['veteran'].delete('if')
attrs['properties']['veteran'].delete('then')
attrs.delete('if')
attrs.delete('then')
end
swagger_schema k, v
end
swagger_schema 'hlrCreate' do
example VetsJsonSchema::EXAMPLES.fetch 'HLR-CREATE-REQUEST-BODY_V1'
end
VetsJsonSchema::SCHEMAS.fetch('HLR-SHOW-RESPONSE-200_V2')['definitions'].each do |key, value|
value.delete('$comment')
swagger_schema(key == 'root' ? 'hlrShowRoot' : key, value) {}
end
swagger_schema 'hlrShowRoot' do
example VetsJsonSchema::EXAMPLES.fetch 'HLR-SHOW-RESPONSE-200_V2'
end
# recursive
def self.remove_null_from_type_array(value)
case value
when Hash
value.reduce({}) do |new_hash, (k, v)|
next new_hash.merge(k => x_from_nullable_x_type(v)) if k == 'type' && type_is_nullable?(v)
new_hash.merge(k => remove_null_from_type_array(v))
end
when Array
value.map { |v| remove_null_from_type_array(v) }
else
value
end
end
def self.x_from_nullable_x_type(type_array)
nulls_index = type_array.index('null')
types_index = nulls_index.zero? ? 1 : 0
type_array[types_index]
end
def self.type_is_nullable?(type)
type.is_a?(Array) && type.length == 2 && type.include?('null')
end
swagger_schema(
'hlrContestableIssues',
remove_null_from_type_array(
VetsJsonSchema::SCHEMAS.fetch('DECISION-REVIEW-GET-CONTESTABLE-ISSUES-RESPONSE-200_V1')
).merge(
description: 'Fields may either be null or the type specified',
# eventually there should be a generic contestable issues response
example: VetsJsonSchema::EXAMPLES.fetch('DECISION-REVIEW-GET-CONTESTABLE-ISSUES-RESPONSE-200_V1')
).except('$schema')
)
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas
|
code_files/vets-api-private/app/swagger/swagger/v1/schemas/appeals/decision_review_evidence.rb
|
# frozen_string_literal: true
module Swagger
module V1
module Schemas
module Appeals
class DecisionReviewEvidence
include Swagger::Blocks
swagger_schema :DecisionReviewEvidence do
property :data, type: :object do
property :attributes, type: :object do
key :required, %i[guid]
property :guid, type: :string, example: '3c05b2f0-0715-4298-965d-f733465ed80a'
end
property :id, type: :string, example: '11'
property :type, type: :string, example: 'decision_review_evidence_attachment'
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/income_limits.rb
|
# frozen_string_literal: true
class Swagger::V1::Requests::IncomeLimits
include Swagger::Blocks
swagger_path '/income_limits/v1/limitsByZipCode/{zip}/{year}/{dependents}' do
operation :get do
key :description, 'Gets the income limits'
key :operationId, 'getlimitsByZipCode'
key :tags, %w[income_limits]
parameter do
key :name, :zip
key :in, :path
key :description, 'Zip Code'
key :minLength, 5
key :maxLength, 5
key :required, true
key :type, :integer
key :format, :int64
end
parameter do
key :name, :year
key :in, :path
key :description, 'Year'
key :minimum, 1970
key :maximum, 2999
key :required, true
key :type, :integer
key :format, :int64
end
parameter do
key :name, :dependents
key :in, :path
key :description, 'Dependents'
key :required, true
key :type, :integer
key :format, :int64
end
response 200 do
key :description, 'response'
schema do
key :$ref, :IncomeLimitThresholds
end
end
response 422 do
key :description, 'unprocessable_entity'
end
end
end
swagger_path '/income_limits/v1/validateZipCode/{zip}' do
operation :get do
key :description, 'Validate Zip Code'
key :operationId, 'getIncomeLimits'
key :tags, %w[income_limits]
parameter do
key :name, :zip
key :in, :path
key :description, 'Zip Code'
key :minLength, 5
key :maxLength, 5
key :required, true
key :type, :integer
key :format, :int64
end
response 200 do
key :description, 'response'
schema do
key :$ref, :ZipCodeIsValid
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/post911_gi_bill_statuses.rb
|
# frozen_string_literal: true
class Swagger::V1::Requests::Post911GIBillStatuses
include Swagger::Blocks
swagger_path '/v1/post911_gi_bill_status' do
operation :get do
extend Swagger::Responses::AuthenticationError
key :description, 'Get the Post 911 GI Bill Status for a Veteran'
key :operationId, 'getPost911GiBillStatus'
key :tags, ['benefits_status']
parameter :authorization
response 200 do
key :description, 'Response is OK'
schema do
key :$ref, :Post911GiBillStatus
end
end
response 404 do
key :description, 'Veteran Gi Bill Status not found in Lighthouse'
schema do
key :$ref, :Errors
end
end
response 503 do
key :description, 'The backend GI Bill Status service is unavailable'
header 'Retry-After' do
key :type, :string
key :format, 'date'
end
schema do
key :$ref, :Errors
end
end
end
end
swagger_schema :Post911GiBillStatus do
key :required, %i[data]
property :data, description: 'The response from the Lighthouse service to vets-api', type: :object do
property :id, type: :string
property :type, type: :string, example: 'lighthouse_gi_bill_status_gi_bill_status_responses'
property :attributes, type: :object do
property :first_name, type: :string, example: 'Abraham'
property :last_name, type: :string, example: 'Lincoln'
property :name_suffix, type: %i[string null], example: 'Jr'
property :date_of_birth, type: %i[string null], example: '1955-11-12T06:00:00.000+0000'
property :va_file_number, type: %i[string null], example: '123456789'
property :regional_processing_office, type: %i[string null], example: 'Central Office Washington, DC'
property :eligibility_date, type: %i[string null], example: '2004-10-01T04:00:00.000+0000'
property :delimiting_date, type: %i[string null], example: '2015-10-01T04:00:00.000+0000'
property :percentage_benefit, type: %i[integer null], example: 100
property :veteran_is_eligible, type: %i[boolean null], example: false
property :active_duty, type: %i[boolean null], example: false
property :original_entitlement, type: :object do
key :$ref, :Entitlement
end
property :used_entitlement, type: :object do
key :$ref, :Entitlement
end
property :remaining_entitlement, type: :object do
key :$ref, :Entitlement
end
property :enrollments do
key :type, :array
items do
key :$ref, :Enrollment
end
end
end
end
end
swagger_schema :Enrollment do
key :required, [:begin_date]
property :begin_date, type: :string, example: '2012-11-01T04:00:00.000+00:00'
property :end_date, type: %i[string null], example: '2012-12-01T05:00:00.000+00:00'
property :facility_code, type: %i[string null], example: '12345678'
property :facility_name, type: %i[string null], example: 'Purdue University'
property :participant_id, type: %i[integer null], example: 1234
property :training_type, type: %i[string null], example: 'UNDER_GRAD'
property :term_id, type: %i[string null], example: nil
property :hour_type, type: %i[string null], example: nil
property :full_time_hours, type: %i[integer null], example: 12
property :full_time_credit_hour_under_grad, type: %i[integer null], example: nil
property :vacation_day_count, type: %i[integer null], example: 0
property :on_campus_hours, type: %i[number null], format: :float, example: 12.0
property :online_hours, type: %i[number null], format: :float, example: 0.0
property :yellow_ribbon_amount, type: %i[number null], format: :float, example: 0.0
property :status, type: %i[string null], example: 'Approved'
property :amendments do
key :type, :array
items do
key :$ref, :Amendment
end
end
end
swagger_schema :Amendment do
key :required, [:type]
property :on_campus_hours, type: %i[number null], format: :float, example: 10.5
property :online_hours, type: %i[number null], format: :float, example: 3.5
property :yellow_ribbon_amount, type: %i[number null], format: :float, example: 5.25
property :type, type: %i[string null]
property :change_effective_date, type: %i[string null], example: '2012-12-01T05:00:00.000+00:00'
end
swagger_schema :Entitlement do
key :required, %i[days months]
property :days, type: :integer
property :months, type: :integer
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/ivc_champva_forms.rb
|
# frozen_string_literal: true
class Swagger::V1::Requests::IvcChampvaForms
include Swagger::Blocks
swagger_path '/ivc_champva/v1/forms/status_updates' do
operation :post do
extend Swagger::Responses::AuthenticationError
key :description, 'Updates an existing form'
key :operationId, 'Endpoint for updating an existing form'
key :tags, %w[ivc_champva_forms]
parameter :authorization
parameter do
key :name, :form_uuid
key :description, 'UUID of the form'
key :in, :body
key :required, true
schema do
key :type, :string
key :format, :uuid
key :example, '12345678-1234-5678-1234-567812345678'
end
end
parameter do
key :name, :file_names
key :description, 'List of file names associated with the form'
key :in, :body
key :required, true
schema do
key :type, :array
items do
key :type, :string
end
key :example,
['12345678-1234-5678-1234-567812345678_vha_10_10d.pdf',
'12345678-1234-5678-1234-567812345678_vha_10_10d2.pdf']
end
end
parameter do
key :name, :status
key :description, 'Status of the form processing'
key :in, :body
key :required, true
schema do
key :type, :string
key :enum, ['Processed', 'Not Processed']
key :example, 'Processed'
end
end
parameter do
key :name, :case_id
key :description, 'PEGA system identifier'
key :in, :body
key :required, true
schema do
key :type, :string
key :example, 'D-40350'
end
end
response 200 do
key :description, 'Response is OK'
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/medical_copays.rb
|
# frozen_string_literal: true
class Swagger::V1::Requests::MedicalCopays
include Swagger::Blocks
swagger_path '/v1/medical_copays' do
operation :get do
key :description, 'List of user medical copay statements (HCCC-backed)'
key :operationId, 'getMedicalCopays'
key :tags, %w[medical_copays]
parameter :authorization
parameter do
key :name, :count
key :in, :query
key :description, 'Number of Invoices to return per page'
key :required, false
key :type, :integer
key :format, :int32
key :default, 10
end
parameter do
key :name, :page
key :in, :query
key :description, 'Page number of Invoice results'
key :required, false
key :type, :integer
key :format, :int32
key :default, 1
key :minimum, 1
end
response 200 do
key :description, 'Successful copays lookup'
schema do
# JSON:API top-level data
property :data, type: :array do
items do
property :id, type: :string, example: '675-K3FD983'
property :type, type: :string, example: 'medical_copays'
property :attributes, type: :object do
property :url,
type: :string,
example: 'https://api.va.gov/v1/medical_copays/675-K3FD983'
property :facility,
type: :string,
example: 'TEST VAMC'
property :externalId,
type: :string,
example: '675-K3FD983'
property :latestBillingRef,
type: :string,
example: '4-6c9ZE23XQjkA9CC'
property :currentBalance,
type: :number,
format: :float,
example: 284.59
property :previousBalance,
type: :number,
format: :float,
example: 76.19
property :previousUnpaidBalance,
type: :number,
format: :float,
example: 0.0
end
end
end
# Pagination links (built from Bundle#links)
property :links, type: :object do
property :self, type: :string, example: 'https://api.va.gov/v1/medical_copays?count=10&page=1'
property :first, type: :string, example: 'https://api.va.gov/v1/medical_copays?count=10&page=1'
property :prev, type: :string, example: 'https://api.va.gov/v1/medical_copays?count=10&page=0'
property :next, type: :string, example: 'https://api.va.gov/v1/medical_copays?count=10&page=2'
property :last, type: :string, example: 'https://api.va.gov/v1/medical_copays?count=10&page=5'
end
# Pagination meta (built from Bundle#meta)
property :meta, type: :object do
property :total, type: :integer, example: 50
property :page, type: :integer, example: 1
property :per_page, type: :integer, example: 10
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/requests
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/gibct/version_public_exports.rb
|
# frozen_string_literal: true
module Swagger
module V1
module Requests
module Gibct
class VersionPublicExports
include Swagger::Blocks
swagger_path '/v1/gi/public_exports/{id}' do
operation :get do
key :description, 'Retrieves the latest institution data export file'
key :operationId, 'gibctVersionPublicExport'
key :tags, %w[gi_bill_institutions]
key :produces, ['text/plain']
parameter description: 'Version ID to fetch export for',
in: :path,
name: :id,
required: true,
type: :string
response 200 do
key :description, '200 passes the response from the upstream GIDS controller'
schema do
key :type, :file
end
end
response 404 do
key :description, 'Version ID not found'
schema '$ref': :Errors
end
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger/v1/requests
|
code_files/vets-api-private/app/swagger/swagger/v1/requests/appeals/appeals.rb
|
# frozen_string_literal: true
require 'decision_review/schemas'
class Swagger::V1::Requests::Appeals::Appeals
include Swagger::Blocks
swagger_path '/decision_reviews/v1/higher_level_reviews' do
operation :post do
key :tags, %w[higher_level_reviews]
key :summary, 'Creates a higher level review'
key :operationId, 'createHigherLevelReview'
description = 'Sends data to Lighthouse who Creates a filled-out HLR PDF and uploads it to Central Mail.' \
' NOTE: If `informalConference` is false, the fields `informalConferenceRep`' \
' and `informalConferenceTime` cannot be present.'
key :description, description
parameter do
key :name, :request
key :in, :body
key :required, true
schema '$ref': :hlrCreate
end
response 200 do
key :description, 'Submitted'
schema '$ref': :hlrShowRoot
end
response 422 do
key :description, 'Malformed request'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/higher_level_reviews/{uuid}' do
operation :get do
key :description, 'This endpoint returns the details of a specific Higher Level Review'
key :operationId, 'showHigherLevelReview'
key :tags, %w[higher_level_reviews]
parameter do
key :name, :uuid
key :in, :path
key :description, 'UUID of a higher level review'
key :required, true
key :type, :string
key :format, :uuid
key :pattern, '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
end
response 200 do
key :description, 'Central Mail status and original payload for Higher-Level Review'
schema '$ref': :hlrShowRoot
end
response 404 do
key :description, 'ID not found'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/higher_level_reviews/contestable_issues/{benefit_type}' do
operation :get do
description =
'For the logged-in veteran, returns a list of issues that could be contested in a Higher-Level Review ' \
'for the specified benefit type.'
key :description, description
key :operationId, 'getContestableIssues'
key :tags, %w[higher_level_reviews]
parameter do
key :name, :benefit_type
key :in, :path
key :required, true
key :type, :string
key :enum, VetsJsonSchema::SCHEMAS.fetch('HLR-GET-CONTESTABLE-ISSUES-REQUEST-BENEFIT-TYPE_V1')['enum']
end
response 200 do
key :description, 'Issues'
schema '$ref': :hlrContestableIssues
end
response 404 do
key :description, 'Veteran not found'
schema '$ref': :Errors
end
response 422 do
key :description, 'Malformed request'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/notice_of_disagreements' do
operation :post do
key :tags, %w[notice_of_disagreements]
key :summary, 'Creates a notice of disagreement'
key :operationId, 'createNoticeOfDisagreement'
description = 'Submits an appeal of type Notice of Disagreement, to be passed on to lighthouse. ' \
'This endpoint is effectively the same as submitting VA Form 10182 via mail or fax directly' \
' to the Board of Veterans’ Appeals.'
key :description, description
parameter do
key :name, :request
key :in, :body
key :required, true
schema '$ref': :nodCreate
end
response 200 do
key :description, 'Submitted'
schema '$ref': :nodShowRoot
end
response 422 do
key :description, 'Malformed request'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/notice_of_disagreements/{uuid}' do
operation :get do
key :description, 'This endpoint returns the details of a specific notice of disagreement'
key :operationId, 'showNoticeOfDisagreement'
key :tags, %w[notice_of_disagreements]
parameter do
key :name, :uuid
key :in, :path
key :description, 'UUID of a notice of disagreement'
key :required, true
key :type, :string
key :format, :uuid
key :pattern, '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
end
response 200 do
key :description, 'status and original payload for Notice of Disagreement'
schema '$ref': :nodShowRoot
end
response 404 do
key :description, 'ID not found'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/notice_of_disagreements/contestable_issues' do
operation :get do
description =
'For the logged-in veteran, returns a list of issues that could be contested in a Notice of Disagreement'
key :description, description
key :operationId, 'getContestableIssues'
key :tags, %w[notice_of_disagreements]
response 200 do
key :description, 'Issues'
schema '$ref': :nodContestableIssues
end
response 404 do
key :description, 'Veteran not found'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/supplemental_claims' do
operation :post do
key :tags, %w[supplemental_claims]
key :summary, 'Creates a supplemental claim'
key :operationId, 'createSupplementalClaim'
description = 'Submits an appeal of type Supplemental Claim. \
This endpoint is the same as submitting VA form 200995 via mail or fax \
directly to the Board of Veterans’ Appeals.'
key :description, description
parameter do
key :name, :request
key :in, :body
key :required, true
schema '$ref': :scCreate
end
response 200 do
key :description, 'Submitted'
schema '$ref': :scShowRoot
end
response 422 do
key :description, 'Malformed request'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/supplemental_claims/{uuid}' do
operation :get do
key :description, 'Returns all of the data associated with a specific \
Supplemental Claim.'
key :operationId, 'showSupplementalClaim'
key :tags, %w[supplemental_claims]
parameter do
key :name, :uuid
key :in, :path
key :description, 'UUID of a supplemental claim'
key :required, true
key :type, :string
key :format, :uuid
key :pattern, '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
end
response 200 do
key :description, 'status and original payload for Supplemental Claim'
schema '$ref': :scShowRoot
end
response 404 do
key :description, 'ID not found'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/supplemental_claims/contestable_issues/{benefit_type}' do
operation :get do
description =
'For the logged-in veteran, returns a list of issues that could be \
contested in a Supplemental Claim'
key :description, description
key :operationId, 'getContestableIssues'
key :tags, %w[supplemental_claims]
parameter do
key :name, :benefit_type
key :in, :path
key :required, true
key :type, :string
key :enum, VetsJsonSchema::SCHEMAS.fetch('SC-GET-CONTESTABLE-ISSUES-REQUEST-BENEFIT-TYPE_V1')['enum']
end
response 200 do
key :description, 'Issues'
schema '$ref': :scContestableIssues
end
response 404 do
key :description, 'Veteran not found'
schema '$ref': :Errors
end
end
end
swagger_path '/decision_reviews/v1/decision_review_evidence' do
operation :post do
extend Swagger::Responses::BadRequestError
key :description, 'Uploadfile containing supporting evidence for Notice of Disagreement or Supplemental Claims'
key :operationId, 'decisionReviewEvidence'
key :tags, %w[notice_of_disagreements supplemental_claims]
parameter do
key :name, :decision_review_evidence_attachment
key :in, :body
key :description, 'Object containing file name'
key :required, true
schema do
key :required, %i[file_data]
property :file_data, type: :string, example: 'filename.pdf'
end
end
response 200 do
key :description, 'Response is ok'
schema do
key :$ref, :DecisionReviewEvidence
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/forbidden_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module ForbiddenError
def self.extended(base)
base.response 403 do
key :description, 'Forbidden'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/authentication_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module AuthenticationError
def self.extended(base)
base.response 401 do
key :description, 'Not authorized'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/saved_form.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module SavedForm
def self.extended(base)
base.response 200 do
key :description, 'Form Submitted'
schema do
key :$ref, :SavedForm
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/bad_gateway_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module BadGatewayError
def self.extended(base)
base.response 502 do
key :description, 'Internal server error'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/unprocessable_entity_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module UnprocessableEntityError
def self.extended(base)
base.response 422 do
key :description, 'Unprocessable Entity'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/internal_server_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module InternalServerError
def self.extended(base)
base.response 500 do
key :description, 'Internal server error'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/record_not_found_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module RecordNotFoundError
def self.extended(base)
base.response 404 do
key :description, 'Record not found'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/bad_request_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module BadRequestError
def self.extended(base)
base.response 400 do
key :description, 'Bad Request'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/backend_service_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module BackendServiceError
def self.extended(base)
base.response 400 do
key :description, 'Backend service error'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/validation_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module ValidationError
def self.extended(base)
base.response 422 do
key :description, 'Failed model validation(s)'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/responses/service_unavailable_error.rb
|
# frozen_string_literal: true
module Swagger
module Responses
module ServiceUnavailableError
def self.extended(base)
base.response 503 do
key :description, 'Internal server error'
schema do
key :$ref, :Errors
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/dependents.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class Dependents
include Swagger::Blocks
swagger_schema :Dependents do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
property :persons do
items do
key :type, :object
key :$ref, :Persons
end
end
end
end
end
swagger_schema :Persons do
key :required, %i[award_indicator]
property :award_indicator, type: :string, example: 'N'
property :city_of_birth, type: :string, example: 'WASHINGTON'
property :current_relate_status, type: :string, example: nil
property :date_of_birth, type: :string, example: '01/01/2000'
property :date_of_death, type: :string, example: nil
property :death_reason, type: :string, example: nil
property :email_address, type: :string, example: 'Curt@email.com'
property :first_name, type: :string, example: 'CURT'
property :last_name, type: :string, example: 'WEBB-STER'
property :middle_name, type: :string, example: nil
property :proof_of_dependency, type: :string, example: 'Y'
property :ptcpnt_id, type: :string, example: '32354974'
property :related_to_vet, type: :string, example: 'N'
property :relationship, type: :string, example: 'Child'
property :ssn, type: :string, example: '500223351'
property :ssn_verify_status, type: :string, example: '1'
property :state_of_birth, type: :string, example: 'DC'
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/financial_status_reports.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class FinancialStatusReports
include Swagger::Blocks
swagger_schema :FullName, type: :object do
property :first, type: :string
property :middle, type: :string
property :last, type: :string
end
swagger_schema :Address, type: :object do
property :address_line_one, type: :string
property :address_line_two, type: :string
property :address_line_three, type: :string
property :city, type: :string
property :state_or_province, type: :string
property :zip_or_postal_code, type: :string
property :country_name, type: :string
end
swagger_schema :PersonalIdentification do
key :required, %i[ssn file_number fsr_reason]
property :ssn, type: :string
property :file_number, type: :string
property :fsr_reason, type: :string
end
swagger_schema :PersonalData do
property :veteran_full_name, type: :object do
key :$ref, :FullName
end
property :address, type: :object do
key :$ref, :Address
end
property :telephone_number, type: :string
property :email_address, type: :string
property :date_of_birth, type: :string
property :married, type: :boolean
property :spouse_full_name, type: :object do
key :$ref, :FullName
end
property :ages_of_other_dependents, type: :array do
items do
key :type, :string
end
end
property :employment_history, type: :array do
items do
property :veteran_or_spouse, type: :string
property :occupation_name, type: :string
property :from, type: :string
property :to, type: :string
property :present, type: :boolean
property :employer_name, type: :string
property :employer_address, type: :object do
key :$ref, :Address
end
end
end
end
swagger_schema :Income do
property :veteran_or_spouse, type: :string
property :monthly_gross_salary, type: :string
property :deductions, type: :object do
property :taxes, type: :string
property :retirement, type: :string
property :social_security, type: :string
property :other_deductions, type: :object do
property :name, type: :string
property :amount, type: :string
end
end
property :total_deductions, type: :string
property :net_take_home_pay, type: :string
property :other_income, type: :object do
property :name, type: :string
property :amount, type: :string
end
property :total_monthly_net_income, type: :string
end
swagger_schema :Expenses do
property :rent_or_mortgage, type: :string
property :food, type: :string
property :utilities, type: :string
property :other_living_expenses, type: :object do
property :name, type: :string
property :amount, type: :string
end
property :expenses_installment_contracts_and_other_debts, type: :string
property :total_monthly_expenses, type: :string
end
swagger_schema :DiscretionaryIncome do
property :net_monthly_income_less_expenses, type: :string
property :amount_can_be_paid_toward_debt, type: :string
end
swagger_schema :Assets do
property :cash_in_bank, type: :string
property :cash_on_hand, type: :string
property :automobiles, type: :array do
items do
property :make, type: :string
property :model, type: :string
property :year, type: :string
property :resale_value, type: :string
end
end
property :trailers_boats_campers, type: :string
property :us_savings_bonds, type: :string
property :stocks_and_other_bonds, type: :string
property :real_estate_owned, type: :string
property :other_assets, type: :array do
items do
property :name, type: :string
property :amount, type: :string
end
end
property :total_assets, type: :string
end
swagger_schema :InstallmentContractsAndOtherDebts do
property :creditor_name, type: :string
property :creditor_address, type: :object do
key :$ref, :Address
end
property :date_started, type: :string
property :purpose, type: :string
property :original_amount, type: :string
property :unpaid_balance, type: :string
property :amount_due_monthly, type: :string
property :amount_past_due, type: :string
end
swagger_schema :TotalOfInstallmentContractsAndOtherDebts do
property :original_amount, type: :string
property :unpaid_balance, type: :string
property :amount_due_monthly, type: :string
property :amount_past_due, type: :string
end
swagger_schema :AdditionalData do
property :bankruptcy, type: :object do
property :has_been_adjudicated_bankrupt, type: :boolean
property :date_discharged, type: :string
property :court_location, type: :string
property :docket_number, type: :string
end
property :additional_comments, type: :string
end
swagger_schema :FinancialStatusReport do
key :required, [:personal_identification]
property :personal_identification, type: :object do
key :$ref, :PersonalIdentification
end
property :personal_data, type: :object do
key :$ref, :PersonalData
end
property :income, type: :array do
items do
key :$ref, :Income
end
end
property :expenses, type: :object do
key :$ref, :Expenses
end
property :discretionary_income, type: :object do
key :$ref, :DiscretionaryIncome
end
property :assets, type: :object do
key :$ref, :Assets
end
property :installment_contracts_and_other_debts, type: :array do
items do
key :$ref, :InstallmentContractsAndOtherDebts
end
end
property :total_of_installment_contracts_and_other_debts, type: :object do
key :$ref, :TotalOfInstallmentContractsAndOtherDebts
end
property :additional_data do
key :$ref, :AdditionalData
end
property :selected_debts_and_copays, type: :array do
items do
property :debt_type, type: :string
property :deduction_code, type: :string
property :resolution_comment, type: :string
property :resolution_option, type: :string
property :station, type: :object do
property :facilit_y_num, type: :string
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/onsite_notifications.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class OnsiteNotifications
include Swagger::Blocks
swagger_schema :OnsiteNotification do
key :type, :object
property(:id, type: :string)
property(:type, type: :string)
property(:attributes) do
key :type, :object
property(:template_id, type: :string)
property(:va_profile_id, type: :string)
property(:dismissed, type: :boolean)
property(:created_at, type: :string)
property(:updated_at, type: :string)
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/saved_form.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class SavedForm
include Swagger::Blocks
swagger_schema :SavedForm do
key :required, [:data]
property :data, type: :object do
property :id, type: :string
property :type, type: :string
property :attributes, type: :object do
property :form, type: :string
property :submitted_at, type: :string
property :regional_office, type: :array
property :confirmation_number, type: :string
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/letter_beneficiary.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class LetterBeneficiary
include Swagger::Blocks
swagger_schema :LetterBeneficiary do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
key :required, %i[benefit_information military_service]
property :benefit_information, type: :object do
property :has_non_service_connected_pension, type: :boolean, example: true
property :has_service_connected_disabilities, type: :boolean, example: true
property :has_survivors_indemnity_compensation_award, type: :boolean, example: true
property :has_survivors_pension_award, type: :boolean, example: true
property :monthly_award_amount, type: :number, example: 123.5
property :service_connected_percentage, type: :integer, example: 2
property :award_effective_date, type: :string, example: true
property :has_adapted_housing, type: %i[boolean null], example: true
property :has_chapter35_eligibility, type: %i[boolean null], example: true
property :has_death_result_of_disability, type: %i[boolean null], example: true
property :has_individual_unemployability_granted, type: %i[boolean null], example: true
property :has_special_monthly_compensation, type: %i[boolean null], example: true
end
property :military_service do
items do
property :branch, type: :string, example: 'ARMY'
property :character_of_service, type: :string, enum:
%w[
HONORABLE
OTHER_THAN_HONORABLE
UNDER_HONORABLE_CONDITIONS
GENERAL
UNCHARACTERIZED
UNCHARACTERIZED_ENTRY_LEVEL
DISHONORABLE
], example: 'HONORABLE'
property :entered_date, type: :string, example: '1973-01-01T05:00:00.000+00:00'
property :released_date, type: :string, example: '1977-10-01T04:00:00.000+00:00'
end
end
end
property :id, type: :string, example: nil
property :type, type: :string, example: 'evss_letters_letter_beneficiary_response'
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/valid_va_file_number.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class ValidVAFileNumber
include Swagger::Blocks
swagger_schema :ValidVAFileNumber do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
property :valid_va_file_number, type: :boolean, example: true
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/maintenance_windows.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class MaintenanceWindows
include Swagger::Blocks
swagger_schema :MaintenanceWindows do
key :required, [:data]
property :data, type: :array do
items do
property :id, type: :string
property :type, type: :string
property :attributes, type: :object do
property :external_service, type: :string
property :start_time, type: :string, format: :date
property :end_time, type: :string, format: :date
property :description, type: :string
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/connected_applications.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class ConnectedApplications
include Swagger::Blocks
swagger_schema :ConnectedApplications do
key :required, [:data]
property :data, type: :array do
items do
property :id, type: :string
property :type, type: :string
property :attributes, type: :object do
property :title, type: :string
property :created, type: :string
property :logo, type: :string
property :privacy_url, type: :string
property :grants, type: :array do
items do
property :id, type: :string
property :title, type: :string
end
end
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/errors.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class Errors
include Swagger::Blocks
swagger_schema :Errors do
key :required, [:errors]
property :errors do
key :type, :array
items do
key :$ref, :Error
end
end
end
swagger_schema :Error do
key :required, %i[title detail code status]
property :title, type: :string, example: 'Bad Request', description: 'error class name'
property :detail, type: :string, example: 'Received a bad request response from the upstream server',
description: 'possibly some additional info, or just the class name again'
property :code, type: :string, example: 'EVSS400',
description: 'Sometiems just the http code again, sometimes something like "EVSS400", where" \
" the code can be found in config/locales/exceptions.en.yml'
property :source, type: %i[string object], example: 'EVSS::DisabilityCompensationForm::Service',
description: 'error source class'
property :status, type: :string, example: '400', description: 'http status code'
property :meta, type: :object, description: 'additional info, like a backtrace'
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/states.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class States
include Swagger::Blocks
swagger_schema :States do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
key :required, [:states]
property :states do
key :type, :array
items do
key :required, [:name]
property :name, type: :string, example: 'CA'
end
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/dependents_verifications.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class DependentsVerifications
include Swagger::Blocks
swagger_schema :DependentsVerifications do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :prompt_renewal, type: :boolean, example: true
property :dependency_verifications, type: :array, example: [
{
award_effective_date: '2016-06-01T00:00:00.000-05:00',
award_event_id: '185878',
award_type: 'CPL',
begin_award_event_id: '171629',
beneficiary_id: '13367440',
birthday_date: '1995-05-01T00:00:00.000-05:00',
decision_date: '2015-02-24T10:50:42.000-06:00',
decision_id: '125932',
dependency_decision_id: '53153',
dependency_decision_type: 'SCHATTT',
dependency_decision_type_description: 'School Attendance Terminates',
dependency_status_type: 'NAWDDEP',
dependency_status_type_description: 'Not an Award Dependent',
event_date: '2016-05-01T00:00:00.000-05:00',
first_name: 'JAMES',
full_name: 'JAMES E. SMITH',
last_name: 'SMITH',
middle_name: 'E',
modified_action: 'I',
modified_by: 'VHAISWWHITWT',
modified_date: '2015-02-24T10:50:41.000-06:00',
modified_location: '317',
modified_process: 'Awds/RBA-cp_dependdec_pkg.do_cre',
person_id: '600086386',
sort_date: '2015-02-24T10:50:42.000-06:00',
sort_order_number: '0',
veteran_id: '13367440',
veteran_indicator: 'N'
}
]
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/travel_pay.rb
|
# frozen_string_literal: true
module Swagger::Schemas
class TravelPay
include Swagger::Blocks
swagger_schema :TravelPayClaims do
key :required, [:data]
property :data, type: :array do
items do
key :$ref, :TravelPayClaimSummary
end
end
end
swagger_schema :TravelPayClaimSummary do
property :id, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :claimNumber, type: :string, example: 'TC1234123412341234'
property :claimStatus, type: :string, enum: [
'Pre approved for payment',
'Saved',
'In process',
'Pending',
'On hold',
'In manual review',
'Submitted for payment',
'Claim paid',
'Incomplete',
'Appeal',
'Denied',
'Closed with no payment',
'Claim submitted',
'Approved for payment',
'Approved for payment incomplete',
'Payment canceled',
'Partial payment',
'Fiscal rescinded',
'Unspecified'
], example: 'Claim paid'
property :appointmentDateTime, type: :string, example: '2024-06-13T13:57:07.291Z'
property :facilityName, type: :string, example: 'Cheyenne VA Medical Center'
property :createdOn, type: :string, example: '2024-06-13T13:57:07.291Z'
property :modifiedOn, type: :string, example: '2024-06-13T13:57:07.291Z'
end
swagger_schema :TravelPayClaimDetails do
property :id, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :claimNumber, type: :string, example: 'TC1234123412341234'
property :claimStatus, type: :string, enum: [
'Pre approved for payment',
'Saved',
'In process',
'Pending',
'On hold',
'In manual review',
'Submitted for payment',
'Claim paid',
'Incomplete',
'Appeal',
'Denied',
'Closed with no payment',
'Claim submitted',
'Approved for payment',
'Approved for payment incomplete',
'Payment canceled',
'Partial payment',
'Fiscal rescinded',
'Unspecified'
], example: 'Claim paid'
property :appointmentDate, type: :string, example: '2024-06-13T13:57:07.291Z'
property :claimName, type: :string, example: 'Claim created for NOLLE BARAKAT'
property :claimantFirstName, type: :string, example: 'Nolle'
property :claimantMiddleName, type: :string, example: 'Polite'
property :claimantLastName, type: :string, example: 'Varakat'
property :facilityName, type: :string, example: 'Cheyenne VA Medical Center'
property :totalCostRequested, type: :number, example: 20.00
property :reimbursementAmount, type: :number, example: 14.52
property :appointment, type: :object do
key :$ref, :TravelPayAppointment
end
property :expenses, type: :array do
items do
key :$ref, :TravelPayExpense
end
end
property :documents, type: :array do
items do
key :$ref, :TravelPayDocumentSummary
end
end
property :createdOn, type: :string, example: '2024-06-13T13:57:07.291Z'
property :modifiedOn, type: :string, example: '2024-06-13T13:57:07.291Z'
end
swagger_schema :TravelPayAppointment do
property :id, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :appointmentSource, type: :string, example: 'VISTA'
property :appointmentDateTime, type: :string, example: '2024-06-13T13:57:07.291Z'
property :appointmentName, type: :string, example: 'VistA - 983 CHY TEST CLINIC'
property :appointmentType, type: :string, example: 'EnvironmentalHealth'
property :facilityId, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :facilityName, type: :string, example: 'Cheyenne VA Medical Center'
property :serviceConnectedDisability, type: :number, example: 421750001 # rubocop:disable Style/NumericLiterals
property :currentStatus, type: :string, example: 'CHECKED OUT'
property :appointmentStatus, type: :string, example: 'Complete'
property :externalAppointmentId, type: :string, example: 'A;3250113.083;1414'
property :associatedClaimId, type: :string, example: 'TC1234123412341234'
property :associatedClaimNumber, type: :string, example: 'TC1234123412341234'
property :isCompleted, type: :boolean, example: true
property :createdOn, type: :string, example: '2024-06-13T13:57:07.291Z'
property :modifiedOn, type: :string, example: '2024-06-13T13:57:07.291Z'
end
swagger_schema :TravelPayExpense do
property :id, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :expenseType, type: :string, example: 'Mileage'
property :name, type: :string, example: 'My trip'
property :dateIncurred, type: :string, example: '2024-06-13T13:57:07.291Z'
property :description, type: :string, example: 'mileage-expense'
property :costRequested, type: :number, example: 20.00
property :costSubmitted, type: :number, example: 20.00
end
swagger_schema :TravelPayDocumentSummary do
property :documentId, type: :string, example: '33333333-5555-4444-bbbb-222222444444'
property :filename, type: :string, example: 'DecisionLetter.pdf'
property :mimetype, type: :string, example: 'application/pdf'
property :createdon, type: :string, example: '2024-06-13T13:57:07.291Z'
end
swagger_schema :TravelPayDocumentBinary do
property :data, type: :string, example: 'VGhpcyBpcyBhIHN0cmluZw=='
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/email.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class Email
include Swagger::Blocks
swagger_schema :Email do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
property :email, type: :string, example: 'john@example.com'
property :effective_at, type: :string, example: '2018-02-27T14:41:32.283Z'
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/payment_history.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class PaymentHistory
include Swagger::Blocks
swagger_schema :PaymentHistory do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
property :payments, type: :array, example: [
{
pay_check_dt: '2017-12-29T00:00:00.000-06:00',
pay_check_amount: '$3,261.10',
pay_check_type: 'Compensation & Pension - Recurring',
payment_method: 'Direct Deposit',
bank_name: 'NAVY FEDERAL CREDIT UNION',
account_number: '***4567'
}
]
property :return_payments, type: :array, example: [
{
returned_check_issue_dt: '2012-12-15T00:00:00.000-06:00',
returned_check_cancel_dt: '2013-01-01T00:00:00.000-06:00',
returned_check_amount: '$50.00',
returned_check_number: '12345678',
returned_check_type: 'CH31 VR&E',
return_reason: 'Other Reason'
}
]
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/forms.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class Forms
include Swagger::Blocks
swagger_schema :Forms do
key :required, [:data]
property :data, type: :array do
items do
property :id do
key :description, 'JSON API identifier'
key :type, :string
key :example, 'VA10192'
end
property :type do
key :description, 'JSON API type specification'
key :type, :string
key :example, 'va_form'
end
property :attributes do
property :form_name do
key :description, 'Name of the VA Form'
key :type, :string
key :example, 'VA10192'
end
property :url do
key :description, 'Web location of the form'
key :type, :string
key :example, 'https://www.va.gov/vaforms/va/pdf/VA10192.pdf'
end
property :title do
key :description, 'Title of the form as given by VA'
key :type, :string
key :example, 'Information for Pre-Complaint Processing'
end
property :last_revision_on do
key :description, 'The date the form was last updated'
key :type, :string
key :example, '2012-01-01'
key :format, 'date'
end
property :pages do
key :description, 'Number of pages contained in the form'
key :type, :integer
key :example, 3
end
property :sha256 do
key :description, 'A sha256 hash of the form contents'
key :type, :string
key :example, '5fe171299ece147e8b456961a38e17f1391026f26e9e170229317bc95d9827b7'
end
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/user_internal_services.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class UserInternalServices
include Swagger::Blocks
swagger_schema :UserInternalServices do
property :data, type: :object do
property :id, type: :string
property :type, type: :string
property :attributes, type: :object do
property :services, type: :array do
key :example, %w[gibs facilities hca edu-benefits evss-claims appeals-status user-profile id-card
identity-proofed vet360 rx messaging health-records mhv-accounts
form-save-in-progress form-prefill]
items do
key :type, :string
end
end
property :in_progress_forms do
key :type, :array
items do
property :form, type: :string
property :metadata, type: :object do
property :version, type: :integer
property :return_url, type: :string
property :expires_at, type: :integer
property :last_updated, type: :integer
end
property :last_updated, type: :integer
end
end
property :profile, type: :object do
property :email, type: :string
property :first_name, type: :string, example: 'Abigail'
property :middle_name, type: :string, example: 'Jane'
property :last_name, type: :string, example: 'Brown'
property :preferred_name, type: %i[string null], example: 'Abby'
property :birth_date, type: :string, example: '1900-01-01'
property :gender, type: :string, example: 'F'
property :zip,
type: %i[string null],
description: "The user's zip code from MPI"
property :multifactor,
type: :boolean,
example: true,
description: "ID.me boolean value if the signed-in 'wallet' has multifactor enabled"
property :last_signed_in, type: :string, example: '2019-10-02T13:55:54.261Z'
property :initial_sign_in, type: :string, example: '2019-10-02T13:55:54.261Z'
property :authn_context,
enum: ['dslogon', 'dslogon_loa3', 'dslogon_multifactor', 'myhealthevet', 'myhealthevet_loa3',
'myhealthevet_multifactor', LOA::IDME_LOA1_VETS, LOA::IDME_LOA3_VETS],
example: 'myhealthevet_loa3',
description: 'The login method of a user.
If a user logs in using a DS Logon Username and password and then goes through
identity verification with id.me their login type would be dslogon_loa3.
or if they logged in with dslogon and added multifactor authentication through
id.me their authn_context would be dslogon_multifactor'
property :sign_in, type: :object do
property :service_name,
type: :string,
enum: %w[mhv dslogon idme logingov],
example: 'mhv',
description: 'The name of the service that the user used for the beginning of the
authentication process (username + password)'
property :account_type,
enum: %w[Basic Premium 1 2 3],
example: 'Basic',
description: 'myhealthevet account_types: Basic, Premium. dslogon account account_types: 1-3'
property :ssoe,
type: :boolean,
description: 'true if the user was authenticated using SSOe'
property :transactionid,
type: :string,
example: 'E35imPCwyUBl/Eo4AhlCJfioOcQEWDdyjFXUJRBky1k=',
description: 'a unique id representing the authentication transaction with SSOe'
end
property :verified, type: :boolean, example: true
property :loa, type: :object do
property :current,
type: :integer,
format: :int32,
example: 3,
description: 'NIST level of assurance, either 1 or 3'
property :highest,
type: :integer,
format: :int32,
example: 3,
description: "level of assurance - During the login flow reference 'highest', otherwise, use
'current'"
end
end
property :onboarding, type: :object do
property :show,
type: :boolean,
description: 'Whether the client should display Veteran Onboarding information'
end
property :prefills_available do
key :type, :array
items do
key :type, :string
end
end
property :session, type: :object do
property :ssoe, type: :boolean
property :transactionid, type: %i[string null]
end
end
end
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/sign_in.rb
|
# frozen_string_literal: true
# rubocop:disable Layout/LineLength
module Swagger
module Schemas
class SignIn
include Swagger::Blocks
swagger_schema :CSPAuthFormResponse do
property :data, type: :string
key :example, "<form id=\"oauth-form\" action=\"https://idp.int.identitysandbox.gov/openid_connect/authorize\" accept-charset=\"UTF-8\" method=\"get\">\n" \
"<input type=\"hidden\" name=\"acr_values\" id=\"acr_values\" value=\"http://idmanagement.gov/ns/assurance/ial/2\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"client_id\" id=\"client_id\" value=\"urn:gov:gsa:openidconnect.profiles:sp:sso:va:dev_signin\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"nonce\" id=\"nonce\" value=\"11eb8f30f120e16ccdab1327bcf031f6\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"prompt\" id=\"prompt\" value=\"select_account\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"redirect_uri\" id=\"redirect_uri\" value=\"http://localhost:3000/sign_in/logingov/callback\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"response_type\" id=\"response_type\" value=\"code\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"scope\" id=\"scope\" value=\"profile email openid social_security_number\" autocomplete=\"off\" />\n" \
"<input type=\"hidden\" name=\"state\" id=\"state\" value=\"d940a929b7af6daa595707d0c99bec57\" autocomplete=\"off\" />\n" \
"<noscript>\n" \
"<div> <input type=”submit” value=”Continue”/> </div>\n" \
"</noscript>\n" \
"</form>\n" \
"<script nonce=\"**CSP_NONCE**\">\n" \
"(function() {\n" \
"document.getElementById(\"oauth-form\").submit();\n" \
"})();\n" \
"</script>\n"
end
swagger_schema :TokenResponse do
key :type, :object
property(:data) do
key :type, :object
property :access_token do
key :description, 'Access token, used to obtain user attributes - 5 minute expiration'
key :type, :string
key :example,
'eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ2YS5nb3Ygc2lnbiBpbiIsImF1ZCI6InZhbW9iaWxlIiwiY2xpZW50X2lkIjoidmFtb2JpbGUiLCJqdGkiOiJkYTllMzY5Ny0zNmYzLTRlZGMtODZmZC03YzQyNDJhMzFmZTIiLCJzdWIiOiJkOTM3NjIyMi1jMjk0LTQwZGEtODI5MC05NmNmNjExYWRmY2MiLCJleHAiOjE2NTI3MjE3OTYsImlhdCI6MTY1MjcyMTQ5Niwic2Vzc2lvbl9oYW5kbGUiOiJlNmM4NTc5ZC04MDQxLTQ4MzYtOWJmYS1mOTAwNzk2NDMzNjYiLCJyZWZyZXNoX3Rva2VuX2hhc2giOiI4YTE4ZTJjNDRjNzRiNTBlYThlY2YzZmQ4MmFjNmYwMGE5ZjNhOTJjOTI0ZjAzYzM4ZDVhOWU5YWJiOWZlMzdiIiwicGFyZW50X3JlZnJlc2hfdG9rZW5faGFzaCI6ImVlZjcxZDY1OWE5NDQ5YTA4ODE1MWM1NmFkMzgwZTA5ZThmYTQ2YTc2ODhmYWY0MmUwODNlY2UzYjUwYjVjZDgiLCJhbnRpX2NzcmZfdG9rZW4iOiI3YzhmMzYyZjQ1ODk0MzMzMTRkNmRjOGU2Mzc4ODAwZCIsImxhc3RfcmVnZW5lcmF0aW9uX3RpbWUiOjE2NTI3MjE0OTYsInZlcnNpb24iOiJWMCJ9.TMQ02cRwu6hUGI07r_wjsTbz7Z6FBQPyrSOn2tZaUL401Yd6SqzRhe4FM_LBSG6Qju7bEdbH-J5PcnWsNoLnptr27c62jxl2LOw_p-jOPJrqHK8wrTODhH6Pu58KTmklnGovBUniiyRYipu1eTehuoOc6zaZKq4IYsQOEWWWNTG_jL5_CxD2W7_bLmffxQ49UbwNfkQg3lAZcRBEbB8DYEf8ay3HEEWoeGY5LLLyUnzT9vuEtdJVttvGItQWTTC1k4_ZqNqKzpRabx3utSlv65ZAYZQqDYSV50KsI6CQj9iuBfWtz-JvhzrXvBa3CwJdPFWueaEZNZr5OyB1zFg5NQ'
end
property :refresh_token do
key :description, 'Refresh token, used to refresh a session and obtain new tokens - 30 minute expiration'
key :type, :string
key :example,
'v1:insecure+data+A6ZXlKMWMyVnlYM1YxYVdRaU9pSmtPVE0zTmpJeU1pMWpNamswTFRRd1pHRXRPREk1TUMwNU5tTm1OakV4WVdSbVkyTWlMQ0p6WlhOemFXOXVYMmhoYm1Sc1pTSTZJbVUyWXpnMU56bGtMVGd3TkRFdE5EZ3pOaTA1WW1aaExXWTVNREEzT1RZME16TTJOaUlzSW5CaGNtVnVkRjl5WldaeVpYTm9YM1J2YTJWdVgyaGhjMmdpT2lKbFpXWTNNV1EyTlRsaE9UUTBPV0V3T0RneE5URmpOVFpoWkRNNE1HVXdPV1U0Wm1FME5tRTNOamc0Wm1GbU5ESmxNRGd6WldObE0ySTFNR0kxWTJRNElpd2lZVzUwYVY5amMzSm1YM1J2YTJWdUlqb2lOMk00WmpNMk1tWTBOVGc1TkRNek16RTBaRFprWXpobE5qTTNPRGd3TUdRaUxDSnViMjVqWlNJNklqazNObUU0WVdOaE9UZG1NRFl5TjJVM1ltUm1ZamRpTW1NMFpUbGhOMlZpSWl3aWRtVnljMmx2YmlJNklsWXdJaXdpZG1Gc2FXUmhkR2x2Ymw5amIyNTBaWGgwSWpwdWRXeHNMQ0psY25KdmNuTWlPbnQ5ZlE9PQ==.976a8aca97f0627e7bdfb7b2c4e9a7eb.V0'
end
property :anti_csrf_token do
key :description,
'Anti CSRF token, used to match `refresh` calls with the `token` call that generated the refresh token used - currently disabled, this can be ignored'
key :type, :string
key :example, '7c8f362f4589433314d6dc8e6378800d'
end
end
end
swagger_schema :LogoutRedirectResponse do
key :type, :string
key :example, 'https://idp.int.identitysandbox.gov/openid_connect/logout?id_token_hint=eyJraWQiOiJmNWNlMTIzOWUzOWQzZGE4MzZmOTYzYmNjZDg1Zjg1ZDU3ZDQzMzVjZmRjNmExNzAzOWYyNzQzNjFhMThiMTNjIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIzMjNlZDlmYi05ZDQxLTQwNjQtYjgyYS03NjQ3YjgzNjRlZTIiLCJpc3MiOiJodHRwczovL2lkcC5pbnQuaWRlbnRpdHlzYW5kYm94Lmdvdi8iLCJlbWFpbCI6InZldHMuZ292LnVzZXIrMTUwQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJnaXZlbl9uYW1lIjoiV0lMTEFSRCIsImZhbWlseV9uYW1lIjoiUklMRVkiLCJiaXJ0aGRhdGUiOiIxOTU5LTAyLTI1Iiwic29jaWFsX3NlY3VyaXR5X251bWJlciI6Ijc5NjAxMzE0NSIsImFkZHJlc3MiOnsiZm9ybWF0dGVkIjoiMTIzIFRlc3QgU3RyZWV0XG5XYWxkb3JmLCBNRCAyMDYwMyIsInN0cmVldF9hZGRyZXNzIjoiMTIzIFRlc3QgU3RyZWV0IiwibG9jYWxpdHkiOiJXYWxkb3JmIiwicmVnaW9uIjoiTUQiLCJwb3N0YWxfY29kZSI6IjIwNjAzIn0sInZlcmlmaWVkX2F0IjoxNjM4NTUyMDI3LCJhY3IiOiJodHRwOi8vaWRtYW5hZ2VtZW50Lmdvdi9ucy9hc3N1cmFuY2UvaWFsLzIiLCJub25jZSI6IjdmYTMyOWJkYjE5ODBkM2YwNmEwOGI1ODI3ZWVlYTE0IiwiYXVkIjoiaHR0cHM6Ly9zcWEuZWF1dGgudmEuZ292L2lzYW0vc3BzL3NhbWwyMHNwL3NhbWwyMCIsImp0aSI6Il85NmJYb3JWN2tPTjdNU1VzRUIwLWciLCJhdF9oYXNoIjoibE14VnQtSGlrUzcwQVlHYWtUX3RaUSIsImNfaGFzaCI6IlcyTU9wNVc5OFVUdzZISDE4Y0FmR3ciLCJleHAiOjE2NjUwMDI0ODYsImlhdCI6MTY2NTAwMTU4NiwibmJmIjoxNjY1MDAxNTg2fQ.U8tRWJTUNksru-ZVXvxDHSrUJvcfWKl89n96gxH3wlDquGDkxk7_JOMm6yDtHPfcuO6ij8JqKgMAhYW31Di2OnRdecdbgxz0j883KFeOYCgitv2dkSqNmQOTMXlFK170cWEpXb_oUiEPTAWy9f06XlIhrtk_kIc69SnXVh0AOJXAixTIyYbp6eUy5tMkBsa84dyM8OcvbnRmarAKSP36w1SYCLp0nX6jIXggyOvJL3FnX4UOA-w5MswboQcfGhOvAS3mYoJuoAogy1k7ybxAC04HqfqKgcbJ7TE-4xtdXAZ0qCSnEh7klqMhTJQ2iDAUdEaS_lK2dF8IR0KKGHCulA&post_logout_redirect_uri=http%3A%2F%2Flocalhost%3A3001&state=746e60841b6d736137dc190ac64b417a'
end
swagger_schema :UserAttributesResponse do
key :type, :object
property(:data) do
key :type, :object
property :id, type: :string, example: ''
property :type, type: :string, example: 'users'
property(:attributes) do
key :type, :object
property :uuid, type: :string, example: 'd9376222-c294-40da-8290-96cf611adfcc'
property :first_name, type: :string, example: 'ALFREDO'
property :middle_name, type: :string, example: 'MATTHEW'
property :last_name, type: :string, example: 'ARMSTRONG'
property :birth_date, type: :string, example: '1989-11-11'
property :email, type: :string, example: 'vets.gov.user+4@gmail.com'
property :gender, type: :string, example: 'M'
property :ssn, type: :string, example: '111111111'
property :birls_id, type: :string, example: '796121200'
property :authn_context, type: :string, example: 'logingov'
property :icn, type: :string, example: '1012846043V576341'
property :edipi, type: :string, example: '001001999'
property :active_mhv_ids, type: :array, example: %w[12345 67890]
property :sec_id, type: :string, example: '1013173963'
property :vet360_id, type: :string, example: '18277'
property :participant_id, type: :string, example: '13014883'
property :cerner_id, type: :string, example: '9923454432'
property :cerner_facility_ids, type: :array, example: %w[200MHV]
property :vha_facility_ids, type: :array, example: %w[200ESR 648]
property :id_theft_flag, type: :boolean, example: false
property :verified, type: :boolean, example: true
property :access_token_ttl, type: :integer, example: 300
end
end
end
end
end
end
# rubocop:enable Layout/LineLength
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/benefits_claims.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class BenefitsClaims
include Swagger::Blocks
swagger_schema :FailedEvidenceSubmission do
property :acknowledgement_date, type: %i[string null]
property :claim_id, type: :integer
property :created_at, type: :string
property :delete_date, type: %i[string null]
property :document_type, type: :string
property :failed_date, type: :string
property :file_name, type: :string
property :id, type: :integer
property :lighthouse_upload, type: :boolean
property :tracked_item_id, type: %i[integer null]
property :tracked_item_display_name, type: %i[string null]
property :upload_status, type: :string
property :va_notify_status, type: %i[string null]
end
end
end
end
|
0
|
code_files/vets-api-private/app/swagger/swagger
|
code_files/vets-api-private/app/swagger/swagger/schemas/phone_number.rb
|
# frozen_string_literal: true
module Swagger
module Schemas
class PhoneNumber
include Swagger::Blocks
swagger_schema :PhoneNumber do
key :required, [:data]
property :data, type: :object do
key :required, [:attributes]
property :attributes, type: :object do
property :number, type: :string, example: '4445551212'
property :extension, type: :string, example: '101'
property :country_code, type: :string, example: '1'
property :effective_date, type: :string, example: '2018-03-26T15:41:37.487Z'
end
end
end
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.