-
Notifications
You must be signed in to change notification settings - Fork 166
LG-6348: Implement "Ready to verify" page content #6580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8b7807c
LG-6348: Implement "Ready to verify" static page content
aduth c4e5d36
Use full day names
aduth 49aa99d
Add final translated copy
aduth 91176aa
Update ticket reference for creating enrollment
aduth 519ad9f
Use new enrollment fields
aduth 1aebaec
Remove duplicate MarketingSite article
aduth f26906f
Use range text for days of week
aduth 34ce738
Display due date as expected by USPS enrollment
aduth 3aec4cc
Use USPS timezone in feature spec assertions
aduth ac07bc6
Timezone is already ActiveSupport::Timezone
aduth d52bc79
Omit profile from sample enrollment
aduth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 33 additions & 7 deletions
40
app/controllers/idv/in_person/ready_to_verify_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| require 'barby' | ||
| require 'barby/barcode/code_128' | ||
| require 'barby/outputter/png_outputter' | ||
|
|
||
| module Idv | ||
| module InPerson | ||
| class ReadyToVerifyPresenter | ||
| # WILLFIX: With LG-6881, confirm timezone or use deadline from enrollment response. | ||
| USPS_SERVER_TIMEZONE = ActiveSupport::TimeZone['America/New_York'] | ||
|
|
||
| delegate :selected_location_details, to: :enrollment | ||
|
|
||
| def initialize(enrollment:) | ||
| @enrollment = enrollment | ||
| end | ||
|
|
||
| def barcode_data_url | ||
| "data:image/png;base64,#{Base64.strict_encode64(barcode_image_data)}" | ||
| end | ||
|
|
||
| def formatted_due_date | ||
| due_date.in_time_zone(USPS_SERVER_TIMEZONE).strftime(I18n.t('time.formats.event_date')) | ||
| end | ||
|
|
||
| def formatted_enrollment_code | ||
| EnrollmentCodeFormatter.format(enrollment_code) | ||
| end | ||
|
|
||
| def selected_location_hours(prefix) | ||
| selected_location_details['hours'].each do |hours_candidate| | ||
| hours = hours_candidate["#{prefix}Hours"] | ||
| return localized_hours(hours) if hours | ||
| end | ||
| end | ||
|
|
||
| def needs_proof_of_address? | ||
| !enrollment.current_address_matches_id | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_reader :enrollment | ||
| delegate :enrollment_code, to: :enrollment | ||
|
|
||
| def barcode_image_data | ||
| Barby::Code128C.new(enrollment_code).to_png(margin: 0, xdim: 2) | ||
| end | ||
|
|
||
| def due_date | ||
| enrollment.created_at + IdentityConfig.store.in_person_enrollment_validity_in_days.days | ||
| end | ||
|
|
||
| def localized_hours(hours) | ||
| case hours | ||
| when 'Closed' | ||
| I18n.t('in_person_proofing.body.barcode.retail_hours_closed') | ||
| else | ||
| hours. | ||
| split(' - '). # Hyphen | ||
| map { |time| Time.zone.parse(time).strftime(I18n.t('time.formats.event_time')) }. | ||
| join(' – ') # Endash | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| module Idv | ||
| module InPerson | ||
| class EnrollmentCodeFormatter | ||
| def self.format(code) | ||
| code.gsub(/(\d{4})/, '\1-').chomp('-') | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,108 @@ | ||
| <% title t('in_person_proofing.headings.barcode') %> | ||
|
|
||
| <%= render PageHeadingComponent.new.with_content(t('in_person_proofing.headings.barcode')) %> | ||
| <% content_for(:pre_flash_content) do %> | ||
| <%= render 'shared/step_indicator', { | ||
| steps: Idv::Flows::InPersonFlow::STEP_INDICATOR_STEPS, | ||
| current_step: :go_to_the_post_office, | ||
| locale_scope: 'idv', | ||
| class: 'margin-x-neg-2 margin-top-neg-4 tablet:margin-x-neg-6 tablet:margin-top-neg-4', | ||
| } %> | ||
| <% end %> | ||
|
|
||
| <%= image_tag( | ||
| asset_url('idv/user-in-person.svg'), | ||
| width: 136, | ||
| height: 136, | ||
| class: 'display-block margin-x-auto margin-bottom-4', | ||
| ) %> | ||
|
|
||
| <%= render PageHeadingComponent.new(class: 'text-center') do %> | ||
| <%= t('in_person_proofing.headings.barcode') %> | ||
| <% end %> | ||
|
|
||
| <%= render AlertComponent.new(class: 'margin-y-4', text_tag: :div) do %> | ||
| <p class="font-sans-md margin-bottom-1"><strong><%= t('in_person_proofing.body.barcode.deadline', deadline: @presenter.formatted_due_date) %></strong></p> | ||
| <p class="margin-bottom-0"><%= t('in_person_proofing.body.barcode.deadline_restart') %></p> | ||
| <% end %> | ||
|
|
||
| <section class="border-1px border-primary-light radius-lg padding-4"> | ||
| <h2 class="margin-top-0 margin-bottom-2"><%= t('in_person_proofing.body.barcode.items_to_bring') %></h2> | ||
| <p><%= t('in_person_proofing.body.barcode.emailed_info') %></p> | ||
| <%= render ProcessListComponent.new(heading_level: :h3, class: 'margin-y-3') do |c| %> | ||
| <% c.item(heading: t('in_person_proofing.process.barcode.heading')) do %> | ||
| <p><%= t('in_person_proofing.process.barcode.info') %></p> | ||
| <figure class="display-inline-block margin-0"> | ||
| <%= image_tag( | ||
| @presenter.barcode_data_url, | ||
| skip_pipeline: true, | ||
| alt: t('in_person_proofing.process.barcode.image_alt'), | ||
| class: 'display-block margin-bottom-1', | ||
| ) %> | ||
| <figcaption class="text-center"> | ||
| <span class="usa-sr-only"><%= t('in_person_proofing.process.barcode.caption_label') %>:</span> | ||
| <%= @presenter.formatted_enrollment_code %> | ||
| </figcaption> | ||
| </figure> | ||
| <% end %> | ||
| <% c.item(heading: t('in_person_proofing.process.state_id.heading')) do %> | ||
| <p class="margin-bottom-105"><%= t('in_person_proofing.process.state_id.info') %></p> | ||
| <ul class="usa-list margin-y-105"> | ||
| <% t('in_person_proofing.process.state_id.acceptable_documents').each do |document| %> | ||
| <li><%= document %></li> | ||
| <% end %> | ||
| </ul> | ||
| <p><%= t('in_person_proofing.process.state_id.no_other_documents') %></p> | ||
| <% end %> | ||
| <% if @presenter.needs_proof_of_address? %> | ||
| <% c.item(heading: t('in_person_proofing.process.proof_of_address.heading')) do %> | ||
| <p class="margin-bottom-105"><%= t('in_person_proofing.process.proof_of_address.info') %></p> | ||
| <ul class="usa-list margin-y-105"> | ||
| <% t('in_person_proofing.process.proof_of_address.acceptable_proof').each do |proof| %> | ||
| <li><%= proof %></li> | ||
| <% end %> | ||
| </ul> | ||
| <% end %> | ||
| <% end %> | ||
| <% end %> | ||
| <p class="margin-bottom-0"> | ||
| <%= t('in_person_proofing.body.barcode.items_to_bring_questions') %> | ||
| <%= new_window_link_to( | ||
| t('in_person_proofing.body.barcode.learn_more'), | ||
| MarketingSite.help_center_article_url( | ||
| category: 'verify-your-identity', | ||
| article: 'how-to-verify-in-person', | ||
| ), | ||
| ) %> | ||
| </p> | ||
| </section> | ||
|
|
||
| <section aria-label="<%= t('in_person_proofing.body.barcode.location_details') %>" class="margin-y-4"> | ||
| <address> | ||
| <h2 class="font-sans-md margin-bottom-1"><%= @presenter.selected_location_details['name'] %></h2> | ||
| <div class="margin-bottom-1"> | ||
| <%= @presenter.selected_location_details['streetAddress'] %><br> | ||
| <%= @presenter.selected_location_details['city'] %>, | ||
| <%= @presenter.selected_location_details['state'] %> | ||
| <%= @presenter.selected_location_details['zip5'] %>-<%= @presenter.selected_location_details['zip4'] %> | ||
| </div> | ||
| <h3 class="font-sans-sm margin-y-0"><%= t('in_person_proofing.body.barcode.retail_hours') %></h3> | ||
| <div class="margin-bottom-2"> | ||
| <%= t('date.range', from: t('date.day_names')[0], to: t('date.day_names')[4]) %>: <%= @presenter.selected_location_hours(:weekday) %><br> | ||
| <%= t('date.day_names')[5] %>: <%= @presenter.selected_location_hours(:saturday) %><br> | ||
| <%= t('date.day_names')[6] %>: <%= @presenter.selected_location_hours(:sunday) %> | ||
| </div> | ||
| <div> | ||
| <span class="usa-sr-only"><%= t('in_person_proofing.body.barcode.retail_phone_label') %>: </span> | ||
| <%= @presenter.selected_location_details['phone'] %> | ||
| </div> | ||
| </address> | ||
| </section> | ||
|
|
||
| <p><%= t('in_person_proofing.body.barcode.speak_to_associate') %></p> | ||
|
|
||
| <p> | ||
| <strong><%= t('in_person_proofing.body.barcode.deadline', deadline: @presenter.formatted_due_date) %></strong> | ||
| <%= t('in_person_proofing.body.barcode.no_appointment_required') %> | ||
| </p> | ||
|
|
||
| <%= render 'idv/doc_auth/cancel', step: 'in_person_ready_to_verify' %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I'm beginning to work on LG-6343 (email notification) which is also meant to include an image of the barcode, I may plan to revise the output, since data URLs are not well-supported in email clients ([1][2][3]). The Barby gem supports a number of "Outputters", and the HTML outputter seems to be the most promising for email compatibility, and wouldn't be a big lift to swap in to use in the web layout for consistency.
I probably won't change it here now, but will revisit with the pull request for LG-6343.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(A preview of this rework can be seen at #6585)