Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/models/in_person_enrollment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def minutes_since_last_status_update

def due_date
start_date = enrollment_established_at.presence || created_at
start_date + IdentityConfig.store.in_person_enrollment_validity_in_days.days
start_date + days_to_expire
end

def days_to_due_date
Expand All @@ -157,6 +157,14 @@ def enhanced_ipp?

private

def days_to_expire
if enhanced_ipp?
IdentityConfig.store.in_person_eipp_enrollment_validity_in_days.days
else
IdentityConfig.store.in_person_enrollment_validity_in_days.days
end
end

def on_notification_sent_at_updated
change_will_be_saved = notification_sent_at_change_to_be_saved&.last.present?
if change_will_be_saved && notification_phone_configuration.present?
Expand Down
1 change: 1 addition & 0 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ idv_send_link_max_attempts: 5
idv_sp_required: false
in_person_completion_survey_url: 'https://login.gov'
in_person_doc_auth_button_enabled: true
in_person_eipp_enrollment_validity_in_days: 7
in_person_email_reminder_early_benchmark_in_days: 11
in_person_email_reminder_final_benchmark_in_days: 1
in_person_email_reminder_late_benchmark_in_days: 4
Expand Down
1 change: 1 addition & 0 deletions lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def self.store
config.add(:idv_sp_required, type: :boolean)
config.add(:in_person_completion_survey_url, type: :string)
config.add(:in_person_doc_auth_button_enabled, type: :boolean)
config.add(:in_person_eipp_enrollment_validity_in_days, type: :integer)
config.add(:in_person_email_reminder_early_benchmark_in_days, type: :integer)
config.add(:in_person_email_reminder_final_benchmark_in_days, type: :integer)
config.add(:in_person_email_reminder_late_benchmark_in_days, type: :integer)
Expand Down
20 changes: 20 additions & 0 deletions spec/models/in_person_enrollment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,26 @@
end
end
end

context 'eipp enrollment' do
let(:eipp_validity_in_days) { 7 }
before do
allow(IdentityConfig.store).
to(
receive(:in_person_eipp_enrollment_validity_in_days).
and_return(eipp_validity_in_days),
)
end
it 'days_to_due_date returns the number of days left until the due date' do
freeze_time do
enrollment = create(
:in_person_enrollment, :enhanced_ipp,
enrollment_established_at: (eipp_validity_in_days - 2).days.ago
)
expect(enrollment.days_to_due_date).to eq(2)
end
end
end
end

describe 'eligible_for_notification?' do
Expand Down