Class: Decidim::Verifications::IdDocuments::InformationForm

Inherits:
AuthorizationHandler show all
Defined in:
app/forms/decidim/verifications/id_documents/information_form.rb

Overview

A form object to be used as the base for identity document verification

Direct Known Subclasses

InformationRejectionForm, UploadForm

Constant Summary collapse

DOCUMENT_TYPES =
%w(DNI NIE passport).freeze

Instance Method Summary collapse

Methods inherited from AuthorizationHandler

#form_attributes, handler_for, handler_name, #metadata, #to_partial_path, #unique_id, #verification_attachment

Instance Method Details

#document_types_for_selectObject



39
40
41
42
43
44
45
46
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 39

def document_types_for_select
  DOCUMENT_TYPES.map do |type|
    [
      I18n.t(type.downcase, scope: "decidim.verifications.id_documents"),
      type
    ]
  end
end

#handler_nameObject



23
24
25
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 23

def handler_name
  "id_documents"
end

#map_model(model) ⇒ Object



27
28
29
30
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 27

def map_model(model)
  self.document_type = model.["document_type"]
  self.document_number = model.["document_number"]
end

#verification_metadataObject



32
33
34
35
36
37
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 32

def 
  {
    "document_type" => document_type,
    "document_number" => document_number
  }
end