Class: BGS::BenefitClaim
- Inherits:
-
Object
- Object
- BGS::BenefitClaim
- Includes:
- Utilities::Helpers, SentryLogging
- Defined in:
- lib/bgs/benefit_claim.rb
Constant Summary collapse
- BENEFIT_CLAIM_PARAM_CONSTANTS =
{ benefit_claim_type: '1', payee: '00', disposition: 'M', section_unit_no: '555', folder_with_claim: 'N', pre_discharge_indicator: 'N' }.freeze
Instance Method Summary collapse
-
#benefit_claim_params ⇒ Object
private
rubocop:disable Metrics/MethodLength.
- #bgs_service ⇒ Object private
- #create ⇒ Object
- #handle_error(error, method) ⇒ Object private
-
#initialize(args:) ⇒ BenefitClaim
constructor
A new instance of BenefitClaim.
-
#normalize_name(name) ⇒ Object
private
rubocop:enable Metrics/MethodLength.
Methods included from Utilities::Helpers
#normalize_composite_characters, #remove_special_characters_from_name
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Constructor Details
#initialize(args:) ⇒ BenefitClaim
Returns a new instance of BenefitClaim.
19 20 21 22 23 24 25 26 |
# File 'lib/bgs/benefit_claim.rb', line 19 def initialize(args:) @vnp_benefit_claim = args[:vnp_benefit_claim] @veteran = args[:veteran] @user = args[:user] @proc_id = args[:proc_id] @end_product_name = args[:end_product_name] @end_product_code = args[:end_product_code] end |
Instance Method Details
#benefit_claim_params ⇒ Object (private)
rubocop:disable Metrics/MethodLength
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bgs/benefit_claim.rb', line 48 def benefit_claim_params { file_number: @veteran[:file_number], ssn: @user[:ssn], ptcpnt_id_claimant: @user[:participant_id], end_product: @veteran[:benefit_claim_type_end_product], first_name: normalize_name(@user[:first_name]), last_name: normalize_name(@user[:last_name]), address_line1: @veteran[:address_line_one], address_line2: @veteran[:address_line_two], address_line3: @veteran[:address_line_three], city: @veteran[:address_city], state: @veteran[:address_state_code], postal_code: @veteran[:address_zip_code], address_type: @veteran[:address_type], mlty_postal_type_cd: @veteran[:mlty_postal_type_cd], mlty_post_office_type_cd: @veteran[:mlty_post_office_type_cd], foreign_mail_code: @veteran[:foreign_mail_code], email_address: @veteran[:email_address], country: @veteran[:address_country], date_of_claim: Time.current.strftime('%m/%d/%Y'), end_product_name: @end_product_name, end_product_code: @end_product_code, soj: @veteran[:regional_office_number] }.merge(BENEFIT_CLAIM_PARAM_CONSTANTS) end |
#bgs_service ⇒ Object (private)
86 87 88 |
# File 'lib/bgs/benefit_claim.rb', line 86 def bgs_service @bgs_service ||= BGS::Service.new(@user) end |
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bgs/benefit_claim.rb', line 28 def create benefit_claim = bgs_service.insert_benefit_claim(benefit_claim_params) { benefit_claim_id: benefit_claim.dig(:benefit_claim_record, :benefit_claim_id), claim_type_code: benefit_claim.dig(:benefit_claim_record, :claim_type_code), participant_claimant_id: benefit_claim.dig(:benefit_claim_record, :participant_claimant_id), program_type_code: benefit_claim.dig(:benefit_claim_record, :program_type_code), service_type_code: benefit_claim.dig(:benefit_claim_record, :service_type_code), status_type_code: benefit_claim.dig(:benefit_claim_record, :status_type_code) } rescue => e # temporary logging to troubleshoot ("BACKUP-LOGGING: #{@proc_id} - #{e.}", :warn, '', { team: 'vfs-ebenefits' }) handle_error(e, __method__.to_s) end |
#handle_error(error, method) ⇒ Object (private)
80 81 82 83 84 |
# File 'lib/bgs/benefit_claim.rb', line 80 def handle_error(error, method) bgs_service.update_manual_proc(@proc_id) bgs_service.notify_of_service_exception(error, method) end |
#normalize_name(name) ⇒ Object (private)
rubocop:enable Metrics/MethodLength
76 77 78 |
# File 'lib/bgs/benefit_claim.rb', line 76 def normalize_name(name) remove_special_characters_from_name(normalize_composite_characters(name)) end |