Class: FormProfiles::VA21p530

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

Instance Method Summary collapse

Instance Method Details

#convert_to_iso2(country_code) ⇒ Object (private)



29
30
31
32
# File 'app/models/form_profiles/va_21p530.rb', line 29

def convert_to_iso2(country_code)
  code = IsoCountryCodes.find(country_code)
  code.alpha2
end

#metadataObject



6
7
8
9
10
11
12
# File 'app/models/form_profiles/va_21p530.rb', line 6

def 
  {
    version: 0,
    prefill: true,
    returnUrl: '/claimant-information'
  }
end

#prefillObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/form_profiles/va_21p530.rb', line 14

def prefill
  @identity_information = initialize_identity_information
  @contact_information = initialize_contact_information
  if @contact_information&.address&.country.present?
    @contact_information.address.country = convert_to_iso2(@contact_information.address.country)
  end
  mappings = self.class.mappings_for_form(form_id)

  form_data = generate_prefill(mappings) if FormProfile.prefill_enabled_forms.include?(form_id)

  { form_data:, metadata: }
end