Skip to content

LG-7819: Modify enrollment creation CLI tool to create enrollments in USPS API#7302

Merged
NavaTim merged 5 commits intomainfrom
tbradley/lg-7819-usps-ippaas-job-create-via-api
Nov 9, 2022
Merged

LG-7819: Modify enrollment creation CLI tool to create enrollments in USPS API#7302
NavaTim merged 5 commits intomainfrom
tbradley/lg-7819-usps-ippaas-job-create-via-api

Conversation

@NavaTim
Copy link
Contributor

@NavaTim NavaTim commented Nov 5, 2022

🎫 Ticket

LG-7876

🛠 Summary of changes

  • Add new env var flag CREATE_PENDING_ENROLLMENT_IN_USPS to dev:random_in_person_users task
    • Creates enrollments via the USPS API if that is configured for the application

📜 Testing Plan

  1. Update application.yml config:
    • Set usps_mock_fallback to false
    • Set values corresponding to a sandbox environment for the following:
      • usps_ipp_root_url
      • usps_ipp_username
      • usps_ipp_password
      • usps_ipp_sponsor_id
      • usps_ipp_client_id
  2. If you created users with the dev CLI tools before, then make sure they don't have pending enrollments, for example:
echo 'ActiveRecord::Base.connection.execute("TRUNCATE in_person_enrollments RESTART IDENTITY")' | bundle exec rails console
  1. Run the command:
# Create one user and configure a pending enrollment with corresponding USPS records
bundle exec rails dev:random_in_person_users NUM_USERS='1' SCRYPT_COST='800$8$1$' CREATE_PENDING_ENROLLMENT_IN_USPS='1'

If you want to see more details of the USPS IPPaaS requests, then you can temporarily add a line like the following to UspsInPersonProofing::Proofer.faraday. DO NOT do this in a deployed environment where the data could be ingested into logs.

conn.response :logger, nil, { headers: true, bodies: true }

… USPS API

changelog: Internal, In-Person Proofing, Update enrollment CLI tool to support enrollment creation in USPS IPPaaS API
@NavaTim NavaTim requested review from a team and sheldon-b November 5, 2022 01:00
Copy link
Contributor

@sheldon-b sheldon-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left a couple suggestions, none blocking

Comment on lines +106 to +108
usps_compatible_number_alternative = n.to_s.chars.map do |c|
('a'.ord + c.to_i).chr
end.join('')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment here would aid readability, something as simple as

# Convert index to a string of letters to be a valid last name for the USPS API

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

last_name: "User #{n}",
last_name: "User #{usps_compatible_number_alternative}",
dob: '1970-05-01',
ssn: "666-#{n}", # doesn't need to be legit 9 digits, just unique
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry about duplicates across multiple runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicates are expected, and that's fine.

@NavaTim NavaTim merged commit 6756096 into main Nov 9, 2022
@NavaTim NavaTim deleted the tbradley/lg-7819-usps-ippaas-job-create-via-api branch November 9, 2022 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants