bump minimum age to 13 (#9)

This commit is contained in:
SrIzan10 2025-09-13 01:07:13 +01:00 committed by GitHub
parent 6cc5bb6163
commit 98183c1937
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 15 deletions

View file

@ -23,8 +23,8 @@ class VerificationMailer < ApplicationMailer
reason_line = @verification.try(:rejection_reason_name)&.downcase || @verification.rejection_reason.humanize.downcase
reason_line += " (#{@verification.rejection_reason_details})" if @verification.rejection_reason_details.present?
if @verification.rejection_reason == "under_11"
reason_line += ". You can resubmit your application once you turn 11 years old"
if @verification.rejection_reason == "under_13"
reason_line += ". You can resubmit your application once you turn 13 years old"
end
@datavariables = {

View file

@ -259,7 +259,7 @@ class Identity < ApplicationRecord
needs_resubmission?
end
def under_11? = age <= 11
def under_13? = age <= 13
def age = (Date.today - birthday).days.in_years

View file

@ -111,7 +111,7 @@ class Verification::AadhaarVerification < Verification
# Retry-able issues
invalid_format: "invalid_format",
service_unavailable: "service_unavailable",
under_11: "under_11",
under_13: "under_13",
other: "other",
# Fatal issues
info_mismatch: "info_mismatch",
@ -119,7 +119,7 @@ class Verification::AadhaarVerification < Verification
}
# Define retry-able vs fatal rejection reasons
RETRYABLE_REJECTION_REASONS = %w[invalid_format service_unavailable under_11 other].freeze
RETRYABLE_REJECTION_REASONS = %w[invalid_format service_unavailable 13 other].freeze
FATAL_REJECTION_REASONS = %w[info_mismatch duplicate].freeze
# Friendly names for rejection reasons
@ -127,7 +127,7 @@ class Verification::AadhaarVerification < Verification
# Retry-able issues
"invalid_format" => "Invalid Aadhaar format",
"service_unavailable" => "Aadhaar verification service unavailable",
"under_11" => "Submitter is under 11 years old",
"under_13" => "Submitter is under 13 years old",
"other" => "Other fixable issue",
# Fatal issues
"info_mismatch" => "Aadhaar information doesn't match profile",

View file

@ -94,7 +94,7 @@ class Verification::DocumentVerification < Verification
not_readable: "not_readable",
wrong_type: "wrong_type",
expired: "expired",
under_11: "under_11",
under_13: "under_13",
other: "other",
# Fatal issues
info_mismatch: "info_mismatch",
@ -103,7 +103,7 @@ class Verification::DocumentVerification < Verification
}
# Define retry-able vs fatal rejection reasons
RETRYABLE_REJECTION_REASONS = %w[poor_quality not_readable wrong_type expired under_11 other].freeze
RETRYABLE_REJECTION_REASONS = %w[poor_quality not_readable wrong_type expired under_13 other].freeze
FATAL_REJECTION_REASONS = %w[info_mismatch altered duplicate].freeze
# Friendly names for rejection reasons
@ -113,7 +113,7 @@ class Verification::DocumentVerification < Verification
"not_readable" => "Document not readable",
"wrong_type" => "Wrong document type",
"expired" => "Expired document",
"under_11" => "Submitter is under 11 years old",
"under_13" => "Submitter is under 13 years old",
"other" => "Other fixable issue",
# Fatal issues
"info_mismatch" => "Information doesn't match profile",

View file

@ -95,16 +95,16 @@
<div>
<h3 style="color: #dc2626;">❌ Reject Document</h3>
<%= form_with url: reject_backend_verification_path(@verification), method: :patch, local: true do |form| %>
<% if @verification.identity.under_11? %>
<% if @verification.identity.under_13? %>
<div style="background: #fef3c7; border: 1px solid #f59e0b; padding: 1rem; border-radius: 4px; margin-bottom: 1rem;">
⚠️ <strong>Warning:</strong> The submitted identity is under 11 years old (age <%= @verification.identity.age.round(2) %>). Consider selecting "Submitter is under 11 years old" as the rejection reason.
⚠️ <strong>Warning:</strong> The submitted identity is under 13 years old (age <%= @verification.identity.age.round(2) %>). Consider selecting "Submitter is under 13 years old" as the rejection reason.
</div>
<% end %>
<%= form.label :rejection_reason, "Rejection Reason:" %>
<% if @verification.is_a?(Verification::AadhaarVerification) %>
<%
default_selection = if @verification.identity.under_11?
"under_11"
default_selection = if @verification.identity.under_13?
"under_13"
elsif @verification.identity.resemblances.any?
"duplicate"
else
@ -126,8 +126,8 @@
required: true, style: "width: 100%; margin-bottom: 1rem;" } %>
<% elsif @verification.is_a?(Verification::DocumentVerification) %>
<%
default_selection = if @verification.identity.under_11?
"under_11"
default_selection = if @verification.identity.under_13?
"under_13"
elsif @verification.identity.resemblances.any?
"duplicate"
else