Skip to content

Commit

Permalink
23332 - Enable request restoration NR for a limited restored company (b…
Browse files Browse the repository at this point in the history
…cgov#786)

* Added check for limited restoration

* Added condition to use exact look up (BusinessFetch) component for restoration NRs
  • Loading branch information
AimeeGao authored and meawong committed Jan 3, 2025
1 parent 5156bbf commit 76a2a77
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.5.14",
"version": "5.5.15",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
26 changes: 14 additions & 12 deletions app/src/components/new-request/business-fetch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,22 @@ export default class BusinessFetch extends Vue {
const valid = this.validate()
if (!valid) return
// perform search
this.state = States.SEARCHING
this.searchField = this.searchField.replace(' ', '').toUpperCase()
const result = await this.searchBusiness(this.searchField).catch(() => {})
try {
// perform search
this.state = States.SEARCHING
this.searchField = this.searchField.replace(' ', '').toUpperCase()
const result = await this.searchBusiness(this.searchField)
// return result
if (result) {
this.state = States.SUMMARY
return result
// return result
if (result) {
this.state = States.SUMMARY
return result
}
} catch (error) {
// show actual error message
this.state = States.INITIAL
this.errorMessages = [(error as Error).message || 'Business not found']
}
// show error
this.state = States.INITIAL
this.errorMessages = ['Business not found']
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
:md="md"
>
<template v-if="!getSearchBusiness">
<BusinessLookup
v-if="isAuthenticated"
:searchStatus="lookupActiveOrHistorical"
@business="onBusiness($event)"
/>
<BusinessFetch
v-else
v-if="isRestoration"
@business="onBusiness($event)"
/>
<template v-else>
<BusinessLookup
v-if="isAuthenticated"
:searchStatus="lookupActiveOrHistorical"
@business="onBusiness($event)"
/>
<BusinessFetch
v-else
@business="onBusiness($event)"
/>
</template>
</template>
<v-form
v-else
Expand Down
9 changes: 9 additions & 0 deletions app/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +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)
// 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 76a2a77

Please sign in to comment.