diff --git a/app/controllers/concerns/verify_profile_concern.rb b/app/controllers/concerns/verify_profile_concern.rb index 4734d1421b1..fc159f1bf78 100644 --- a/app/controllers/concerns/verify_profile_concern.rb +++ b/app/controllers/concerns/verify_profile_concern.rb @@ -12,7 +12,7 @@ def account_or_verify_profile_url def account_or_verify_profile_route return 'idv' if session[:ial2_with_no_sp_campaign] && current_user.active_profile.blank? return 'account' unless profile_needs_verification? - return 'idv_usps' if usps_mail_bounced? + return 'idv_gpo' if gpo_mail_bounced? 'verify_account' end @@ -21,7 +21,7 @@ def profile_needs_verification? current_user.decorate.pending_profile_requires_verification? end - def usps_mail_bounced? - current_user.decorate.usps_mail_bounced? + def gpo_mail_bounced? + current_user.decorate.gpo_mail_bounced? end end diff --git a/app/controllers/idv/come_back_later_controller.rb b/app/controllers/idv/come_back_later_controller.rb index cc39266a9c4..993ca099f33 100644 --- a/app/controllers/idv/come_back_later_controller.rb +++ b/app/controllers/idv/come_back_later_controller.rb @@ -1,7 +1,7 @@ module Idv class ComeBackLaterController < ApplicationController before_action :confirm_two_factor_authenticated - before_action :confirm_user_needs_usps_confirmation + before_action :confirm_user_needs_gpo_confirmation def show analytics.track_event(Analytics::IDV_COME_BACK_LATER_VISIT) @@ -9,7 +9,7 @@ def show private - def confirm_user_needs_usps_confirmation + def confirm_user_needs_gpo_confirmation redirect_to account_url unless current_user.decorate.pending_profile_requires_verification? end end diff --git a/app/controllers/idv/confirmations_controller.rb b/app/controllers/idv/confirmations_controller.rb index 1165a55a58c..0c1d05443c5 100644 --- a/app/controllers/idv/confirmations_controller.rb +++ b/app/controllers/idv/confirmations_controller.rb @@ -27,7 +27,7 @@ def download def next_step if session[:sp] && !pending_profile? sign_up_completed_url - elsif pending_profile? && idv_session.address_verification_mechanism == 'usps' + elsif pending_profile? && %w[gpo usps].include?(idv_session.address_verification_mechanism) idv_come_back_later_url else after_sign_in_path_for(current_user) diff --git a/app/controllers/idv/doc_auth_controller.rb b/app/controllers/idv/doc_auth_controller.rb index c4a71aad335..679aae5344c 100644 --- a/app/controllers/idv/doc_auth_controller.rb +++ b/app/controllers/idv/doc_auth_controller.rb @@ -20,7 +20,7 @@ class DocAuthController < ApplicationController }.freeze def redirect_if_mail_bounced - redirect_to idv_usps_url if current_user.decorate.usps_mail_bounced? + redirect_to idv_gpo_url if current_user.decorate.gpo_mail_bounced? end def redirect_if_pending_profile diff --git a/app/controllers/idv/usps_controller.rb b/app/controllers/idv/gpo_controller.rb similarity index 80% rename from app/controllers/idv/usps_controller.rb rename to app/controllers/idv/gpo_controller.rb index 0ffdd7bf07b..5aa0b93b39b 100644 --- a/app/controllers/idv/usps_controller.rb +++ b/app/controllers/idv/gpo_controller.rb @@ -1,5 +1,5 @@ module Idv - class UspsController < ApplicationController + class GpoController < ApplicationController include IdvSession before_action :confirm_two_factor_authenticated @@ -9,11 +9,11 @@ class UspsController < ApplicationController before_action :max_attempts_reached, only: [:update] def index - @presenter = UspsPresenter.new(current_user, url_options) + @presenter = GpoPresenter.new(current_user, url_options) current_async_state = async_state if current_async_state.none? - analytics.track_event(Analytics::IDV_USPS_ADDRESS_VISITED) + analytics.track_event(Analytics::IDV_GPO_ADDRESS_VISITED) render :index elsif current_async_state.in_progress? render :wait @@ -27,7 +27,7 @@ def index def create update_tracking - idv_session.address_verification_mechanism = :usps + idv_session.address_verification_mechanism = :gpo if current_user.decorate.pending_profile_requires_verification? resend_letter @@ -40,23 +40,23 @@ def create def update result = idv_form.submit(profile_params) enqueue_job if result.success? - redirect_to idv_usps_path + redirect_to idv_gpo_path end - def usps_mail_service - @_usps_mail_service ||= Idv::UspsMail.new(current_user) + def gpo_mail_service + @_gpo_mail_service ||= Idv::GpoMail.new(current_user) end private def update_tracking - analytics.track_event(Analytics::IDV_USPS_ADDRESS_LETTER_REQUESTED) - create_user_event(:usps_mail_sent, current_user) + analytics.track_event(Analytics::IDV_GPO_ADDRESS_LETTER_REQUESTED) + create_user_event(:gpo_mail_sent, current_user) Db::ProofingComponent::Add.call(current_user.id, :address_check, 'gpo_letter') end def failure - redirect_to idv_usps_url unless performed? + redirect_to idv_gpo_url unless performed? end def pii(address_pii) @@ -83,7 +83,7 @@ def idv_session_settings(hash) { 'vendor_phone_confirmation': false, 'user_phone_confirmation': false, 'resolution_successful': 'phone', - 'address_verification_mechanism': 'usps', + 'address_verification_mechanism': 'gpo', 'profile_confirmation': true, 'params': hash, 'applicant': hash, @@ -92,7 +92,7 @@ def idv_session_settings(hash) def confirm_mail_not_spammed redirect_to idv_review_url if idv_session.address_mechanism_chosen? && - usps_mail_service.mail_spammed? + gpo_mail_service.mail_spammed? end def confirm_user_completed_idv_profile_step @@ -107,12 +107,12 @@ def confirm_user_completed_idv_profile_step def resend_letter confirmation_maker = confirmation_maker_perform send_reminder - return unless FeatureManagement.reveal_usps_code? - session[:last_usps_confirmation_code] = confirmation_maker.otp + return unless FeatureManagement.reveal_gpo_code? + session[:last_gpo_confirmation_code] = confirmation_maker.otp end def confirmation_maker_perform - confirmation_maker = UspsConfirmationMaker.new( + confirmation_maker = GpoConfirmationMaker.new( pii: Pii::Cacher.new(current_user, user_session).fetch, issuer: sp_session[:issuer], profile: current_user.decorate.pending_profile, @@ -155,7 +155,7 @@ def throttle_failure def flash_error flash[:error] = error_message - redirect_to idv_usps_url + redirect_to idv_gpo_url end def max_attempts_reached @@ -173,8 +173,8 @@ def send_reminder end def enqueue_job - return if idv_session.idv_usps_document_capture_session_uuid - idv_session.previous_usps_step_params = profile_params.to_h + return if idv_session.idv_gpo_document_capture_session_uuid + idv_session.previous_gpo_step_params = profile_params.to_h document_capture_session = DocumentCaptureSession.create( user_id: current_user.id, @@ -184,7 +184,7 @@ def enqueue_job ) document_capture_session.create_proofing_session - idv_session.idv_usps_document_capture_session_uuid = document_capture_session.uuid + idv_session.idv_gpo_document_capture_session_uuid = document_capture_session.uuid applicant = pii(profile_params.to_h) Idv::Agent.new(applicant).proof_resolution( document_capture_session, @@ -194,7 +194,7 @@ def enqueue_job end def async_state - dcs_uuid = idv_session.idv_usps_document_capture_session_uuid + dcs_uuid = idv_session.idv_gpo_document_capture_session_uuid dcs = DocumentCaptureSession.find_by(uuid: dcs_uuid) return ProofingSessionAsyncResult.none if dcs_uuid.nil? return timed_out if dcs.nil? @@ -215,18 +215,18 @@ def async_state_done(async_state) delete_async async_state_done_analytics(result) - applicant = pii(idv_session.previous_usps_step_params) + applicant = pii(idv_session.previous_gpo_step_params) result.success? ? resolution_success(applicant) : failure end def async_state_done_analytics(result) - analytics.track_event(Analytics::IDV_USPS_ADDRESS_SUBMITTED, result.to_h) + analytics.track_event(Analytics::IDV_GPO_ADDRESS_SUBMITTED, result.to_h) Db::SpCost::AddSpCost.call(sp_session[:issuer].to_s, 2, :lexis_nexis_resolution) Db::ProofingCost::AddUserProofingCost.call(current_user.id, :lexis_nexis_resolution) end def delete_async - idv_session.idv_usps_document_capture_session_uuid = nil + idv_session.idv_gpo_document_capture_session_uuid = nil end def timed_out diff --git a/app/controllers/idv/review_controller.rb b/app/controllers/idv/review_controller.rb index c11a48a07bd..87ef01dfc53 100644 --- a/app/controllers/idv/review_controller.rb +++ b/app/controllers/idv/review_controller.rb @@ -31,9 +31,9 @@ def new @applicant = idv_session.applicant analytics.track_event(Analytics::IDV_REVIEW_VISIT) - usps_mail_service = Idv::UspsMail.new(current_user) + gpo_mail_service = Idv::GpoMail.new(current_user) flash_now = flash.now - if usps_mail_service.mail_spammed? + if gpo_mail_service.mail_spammed? flash_now[:error] = t('idv.errors.mail_limit_reached') else flash_now[:success] = flash_message_content @@ -46,14 +46,15 @@ def create redirect_to idv_confirmations_url analytics.track_event(Analytics::IDV_REVIEW_COMPLETE) - return unless FeatureManagement.reveal_usps_code? - session[:last_usps_confirmation_code] = idv_session.usps_otp + return unless FeatureManagement.reveal_gpo_code? + session[:last_gpo_confirmation_code] = idv_session.gpo_otp end private def flash_message_content - if idv_session.address_verification_mechanism == 'usps' + # NOTE: remove usps after next deploy + if %w[gpo usps].include?(idv_session.address_verification_mechanism) t('idv.messages.mail_sent') else phone_of_record_msg = ActionController::Base.helpers.content_tag( diff --git a/app/controllers/recurring_job/usps_upload_controller.rb b/app/controllers/recurring_job/gpo_upload_controller.rb similarity index 58% rename from app/controllers/recurring_job/usps_upload_controller.rb rename to app/controllers/recurring_job/gpo_upload_controller.rb index 5e4cb169046..4dad20c529e 100644 --- a/app/controllers/recurring_job/usps_upload_controller.rb +++ b/app/controllers/recurring_job/gpo_upload_controller.rb @@ -1,8 +1,8 @@ module RecurringJob - class UspsUploadController < AuthTokenController + class GpoUploadController < AuthTokenController def create today = Time.zone.today - UspsConfirmationUploader.new.run unless CalendarService.weekend_or_holiday?(today) + GpoConfirmationUploader.new.run unless CalendarService.weekend_or_holiday?(today) render plain: 'ok' end diff --git a/app/controllers/users/verify_account_controller.rb b/app/controllers/users/verify_account_controller.rb index 552d116eec0..3d5e4e0d888 100644 --- a/app/controllers/users/verify_account_controller.rb +++ b/app/controllers/users/verify_account_controller.rb @@ -7,10 +7,10 @@ class VerifyAccountController < ApplicationController def index analytics.track_event(Analytics::ACCOUNT_VERIFICATION_VISITED) - usps_mail = Idv::UspsMail.new(current_user) - @mail_spammed = usps_mail.mail_spammed? + gpo_mail = Idv::GpoMail.new(current_user) + @mail_spammed = gpo_mail.mail_spammed? @verify_account_form = VerifyAccountForm.new(user: current_user) - @code = session[:last_usps_confirmation_code] if FeatureManagement.reveal_usps_code? + @code = session[:last_gpo_confirmation_code] if FeatureManagement.reveal_gpo_code? if Throttler::IsThrottled.call(current_user.id, :verify_gpo_key) render :throttled diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index c8b506b96a0..07d02698107 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -99,9 +99,9 @@ def identity_verified? user.active_profile.present? end - def usps_mail_bounced? + def gpo_mail_bounced? return unless pending_profile - pending_profile&.usps_confirmation_codes&.order(created_at: :desc)&.first&.bounced_at + pending_profile&.gpo_confirmation_codes&.order(created_at: :desc)&.first&.bounced_at end def active_profile_newer_than_pending_profile? diff --git a/app/forms/verify_account_form.rb b/app/forms/verify_account_form.rb index 2ff1d9de31a..9441b96797a 100644 --- a/app/forms/verify_account_form.rb +++ b/app/forms/verify_account_form.rb @@ -30,16 +30,16 @@ def pending_profile @_pending_profile ||= user.decorate.pending_profile end - def usps_confirmation_code + def gpo_confirmation_code return if otp.blank? || pending_profile.blank? - pending_profile.usps_confirmation_codes.first_with_otp(otp) + pending_profile.gpo_confirmation_codes.first_with_otp(otp) end def validate_otp_not_expired - return unless usps_confirmation_code.present? && usps_confirmation_code.expired? + return unless gpo_confirmation_code.present? && gpo_confirmation_code.expired? - errors.add :otp, :usps_otp_expired + errors.add :otp, :gpo_otp_expired end def validate_pending_profile @@ -52,7 +52,7 @@ def validate_otp end def valid_otp? - otp.present? && usps_confirmation_code.present? + otp.present? && gpo_confirmation_code.present? end def reset_sensitive_fields diff --git a/app/models/event.rb b/app/models/event.rb index 410a1f2e47b..3b7e9a05763 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -13,7 +13,7 @@ class Event < ApplicationRecord authenticator_enabled: 6, authenticator_disabled: 7, account_verified: 8, - usps_mail_sent: 9, + gpo_mail_sent: 9, piv_cac_enabled: 10, piv_cac_disabled: 11, new_personal_key: 12, diff --git a/app/models/usps_confirmation.rb b/app/models/gpo_confirmation.rb similarity index 87% rename from app/models/usps_confirmation.rb rename to app/models/gpo_confirmation.rb index 34f1b5914b8..d3567c49d03 100644 --- a/app/models/usps_confirmation.rb +++ b/app/models/gpo_confirmation.rb @@ -1,4 +1,6 @@ -class UspsConfirmation < ApplicationRecord +class GpoConfirmation < ApplicationRecord + self.table_name = 'usps_confirmations' + # Store the pii as encrypted json def entry=(entry_hash) self[:entry] = encryptor.encrypt(entry_hash.to_json) diff --git a/app/models/usps_confirmation_code.rb b/app/models/gpo_confirmation_code.rb similarity index 80% rename from app/models/usps_confirmation_code.rb rename to app/models/gpo_confirmation_code.rb index 98666b7cf21..aeb988c06d3 100644 --- a/app/models/usps_confirmation_code.rb +++ b/app/models/gpo_confirmation_code.rb @@ -1,11 +1,13 @@ -class UspsConfirmationCode < ApplicationRecord +class GpoConfirmationCode < ApplicationRecord + self.table_name = 'usps_confirmation_codes' + belongs_to :profile def self.first_with_otp(otp) - find do |usps_confirmation_code| + find do |gpo_confirmation_code| Pii::Fingerprinter.verify( Base32::Crockford.normalize(otp), - usps_confirmation_code.otp_fingerprint, + gpo_confirmation_code.otp_fingerprint, ) end end diff --git a/app/models/letter_requests_to_gpo_ftp_log.rb b/app/models/letter_requests_to_gpo_ftp_log.rb new file mode 100644 index 00000000000..f38ac4575e1 --- /dev/null +++ b/app/models/letter_requests_to_gpo_ftp_log.rb @@ -0,0 +1,6 @@ +class LetterRequestsToGpoFtpLog < ApplicationRecord + self.table_name = 'letter_requests_to_usps_ftp_logs' + + validates :ftp_at, presence: true + validates :letter_requests_count, presence: true +end diff --git a/app/models/letter_requests_to_usps_ftp_log.rb b/app/models/letter_requests_to_usps_ftp_log.rb deleted file mode 100644 index 17a163e0d74..00000000000 --- a/app/models/letter_requests_to_usps_ftp_log.rb +++ /dev/null @@ -1,4 +0,0 @@ -class LetterRequestsToUspsFtpLog < ApplicationRecord - validates :ftp_at, presence: true - validates :letter_requests_count, presence: true -end diff --git a/app/models/profile.rb b/app/models/profile.rb index fafae3ce494..63363733f81 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -2,7 +2,7 @@ class Profile < ApplicationRecord self.ignored_columns = %w[phone_confirmed] belongs_to :user - has_many :usps_confirmation_codes, dependent: :destroy + has_many :gpo_confirmation_codes, dependent: :destroy validates :active, uniqueness: { scope: :user_id, if: :active? } diff --git a/app/presenters/idv/usps_presenter.rb b/app/presenters/idv/gpo_presenter.rb similarity index 70% rename from app/presenters/idv/usps_presenter.rb rename to app/presenters/idv/gpo_presenter.rb index 8d7807adfd5..6c0e7fcf5fa 100644 --- a/app/presenters/idv/usps_presenter.rb +++ b/app/presenters/idv/gpo_presenter.rb @@ -1,5 +1,5 @@ module Idv - class UspsPresenter + class GpoPresenter include Rails.application.routes.url_helpers attr_reader :current_user @@ -14,10 +14,10 @@ def title end def byline - if usps_mail_bounced? - I18n.t('idv.messages.usps.new_address') + if gpo_mail_bounced? + I18n.t('idv.messages.gpo.new_address') else - I18n.t('idv.messages.usps.address_on_file') + I18n.t('idv.messages.gpo.address_on_file') end end @@ -29,8 +29,8 @@ def fallback_back_path user_needs_address_otp_verification? ? verify_account_path : idv_phone_path end - def usps_mail_bounced? - current_user.decorate.usps_mail_bounced? + def gpo_mail_bounced? + current_user.decorate.gpo_mail_bounced? end def url_options @@ -39,12 +39,12 @@ def url_options private - def usps_mail_service - @usps_mail_service ||= Idv::UspsMail.new(current_user) + def gpo_mail_service + @gpo_mail_service ||= Idv::GpoMail.new(current_user) end def letter_already_sent? - usps_mail_service.any_mail_sent? + gpo_mail_service.any_mail_sent? end def user_needs_address_otp_verification? diff --git a/app/services/analytics.rb b/app/services/analytics.rb index 151a60e1aa1..e2744fe78b5 100644 --- a/app/services/analytics.rb +++ b/app/services/analytics.rb @@ -127,9 +127,9 @@ def browser_attributes IDV_PHONE_RECORD_VISIT = 'IdV: phone of record visited'.freeze IDV_REVIEW_COMPLETE = 'IdV: review complete'.freeze IDV_REVIEW_VISIT = 'IdV: review info visited'.freeze - IDV_USPS_ADDRESS_LETTER_REQUESTED = 'IdV: USPS address letter requested'.freeze - IDV_USPS_ADDRESS_SUBMITTED = 'IdV: USPS address submitted'.freeze - IDV_USPS_ADDRESS_VISITED = 'IdV: USPS address visited'.freeze + IDV_GPO_ADDRESS_LETTER_REQUESTED = 'IdV: USPS address letter requested'.freeze + IDV_GPO_ADDRESS_SUBMITTED = 'IdV: USPS address submitted'.freeze + IDV_GPO_ADDRESS_VISITED = 'IdV: USPS address visited'.freeze IDV_VERIFICATION_ATTEMPT_CANCELLED = 'IdV: verification attempt cancelled'.freeze INVALID_AUTHENTICITY_TOKEN = 'Invalid Authenticity Token'.freeze IN_PERSON_PROOFING = 'In Person Proofing'.freeze # visited or submitted is appended diff --git a/app/services/db/usps_confirmation_code/letters_sent_and_verified_since.rb b/app/services/db/gpo_confirmation_code/letters_sent_and_verified_since.rb similarity index 95% rename from app/services/db/usps_confirmation_code/letters_sent_and_verified_since.rb rename to app/services/db/gpo_confirmation_code/letters_sent_and_verified_since.rb index 3c970ab82f4..24d7761fe12 100644 --- a/app/services/db/usps_confirmation_code/letters_sent_and_verified_since.rb +++ b/app/services/db/gpo_confirmation_code/letters_sent_and_verified_since.rb @@ -1,5 +1,5 @@ module Db - module UspsConfirmationCode + module GpoConfirmationCode class LettersSentAndVerifiedSince def self.call(start_date) params = { diff --git a/app/services/db/usps_confirmation_code/letters_sent_since.rb b/app/services/db/gpo_confirmation_code/letters_sent_since.rb similarity index 93% rename from app/services/db/usps_confirmation_code/letters_sent_since.rb rename to app/services/db/gpo_confirmation_code/letters_sent_since.rb index d092256f604..eb3ec21d43c 100644 --- a/app/services/db/usps_confirmation_code/letters_sent_since.rb +++ b/app/services/db/gpo_confirmation_code/letters_sent_since.rb @@ -1,5 +1,5 @@ module Db - module UspsConfirmationCode + module GpoConfirmationCode class LettersSentSince def self.call(start_date) params = { diff --git a/app/services/funnel/doc_auth/register_step_from_analytics_submit_event.rb b/app/services/funnel/doc_auth/register_step_from_analytics_submit_event.rb index 6dd088518d5..d67366690fe 100644 --- a/app/services/funnel/doc_auth/register_step_from_analytics_submit_event.rb +++ b/app/services/funnel/doc_auth/register_step_from_analytics_submit_event.rb @@ -2,7 +2,7 @@ module Funnel module DocAuth class RegisterStepFromAnalyticsSubmitEvent ANALYTICS_EVENT_TO_DOC_AUTH_LOG_TOKEN = { - Analytics::IDV_USPS_ADDRESS_LETTER_REQUESTED => :usps_letter_sent, + Analytics::IDV_GPO_ADDRESS_LETTER_REQUESTED => :usps_letter_sent, }.freeze def self.call(user_id, issuer, event, result) diff --git a/app/services/funnel/doc_auth/register_step_from_analytics_view_event.rb b/app/services/funnel/doc_auth/register_step_from_analytics_view_event.rb index c915ad35ae5..6fdb86017d3 100644 --- a/app/services/funnel/doc_auth/register_step_from_analytics_view_event.rb +++ b/app/services/funnel/doc_auth/register_step_from_analytics_view_event.rb @@ -5,7 +5,7 @@ class RegisterStepFromAnalyticsViewEvent Analytics::IDV_PHONE_RECORD_VISIT => :verify_phone, Analytics::IDV_REVIEW_VISIT => :encrypt, Analytics::IDV_FINAL => :verified, - Analytics::IDV_USPS_ADDRESS_VISITED => :usps_address, + Analytics::IDV_GPO_ADDRESS_VISITED => :usps_address, }.freeze def self.call(user_id, issuer, event, result) diff --git a/app/services/usps_confirmation_exporter.rb b/app/services/gpo_confirmation_exporter.rb similarity index 97% rename from app/services/usps_confirmation_exporter.rb rename to app/services/gpo_confirmation_exporter.rb index b6e54052d64..207df3d916c 100644 --- a/app/services/usps_confirmation_exporter.rb +++ b/app/services/gpo_confirmation_exporter.rb @@ -1,4 +1,4 @@ -class UspsConfirmationExporter +class GpoConfirmationExporter DELIMITER = '|'.freeze LINE_ENDING = "\r\n".freeze HEADER_ROW_ID = '01'.freeze diff --git a/app/services/usps_confirmation_maker.rb b/app/services/gpo_confirmation_maker.rb similarity index 91% rename from app/services/usps_confirmation_maker.rb rename to app/services/gpo_confirmation_maker.rb index cca30bb2f9d..57a42729d19 100644 --- a/app/services/usps_confirmation_maker.rb +++ b/app/services/gpo_confirmation_maker.rb @@ -1,4 +1,4 @@ -class UspsConfirmationMaker +class GpoConfirmationMaker def initialize(pii:, issuer:, profile: nil, profile_id: nil, otp: nil) raise ArgumentError 'must have either profile or profile_id' if !profile && !profile_id @@ -14,8 +14,8 @@ def otp end def perform - UspsConfirmation.create!(entry: attributes) - UspsConfirmationCode.create!( + GpoConfirmation.create!(entry: attributes) + GpoConfirmationCode.create!( profile_id: profile&.id || profile_id, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), ) diff --git a/app/services/usps_confirmation_uploader.rb b/app/services/gpo_confirmation_uploader.rb similarity index 71% rename from app/services/usps_confirmation_uploader.rb rename to app/services/gpo_confirmation_uploader.rb index da2aa30b6cd..903807a8b1b 100644 --- a/app/services/usps_confirmation_uploader.rb +++ b/app/services/gpo_confirmation_uploader.rb @@ -1,13 +1,13 @@ -class UspsConfirmationUploader +class GpoConfirmationUploader def initialize @now = Time.zone.now end def run - confirmations = UspsConfirmation.all.to_a + confirmations = GpoConfirmation.all.to_a export = generate_export(confirmations) upload_export(export) - LetterRequestsToUspsFtpLog.create(ftp_at: @now, letter_requests_count: confirmations.count) + LetterRequestsToGpoFtpLog.create(ftp_at: @now, letter_requests_count: confirmations.count) clear_confirmations(confirmations) rescue StandardError => error NewRelic::Agent.notice_error(error) @@ -16,11 +16,11 @@ def run private def generate_export(confirmations) - UspsConfirmationExporter.new(confirmations).run + GpoConfirmationExporter.new(confirmations).run end def upload_export(export) - return unless FeatureManagement.usps_upload_enabled? + return unless FeatureManagement.gpo_upload_enabled? io = StringIO.new(export) Net::SFTP.start(*sftp_config) do |sftp| sftp.upload!(io, remote_path) @@ -28,7 +28,7 @@ def upload_export(export) end def clear_confirmations(confirmations) - UspsConfirmation.where(id: confirmations.map(&:id)).destroy_all + GpoConfirmation.where(id: confirmations.map(&:id)).destroy_all end def remote_path diff --git a/app/services/usps_daily_test_sender.rb b/app/services/gpo_daily_test_sender.rb similarity index 86% rename from app/services/usps_daily_test_sender.rb rename to app/services/gpo_daily_test_sender.rb index 65264f39ced..93c4fad084f 100644 --- a/app/services/usps_daily_test_sender.rb +++ b/app/services/gpo_daily_test_sender.rb @@ -1,11 +1,11 @@ # Mails a letter to the designated receiver -class UspsDailyTestSender +class GpoDailyTestSender def run if valid_designated_receiver_pii? - UspsConfirmationMaker.new( + GpoConfirmationMaker.new( pii: designated_receiver_pii, issuer: nil, - profile_id: -1, # profile_id can't be null on UspsConfirmationCode + profile_id: -1, # profile_id can't be null on GpoConfirmationCode otp: otp_from_date, ).perform else diff --git a/app/services/idv/usps_mail.rb b/app/services/idv/gpo_mail.rb similarity index 93% rename from app/services/idv/usps_mail.rb rename to app/services/idv/gpo_mail.rb index 287fdde3308..a3f359c8362 100644 --- a/app/services/idv/usps_mail.rb +++ b/app/services/idv/gpo_mail.rb @@ -1,5 +1,5 @@ module Idv - class UspsMail + class GpoMail MAX_MAIL_EVENTS = AppConfig.env.max_mail_events.to_i MAIL_EVENTS_WINDOW_DAYS = AppConfig.env.max_mail_events_window_in_days.to_i @@ -22,7 +22,7 @@ def any_mail_sent? def user_mail_events @_user_mail_events ||= current_user.events. - usps_mail_sent. + gpo_mail_sent. order('updated_at DESC'). limit(MAX_MAIL_EVENTS) end diff --git a/app/services/idv/session.rb b/app/services/idv/session.rb index a0c5dfeb4a1..0d6444f4d23 100644 --- a/app/services/idv/session.rb +++ b/app/services/idv/session.rb @@ -1,16 +1,19 @@ module Idv class Session + # NOTE: remove _usps_ attributes after next deploy VALID_SESSION_ATTRIBUTES = %i[ address_verification_mechanism applicant idv_phone_step_document_capture_session_uuid idv_usps_document_capture_session_uuid + idv_gpo_document_capture_session_uuid vendor_phone_confirmation user_phone_confirmation pii previous_phone_step_params previous_profile_step_params previous_usps_step_params + previous_gpo_step_params profile_confirmation profile_id profile_step_params @@ -19,7 +22,7 @@ class Session step_attempts ].freeze - attr_reader :current_user, :usps_otp, :issuer + attr_reader :current_user, :gpo_otp, :issuer def initialize(user_session:, current_user:, issuer:) @user_session = user_session @@ -28,6 +31,24 @@ def initialize(user_session:, current_user:, issuer:) set_idv_session end + def idv_gpo_document_capture_session_uuid(value = nil) + if value + session[:idv_gpo_document_capture_session_uuid] = value + else + session[:idv_gpo_document_capture_session_uuid] || + session[:idv_usps_document_capture_session_uuid] + end + end + + def previous_gpo_step_params(value = nil) + if value + session[:previous_gpo_step_params] = value + else + session[:previous_gpo_step_params] || + session[:previous_usps_step_params] + end + end + def method_missing(method_sym, *arguments, &block) attr_name_sym = method_sym.to_s.gsub(/=\z/, '').to_sym if VALID_SESSION_ATTRIBUTES.include?(attr_name_sym) @@ -78,7 +99,7 @@ def phone_confirmed? def complete_session complete_profile if phone_confirmed? - create_usps_entry if address_verification_mechanism == 'usps' + create_gpo_entry if %w[usps gpo].include?(address_verification_mechanism) end def complete_profile @@ -86,13 +107,13 @@ def complete_profile move_pii_to_user_session end - def create_usps_entry + def create_gpo_entry move_pii_to_user_session self.pii = Pii::Attributes.new_from_json(user_session[:decrypted_pii]) if pii.is_a?(String) - confirmation_maker = UspsConfirmationMaker.new(pii: pii, issuer: issuer, profile: profile) + confirmation_maker = GpoConfirmationMaker.new(pii: pii, issuer: issuer, profile: profile) confirmation_maker.perform - @usps_otp = confirmation_maker.otp + @gpo_otp = confirmation_maker.otp end def alive? @@ -100,7 +121,7 @@ def alive? end def address_mechanism_chosen? - vendor_phone_confirmation == true || address_verification_mechanism == 'usps' + vendor_phone_confirmation == true || %w[gpo usps].include?(address_verification_mechanism) end def user_phone_confirmation_session diff --git a/app/services/reports/usps_report.rb b/app/services/reports/gpo_report.rb similarity index 83% rename from app/services/reports/usps_report.rb rename to app/services/reports/gpo_report.rb index e5a69602c3e..1052303b768 100644 --- a/app/services/reports/usps_report.rb +++ b/app/services/reports/gpo_report.rb @@ -1,7 +1,7 @@ require 'identity/hostdata' module Reports - class UspsReport < BaseReport + class GpoReport < BaseReport REPORT_NAME = 'usps-report'.freeze def initialize @@ -32,12 +32,12 @@ def create_reports def letters_sent_since(days_ago) @results[:letters_sent_since_days][days_ago] = - Db::UspsConfirmationCode::LettersSentSince.call(days_ago.days.ago) + Db::GpoConfirmationCode::LettersSentSince.call(days_ago.days.ago) end def letters_sent_and_validated_since(days_ago) @results[:letters_sent_and_validated_since_days][days_ago] = - Db::UspsConfirmationCode::LettersSentAndVerifiedSince.call(days_ago.days.ago) + Db::GpoConfirmationCode::LettersSentAndVerifiedSince.call(days_ago.days.ago) end end end diff --git a/app/services/reports/monthly_usps_letter_requests_report.rb b/app/services/reports/monthly_gpo_letter_requests_report.rb similarity index 82% rename from app/services/reports/monthly_usps_letter_requests_report.rb rename to app/services/reports/monthly_gpo_letter_requests_report.rb index 632bd858058..540c4abd141 100644 --- a/app/services/reports/monthly_usps_letter_requests_report.rb +++ b/app/services/reports/monthly_gpo_letter_requests_report.rb @@ -1,13 +1,13 @@ require 'identity/hostdata' module Reports - class MonthlyUspsLetterRequestsReport < BaseReport + class MonthlyGpoLetterRequestsReport < BaseReport REPORT_NAME = 'monthly-usps-letter-requests-report'.freeze def call(start_time: first_of_this_month, end_time: end_of_today) daily_results = transaction_with_timeout do - ::LetterRequestsToUspsFtpLog.where(ftp_at: start_time..end_time) + ::LetterRequestsToGpoFtpLog.where(ftp_at: start_time..end_time) end totals = calculate_totals(daily_results) save_report(REPORT_NAME, {total_letter_requests: totals, diff --git a/app/services/send_expired_letter_notifications.rb b/app/services/send_expired_letter_notifications.rb index 1dddac5629d..01073371328 100644 --- a/app/services/send_expired_letter_notifications.rb +++ b/app/services/send_expired_letter_notifications.rb @@ -1,11 +1,11 @@ class SendExpiredLetterNotifications def call notifications_sent = 0 - UspsConfirmationCode.where( + GpoConfirmationCode.where( 'created_at < ?', Time.zone.now - AppConfig.env.usps_confirmation_max_days.to_i.days ).where(bounced_at: nil, letter_expired_sent_at: nil). - order(created_at: :asc).each do |usps_confirmation_code| - mark_sent_and_send_email(usps_confirmation_code) + order(created_at: :asc).each do |gpo_confirmation_code| + mark_sent_and_send_email(gpo_confirmation_code) notifications_sent += 1 end notifications_sent @@ -13,16 +13,16 @@ def call private - def mark_sent_and_send_email(usps_confirmation_code) - user = usps_confirmation_code.profile.user - mark_sent(usps_confirmation_code) + def mark_sent_and_send_email(gpo_confirmation_code) + user = gpo_confirmation_code.profile.user + mark_sent(gpo_confirmation_code) user.confirmed_email_addresses.each do |email_address| UserMailer.letter_expired(user, email_address.email).deliver_now end end - def mark_sent(usps_confirmation_code) - usps_confirmation_code.letter_expired_sent_at = Time.zone.now - usps_confirmation_code.save! + def mark_sent(gpo_confirmation_code) + gpo_confirmation_code.letter_expired_sent_at = Time.zone.now + gpo_confirmation_code.save! end end diff --git a/app/services/undeliverable_address_notifier.rb b/app/services/undeliverable_address_notifier.rb index 4692c048ee7..150e94c1262 100644 --- a/app/services/undeliverable_address_notifier.rb +++ b/app/services/undeliverable_address_notifier.rb @@ -1,5 +1,5 @@ class UndeliverableAddressNotifier - TEMP_FILE_BASENAME = 'usps_bounced'.freeze + TEMP_FILE_BASENAME = 'gpo_bounced'.freeze def call temp_file = download_file @@ -36,8 +36,7 @@ def process_file(file) end def process_code(otp) - usps_confirmation_code = usps_confirmation_code(otp) - usps_confirmation_code&.safe_update_bounced_at_and_send_notification + gpo_confirmation_code(otp)&.safe_update_bounced_at_and_send_notification end def sftp_config @@ -53,7 +52,7 @@ def env AppConfig.env end - def usps_confirmation_code(otp) - @ucc ||= UspsConfirmationCode.find_by(otp_fingerprint: Pii::Fingerprinter.fingerprint(otp)) + def gpo_confirmation_code(otp) + @ucc ||= GpoConfirmationCode.find_by(otp_fingerprint: Pii::Fingerprinter.fingerprint(otp)) end end diff --git a/app/view_models/account_show.rb b/app/view_models/account_show.rb index 8b041ddb68e..f45afe76f4c 100644 --- a/app/view_models/account_show.rb +++ b/app/view_models/account_show.rb @@ -19,10 +19,10 @@ def show_password_reset_partial? def pending_profile_partial if decorated_user.pending_profile_requires_verification? - if decorated_user.usps_mail_bounced? - 'accounts/pending_profile_bounced_usps' + if decorated_user.gpo_mail_bounced? + 'accounts/pending_profile_bounced_gpo' else - 'accounts/pending_profile_usps' + 'accounts/pending_profile_gpo' end else 'shared/null' diff --git a/app/views/accounts/_pending_profile_bounced_usps.html.erb b/app/views/accounts/_pending_profile_bounced_gpo.html.erb similarity index 94% rename from app/views/accounts/_pending_profile_bounced_usps.html.erb rename to app/views/accounts/_pending_profile_bounced_gpo.html.erb index 907a5da5354..2bb4f0f6ce6 100644 --- a/app/views/accounts/_pending_profile_bounced_usps.html.erb +++ b/app/views/accounts/_pending_profile_bounced_gpo.html.erb @@ -7,6 +7,6 @@ <%= t('account.index.verification.bounced') %>

- <%= link_to t('account.index.verification.update_address'), idv_usps_path %> + <%= link_to t('account.index.verification.update_address'), idv_gpo_path %>

<% end %> diff --git a/app/views/accounts/_pending_profile_usps.html.erb b/app/views/accounts/_pending_profile_gpo.html.erb similarity index 100% rename from app/views/accounts/_pending_profile_usps.html.erb rename to app/views/accounts/_pending_profile_gpo.html.erb diff --git a/app/views/idv/usps/_address_on_file.html.erb b/app/views/idv/gpo/_address_on_file.html.erb similarity index 59% rename from app/views/idv/usps/_address_on_file.html.erb rename to app/views/idv/gpo/_address_on_file.html.erb index 50cd73fdd9f..49218a22e6b 100644 --- a/app/views/idv/usps/_address_on_file.html.erb +++ b/app/views/idv/gpo/_address_on_file.html.erb @@ -1,2 +1,2 @@ -<%= button_to @presenter.button, idv_usps_path, method: 'put', +<%= button_to @presenter.button, idv_gpo_path, method: 'put', class: 'btn btn-primary btn-wide', form_class: 'inline-block margin-right-2' %> diff --git a/app/views/idv/usps/_new_address.html.erb b/app/views/idv/gpo/_new_address.html.erb similarity index 94% rename from app/views/idv/usps/_new_address.html.erb rename to app/views/idv/gpo/_new_address.html.erb index 27083138225..b5c85e62011 100644 --- a/app/views/idv/usps/_new_address.html.erb +++ b/app/views/idv/gpo/_new_address.html.erb @@ -1,4 +1,4 @@ -<%= validated_form_for(:idv_form, url: idv_usps_path, method: 'POST', +<%= validated_form_for(:idv_form, url: idv_gpo_path, method: 'POST', html: { autocomplete: 'off', role: 'form', class: 'margin-top-2' }) do |f| %> <%= f.input :address1, label: t('idv.form.address1'), wrapper_html: { class: 'margin-bottom-1' }, diff --git a/app/views/idv/usps/index.html.erb b/app/views/idv/gpo/index.html.erb similarity index 64% rename from app/views/idv/usps/index.html.erb rename to app/views/idv/gpo/index.html.erb index 29c87f89157..df893e77e68 100644 --- a/app/views/idv/usps/index.html.erb +++ b/app/views/idv/gpo/index.html.erb @@ -5,14 +5,14 @@

<%= @presenter.byline %> - <%= t('idv.messages.usps.success') %> + <%= t('idv.messages.gpo.success') %>

- <% if @presenter.usps_mail_bounced? %> - <%= render 'idv/usps/new_address', presenter: @presenter %> + <% if @presenter.gpo_mail_bounced? %> + <%= render 'idv/gpo/new_address', presenter: @presenter %> <% else %> - <%= render 'idv/usps/address_on_file', presenter: @presenter %> + <%= render 'idv/gpo/address_on_file', presenter: @presenter %> <% end %>
diff --git a/app/views/idv/usps/wait.html.erb b/app/views/idv/gpo/wait.html.erb similarity index 100% rename from app/views/idv/usps/wait.html.erb rename to app/views/idv/gpo/wait.html.erb diff --git a/app/views/idv/otp_delivery_method/new.html.erb b/app/views/idv/otp_delivery_method/new.html.erb index d6b7f7f76c7..94c99dbd951 100644 --- a/app/views/idv/otp_delivery_method/new.html.erb +++ b/app/views/idv/otp_delivery_method/new.html.erb @@ -38,9 +38,9 @@ - <% if FeatureManagement.enable_usps_verification? %> + <% if FeatureManagement.enable_gpo_verification? %>
- <%= t('idv.form.no_alternate_phone_html', link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + <%= t('idv.form.no_alternate_phone_html', link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>
<% end %>
diff --git a/app/views/idv/phone/_verification_options.html.erb b/app/views/idv/phone/_verification_options.html.erb index 4f8d66e723d..2c01d611549 100644 --- a/app/views/idv/phone/_verification_options.html.erb +++ b/app/views/idv/phone/_verification_options.html.erb @@ -1,4 +1,4 @@

<%= t('idv.form.no_alternate_phone_html', - link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>

diff --git a/app/views/idv/phone/new.html.erb b/app/views/idv/phone/new.html.erb index 4ea5dd19217..fd556b0564e 100644 --- a/app/views/idv/phone/new.html.erb +++ b/app/views/idv/phone/new.html.erb @@ -53,7 +53,7 @@ <%= f.input :phone, required: true, input_html: { aria: { invalid: false }, class: 'sm-col-8' }, label: false, wrapper_html: { class: 'margin-right-2' } %> - <% if FeatureManagement.enable_usps_verification? %> + <% if FeatureManagement.enable_gpo_verification? %> <%= render 'idv/phone/verification_options' %> <% end %> diff --git a/app/views/idv/phone_errors/failure.html.erb b/app/views/idv/phone_errors/failure.html.erb index 46b28e31794..6afc37b4a24 100644 --- a/app/views/idv/phone_errors/failure.html.erb +++ b/app/views/idv/phone_errors/failure.html.erb @@ -16,10 +16,10 @@
-<% if FeatureManagement.enable_usps_verification? %> +<% if FeatureManagement.enable_gpo_verification? %>

<%= t('idv.form.no_alternate_phone_html', - link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>

<% end %> diff --git a/app/views/idv/phone_errors/jobfail.html.erb b/app/views/idv/phone_errors/jobfail.html.erb index 819bb0fd0e3..9f83973d82b 100644 --- a/app/views/idv/phone_errors/jobfail.html.erb +++ b/app/views/idv/phone_errors/jobfail.html.erb @@ -8,10 +8,10 @@
-<% if FeatureManagement.enable_usps_verification? %> +<% if FeatureManagement.enable_gpo_verification? %>

<%= t('idv.form.no_alternate_phone_html', - link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>

<% end %> diff --git a/app/views/idv/phone_errors/timeout.html.erb b/app/views/idv/phone_errors/timeout.html.erb index be8b279b49e..1be8756a06f 100644 --- a/app/views/idv/phone_errors/timeout.html.erb +++ b/app/views/idv/phone_errors/timeout.html.erb @@ -8,10 +8,10 @@
-<% if FeatureManagement.enable_usps_verification? %> +<% if FeatureManagement.enable_gpo_verification? %>

<%= t('idv.form.no_alternate_phone_html', - link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>

<% end %> diff --git a/app/views/idv/phone_errors/warning.html.erb b/app/views/idv/phone_errors/warning.html.erb index 6c167296efc..36a818f34cc 100644 --- a/app/views/idv/phone_errors/warning.html.erb +++ b/app/views/idv/phone_errors/warning.html.erb @@ -8,10 +8,10 @@
-<% if FeatureManagement.enable_usps_verification? %> +<% if FeatureManagement.enable_gpo_verification? %>

<%= t('idv.form.no_alternate_phone_html', - link: link_to(t('idv.form.activate_by_mail'), idv_usps_path)) %> + link: link_to(t('idv.form.activate_by_mail'), idv_gpo_path)) %>

<% end %> diff --git a/app/views/users/verify_account/index.html.erb b/app/views/users/verify_account/index.html.erb index 11663d4febe..b39b37483ef 100644 --- a/app/views/users/verify_account/index.html.erb +++ b/app/views/users/verify_account/index.html.erb @@ -16,8 +16,8 @@ <% end %> <% end %> -<% if FeatureManagement.enable_usps_verification? && !@mail_spammed %> - <%= link_to t('idv.messages.usps.resend'), idv_usps_path, class: 'block margin-bottom-2' %> +<% if FeatureManagement.enable_gpo_verification? && !@mail_spammed %> + <%= link_to t('idv.messages.gpo.resend'), idv_gpo_path, class: 'block margin-bottom-2' %> <% end %> <%= button_to t('idv.messages.clear_and_start_over'), idv_session_path, method: :delete, class: 'usa-button usa-button--unstyled' %> diff --git a/config/initializers/job_configurations.rb b/config/initializers/job_configurations.rb index acbdc2d7f52..ffe7d76a03f 100644 --- a/config/initializers/job_configurations.rb +++ b/config/initializers/job_configurations.rb @@ -7,9 +7,9 @@ interval: 24 * 60 * 60, timeout: 300, callback: lambda do - UspsDailyTestSender.new.run + GpoDailyTestSender.new.run - UspsConfirmationUploader.new.run unless CalendarService.weekend_or_holiday?(Time.zone.today) + GpoConfirmationUploader.new.run unless CalendarService.weekend_or_holiday?(Time.zone.today) end, ) @@ -167,18 +167,18 @@ callback: -> { Reports::DeletedUserAccountsReport.new.call }, ) -# Send USPS Report to S3 +# Send GPO Report to S3 JobRunner::Runner.add_config JobRunner::JobConfiguration.new( - name: 'USPS report', + name: 'GPO report', interval: 24 * 60 * 60, # 24 hours timeout: 300, - callback: -> { Reports::UspsReport.new.call }, + callback: -> { Reports::GpoReport.new.call }, ) -# Send Monthly USPS Letter Requests Report to S3 +# Send Monthly GPO Letter Requests Report to S3 JobRunner::Runner.add_config JobRunner::JobConfiguration.new( - name: 'Monthly USPS letter requests report', + name: 'Monthly GPO letter requests report', interval: 24 * 60 * 60, # 24 hours timeout: 300, - callback: -> { Reports::MonthlyUspsLetterRequestsReport.new.call }, + callback: -> { Reports::MonthlygpoLetterRequestsReport.new.call }, ) diff --git a/config/locales/errors/en.yml b/config/locales/errors/en.yml index 08b0bd36509..2ad99dabf3c 100644 --- a/config/locales/errors/en.yml +++ b/config/locales/errors/en.yml @@ -82,6 +82,8 @@ en: confirmation instructions" to get another one. expired: has expired, please request a new one format_mismatch: Please match the requested format. + gpo_otp_expired: Your confirmation code has expired. Please request another + letter for a new code. improbable_phone: Invalid phone number. Please make sure you enter a valid phone number. invalid_calling_area: Calls to that phone number are not supported. Please try @@ -108,8 +110,6 @@ en: unauthorized_authn_context: Unauthorized authentication context unauthorized_nameid_format: Unauthorized nameID format unauthorized_service_provider: Unauthorized Service Provider - usps_otp_expired: Your confirmation code has expired. Please request another - letter for a new code. voip_check_error: There was an error checking your phone, please try again voip_phone: This number is a web-based (VOIP) phone service. Please select a different number and try again diff --git a/config/locales/errors/es.yml b/config/locales/errors/es.yml index 871d35082d1..d83f8080a0c 100644 --- a/config/locales/errors/es.yml +++ b/config/locales/errors/es.yml @@ -83,6 +83,8 @@ es: en "Reenviar instrucciones de confirmación" para obtener otro. expired: ha caducado, por favor solicite uno nuevo format_mismatch: Por favor, use el formato solicitado. + gpo_otp_expired: Tu código de confirmación ha caducado. Vuelve a solicitar otra + carta para recibir un nuevo código. improbable_phone: Número de teléfono no válido. Asegúrate de introducir un número de teléfono válido. invalid_calling_area: No se admiten llamadas a ese número de teléfono. Intenta @@ -110,8 +112,6 @@ es: unauthorized_authn_context: Contexto de autenticación no autorizado unauthorized_nameid_format: Formato de ID de nombre no autorizado unauthorized_service_provider: Proveedor de servicio no autorizado - usps_otp_expired: Tu código de confirmación ha caducado. Vuelve a solicitar - otra carta para recibir un nuevo código. voip_check_error: Se ha producido un error al comprobar su teléfono, por favor, inténtelo de nuevo voip_phone: Este número corresponde a un servicio de telefonía basado en la diff --git a/config/locales/errors/fr.yml b/config/locales/errors/fr.yml index bc91ef4b73a..4c6875fb4b4 100644 --- a/config/locales/errors/fr.yml +++ b/config/locales/errors/fr.yml @@ -88,6 +88,8 @@ fr: un autre. expired: est expiré, veuillez en demander un nouveau format_mismatch: Veuillez vous assurer de respecter le format requis. + gpo_otp_expired: Votre code de confirmation a expiré. Veuillez solliciter une + autre lettre afin d'obtenir un nouveau code. improbable_phone: Numéro de téléphone non valide. Veillez à saisir un numéro de téléphone valide. invalid_calling_area: Les appels vers ce numéro de téléphone ne sont pas pris @@ -117,8 +119,6 @@ fr: unauthorized_authn_context: Contexte d'authentification non autorisé unauthorized_nameid_format: Format non autorisé du nom d'identification unauthorized_service_provider: Fournisseur de service non autorisé - usps_otp_expired: Votre code de confirmation a expiré. Veuillez solliciter une - autre lettre afin d'obtenir un nouveau code. voip_check_error: Il y a eu une erreur lors de la vérification de votre téléphone, veuillez réessayer voip_phone: Ce numéro est un service téléphonique basé sur le Web (Voix sur diff --git a/config/locales/event_types/en.yml b/config/locales/event_types/en.yml index b6ca78871c4..180547a366b 100644 --- a/config/locales/event_types/en.yml +++ b/config/locales/event_types/en.yml @@ -11,6 +11,7 @@ en: eastern_timestamp: "%{timestamp} (Eastern)" email_changed: Email address changed email_deleted: Email address deleted + gpo_mail_sent: Letter sent new_personal_key: Personal key changed password_changed: Password changed password_invalidated: Password reset by %{app_name} @@ -23,6 +24,5 @@ en: piv_cac_enabled: PIV/CAC card associated sign_in_after_2fa: Signed in with second factor sign_in_before_2fa: Signed in with password - usps_mail_sent: Letter sent webauthn_key_added: Hardware security key added webauthn_key_removed: Hardware security key removed diff --git a/config/locales/event_types/es.yml b/config/locales/event_types/es.yml index 9ebdec06e4a..19d44bd1d86 100644 --- a/config/locales/event_types/es.yml +++ b/config/locales/event_types/es.yml @@ -11,6 +11,7 @@ es: eastern_timestamp: "%{timestamp} (hora del Este)" email_changed: Email cambiado email_deleted: Dirección de correo electrónico eliminada + gpo_mail_sent: Carta enviada new_personal_key: Clave personal cambiado password_changed: Contraseña cambiada password_invalidated: Restablecimiento de contraseña por %{app_name} @@ -23,6 +24,5 @@ es: piv_cac_enabled: Tarjeta PIV/CAC asociada sign_in_after_2fa: Inicia sesión con segundo factor sign_in_before_2fa: Inicia sesión con contraseña - usps_mail_sent: Carta enviada webauthn_key_added: Clave de seguridad de hardware añadido webauthn_key_removed: Clave de seguridad de hardware eliminada diff --git a/config/locales/event_types/fr.yml b/config/locales/event_types/fr.yml index 5c543365dc8..1095d798333 100644 --- a/config/locales/event_types/fr.yml +++ b/config/locales/event_types/fr.yml @@ -11,6 +11,7 @@ fr: eastern_timestamp: "%{timestamp} (est)" email_changed: Adresse courriel modifiée email_deleted: Adresse e-mail supprimée + gpo_mail_sent: Lettre envoyée new_personal_key: Clé personnelle modifié password_changed: Mot de passe modifié password_invalidated: Réinitialisation du mot de passe par %{app_name} @@ -23,6 +24,5 @@ fr: piv_cac_enabled: Carte PIV/CAC associée sign_in_after_2fa: Signé avec deuxième facteur sign_in_before_2fa: Connecté avec mot de passe - usps_mail_sent: Lettre envoyée webauthn_key_added: Clé de sécurité ajoutée webauthn_key_removed: Clé de sécurité retirée diff --git a/config/locales/idv/en.yml b/config/locales/idv/en.yml index 27ba67a56ff..456497f0d5e 100644 --- a/config/locales/idv/en.yml +++ b/config/locales/idv/en.yml @@ -106,6 +106,13 @@ en: for now. come_back_later_sp_html: You can return to %{sp} for now. confirm: You have encrypted your verified data + gpo: + address_on_file: We will mail a letter with a confirmation code to your verified + address on file. + new_address: We will mail a letter with a confirmation code to the address + you specify. + resend: Send me another letter + success: It should arrive in 5 to 10 business days. hardfail: We can't log you in right now, but you can try verifying your identity again in %{hours} hours. mail_sent: Your letter is on its way @@ -138,13 +145,6 @@ en: read_more_encrypt: Read more about how login.gov protects your personal information review_message: When you re-enter your password, login.gov will protect the information you've given us, so that only you can access it - usps: - address_on_file: We will mail a letter with a confirmation code to your verified - address on file. - new_address: We will mail a letter with a confirmation code to the address - you specify. - resend: Send me another letter - success: It should arrive in 5 to 10 business days. review: dob: Date of birth full_name: Full name diff --git a/config/locales/idv/es.yml b/config/locales/idv/es.yml index a6fb7a5a9e2..27ba82858d2 100644 --- a/config/locales/idv/es.yml +++ b/config/locales/idv/es.yml @@ -107,6 +107,13 @@ es: come_back_later_no_sp_html: Ahora puedes volver a tu cuenta de %{app}. come_back_later_sp_html: Ahora puedes volver a %{sp}. confirm: Usted ha encriptado sus datos verificados. + gpo: + address_on_file: Le enviaremos una carta con un código de confirmación a su + dirección verificada en el archivo. + new_address: Le enviaremos una carta con un código de confirmación a la dirección + que especifique. + resend: Envíeme otra carta + success: Debe llegar en 5 a 10 días laborales. hardfail: No puedes iniciar sesión en estos instantes pero puedes intentar verificar tu edad de nuevo en %{hours} horas. mail_sent: Su carta está en camino @@ -141,13 +148,6 @@ es: read_more_encrypt: Lea más sobre cómo login.gov protege su información personal review_message: Cuando vuelva a ingresar su contraseña, login.gov cifrará sus datos para asegurarse de que nadie más pueda acceder a ellos. - usps: - address_on_file: Le enviaremos una carta con un código de confirmación a su - dirección verificada en el archivo. - new_address: Le enviaremos una carta con un código de confirmación a la dirección - que especifique. - resend: Envíeme otra carta - success: Debe llegar en 5 a 10 días laborales. review: dob: Fecha de nacimiento full_name: Nombre completo diff --git a/config/locales/idv/fr.yml b/config/locales/idv/fr.yml index cb4a24fec50..aa11ceed1da 100644 --- a/config/locales/idv/fr.yml +++ b/config/locales/idv/fr.yml @@ -116,6 +116,13 @@ fr: come_back_later_sp_html: Vous pouvez revenir à %{sp} pour le moment. confirm: Vous avez crypté vos données vérifiées + gpo: + address_on_file: Nous posterons une lettre à l'adresse vérifiée dans nos dossiers. + Celle-ci contient un code de confirmation. + new_address: Nous vous enverrons une lettre avec un code de confirmation à + l'adresse que vous spécifiez. + resend: Envoyez-moi une autre lettre + success: Elle devrait arriver dans 5 à 10 jours ouvrables. hardfail: Nous ne pouvons pas vous connecter pour le moment, mais vous pouvez retenter d'effectuer la vérification de votre identité dans %{hours} heures. mail_sent: Votre lettre est en route @@ -154,13 +161,6 @@ fr: informations personnelles review_message: Lorsque vous entrez à nouveau votre mot de passe, login.gov crypte vos données pour vous assurer que personne ne peut y accéder. - usps: - address_on_file: Nous posterons une lettre à l'adresse vérifiée dans nos dossiers. - Celle-ci contient un code de confirmation. - new_address: Nous vous enverrons une lettre avec un code de confirmation à - l'adresse que vous spécifiez. - resend: Envoyez-moi une autre lettre - success: Elle devrait arriver dans 5 à 10 jours ouvrables. review: dob: Date de naissance full_name: Nom complet diff --git a/config/routes.rb b/config/routes.rb index edf327c47e3..49690a6a353 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,7 +29,7 @@ post '/api/account_reset/send_notifications' => 'send_account_reset_notifications#create' post '/api/expired_letters' => 'expired_letters#create' post '/api/usps_download' => 'undeliverable_address#create' - post '/api/usps_upload' => 'usps_upload#create' + post '/api/usps_upload' => 'gpo_upload#create' end scope module: :lambda_callback do @@ -330,11 +330,11 @@ get '/account/verify' => 'users/verify_account#index', as: :verify_account post '/account/verify' => 'users/verify_account#create' - if FeatureManagement.enable_usps_verification? + if FeatureManagement.enable_gpo_verification? scope '/verify', module: 'idv', as: 'idv' do - get '/usps' => 'usps#index' - put '/usps' => 'usps#create' - post '/usps' => 'usps#update' + get '/usps' => 'gpo#index', as: :gpo + put '/usps' => 'gpo#create' + post '/usps' => 'gpo#update' end end diff --git a/lib/feature_management.rb b/lib/feature_management.rb index 9aa43a1dd9c..d2109c64081 100644 --- a/lib/feature_management.rb +++ b/lib/feature_management.rb @@ -1,5 +1,5 @@ class FeatureManagement - ENVS_WHERE_PREFILLING_USPS_CODE_ALLOWED = %w[ + ENVS_WHERE_PREFILLING_GPO_CODE_ALLOWED = %w[ idp.dev.login.gov idp.int.login.gov idp.qa.login.gov idp.pt.login.gov idp.dev.identitysandbox.gov idp.qa.identitysandbox.gov idp.int.identitysandbox.gov idp.pt.identitysandbox.gov @@ -53,16 +53,17 @@ def self.use_dashboard_service_providers? AppConfig.env.use_dashboard_service_providers == 'true' end - def self.enable_usps_verification? + def self.enable_gpo_verification? + # leaving the usps name for backwards compatibility AppConfig.env.enable_usps_verification == 'true' end - def self.reveal_usps_code? - Rails.env.development? || current_env_allowed_to_see_usps_code? + def self.reveal_gpo_code? + Rails.env.development? || current_env_allowed_to_see_gpo_code? end - def self.current_env_allowed_to_see_usps_code? - ENVS_WHERE_PREFILLING_USPS_CODE_ALLOWED.include?(AppConfig.env.domain_name) + def self.current_env_allowed_to_see_gpo_code? + ENVS_WHERE_PREFILLING_GPO_CODE_ALLOWED.include?(AppConfig.env.domain_name) end def self.show_demo_banner? @@ -98,7 +99,8 @@ def self.in_person_proofing_enabled? AppConfig.env.in_person_proofing_enabled == 'true' end - def self.usps_upload_enabled? + def self.gpo_upload_enabled? + # leaving the usps name for backwards compatibility AppConfig.env.usps_upload_enabled == 'true' end diff --git a/spec/config/initializers/job_configurations.rb b/spec/config/initializers/job_configurations.rb index 90685433269..12c1a225779 100644 --- a/spec/config/initializers/job_configurations.rb +++ b/spec/config/initializers/job_configurations.rb @@ -7,8 +7,8 @@ expect(job).to be_instance_of(JobRunner::JobConfiguration) expect(job.interval).to eq 24 * 60 * 60 - stub = instance_double(UspsConfirmationUploader) - expect(UspsConfirmationUploader).to receive(:new).and_return(stub) + stub = instance_double(GpoConfirmationUploader) + expect(GpoConfirmationUploader).to receive(:new).and_return(stub) expect(stub).to receive(:run).and_return('the GPO test worked') result = CalendarService.weekend_or_holiday?(Time.zone.today) ? nil : 'the GPO test worked' @@ -244,7 +244,7 @@ expect(job.callback.call).to eq 'the report test worked' end - it 'runs the USPS report' do + it 'runs the GPO report' do job = JobRunner::Runner.configurations.find { |c| c.name == 'USPS report' } expect(job).to be_instance_of(JobRunner::JobConfiguration) expect(job.interval).to eq 24 * 60 * 60 @@ -256,15 +256,15 @@ expect(job.callback.call).to eq 'the report test worked' end - it 'runs the Monthly USPS letter requests report' do + it 'runs the Monthly GPO letter requests report' do job = JobRunner::Runner.configurations.find do |c| - c.name == 'Monthly USPS letter requests report' + c.name == 'Monthly GPO letter requests report' end expect(job).to be_instance_of(JobRunner::JobConfiguration) expect(job.interval).to eq 24 * 60 * 60 - service = instance_double(Reports::MonthlyUspsLetterRequestsReport) - expect(Reports::MonthlyUspsLetterRequestsReport).to receive(:new).and_return(service) + service = instance_double(Reports::MonthlyGpoLetterRequestsReport) + expect(Reports::MonthlyGpoLetterRequestsReport).to receive(:new).and_return(service) expect(service).to receive(:call).and_return('the report test worked') expect(job.callback.call).to eq 'the report test worked' diff --git a/spec/controllers/idv/confirmations_controller_spec.rb b/spec/controllers/idv/confirmations_controller_spec.rb index f39687835e4..80ba112ab1f 100644 --- a/spec/controllers/idv/confirmations_controller_spec.rb +++ b/spec/controllers/idv/confirmations_controller_spec.rb @@ -199,9 +199,9 @@ def index end end - context 'user selected usps verification' do + context 'user selected gpo verification' do before do - subject.idv_session.address_verification_mechanism = 'usps' + subject.idv_session.address_verification_mechanism = 'gpo' subject.idv_session.complete_session end diff --git a/spec/controllers/idv/usps_controller_spec.rb b/spec/controllers/idv/gpo_controller_spec.rb similarity index 79% rename from spec/controllers/idv/usps_controller_spec.rb rename to spec/controllers/idv/gpo_controller_spec.rb index 56dbd5a250e..0d226f9a236 100644 --- a/spec/controllers/idv/usps_controller_spec.rb +++ b/spec/controllers/idv/gpo_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe Idv::UspsController do +describe Idv::GpoController do let(:user) { create(:user) } describe 'before_actions' do @@ -30,7 +30,7 @@ end it 'redirects if the user has sent too much mail' do - allow(controller.usps_mail_service).to receive(:mail_spammed?).and_return(true) + allow(controller.gpo_mail_service).to receive(:mail_spammed?).and_return(true) allow(subject.idv_session).to receive(:address_mechanism_chosen?). and_return(true) get :index @@ -39,7 +39,7 @@ end it 'allows a user to request another letter' do - allow(controller.usps_mail_service).to receive(:mail_spammed?).and_return(false) + allow(controller.gpo_mail_service).to receive(:mail_spammed?).and_return(false) get :index expect(response).to be_ok @@ -76,13 +76,13 @@ stub_verify_steps_one_and_two(user) end - it 'sets session to :usps and redirects' do + it 'sets session to :gpo and redirects' do expect(subject.idv_session.address_verification_mechanism).to be_nil put :create expect(response).to redirect_to idv_review_path - expect(subject.idv_session.address_verification_mechanism).to eq :usps + expect(subject.idv_session.address_verification_mechanism).to eq :gpo end end @@ -96,12 +96,12 @@ allow(user.decorate).to receive(:pending_profile_requires_verification?).and_return(true) end - it 'calls the UspsConfirmationMaker to send another letter and redirects' do + it 'calls the GpoConfirmationMaker to send another letter and redirects' do expect_resend_letter_to_send_letter_and_redirect(otp: false) end - it 'calls UspsConfirmationMaker to send another letter with reveal_usps_code on' do - allow(FeatureManagement).to receive(:reveal_usps_code?).and_return(true) + it 'calls GpoConfirmationMaker to send another letter with reveal_gpo_code on' do + allow(FeatureManagement).to receive(:reveal_gpo_code?).and_return(true) expect_resend_letter_to_send_letter_and_redirect(otp: true) end end @@ -115,13 +115,13 @@ def expect_resend_letter_to_send_letter_and_redirect(otp:) session[:sp] = { issuer: '123abc' } - usps_confirmation_maker = instance_double(UspsConfirmationMaker) - allow(UspsConfirmationMaker).to receive(:new). + gpo_confirmation_maker = instance_double(GpoConfirmationMaker) + allow(GpoConfirmationMaker).to receive(:new). with(pii: pii, issuer: '123abc', profile: pending_profile). - and_return(usps_confirmation_maker) + and_return(gpo_confirmation_maker) - expect(usps_confirmation_maker).to receive(:perform) - expect(usps_confirmation_maker).to receive(:otp) if otp + expect(gpo_confirmation_maker).to receive(:perform) + expect(gpo_confirmation_maker).to receive(:otp) if otp put :create diff --git a/spec/controllers/idv/otp_delivery_method_controller_spec.rb b/spec/controllers/idv/otp_delivery_method_controller_spec.rb index 7b30964008f..532d0876346 100644 --- a/spec/controllers/idv/otp_delivery_method_controller_spec.rb +++ b/spec/controllers/idv/otp_delivery_method_controller_spec.rb @@ -24,7 +24,7 @@ describe '#new' do context 'user has not selected phone verification method' do before do - subject.idv_session.address_verification_mechanism = 'usps' + subject.idv_session.address_verification_mechanism = 'gpo' end it 'redirects to the review controller' do @@ -78,7 +78,7 @@ context 'user has not selected phone verification method' do before do - subject.idv_session.address_verification_mechanism = 'usps' + subject.idv_session.address_verification_mechanism = 'gpo' end it 'redirects to the review controller' do diff --git a/spec/controllers/idv/review_controller_spec.rb b/spec/controllers/idv/review_controller_spec.rb index f1f027443b3..4a12bc3248f 100644 --- a/spec/controllers/idv/review_controller_spec.rb +++ b/spec/controllers/idv/review_controller_spec.rb @@ -101,7 +101,7 @@ def show context 'user is verifying by mail' do before do - allow(idv_session).to receive(:address_verification_mechanism).and_return('usps') + allow(idv_session).to receive(:address_verification_mechanism).and_return('gpo') end it 'does not redirect' do @@ -213,7 +213,7 @@ def show context 'user chooses address verification' do before do - idv_session.address_verification_mechanism = 'usps' + idv_session.address_verification_mechanism = 'gpo' end it 'displays a helpful flash message to the user' do @@ -227,10 +227,10 @@ def show context 'user has not requested too much mail' do before do - idv_session.address_verification_mechanism = 'usps' - usps_mail_service = instance_double(Idv::UspsMail) - allow(Idv::UspsMail).to receive(:new).with(user).and_return(usps_mail_service) - allow(usps_mail_service).to receive(:mail_spammed?).and_return(false) + idv_session.address_verification_mechanism = 'gpo' + gpo_mail_service = instance_double(Idv::GpoMail) + allow(Idv::GpoMail).to receive(:new).with(user).and_return(gpo_mail_service) + allow(gpo_mail_service).to receive(:mail_spammed?).and_return(false) end it 'displays a success message' do @@ -243,10 +243,10 @@ def show context 'user has requested too much mail' do before do - idv_session.address_verification_mechanism = 'usps' - usps_mail_service = instance_double(Idv::UspsMail) - allow(Idv::UspsMail).to receive(:new).with(user).and_return(usps_mail_service) - allow(usps_mail_service).to receive(:mail_spammed?).and_return(true) + idv_session.address_verification_mechanism = 'gpo' + gpo_mail_service = instance_double(Idv::GpoMail) + allow(Idv::GpoMail).to receive(:new).with(user).and_return(gpo_mail_service) + allow(gpo_mail_service).to receive(:mail_spammed?).and_return(true) end it 'displays a helpful error message' do @@ -342,9 +342,9 @@ def show end end - context 'user picked USPS confirmation' do + context 'user picked GPO confirmation' do before do - idv_session.address_verification_mechanism = 'usps' + idv_session.address_verification_mechanism = 'gpo' end it 'leaves profile deactivated' do diff --git a/spec/controllers/recurring_job/usps_upload_controller_spec.rb b/spec/controllers/recurring_job/gpo_upload_controller_spec.rb similarity index 70% rename from spec/controllers/recurring_job/usps_upload_controller_spec.rb rename to spec/controllers/recurring_job/gpo_upload_controller_spec.rb index cc0609f575c..81469c08842 100644 --- a/spec/controllers/recurring_job/usps_upload_controller_spec.rb +++ b/spec/controllers/recurring_job/gpo_upload_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe RecurringJob::UspsUploadController do +describe RecurringJob::GpoUploadController do describe '#create' do it_behaves_like 'a recurring job controller', AppConfig.env.usps_upload_token @@ -12,9 +12,9 @@ context 'on a federal workday' do it 'runs the uploader' do Timecop.travel Date.new(2018, 7, 3) do - usps_uploader = instance_double(UspsConfirmationUploader) - expect(usps_uploader).to receive(:run) - expect(UspsConfirmationUploader).to receive(:new).and_return(usps_uploader) + gpo_uploader = instance_double(GpoConfirmationUploader) + expect(gpo_uploader).to receive(:run) + expect(GpoConfirmationUploader).to receive(:new).and_return(gpo_uploader) post :create @@ -26,7 +26,7 @@ context 'on a federal holiday' do it 'does not run the uploader' do Timecop.travel Date.new(2019, 1, 1) do - expect(UspsConfirmationUploader).not_to receive(:new) + expect(GpoConfirmationUploader).not_to receive(:new) post :create diff --git a/spec/controllers/users/verify_account_controller_spec.rb b/spec/controllers/users/verify_account_controller_spec.rb index a27bc36a9f2..8caef32fa22 100644 --- a/spec/controllers/users/verify_account_controller_spec.rb +++ b/spec/controllers/users/verify_account_controller_spec.rb @@ -13,7 +13,7 @@ stub_sign_in(user) decorated_user = stub_decorated_user_with_pending_profile(user) create( - :usps_confirmation_code, + :gpo_confirmation_code, profile: pending_profile, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), ) diff --git a/spec/factories/usps_confirmation_codes.rb b/spec/factories/gpo_confirmation_codes.rb similarity index 79% rename from spec/factories/usps_confirmation_codes.rb rename to spec/factories/gpo_confirmation_codes.rb index 8a00f8d6eea..0af40b8b205 100644 --- a/spec/factories/usps_confirmation_codes.rb +++ b/spec/factories/gpo_confirmation_codes.rb @@ -1,7 +1,7 @@ FactoryBot.define do Faker::Config.locale = :en - factory :usps_confirmation_code do + factory :gpo_confirmation_code do profile otp_fingerprint { Pii::Fingerprinter.fingerprint('ABCDE12345') } end diff --git a/spec/features/account_history_spec.rb b/spec/features/account_history_spec.rb index cd17ad09783..71fa653fcc2 100644 --- a/spec/features/account_history_spec.rb +++ b/spec/features/account_history_spec.rb @@ -3,8 +3,8 @@ describe 'Account history' do let(:user) { create(:user, :signed_up, created_at: Time.zone.now - 100.days) } let(:account_created_event) { create(:event, user: user, created_at: Time.zone.now - 98.days) } - let(:usps_mail_sent_event) do - create(:event, user: user, event_type: :usps_mail_sent, created_at: Time.zone.now - 90.days) + let(:gpo_mail_sent_event) do + create(:event, user: user, event_type: :gpo_mail_sent, created_at: Time.zone.now - 90.days) end let(:identity_with_link) do create( @@ -15,8 +15,8 @@ service_provider: 'http://localhost:3000', ) end - let(:usps_mail_sent_again_event) do - create(:event, user: user, event_type: :usps_mail_sent, created_at: Time.zone.now - 60.days) + let(:gpo_mail_sent_again_event) do + create(:event, user: user, event_type: :gpo_mail_sent, created_at: Time.zone.now - 60.days) end let(:identity_without_link) do create( @@ -28,11 +28,11 @@ ) end let(:account_created_timestamp) { account_created_event.decorate.happened_at_in_words } - let(:usps_mail_sent_timestamp) { usps_mail_sent_event.decorate.happened_at_in_words } + let(:gpo_mail_sent_timestamp) { gpo_mail_sent_event.decorate.happened_at_in_words } let(:identity_with_link_timestamp) do identity_with_link.happened_at.strftime(t('time.formats.event_timestamp')) end - let(:usps_mail_sent_again_timestamp) { usps_mail_sent_again_event.decorate.happened_at_in_words } + let(:gpo_mail_sent_again_timestamp) { gpo_mail_sent_again_event.decorate.happened_at_in_words } let(:identity_without_link_timestamp) do identity_without_link.happened_at.strftime(t('time.formats.event_timestamp')) end @@ -54,8 +54,8 @@ scenario 'viewing account history' do events = [ account_created_event, - usps_mail_sent_event, - usps_mail_sent_again_event, + gpo_mail_sent_event, + gpo_mail_sent_again_event, new_personal_key_event, password_changed_event, ] @@ -80,16 +80,16 @@ identity_with_link.display_name, href: 'http://localhost:3000' ) - expect(identity_without_link_timestamp).to appear_before(usps_mail_sent_again_timestamp) - expect(usps_mail_sent_again_timestamp).to appear_before(identity_with_link_timestamp) - expect(identity_with_link_timestamp).to appear_before(usps_mail_sent_timestamp) - expect(usps_mail_sent_timestamp).to appear_before(account_created_timestamp) + expect(identity_without_link_timestamp).to appear_before(gpo_mail_sent_again_timestamp) + expect(gpo_mail_sent_again_timestamp).to appear_before(identity_with_link_timestamp) + expect(identity_with_link_timestamp).to appear_before(gpo_mail_sent_timestamp) + expect(gpo_mail_sent_timestamp).to appear_before(account_created_timestamp) end def build_account_history account_created_event - usps_mail_sent_event - usps_mail_sent_again_event + gpo_mail_sent_event + gpo_mail_sent_again_event identity_with_link identity_without_link new_personal_key_event diff --git a/spec/features/idv/clearing_and_restarting_spec.rb b/spec/features/idv/clearing_and_restarting_spec.rb index 468ad0ec26f..f22240fe8ef 100644 --- a/spec/features/idv/clearing_and_restarting_spec.rb +++ b/spec/features/idv/clearing_and_restarting_spec.rb @@ -5,10 +5,10 @@ let(:user) { user_with_2fa } - context 'during USPS otp verification' do + context 'during GPO otp verification' do before do start_idv_from_sp - complete_idv_steps_with_usps_before_confirmation_step(user) + complete_idv_steps_with_gpo_before_confirmation_step(user) click_acknowledge_personal_key end diff --git a/spec/features/idv/usps_disabled_spec.rb b/spec/features/idv/gpo_disabled_spec.rb similarity index 68% rename from spec/features/idv/usps_disabled_spec.rb rename to spec/features/idv/gpo_disabled_spec.rb index bc7640a8429..533eb9b1e87 100644 --- a/spec/features/idv/usps_disabled_spec.rb +++ b/spec/features/idv/gpo_disabled_spec.rb @@ -1,19 +1,19 @@ require 'rails_helper' -feature 'disabling USPS address verification' do +feature 'disabling GPO address verification' do include IdvStepHelper - context 'with USPS address verification disabled' do + context 'with GPO address verification disabled' do before do - allow(AppConfig.env).to receive(:enable_usps_verification).and_return('false') - # Whether USPS is available affects the routes that are available + allow(FeatureManagement).to receive(:enable_gpo_verification?).and_return(false) + # Whether GPO is available affects the routes that are available # We want path helpers for unavailable routes to raise and fail the tests # so we reload the routes here Rails.application.reload_routes! end after do - allow(AppConfig.env).to receive(:enable_usps_verification).and_call_original + allow(FeatureManagement).to receive(:enable_gpo_verification?).and_call_original Rails.application.reload_routes! end @@ -22,13 +22,13 @@ start_idv_from_sp complete_idv_steps_before_phone_step(user) - # Link to the USPS flow should not be visible + # Link to the GPO flow should not be visible expect(page).to_not have_content(t('idv.form.activate_by_mail')) fill_out_phone_form_ok('2342255432') click_idv_continue - # Link to the USPS flow should not be visible + # Link to the GPO flow should not be visible expect(page).to_not have_content(t('idv.form.activate_by_mail')) choose_idv_otp_delivery_method_sms diff --git a/spec/features/idv/steps/gpo_otp_verification_step_spec.rb b/spec/features/idv/steps/gpo_otp_verification_step_spec.rb new file mode 100644 index 00000000000..ff3accb22fe --- /dev/null +++ b/spec/features/idv/steps/gpo_otp_verification_step_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +feature 'idv gpo otp verification step' do + include IdvStepHelper + + it_behaves_like 'gpo otp verification step' + it_behaves_like 'gpo otp verification step', :oidc + it_behaves_like 'gpo otp verification step', :saml + + context 'with GPO proofing disabled it still lets users with a letter verify' do + it_behaves_like 'gpo otp verification step' + it_behaves_like 'gpo otp verification step', :oidc + it_behaves_like 'gpo otp verification step', :saml + end +end diff --git a/spec/features/idv/steps/usps_step_spec.rb b/spec/features/idv/steps/gpo_step_spec.rb similarity index 79% rename from spec/features/idv/steps/usps_step_spec.rb rename to spec/features/idv/steps/gpo_step_spec.rb index 37042a63d7e..cd90fcd0a51 100644 --- a/spec/features/idv/steps/usps_step_spec.rb +++ b/spec/features/idv/steps/gpo_step_spec.rb @@ -1,11 +1,11 @@ require 'rails_helper' -feature 'idv usps step' do +feature 'idv gpo step' do include IdvStepHelper it 'redirects to the review step when the user chooses to verify by letter' do start_idv_from_sp - complete_idv_steps_before_usps_step + complete_idv_steps_before_gpo_step click_on t('idv.buttons.mail.send') expect(page).to have_content(t('idv.titles.session.review')) @@ -14,7 +14,7 @@ it 'allows the user to go back' do start_idv_from_sp - complete_idv_steps_before_usps_step + complete_idv_steps_before_gpo_step click_doc_auth_back_link @@ -25,17 +25,17 @@ let(:user) { user_with_2fa } it 'allows the user to resend a letter and redirects to the come back later step' do - complete_idv_and_return_to_usps_step + complete_idv_and_return_to_gpo_step expect { click_on t('idv.buttons.mail.resend') }. - to change { UspsConfirmation.count }.from(1).to(2) + to change { GpoConfirmation.count }.from(1).to(2) expect_user_to_be_unverified(user) expect(page).to have_content(t('idv.titles.come_back_later')) expect(page).to have_current_path(idv_come_back_later_path) end - it 'allows the user to return to usps otp confirmation' do - complete_idv_and_return_to_usps_step + it 'allows the user to return to gpo otp confirmation' do + complete_idv_and_return_to_gpo_step click_doc_auth_back_link expect(page).to have_content(t('forms.verify_profile.title')) @@ -43,9 +43,9 @@ expect_user_to_be_unverified(user) end - def complete_idv_and_return_to_usps_step + def complete_idv_and_return_to_gpo_step start_idv_from_sp - complete_idv_steps_before_usps_step(user) + complete_idv_steps_before_gpo_step(user) click_on t('idv.buttons.mail.send') fill_in 'Password', with: user_password click_continue @@ -54,7 +54,7 @@ def complete_idv_and_return_to_usps_step click_on t('idv.buttons.cancel') first(:link, t('links.sign_out')).click sign_in_live_with_2fa(user) - click_on t('idv.messages.usps.resend') + click_on t('idv.messages.gpo.resend') end def expect_user_to_be_unverified(user) diff --git a/spec/features/idv/steps/phone_step_spec.rb b/spec/features/idv/steps/phone_step_spec.rb index aa4791d052e..fa4c093ab6f 100644 --- a/spec/features/idv/steps/phone_step_spec.rb +++ b/spec/features/idv/steps/phone_step_spec.rb @@ -173,7 +173,7 @@ end it 'does not render the link to proof by mail if proofing by mail is disabled' do - allow(FeatureManagement).to receive(:enable_usps_verification?).and_return(false) + allow(FeatureManagement).to receive(:enable_gpo_verification?).and_return(false) start_idv_from_sp complete_idv_steps_before_phone_step diff --git a/spec/features/idv/steps/review_step_spec.rb b/spec/features/idv/steps/review_step_spec.rb index e823b9e4065..108928a82e1 100644 --- a/spec/features/idv/steps/review_step_spec.rb +++ b/spec/features/idv/steps/review_step_spec.rb @@ -52,24 +52,24 @@ profile = user.profiles.first expect(profile.active?).to eq true - expect(UspsConfirmation.count).to eq(0) + expect(GpoConfirmation.count).to eq(0) end end - context 'choosing to confirm address with usps' do + context 'choosing to confirm address with gpo' do let(:user) { user_with_2fa } let(:sp) { :oidc } before do start_idv_from_sp(sp) - complete_idv_steps_with_usps_before_review_step(user) + complete_idv_steps_with_gpo_before_review_step(user) end it 'sends a letter and creates an unverified profile' do fill_in 'Password', with: user_password expect { click_continue }. - to change { UspsConfirmation.count }.from(0).to(1) + to change { GpoConfirmation.count }.from(0).to(1) expect(user.events.account_verified.size).to be(0) expect(user.profiles.count).to eq 1 @@ -84,13 +84,13 @@ fill_in 'Password', with: user_password click_continue - usps_confirmation_entry = UspsConfirmation.last.entry + gpo_confirmation_entry = GpoConfirmation.last.entry if sp == :saml - expect(usps_confirmation_entry[:issuer]). + expect(gpo_confirmation_entry[:issuer]). to eq('https://rp1.serviceprovider.com/auth/saml/metadata') else - expect(usps_confirmation_entry[:issuer]). + expect(gpo_confirmation_entry[:issuer]). to eq('urn:gov:gsa:openidconnect:sp:server') end end @@ -103,9 +103,9 @@ fill_in 'Password', with: user_password click_continue - usps_confirmation_entry = UspsConfirmation.last.entry + gpo_confirmation_entry = GpoConfirmation.last.entry - expect(usps_confirmation_entry[:issuer]).to eq(nil) + expect(gpo_confirmation_entry[:issuer]).to eq(nil) end end end diff --git a/spec/features/idv/steps/usps_otp_verification_step_spec.rb b/spec/features/idv/steps/usps_otp_verification_step_spec.rb deleted file mode 100644 index f2102e31a52..00000000000 --- a/spec/features/idv/steps/usps_otp_verification_step_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -feature 'idv usps otp verification step' do - include IdvStepHelper - - it_behaves_like 'usps otp verfication step' - it_behaves_like 'usps otp verfication step', :oidc - it_behaves_like 'usps otp verfication step', :saml - - context 'with USPS proofing disabled it still lets users with a letter verify' do - it_behaves_like 'usps otp verfication step' - it_behaves_like 'usps otp verfication step', :oidc - it_behaves_like 'usps otp verfication step', :saml - end -end diff --git a/spec/features/reports/monthly_usps_letter_requests_report_spec.rb b/spec/features/reports/monthly_gpo_letter_requests_report_spec.rb similarity index 53% rename from spec/features/reports/monthly_usps_letter_requests_report_spec.rb rename to spec/features/reports/monthly_gpo_letter_requests_report_spec.rb index 085f973a53e..3a8b1a3304e 100644 --- a/spec/features/reports/monthly_usps_letter_requests_report_spec.rb +++ b/spec/features/reports/monthly_gpo_letter_requests_report_spec.rb @@ -1,27 +1,27 @@ require 'rails_helper' -feature 'Monthly usps letter requests report' do +feature 'Monthly gpo letter requests report' do it 'runs when there are not entries' do - results_hash = JSON.parse(Reports::MonthlyUspsLetterRequestsReport.new.call) + results_hash = JSON.parse(Reports::MonthlyGpoLetterRequestsReport.new.call) expect(results_hash['total_letter_requests']).to eq(0) expect(results_hash['daily_letter_requests'].count).to eq(0) end it 'runs when there is one ftp' do - LetterRequestsToUspsFtpLog.create(ftp_at: Time.zone.now, letter_requests_count: 3) + LetterRequestsToGpoFtpLog.create(ftp_at: Time.zone.now, letter_requests_count: 3) - results_hash = JSON.parse(Reports::MonthlyUspsLetterRequestsReport.new.call) + results_hash = JSON.parse(Reports::MonthlyGpoLetterRequestsReport.new.call) expect(results_hash['total_letter_requests']).to eq(3) expect(results_hash['daily_letter_requests'].count).to eq(1) end it 'totals correctly when there are two ftps' do now = Time.zone.now - LetterRequestsToUspsFtpLog.create(ftp_at: now.yesterday, letter_requests_count: 3) - LetterRequestsToUspsFtpLog.create(ftp_at: now, letter_requests_count: 4) + LetterRequestsToGpoFtpLog.create(ftp_at: now.yesterday, letter_requests_count: 3) + LetterRequestsToGpoFtpLog.create(ftp_at: now, letter_requests_count: 4) results_hash = JSON.parse( - Reports::MonthlyUspsLetterRequestsReport.new.call( + Reports::MonthlyGpoLetterRequestsReport.new.call( start_time: now.yesterday, end_time: now.tomorrow, ), @@ -32,10 +32,10 @@ it 'only reports on the current month' do now = Time.zone.now - LetterRequestsToUspsFtpLog.create(ftp_at: now - 32.days, letter_requests_count: 3) - LetterRequestsToUspsFtpLog.create(ftp_at: now, letter_requests_count: 4) + LetterRequestsToGpoFtpLog.create(ftp_at: now - 32.days, letter_requests_count: 3) + LetterRequestsToGpoFtpLog.create(ftp_at: now, letter_requests_count: 4) - results_hash = JSON.parse(Reports::MonthlyUspsLetterRequestsReport.new.call) + results_hash = JSON.parse(Reports::MonthlyGpoLetterRequestsReport.new.call) expect(results_hash['total_letter_requests']).to eq(4) expect(results_hash['daily_letter_requests'].count).to eq(1) end diff --git a/spec/features/saml/ial2_sso_spec.rb b/spec/features/saml/ial2_sso_spec.rb index ab8136805c4..71bbdd58ce0 100644 --- a/spec/features/saml/ial2_sso_spec.rb +++ b/spec/features/saml/ial2_sso_spec.rb @@ -5,7 +5,7 @@ include IdvStepHelper include DocAuthHelper - def perform_id_verification_with_usps_without_confirming_code(user) + def perform_id_verification_with_gpo_without_confirming_code(user) saml_authn_request = auth_request.create(ial2_with_bundle_saml_settings) visit saml_authn_request fill_in_credentials_and_submit(user.email, user.password) @@ -21,15 +21,15 @@ def perform_id_verification_with_usps_without_confirming_code(user) click_link t('idv.buttons.continue_plain') end - def expected_usps_return_to_sp_url + def expected_gpo_return_to_sp_url URI.join( ServiceProvider.find_by(issuer: ial2_with_bundle_saml_settings.issuer).acs_url, '/', ).to_s end - def mock_usps_mail_bounced - allow_any_instance_of(UserDecorator).to receive(:usps_mail_bounced?).and_return(true) + def mock_gpo_mail_bounced + allow_any_instance_of(UserDecorator).to receive(:gpo_mail_bounced?).and_return(true) end def update_mailing_address @@ -91,30 +91,30 @@ def sign_out_user it 'without signing out' do user = create(:user, :signed_up) - perform_id_verification_with_usps_without_confirming_code(user) + perform_id_verification_with_gpo_without_confirming_code(user) - expect(current_url).to eq expected_usps_return_to_sp_url + expect(current_url).to eq expected_gpo_return_to_sp_url visit account_path click_link(t('account.index.verification.reactivate_button')) expect(current_path).to eq verify_account_path - click_link(t('idv.messages.usps.resend')) + click_link(t('idv.messages.gpo.resend')) expect(user.events.account_verified.size).to be(0) - expect(current_path).to eq(idv_usps_path) + expect(current_path).to eq(idv_gpo_path) click_button(t('idv.buttons.mail.resend')) - expect(user.events.usps_mail_sent.size).to eq 2 + expect(user.events.gpo_mail_sent.size).to eq 2 expect(current_path).to eq(idv_come_back_later_path) end it 'after signing out' do user = create(:user, :signed_up) - perform_id_verification_with_usps_without_confirming_code(user) + perform_id_verification_with_gpo_without_confirming_code(user) visit account_path sign_out_user @@ -122,10 +122,10 @@ def sign_out_user expect(current_path).to eq verify_account_path - click_link(t('idv.messages.usps.resend')) + click_link(t('idv.messages.gpo.resend')) expect(user.events.account_verified.size).to be(0) - expect(current_path).to eq(idv_usps_path) + expect(current_path).to eq(idv_gpo_path) click_button(t('idv.buttons.mail.resend')) @@ -137,17 +137,17 @@ def sign_out_user it 'allows the user to update the address' do user = create(:user, :signed_up) - perform_id_verification_with_usps_without_confirming_code(user) + perform_id_verification_with_gpo_without_confirming_code(user) - expect(current_url).to eq expected_usps_return_to_sp_url + expect(current_url).to eq expected_gpo_return_to_sp_url visit account_path - mock_usps_mail_bounced + mock_gpo_mail_bounced visit account_path click_link(t('account.index.verification.update_address')) - expect(current_path).to eq idv_usps_path + expect(current_path).to eq idv_gpo_path fill_out_address_form_fail click_on t('idv.buttons.mail.resend') @@ -159,25 +159,25 @@ def sign_out_user it 'throttles resolution' do user = create(:user, :signed_up) - perform_id_verification_with_usps_without_confirming_code(user) + perform_id_verification_with_gpo_without_confirming_code(user) - expect(current_url).to eq expected_usps_return_to_sp_url + expect(current_url).to eq expected_gpo_return_to_sp_url visit account_path - mock_usps_mail_bounced + mock_gpo_mail_bounced visit account_path click_link(t('account.index.verification.update_address')) - expect(current_path).to eq idv_usps_path + expect(current_path).to eq idv_gpo_path fill_out_address_form_resolution_fail click_on t('idv.buttons.mail.resend') - expect(current_path).to eq idv_usps_path + expect(current_path).to eq idv_gpo_path expect(page).to have_content(t('idv.failure.sessions.heading')) fill_out_address_form_resolution_fail click_on t('idv.buttons.mail.resend') - expect(current_path).to eq idv_usps_path + expect(current_path).to eq idv_gpo_path expect(page).to have_content(strip_tags(t('idv.failure.sessions.heading'))) end end diff --git a/spec/features/users/verify_profile_spec.rb b/spec/features/users/verify_profile_spec.rb index bc5b6174de2..f1981be0e99 100644 --- a/spec/features/users/verify_profile_spec.rb +++ b/spec/features/users/verify_profile_spec.rb @@ -12,10 +12,10 @@ user: user, ) otp_fingerprint = Pii::Fingerprinter.fingerprint(otp) - create(:usps_confirmation_code, profile: profile, otp_fingerprint: otp_fingerprint) + create(:gpo_confirmation_code, profile: profile, otp_fingerprint: otp_fingerprint) end - context 'USPS letter' do + context 'GPO letter' do scenario 'valid OTP' do sign_in_live_with_2fa(user) fill_in t('forms.verify_profile.name'), with: otp @@ -26,13 +26,13 @@ end scenario 'OTP has expired' do - UspsConfirmationCode.first.update(code_sent_at: 11.days.ago) + GpoConfirmationCode.first.update(code_sent_at: 11.days.ago) sign_in_live_with_2fa(user) fill_in t('forms.verify_profile.name'), with: otp click_button t('forms.verify_profile.submit') - expect(page).to have_content t('errors.messages.usps_otp_expired') + expect(page).to have_content t('errors.messages.gpo_otp_expired') expect(current_path).to eq verify_account_path end diff --git a/spec/forms/verify_account_form_spec.rb b/spec/forms/verify_account_form_spec.rb index f0a59efaf6d..01a930803a7 100644 --- a/spec/forms/verify_account_form_spec.rb +++ b/spec/forms/verify_account_form_spec.rb @@ -15,7 +15,7 @@ next if pending_profile.blank? create( - :usps_confirmation_code, + :gpo_confirmation_code, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), code_sent_at: code_sent_at, profile: pending_profile, @@ -82,7 +82,7 @@ it 'is invalid' do result = subject.submit expect(result.success?).to eq(false) - expect(subject.errors[:otp]).to eq [t('errors.messages.usps_otp_expired')] + expect(subject.errors[:otp]).to eq [t('errors.messages.gpo_otp_expired')] end end end diff --git a/spec/lib/feature_management_spec.rb b/spec/lib/feature_management_spec.rb index bebd0458c4a..564aa6e396b 100644 --- a/spec/lib/feature_management_spec.rb +++ b/spec/lib/feature_management_spec.rb @@ -103,13 +103,13 @@ end end - describe '#reveal_usps_code?' do + describe '#reveal_gpo_code?' do context 'server domain name is dev, qa, or int' do it 'returns true' do %w[idp.dev.login.gov idp.int.login.gov idp.qa.login.gov].each do |domain| allow(AppConfig.env).to receive(:domain_name).and_return(domain) - expect(FeatureManagement.reveal_usps_code?).to eq(true) + expect(FeatureManagement.reveal_gpo_code?).to eq(true) end end end @@ -118,7 +118,7 @@ it 'returns true' do allow(Rails.env).to receive(:development?).and_return(true) - expect(FeatureManagement.reveal_usps_code?).to eq(true) + expect(FeatureManagement.reveal_gpo_code?).to eq(true) end end @@ -127,7 +127,7 @@ allow(Rails.env).to receive(:development?).and_return(false) allow(AppConfig.env).to receive(:domain_name).and_return('foo.login.gov') - expect(FeatureManagement.reveal_usps_code?).to eq(false) + expect(FeatureManagement.reveal_gpo_code?).to eq(false) end end end diff --git a/spec/models/usps_confirmation_code_spec.rb b/spec/models/gpo_confirmation_code_spec.rb similarity index 82% rename from spec/models/usps_confirmation_code_spec.rb rename to spec/models/gpo_confirmation_code_spec.rb index 20d5ce9d695..e172b6c610c 100644 --- a/spec/models/usps_confirmation_code_spec.rb +++ b/spec/models/gpo_confirmation_code_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' -RSpec.describe UspsConfirmationCode do +RSpec.describe GpoConfirmationCode do let(:otp) { 'ABC123' } let(:profile) { build(:profile) } describe '.first_with_otp' do it 'return the record with the matching OTP' do - create(:usps_confirmation_code) + create(:gpo_confirmation_code) good_confirmation_code = create( - :usps_confirmation_code, + :gpo_confirmation_code, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), ) @@ -17,7 +17,7 @@ it 'normalizes the entered otp before searching' do confirmation_code = create( - :usps_confirmation_code, + :gpo_confirmation_code, otp_fingerprint: Pii::Fingerprinter.fingerprint('ABC000'), ) @@ -25,7 +25,7 @@ end it 'returns nil if no record matches the OTP' do - create(:usps_confirmation_code) + create(:gpo_confirmation_code) expect(described_class.first_with_otp(otp)).to be_nil end @@ -34,7 +34,7 @@ describe '#expired?' do it 'returns false for a valid otp' do confirmation_code = build( - :usps_confirmation_code, + :gpo_confirmation_code, code_sent_at: Time.zone.now, ) @@ -43,7 +43,7 @@ it 'returns true for an expired otp' do confirmation_code = build( - :usps_confirmation_code, + :gpo_confirmation_code, code_sent_at: (AppConfig.env.usps_confirmation_max_days.to_i + 1).days.ago, ) diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 120de629de9..69df78873c8 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -18,7 +18,7 @@ end it { is_expected.to belong_to(:user) } - it { is_expected.to have_many(:usps_confirmation_codes).dependent(:destroy) } + it { is_expected.to have_many(:gpo_confirmation_codes).dependent(:destroy) } describe '#encrypt_pii' do subject(:encrypt_pii) { profile.encrypt_pii(pii, user.password) } diff --git a/spec/presenters/idv/usps_presenter_spec.rb b/spec/presenters/idv/gpo_presenter_spec.rb similarity index 93% rename from spec/presenters/idv/usps_presenter_spec.rb rename to spec/presenters/idv/gpo_presenter_spec.rb index 87834f2451d..e9015aa25e4 100644 --- a/spec/presenters/idv/usps_presenter_spec.rb +++ b/spec/presenters/idv/gpo_presenter_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe Idv::UspsPresenter do +RSpec.describe Idv::GpoPresenter do let(:user) { create(:user) } let(:any_mail_sent?) { false } @@ -63,6 +63,6 @@ def create_letter_send_event device = create(:device, user: user) - create(:event, user: user, device: device, event_type: :usps_mail_sent) + create(:event, user: user, device: device, event_type: :gpo_mail_sent) end end diff --git a/spec/routing/usps_verification_routing.rb b/spec/routing/gpo_verification_routing_spec.rb similarity index 69% rename from spec/routing/usps_verification_routing.rb rename to spec/routing/gpo_verification_routing_spec.rb index a31cab8d12e..40ba27c33ea 100644 --- a/spec/routing/usps_verification_routing.rb +++ b/spec/routing/gpo_verification_routing_spec.rb @@ -1,24 +1,26 @@ require 'rails_helper' -describe 'USPS verification routes' do +describe 'GPO verification routes' do GET_ROUTES = %w[ - account/verify verify/usps ].freeze CREATE_ROUTES = %w[ - account/verify + verify/usps ].freeze PUT_ROUTES = %w[ verify/usps ].freeze - context 'when FeatureManagement.enable_usps_verification? is false' do - before do - allow(AppConfig.env).to receive(:enable_usps_verification).and_return('false') - Rails.application.reload_routes! - end + before do + allow(FeatureManagement).to receive(:enable_gpo_verification?). + and_return(enable_gpo_verification) + Rails.application.reload_routes! + end + + context 'when enable_gpo_verification is false' do + let(:enable_gpo_verification) { false } after(:all) do Rails.application.reload_routes! @@ -42,11 +44,8 @@ end end - context 'when FeatureManagement.enable_usps_verification? is true' do - before do - allow(AppConfig.env).to receive(:enable_usps_verification).and_return('true') - Rails.application.reload_routes! - end + context 'when enable_gpo_verification is true' do + let(:enable_gpo_verification) { true } after(:all) do Rails.application.reload_routes! diff --git a/spec/services/usps_confirmation_exporter_spec.rb b/spec/services/gpo_confirmation_exporter_spec.rb similarity index 94% rename from spec/services/usps_confirmation_exporter_spec.rb rename to spec/services/gpo_confirmation_exporter_spec.rb index 6e2632e276b..1b4a04230f5 100644 --- a/spec/services/usps_confirmation_exporter_spec.rb +++ b/spec/services/gpo_confirmation_exporter_spec.rb @@ -1,11 +1,11 @@ require 'rails_helper' -describe UspsConfirmationExporter do +describe GpoConfirmationExporter do let(:issuer) { 'http://localhost:3000' } let(:service_provider) { ServiceProvider.from_issuer(issuer) } let(:confirmations) do [ - UspsConfirmation.new( + GpoConfirmation.new( entry: { first_name: 'John', last_name: 'Johnson', @@ -18,7 +18,7 @@ issuer: issuer, }, ), - UspsConfirmation.new( + GpoConfirmation.new( entry: { first_name: 'Söme', last_name: 'Öne', diff --git a/spec/services/usps_confirmation_maker_spec.rb b/spec/services/gpo_confirmation_maker_spec.rb similarity index 61% rename from spec/services/usps_confirmation_maker_spec.rb rename to spec/services/gpo_confirmation_maker_spec.rb index b62e2a38957..d2590c420a3 100644 --- a/spec/services/usps_confirmation_maker_spec.rb +++ b/spec/services/gpo_confirmation_maker_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe UspsConfirmationMaker do +describe GpoConfirmationMaker do let(:otp) { '123ABC' } let(:issuer) { 'this-is-an-issuer' } let(:decrypted_attributes) do @@ -28,21 +28,21 @@ allow(Base32::Crockford).to receive(:encode).and_return(otp) end - it 'should create a UspsConfirmation with the encrypted attributes' do - expect { subject.perform }.to change { UspsConfirmation.count }.from(0).to(1) + it 'should create a GpoConfirmation with the encrypted attributes' do + expect { subject.perform }.to change { GpoConfirmation.count }.from(0).to(1) - usps_confirmation = UspsConfirmation.first - entry_hash = usps_confirmation.entry + gpo_confirmation = GpoConfirmation.first + entry_hash = gpo_confirmation.entry expect(entry_hash).to eq decrypted_attributes end - it 'should create a UspsConfrimationCode with the profile and the encrypted OTP' do - expect { subject.perform }.to change { UspsConfirmationCode.count }.from(0).to(1) + it 'should create a GpoConfirmationCode with the profile and the encrypted OTP' do + expect { subject.perform }.to change { GpoConfirmationCode.count }.from(0).to(1) - usps_confirmation_code = UspsConfirmationCode.first + gpo_confirmation_code = GpoConfirmationCode.first - expect(usps_confirmation_code.profile).to eq profile - expect(usps_confirmation_code.otp_fingerprint).to eq Pii::Fingerprinter.fingerprint(otp) + expect(gpo_confirmation_code.profile).to eq profile + expect(gpo_confirmation_code.otp_fingerprint).to eq Pii::Fingerprinter.fingerprint(otp) end end diff --git a/spec/services/usps_confirmation_spec.rb b/spec/services/gpo_confirmation_spec.rb similarity index 91% rename from spec/services/usps_confirmation_spec.rb rename to spec/services/gpo_confirmation_spec.rb index cf20430d66a..ab67e551b1e 100644 --- a/spec/services/usps_confirmation_spec.rb +++ b/spec/services/gpo_confirmation_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe UspsConfirmation do +describe GpoConfirmation do let(:attributes) do { first_name: 'Homer', @@ -10,7 +10,7 @@ end let(:encryptor) { Encryption::Encryptors::SessionEncryptor.new } - subject { UspsConfirmation.create!(entry: attributes) } + subject { GpoConfirmation.create!(entry: attributes) } describe '#entry' do it 'stores the entry as an encrypted json string' do diff --git a/spec/services/usps_confirmation_uploader_spec.rb b/spec/services/gpo_confirmation_uploader_spec.rb similarity index 86% rename from spec/services/usps_confirmation_uploader_spec.rb rename to spec/services/gpo_confirmation_uploader_spec.rb index 8e11e86d6ca..4beca44f69c 100644 --- a/spec/services/usps_confirmation_uploader_spec.rb +++ b/spec/services/gpo_confirmation_uploader_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -RSpec.describe UspsConfirmationUploader do +RSpec.describe GpoConfirmationUploader do let(:uploader) { described_class.new } let(:export) { 'foo|bar' } let(:confirmations) do [ - UspsConfirmation.create!( + GpoConfirmation.create!( entry: { first_name: 'John', last_name: 'Johnson', @@ -29,8 +29,8 @@ describe '#generate_export' do subject { uploader.send(:generate_export, confirmations) } - it 'generates an export using the UspsConfirmationExporter and all current UspsConfirmations' do - expect(subject).to eq(UspsConfirmationExporter.new(confirmations).run) + it 'generates an export using the GpoConfirmationExporter and all current GpoConfirmations' do + expect(subject).to eq(GpoConfirmationExporter.new(confirmations).run) end end @@ -38,7 +38,7 @@ subject { uploader.send(:clear_confirmations, confirmations) } it 'deletes the provided confirmations' do - exist = ->(confirmation) { UspsConfirmation.exists?(confirmation.id) } + exist = ->(confirmation) { GpoConfirmation.exists?(confirmation.id) } expect(confirmations.all?(&exist)).to eq(true) @@ -62,7 +62,7 @@ subject end - it 'does not upload when USPS upload is disabled' do + it 'does not upload when GPO upload is disabled' do allow(AppConfig.env).to receive(:usps_upload_enabled).and_return('false') expect(Net::SFTP).to_not receive(:start) @@ -82,7 +82,7 @@ subject - logs = LetterRequestsToUspsFtpLog.all + logs = LetterRequestsToGpoFtpLog.all expect(logs.count).to eq(1) log = logs.first expect(log.ftp_at).to be_present @@ -100,7 +100,7 @@ expect { subject }.to_not raise_error - expect(UspsConfirmation.count).to eq 1 + expect(GpoConfirmation.count).to eq 1 end end end diff --git a/spec/services/usps_daily_test_sender_spec.rb b/spec/services/gpo_daily_test_sender_spec.rb similarity index 69% rename from spec/services/usps_daily_test_sender_spec.rb rename to spec/services/gpo_daily_test_sender_spec.rb index 03925ba4733..30c158b47c6 100644 --- a/spec/services/usps_daily_test_sender_spec.rb +++ b/spec/services/gpo_daily_test_sender_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -RSpec.describe UspsDailyTestSender do - subject(:sender) { UspsDailyTestSender.new } +RSpec.describe GpoDailyTestSender do + subject(:sender) { GpoDailyTestSender.new } let(:designated_receiver_pii) do { @@ -20,24 +20,24 @@ end describe '#run' do - it 'creates a USPS confirmation and code for the current date' do + it 'creates a GPO confirmation and code for the current date' do expect { sender.run }. - to(change { UspsConfirmation.count }.by(1).and(change { UspsConfirmationCode.count }.by(1))) + to(change { GpoConfirmation.count }.by(1).and(change { GpoConfirmationCode.count }.by(1))) - usps_confirmation_code = UspsConfirmationCode.find_by( + gpo_confirmation_code = GpoConfirmationCode.find_by( otp_fingerprint: Pii::Fingerprinter.fingerprint(sender.otp_from_date), ) - expect(usps_confirmation_code).to_not be_nil - expect(usps_confirmation_code.profile_id).to eq(-1) + expect(gpo_confirmation_code).to_not be_nil + expect(gpo_confirmation_code.profile_id).to eq(-1) end context 'when the designed receiver PII is missing' do let(:designated_receiver_pii) { '' } - it 'does not create usps records' do + it 'does not create gpo records' do expect { sender.run }. - to(change { UspsConfirmation.count }.by(0). - and(change { UspsConfirmationCode.count }.by(0))) + to(change { GpoConfirmation.count }.by(0). + and(change { GpoConfirmationCode.count }.by(0))) end it 'does not blow up (so the calling job can continue normally) and notifies NewRelic' do diff --git a/spec/services/idv/usps_mail_spec.rb b/spec/services/idv/gpo_mail_spec.rb similarity index 74% rename from spec/services/idv/usps_mail_spec.rb rename to spec/services/idv/gpo_mail_spec.rb index 67e31e0bb4e..50d05790bfc 100644 --- a/spec/services/idv/usps_mail_spec.rb +++ b/spec/services/idv/gpo_mail_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe Idv::UspsMail do +describe Idv::GpoMail do let(:user) { create(:user) } - let(:subject) { Idv::UspsMail.new(user) } + let(:subject) { Idv::GpoMail.new(user) } describe '#mail_spammed?' do context 'when no mail has been sent' do @@ -13,7 +13,7 @@ context 'when the amount of sent mail is lower than the allowed maximum' do it 'returns false' do - event_create(event_type: :usps_mail_sent, user: user) + event_create(event_type: :gpo_mail_sent, user: user) expect(subject.mail_spammed?).to eq false end @@ -21,15 +21,15 @@ context 'when too much mail has been sent' do it 'returns true if the oldest event was within the last month' do - event_create(event_type: :usps_mail_sent, user: user, updated_at: 2.weeks.ago) - event_create(event_type: :usps_mail_sent, user: user, updated_at: 1.week.ago) + event_create(event_type: :gpo_mail_sent, user: user, updated_at: 2.weeks.ago) + event_create(event_type: :gpo_mail_sent, user: user, updated_at: 1.week.ago) expect(subject.mail_spammed?).to eq true end it 'returns false if the oldest event was more than a month ago' do - event_create(event_type: :usps_mail_sent, user: user, updated_at: 2.weeks.ago) - event_create(event_type: :usps_mail_sent, user: user, updated_at: 2.months.ago) + event_create(event_type: :gpo_mail_sent, user: user, updated_at: 2.weeks.ago) + event_create(event_type: :gpo_mail_sent, user: user, updated_at: 2.months.ago) expect(subject.mail_spammed?).to eq false end @@ -37,8 +37,8 @@ context 'when MAX_MAIL_EVENTS or MAIL_EVENTS_WINDOW_DAYS are zero' do it 'returns false' do - stub_const 'Idv::UspsMail::MAX_MAIL_EVENTS', 0 - stub_const 'Idv::UspsMail::MAIL_EVENTS_WINDOW_DAYS', 0 + stub_const 'Idv::GpoMail::MAX_MAIL_EVENTS', 0 + stub_const 'Idv::GpoMail::MAIL_EVENTS_WINDOW_DAYS', 0 expect(subject.mail_spammed?).to eq false end diff --git a/spec/services/idv/session_spec.rb b/spec/services/idv/session_spec.rb index 66c2cb8ae71..fae5e37ec12 100644 --- a/spec/services/idv/session_spec.rb +++ b/spec/services/idv/session_spec.rb @@ -120,13 +120,19 @@ end end - it 'returns true if the user has selected usps address verification' do + it 'returns true if the user has selected gpo address verification (legacy value)' do subject.address_verification_mechanism = 'usps' expect(subject.address_mechanism_chosen?).to eq(true) end - it 'returns false if the user has not selected phone or usps address verification' do + it 'returns true if the user has selected gpo address verification' do + subject.address_verification_mechanism = 'gpo' + + expect(subject.address_mechanism_chosen?).to eq(true) + end + + it 'returns false if the user has not selected phone or gpo address verification' do subject.address_verification_mechanism = nil expect(subject.address_mechanism_chosen?).to eq(false) diff --git a/spec/services/reports/usps_report_spec.rb b/spec/services/reports/gpo_report_spec.rb similarity index 95% rename from spec/services/reports/usps_report_spec.rb rename to spec/services/reports/gpo_report_spec.rb index dcb395a403a..74e2035230f 100644 --- a/spec/services/reports/usps_report_spec.rb +++ b/spec/services/reports/gpo_report_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe Reports::UspsReport do +describe Reports::GpoReport do subject { described_class } let(:empty_report) do { @@ -43,7 +43,7 @@ end def create_ucc_for(profile) - UspsConfirmationCode.create( + GpoConfirmationCode.create( profile: profile, otp_fingerprint: 'foo', ) diff --git a/spec/services/send_expired_letter_notifications_spec.rb b/spec/services/send_expired_letter_notifications_spec.rb index 2d87c0020ca..e1ba3e11b44 100644 --- a/spec/services/send_expired_letter_notifications_spec.rb +++ b/spec/services/send_expired_letter_notifications_spec.rb @@ -7,9 +7,9 @@ describe '#call' do context 'after the letters expire' do it 'does not send notifications when the notifications were already sent' do - usps_confirmation_code = create_ucc_for(profile) - usps_confirmation_code.letter_expired_sent_at = Time.zone.now - usps_confirmation_code.save + gpo_confirmation_code = create_ucc_for(profile) + gpo_confirmation_code.letter_expired_sent_at = Time.zone.now + gpo_confirmation_code.save after_the_letters_expire do SendExpiredLetterNotifications.new.call @@ -19,9 +19,9 @@ end it 'does not send notifications when the letters bounced' do - usps_confirmation_code = create_ucc_for(profile) - usps_confirmation_code.bounced_at = Time.zone.now - usps_confirmation_code.save + gpo_confirmation_code = create_ucc_for(profile) + gpo_confirmation_code.bounced_at = Time.zone.now + gpo_confirmation_code.save after_the_letters_expire do notifications_sent = SendExpiredLetterNotifications.new.call @@ -51,7 +51,7 @@ end def create_ucc_for(profile) - UspsConfirmationCode.create( + GpoConfirmationCode.create( profile: profile, otp_fingerprint: 'foo', ) diff --git a/spec/services/undeliverable_address_notifier_spec.rb b/spec/services/undeliverable_address_notifier_spec.rb index dd7717e65dd..e7d839b2c22 100644 --- a/spec/services/undeliverable_address_notifier_spec.rb +++ b/spec/services/undeliverable_address_notifier_spec.rb @@ -10,9 +10,9 @@ pii: { ssn: '123-45-6789', dob: '1970-01-01' }, ) end - let(:usps_confirmation_code) do + let(:gpo_confirmation_code) do create( - :usps_confirmation_code, + :gpo_confirmation_code, profile: profile, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), ) @@ -24,7 +24,7 @@ notifications_sent = subject.call expect(notifications_sent).to eq(1) - expect(UspsConfirmationCode.first.bounced_at).to be_present + expect(GpoConfirmationCode.first.bounced_at).to be_present end it 'does not send out notifications to the same user twice after processing twice' do @@ -59,7 +59,7 @@ def create_test_data end def mock_data - usps_confirmation_code + gpo_confirmation_code user temp_file = Tempfile.new('foo') File.open(temp_file.path, 'w') do |file| diff --git a/spec/support/controller_helper.rb b/spec/support/controller_helper.rb index 948b9c1fd4e..7f5180880ae 100644 --- a/spec/support/controller_helper.rb +++ b/spec/support/controller_helper.rb @@ -53,8 +53,8 @@ def stub_decorated_user_with_pending_profile(user) decorated_user end - def stub_usps_mail_bounced(decorated_user) - allow(decorated_user).to receive(:usps_mail_bounced?).and_return(true) + def stub_gpo_mail_bounced(decorated_user) + allow(decorated_user).to receive(:gpo_mail_bounced?).and_return(true) end def stub_identity(user, params) diff --git a/spec/support/features/idv_step_helper.rb b/spec/support/features/idv_step_helper.rb index a43c92f4bcd..523c5cb342c 100644 --- a/spec/support/features/idv_step_helper.rb +++ b/spec/support/features/idv_step_helper.rb @@ -21,7 +21,7 @@ def complete_idv_steps_before_phone_step(user = user_with_2fa) complete_all_doc_auth_steps end - def complete_idv_steps_before_usps_step(user = user_with_2fa) + def complete_idv_steps_before_gpo_step(user = user_with_2fa) complete_idv_steps_before_phone_step(user) click_on t('idv.form.activate_by_mail') end @@ -55,13 +55,13 @@ def complete_idv_steps_with_phone_before_confirmation_step(user = user_with_2fa) alias complete_idv_steps_before_confirmation_step complete_idv_steps_with_phone_before_confirmation_step # rubocop:enable Layout/LineLength - def complete_idv_steps_with_usps_before_review_step(user = user_with_2fa) - complete_idv_steps_before_usps_step(user) + def complete_idv_steps_with_gpo_before_review_step(user = user_with_2fa) + complete_idv_steps_before_gpo_step(user) click_on t('idv.buttons.mail.send') end - def complete_idv_steps_with_usps_before_confirmation_step(user = user_with_2fa) - complete_idv_steps_with_usps_before_review_step(user) + def complete_idv_steps_with_gpo_before_confirmation_step(user = user_with_2fa) + complete_idv_steps_with_gpo_before_review_step(user) password = user.password || user_password fill_in 'Password', with: password click_continue diff --git a/spec/support/idv_examples/clearing_and_restarting.rb b/spec/support/idv_examples/clearing_and_restarting.rb index 835f3e0d99a..be2f5668f49 100644 --- a/spec/support/idv_examples/clearing_and_restarting.rb +++ b/spec/support/idv_examples/clearing_and_restarting.rb @@ -14,7 +14,7 @@ expect(user.reload.decorate.identity_verified?).to eq(true) end - it 'allows the user to retry verification with usps' do + it 'allows the user to retry verification with gpo' do click_on t('idv.messages.clear_and_start_over') expect(user.reload.decorate.pending_profile?).to eq(false) @@ -30,13 +30,13 @@ click_idv_continue click_acknowledge_personal_key - usps_confirmation = UspsConfirmation.order(created_at: :desc).first + gpo_confirmation = GpoConfirmation.order(created_at: :desc).first expect(page).to have_content(t('idv.messages.come_back_later', app: APP_NAME)) expect(page).to have_current_path(idv_come_back_later_path) expect(user.reload.decorate.identity_verified?).to eq(false) expect(user.decorate.pending_profile?).to eq(true) - expect(usps_confirmation.entry[:address1]).to eq('1 FAKE RD') + expect(gpo_confirmation.entry[:address1]).to eq('1 FAKE RD') end it 'deletes decrypted PII from the session and does not display it on the account page' do diff --git a/spec/support/idv_examples/confirmation_step.rb b/spec/support/idv_examples/confirmation_step.rb index fe1718068cc..f7001ded836 100644 --- a/spec/support/idv_examples/confirmation_step.rb +++ b/spec/support/idv_examples/confirmation_step.rb @@ -2,7 +2,7 @@ context 'after choosing to verify by letter' do before do start_idv_from_sp(sp) - complete_idv_steps_with_usps_before_confirmation_step + complete_idv_steps_with_gpo_before_confirmation_step end it 'redirects to the come back later url then to the sp or account' do diff --git a/spec/support/idv_examples/usps_otp_verification_step.rb b/spec/support/idv_examples/gpo_otp_verification_step.rb similarity index 75% rename from spec/support/idv_examples/usps_otp_verification_step.rb rename to spec/support/idv_examples/gpo_otp_verification_step.rb index 0b93fce2d0a..ce440499d6b 100644 --- a/spec/support/idv_examples/usps_otp_verification_step.rb +++ b/spec/support/idv_examples/gpo_otp_verification_step.rb @@ -1,4 +1,4 @@ -shared_examples 'usps otp verfication step' do |sp| +shared_examples 'gpo otp verification step' do |sp| let(:otp) { 'ABC123' } let(:profile) do create( @@ -7,9 +7,9 @@ pii: { ssn: '123-45-6789', dob: '1970-01-01' }, ) end - let(:usps_confirmation_code) do + let(:gpo_confirmation_code) do create( - :usps_confirmation_code, + :gpo_confirmation_code, profile: profile, otp_fingerprint: Pii::Fingerprinter.fingerprint(otp), ) @@ -20,9 +20,9 @@ sign_in_from_sp(sp) expect(current_path).to eq verify_account_path - expect(page).to have_content t('idv.messages.usps.resend') + expect(page).to have_content t('idv.messages.gpo.resend') - usps_confirmation_code + gpo_confirmation_code fill_in t('forms.verify_profile.name'), with: otp click_button t('forms.verify_profile.submit') @@ -46,15 +46,15 @@ end end - it 'renders an error for an expired USPS OTP' do + it 'renders an error for an expired GPO OTP' do sign_in_from_sp(sp) - usps_confirmation_code.update(code_sent_at: 11.days.ago) + gpo_confirmation_code.update(code_sent_at: 11.days.ago) fill_in t('forms.verify_profile.name'), with: otp click_button t('forms.verify_profile.submit') expect(current_path).to eq verify_account_path - expect(page).to have_content t('errors.messages.usps_otp_expired') + expect(page).to have_content t('errors.messages.gpo_otp_expired') user.reload @@ -67,17 +67,17 @@ sign_in_from_sp(sp) - expect(UspsConfirmation.count).to eq(0) - expect(UspsConfirmationCode.count).to eq(0) + expect(GpoConfirmation.count).to eq(0) + expect(GpoConfirmationCode.count).to eq(0) - click_on t('idv.messages.usps.resend') + click_on t('idv.messages.gpo.resend') click_on t('idv.buttons.mail.send') - expect(UspsConfirmation.count).to eq(1) - expect(UspsConfirmationCode.count).to eq(1) + expect(GpoConfirmation.count).to eq(1) + expect(GpoConfirmationCode.count).to eq(1) expect(current_path).to eq idv_come_back_later_path - confirmation_code = UspsConfirmationCode.first + confirmation_code = GpoConfirmationCode.first otp_fingerprint = Pii::Fingerprinter.fingerprint(otp) expect(confirmation_code.otp_fingerprint).to eq(otp_fingerprint) diff --git a/spec/view_models/account_show_spec.rb b/spec/view_models/account_show_spec.rb index 4244dcbc9e8..6c0e561231c 100644 --- a/spec/view_models/account_show_spec.rb +++ b/spec/view_models/account_show_spec.rb @@ -2,8 +2,8 @@ describe AccountShow do describe '#pending_profile_partial' do - context 'user needs profile usps verification' do - it 'returns the accounts/pending_profile_usps partial' do + context 'user needs profile gpo verification' do + it 'returns the accounts/pending_profile_gpo partial' do user = User.new.decorate allow(user).to receive(:pending_profile_requires_verification?).and_return(true) profile_index = AccountShow.new( @@ -11,7 +11,7 @@ locked_for_session: false ) - expect(profile_index.pending_profile_partial).to eq 'accounts/pending_profile_usps' + expect(profile_index.pending_profile_partial).to eq 'accounts/pending_profile_gpo' end end diff --git a/spec/views/idv/usps/index.html.erb_spec.rb b/spec/views/idv/gpo/index.html.erb_spec.rb similarity index 84% rename from spec/views/idv/usps/index.html.erb_spec.rb rename to spec/views/idv/gpo/index.html.erb_spec.rb index 80bf24f813a..fb5c9f4b0cc 100644 --- a/spec/views/idv/usps/index.html.erb_spec.rb +++ b/spec/views/idv/gpo/index.html.erb_spec.rb @@ -1,19 +1,19 @@ require 'rails_helper' -describe 'idv/usps/index.html.erb' do - let(:usps_mail_bounced) { false } +describe 'idv/gpo/index.html.erb' do + let(:gpo_mail_bounced) { false } let(:letter_already_sent) { false } let(:user_needs_address_otp_verification) { false } let(:go_back_path) { nil } let(:presenter) do user = build_stubbed(:user, :signed_up) - Idv::UspsPresenter.new(user, {}) + Idv::GpoPresenter.new(user, {}) end before do allow(view).to receive(:go_back_path).and_return(go_back_path) - allow(presenter).to receive(:usps_mail_bounced?).and_return(usps_mail_bounced) + allow(presenter).to receive(:gpo_mail_bounced?).and_return(gpo_mail_bounced) allow(presenter).to receive(:letter_already_sent?).and_return(letter_already_sent) allow(presenter).to receive(:user_needs_address_otp_verification?). and_return(user_needs_address_otp_verification) @@ -39,11 +39,11 @@ end end - context 'usps mail bounced' do - let(:usps_mail_bounced) { true } + context 'gpo mail bounced' do + let(:gpo_mail_bounced) { true } it 'renders address form to resend letter' do - expect(rendered).to have_content(I18n.t('idv.messages.usps.new_address')) + expect(rendered).to have_content(I18n.t('idv.messages.gpo.new_address')) expect(rendered).to have_field(t('idv.form.address1')) expect(rendered).to have_button(I18n.t('idv.buttons.mail.resend')) end