If a license check was last performed over an hour ago, or if a user has provided a business name and address automatically query the DCA databases for license information.
All updates are made to the userRouter. When a user requests data from the backend, if conditions are correct the check is performed. The check is dependent on either having previously performed a successful license check or providing the information necessary to conduct a check via the profile.
Steps to Test
Using information from a previous license check
Create a business that can conduct a license check
Ex: Poppy with cosmetology industry
Conduct a license search that successfully returns license data
Wait one hour (or fudge the data in the database 🙈)
Refresh the page to initiate a license data fetch from the backend
licenseData.lastUpdatedISO will reflect the most recent fetch
will either need to look at the data returned by the API or the DB because we don't have anything in the UI that reveals this information
Using information provided in the Business Profile
Create a business that can conduct a license check
Supply a business name and address that should return data
You can get this from the Test Licenses spreadsheet.
Save the Business Profile
Refresh the page (may take one or two refreshes)
The license data should be visible in the relevant license check tasks
Note: You can also do this with an Oscar. If you get back an expired license and the license has an associated reinstatement Anytime Action, the Anytime Action should be visible in the dropdown.
Notes
The auto-check only fires for the current business. This could be changed to hit all businesses in the userData object, but I'm operating under the assumption that we want to minimize the number of requests we're making to the DCA databases. The fetch will also automatically fire when the user switches businesses so I don't think the user will notice any perceived difference in their experience.
Code author checklist
[x] I have rebased this branch from the latest main branch
[x] I have performed a self-review of my code
[x] I have created and/or updated relevant documentation on the engineering documentation website
[x] I have not used any relative imports
[x] I have pruned any instances of unused code
[x] I have not added any markdown to labels, titles and button text in config
[x] If I added/updated any values in userData (including profileData, formationData etc), then I added a new migration file
[x] I have checked for and removed instances of unused config from CMS
[x] If I added any new collections to the CMS config, then I updated the search tool and cmsCollections.ts (see CMS Additions in Engineering Reference/FAQ on the engineering documentation site)
[x] I have updated relevant .env values in both .env-template and in Bitwarden
Description
If a license check was last performed over an hour ago, or if a user has provided a business name and address automatically query the DCA databases for license information.
Ticket
This pull request resolves #186879778.
Approach
All updates are made to the userRouter. When a user requests data from the backend, if conditions are correct the check is performed. The check is dependent on either having previously performed a successful license check or providing the information necessary to conduct a check via the profile.
Steps to Test
Using information from a previous license check
licenseData.lastUpdatedISO
will reflect the most recent fetchUsing information provided in the Business Profile
Notes
The auto-check only fires for the current business. This could be changed to hit all businesses in the userData object, but I'm operating under the assumption that we want to minimize the number of requests we're making to the DCA databases. The fetch will also automatically fire when the user switches businesses so I don't think the user will notice any perceived difference in their experience.
Code author checklist
userData
(includingprofileData
,formationData
etc), then I added a new migration filecmsCollections.ts
(see CMS Additions in Engineering Reference/FAQ on the engineering documentation site).env
values in both.env-template
and in Bitwarden