Class: Dscf::Core::FaydaVerificationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dscf/core/fayda_verifications_controller.rb

Instance Method Summary collapse

Methods included from Authorizable

#authorize, #authorize_action!, #policy_scope, #pundit_user

Methods included from JsonResponse

#render_error, #render_success, #serialize

Methods included from TokenAuthenticatable

#require_valid_refresh_token, #validate_device_consistency, #validate_token_expiry

Methods included from Authenticatable

#authenticate_user, #authenticate_user!, #current_user, #refresh_token, #sign_in, #sign_out

Instance Method Details

#verifyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/dscf/core/fayda_verifications_controller.rb', line 9

def verify
  skip_authorization

  fayda_number = params[:fayda_number].presence

  return render_error(errors: "fayda_number is required", status: :unprocessable_entity) unless fayda_number
  return render_error(errors: "Invalid fayda_number format", status: :unprocessable_entity) unless fayda_number.match?(/\A\d{12}\z/)

  render_success(
    data: {
      verified: true,
      fayda_number: fayda_number,
      full_name: "Mock Person",
      gender: "Male",
      date_of_birth: "1990-01-01",
      verification_date: Time.zone.now.iso8601
    }
  )
end