Class: HCA::BaseSubmissionJob
- Inherits:
-
Object
- Object
- HCA::BaseSubmissionJob
show all
- Includes:
- Sidekiq::Job
- Defined in:
- app/sidekiq/hca/base_submission_job.rb
Constant Summary
collapse
- VALIDATION_ERROR =
HCA::SOAPParser::ValidationError
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
11
12
13
|
# File 'app/sidekiq/hca/base_submission_job.rb', line 11
def self.decrypt_form(encrypted_form)
JSON.parse(HealthCareApplication::LOCKBOX.decrypt(encrypted_form))
end
|
Instance Method Details
#handle_enrollment_system_validation_error(form, google_analytics_client_id) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/sidekiq/hca/base_submission_job.rb', line 40
def handle_enrollment_system_validation_error(form, google_analytics_client_id)
StatsD.increment("#{HCA::Service::STATSD_KEY_PREFIX}.enrollment_system_validation_error")
PersonalInformationLog.create!(
data: { form: },
error_class: VALIDATION_ERROR.to_s
)
@health_care_application.update!(
state: 'failed',
form: form.to_json,
google_analytics_client_id:
)
end
|
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/sidekiq/hca/base_submission_job.rb', line 26
def perform(user_identifier, encrypted_form, health_care_application_id, google_analytics_client_id)
@health_care_application = HealthCareApplication.find(health_care_application_id)
form = self.class.decrypt_form(encrypted_form)
result = submit(user_identifier, form, google_analytics_client_id)
return unless result
Rails.logger.info "SubmissionID=#{result[:formSubmissionId]}"
@health_care_application.set_result_on_success!(result)
end
|
#submit(user_identifier, form, google_analytics_client_id) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'app/sidekiq/hca/base_submission_job.rb', line 15
def submit(user_identifier, form, google_analytics_client_id)
begin
result = HCA::Service.new(user_identifier).submit_form(form)
rescue VALIDATION_ERROR
handle_enrollment_system_validation_error(form, google_analytics_client_id)
return false
end
result
end
|