Class: FormProfiles::VA1990s

Inherits:
FormProfile
  • Object
show all
Defined in:
app/models/form_profiles/va_1990s.rb

Instance Method Summary collapse

Instance Method Details

#initialize_payment_informationObject (private)



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/models/form_profiles/va_1990s.rb', line 34

def initialize_payment_information
  return {} unless user.authorize(:ppiu, :access?) && user.authorize(:evss, :access?)

  service = EVSS::PPIU::Service.new(user)
  response = service.get_payment_information
   = response.responses.first&.

  if 
    VA1990s::FormPaymentAccountInformation.new(
      account_type: &.&.capitalize,
      account_number: &.,
      routing_number: &.financial_institution_routing_number,
      bank_name: &.financial_institution_name
    )
  else
    {}
  end
rescue => e
  Rails.logger.error "Failed to retrieve PPIU data: #{e.message}"
  {}
end

#mask(number) ⇒ Object (private)



56
57
58
# File 'app/models/form_profiles/va_1990s.rb', line 56

def mask(number)
  number.gsub(/.(?=.{4})/, '*')
end

#metadataObject



24
25
26
27
28
29
30
# File 'app/models/form_profiles/va_1990s.rb', line 24

def 
  {
    version: 0,
    prefill: true,
    returnUrl: '/apply'
  }
end

#prefillObject



19
20
21
22
# File 'app/models/form_profiles/va_1990s.rb', line 19

def prefill
  @payment_information = initialize_payment_information
  super
end