Class: BGS::Form674
- Inherits:
-
Object
- Object
- BGS::Form674
- Includes:
- SentryLogging
- Defined in:
- lib/bgs/form674.rb
Instance Attribute Summary collapse
-
#saved_claim ⇒ Object
readonly
Returns the value of attribute saved_claim.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, saved_claim) ⇒ Form674
constructor
A new instance of Form674.
-
#submit(payload) ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Constructor Details
#initialize(user, saved_claim) ⇒ Form674
Returns a new instance of Form674.
19 20 21 22 23 24 |
# File 'lib/bgs/form674.rb', line 19 def initialize(user, saved_claim) @user = user @saved_claim = saved_claim @end_product_name = '130 - Automated School Attendance 674' @end_product_code = '130SCHATTEBN' end |
Instance Attribute Details
#saved_claim ⇒ Object (readonly)
Returns the value of attribute saved_claim.
17 18 19 |
# File 'lib/bgs/form674.rb', line 17 def saved_claim @saved_claim end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
17 18 19 |
# File 'lib/bgs/form674.rb', line 17 def user @user end |
Instance Method Details
#submit(payload) ⇒ Object
rubocop:disable Metrics/MethodLength
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/bgs/form674.rb', line 27 def submit(payload) proc_id = create_proc_id_and_form veteran = VnpVeteran.new(proc_id:, payload:, user:, claim_type: '130SCHATTEBN').create process_relationships(proc_id, veteran, payload) vnp_benefit_claim = VnpBenefitClaim.new(proc_id:, veteran:, user:) vnp_benefit_claim_record = vnp_benefit_claim.create set_claim_type('MANUAL_VAGOV') # we are TEMPORARILY always setting to MANUAL_VAGOV for 674 # temporary logging to troubleshoot ("#{proc_id} - #{@end_product_code}", :warn, '', { team: 'vfs-ebenefits' }) benefit_claim_record = BenefitClaim.new( args: { vnp_benefit_claim: vnp_benefit_claim_record, veteran:, user:, proc_id:, end_product_name: @end_product_name, end_product_code: @end_product_code } ).create begin vnp_benefit_claim.update(benefit_claim_record, vnp_benefit_claim_record) # we only want to add a note if the claim is being set to MANUAL_VAGOV # but for now we are temporarily always setting to MANUAL_VAGOV for 674 # when that changes, we need to surround this block of code in an IF statement note_text = 'Claim set to manual by VA.gov: This application needs manual review because a 674 was submitted.' bgs_service.create_note(benefit_claim_record[:benefit_claim_id], note_text) bgs_service.update_proc(proc_id, proc_state: 'MANUAL_VAGOV') rescue Rails.logger.warning('BGS::Form674.submit failed after creating benefit claim in BGS', { user_uuid: user.uuid, saved_claim_id: saved_claim.id, icn: user.icn, error: e. }) end end |