Skip to content

Commit

Permalink
Validate restoration expiry date
Browse files Browse the repository at this point in the history
  • Loading branch information
AimeeGao committed Dec 18, 2024
1 parent 29a668a commit 0c906b2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,15 @@ export async function searchBusiness ({ getters }, corpNum: string): Promise<Bus
try {
// first try to find business in Entities (Legal API)
const data = await NamexServices.searchEntities(corpNum)
// Check if business is eligible for restoration NR by verifying restorationExpiryDate exists
if (getters.isRestoration && !data.restorationExpiryDate) {
throw new Error('This business is not eligible for restoration name request')
// for restoration requests, verify business eligibility
if (getters.isRestoration) {
// check if business is eligible for restoration by verifying restorationExpiryDate exists and not expired
if (!data.restorationExpiryDate ||
getters.getCurrentJsDate.toISOString().slice(0, 10) > data.restorationExpiryDate) {
throw new Error('This business is not eligible for restoration name request')
}
}

return {
identifier: data.identifier,
legalName: data.legalName,
Expand Down

0 comments on commit 0c906b2

Please sign in to comment.