Skip to content

Commit

Permalink
- deleted unused interface
Browse files Browse the repository at this point in the history
- moved NR expiration date check from "is valid" to "get state" to result in a better error
  • Loading branch information
Severin Beauvais committed Mar 27, 2024
1 parent 6dd4a8d commit f8dfeb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
20 changes: 1 addition & 19 deletions src/interfaces/name-request-interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NameRequestStates, NrRequestActionCodes, NrRequestTypeCodes } from '@bcrs-shared-components/enums'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { AddressIF } from './addresses-interface'
import { ApiDateTimeUtc } from './date-interfaces'

/**
Expand Down Expand Up @@ -50,7 +49,7 @@ export interface NameRequestIF {
state: NameRequestStates
}

// NB: use cloneDeep when assigning EmptyOrgPerson
// NB: use cloneDeep when assigning EmptyNameRequest
export const EmptyNameRequest: NameRequestIF = {
applicants: {} as NrApplicantIF,
consentFlag: null,
Expand All @@ -64,20 +63,3 @@ export const EmptyNameRequest: NameRequestIF = {
request_action_cd: null,
state: null
}

/**
* Interface for name request objects we submit to Legal API.
* See:
* https://github.com/bcgov/business-schemas/blob/master/src/registry_schemas/schemas/name_request.json
*/
export interface NrSchemaIF {
nrNumber: string // max 10 chars
legalName: string
legalType: CorpTypeCd
requestType: string // eg, "New Business"
status: string
expires: ApiDateTimeUtc
consent: string
submittedBy: string
address: AddressIF
}
4 changes: 3 additions & 1 deletion src/mixins/name-request-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export default class NameRequestMixin extends Vue {
isNrInvalid (nameRequest: NameRequestIF): string {
if (!nameRequest) return 'Invalid NR object'
if (!nameRequest.applicants) return 'Invalid NR applicants'
if (!nameRequest.expirationDate) return 'Invalid NR expiration date\n(NR may still be processing)'
if (!nameRequest.legalType) return 'Invalid NR legal type'
if (!this.getNrApprovedName(nameRequest)) return 'Invalid NR approved name'
if (!nameRequest.nrNum) return 'Invalid NR number'
Expand All @@ -96,6 +95,9 @@ export default class NameRequestMixin extends Vue {
// ensure a NR object is provided
if (!nameRequest) return null

// check for no expiration date -- NR may still be processing
if (!nameRequest.expirationDate) return NameRequestStates.NOT_APPROVED

// if the NR is awaiting consent, it is not consumable
// null = consent not required
// R = consent received
Expand Down

0 comments on commit f8dfeb1

Please sign in to comment.