bump minimum age to 13

This commit is contained in:
2025-09-13 00:04:39 +02:00
parent 6cc5bb6163
commit 4710ef504f
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.try(:rejection_reason_name)&.downcase || @verification.rejection_reason.humanize.downcase
reason_line += " (#{@verification.rejection_reason_details})" if @verification.rejection_reason_details.present? reason_line += " (#{@verification.rejection_reason_details})" if @verification.rejection_reason_details.present?
if @verification.rejection_reason == "under_11" if @verification.rejection_reason == "under_13"
reason_line += ". You can resubmit your application once you turn 11 years old" reason_line += ". You can resubmit your application once you turn 13 years old"
end end
@datavariables = { @datavariables = {

View File

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

View File

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

View File

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

View File

@@ -95,16 +95,16 @@
<div> <div>
<h3 style="color: #dc2626;">❌ Reject Document</h3> <h3 style="color: #dc2626;">❌ Reject Document</h3>
<%= form_with url: reject_backend_verification_path(@verification), method: :patch, local: true do |form| %> <%= 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;"> <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> </div>
<% end %> <% end %>
<%= form.label :rejection_reason, "Rejection Reason:" %> <%= form.label :rejection_reason, "Rejection Reason:" %>
<% if @verification.is_a?(Verification::AadhaarVerification) %> <% if @verification.is_a?(Verification::AadhaarVerification) %>
<% <%
default_selection = if @verification.identity.under_11? default_selection = if @verification.identity.under_13?
"under_11" "under_13"
elsif @verification.identity.resemblances.any? elsif @verification.identity.resemblances.any?
"duplicate" "duplicate"
else else
@@ -126,8 +126,8 @@
required: true, style: "width: 100%; margin-bottom: 1rem;" } %> required: true, style: "width: 100%; margin-bottom: 1rem;" } %>
<% elsif @verification.is_a?(Verification::DocumentVerification) %> <% elsif @verification.is_a?(Verification::DocumentVerification) %>
<% <%
default_selection = if @verification.identity.under_11? default_selection = if @verification.identity.under_13?
"under_11" "under_13"
elsif @verification.identity.resemblances.any? elsif @verification.identity.resemblances.any?
"duplicate" "duplicate"
else else