Class: BGS::Job
- Inherits:
-
Object
- Object
- BGS::Job
- Includes:
- Utilities::Helpers
- Defined in:
- app/sidekiq/bgs/job.rb
Direct Known Subclasses
Constant Summary collapse
- FILTERED_ERRORS =
[ 'insertBenefitClaim: Invalid zipcode.', 'Maximum number of EPs reached for this bnftClaimTypeCd', 'This update is being elevated for additional review due to an Incident Flash associated with this Beneficiary', 'ORA-20099: Error - File Number and Social Security number are different', 'ORA-00001: unique constraint', 'The length of the EXTERNAL_UID or EXTERNAL_KEY exceeds the maximum' ].freeze
Instance Method Summary collapse
- #in_progress_form_copy(in_progress_form) ⇒ Object
-
#normalize_names_and_addresses!(hash) ⇒ Object
BGS doesn’t accept name and address_line fields with non-ASCII characters (e.g. ü, ñ), and doesn’t accept names with apostrophes.
- #salvage_save_in_progress_form(form_id, user_uuid, copy) ⇒ Object
Methods included from Utilities::Helpers
#normalize_composite_characters, #remove_special_characters_from_name
Instance Method Details
#in_progress_form_copy(in_progress_form) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/sidekiq/bgs/job.rb', line 17 def in_progress_form_copy(in_progress_form) return nil if in_progress_form.blank? OpenStruct.new(meta_data: in_progress_form., form_data: in_progress_form.form_data, user_account: in_progress_form.user_account) end |
#normalize_names_and_addresses!(hash) ⇒ Object
BGS doesn’t accept name and address_line fields with non-ASCII characters (e.g. ü, ñ), and doesn’t accept names with apostrophes. This method recursively iterates through a given hash and strips unprocessable characters from name and address_line fields. The method is called in ‘SubmitForm686cJob` and `SubmitForm674Job` with an enormous form payload potentially containing many names and addresses. See `spec/factories/686c/form_686c_674.rb` for an example of such a payload.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/sidekiq/bgs/job.rb', line 38 def normalize_names_and_addresses!(hash) hash.each do |key, val| case val when Hash normalize_names_and_addresses!(val) when Array val.each { |v| normalize_names_and_addresses!(v) if v.is_a?(Hash) } else is_name_key = %w[first middle last].include?(key) if val && (is_name_key || key.include?('address_line')) val = normalize_composite_characters(val) val = remove_special_characters_from_name(val) if is_name_key hash[key] = val end end end end |
#salvage_save_in_progress_form(form_id, user_uuid, copy) ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/sidekiq/bgs/job.rb', line 25 def salvage_save_in_progress_form(form_id, user_uuid, copy) return if copy.blank? form = InProgressForm.where(form_id:, user_uuid:).first_or_initialize form.user_account = copy.user_account form.update(form_data: copy.form_data) end |