Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15600 Merge Legal Name branch into main branch #557

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ VUE_APP_BUSINESS_EDIT_URL="https://dev.edit.business.bcregistry.gov.bc.ca/"
#vaults API
VUE_APP_AUTH_API_URL="https://auth-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_AUTH_API_VERSION="/api/v1"
VUE_APP_LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca"
# for Legal Name feature branch only:
VUE_APP_LEGAL_API_URL="https://business-api-dy4loprnwa-nn.a.run.app"
#VUE_APP_LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_LEGAL_API_VERSION_2="/api/v2"
VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_STATUS_API_VERSION="/api/v1"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: BUSINESS FILINGS UI CD
name: BUSINESS FILINGS UI CD - legal name

on:
push:
branches:
- main
- feature-legal-name
workflow_dispatch:
inputs:
environment:
Expand All @@ -27,6 +27,6 @@ jobs:
environment: ${{ inputs.environment }}
tagname: ${{ inputs.tagname }}
secrets:
APP_NAME: "business-filings"
APP_NAME: "business-filings-le"
OP_CONNECT_URL: ${{ secrets.OP_CONNECT_URL }}
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
4 changes: 2 additions & 2 deletions devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ VUE_APP_BUSINESS_EDIT_URL="op://web-url/$APP_ENV/business-edit/BUSINESS_EDIT_URL
#vaults API
VUE_APP_AUTH_API_URL="op://API/$APP_ENV/auth-api/AUTH_API_URL"
VUE_APP_AUTH_API_VERSION="op://API/$APP_ENV/auth-api/AUTH_API_VERSION"
VUE_APP_LEGAL_API_URL="op://API/$APP_ENV/legal-api/LEGAL_API_URL"
VUE_APP_LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api/LEGAL_API_VERSION_2"
#VUE_APP_LEGAL_API_URL="op://API/$APP_ENV/legal-api-le/LEGAL_API_URL"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please uncomment this.

VUE_APP_LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api-le/LEGAL_API_VERSION_2"
VUE_APP_STATUS_API_URL="op://API/$APP_ENV/status-api/STATUS_API_URL"
VUE_APP_STATUS_API_VERSION="op://API/$APP_ENV/status-api/STATUS_API_VERSION"
VUE_APP_PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL"
Expand Down
2 changes: 1 addition & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{ "key" : "X-XSS-Protection", "value" : "1; mode=block" },
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;"
"value": "default-src 'self'; frame-src 'self' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.gov.bc.ca *.hotjar.com *.googleapis.com https://*.nr-data.net https://*.newrelic.com https://*.cac1.pure.cloud; style-src 'self' 'unsafe-inline' *.cloudflare.com *.googleapis.com; font-src 'self' *.gov.bc.ca *.hotjar.com *.cloudflare.com *.googleapis.com *.gstatic.com *.jsdelivr.net; img-src 'self' data: *.hotjar.com https://*.cac1.pure.cloud; connect-src 'self' *.gov.bc.ca *.run.app *.launchdarkly.com *.hotjar.com *.postescanada-canadapost.ca *.sentry.io *.apigee.net wss://*.hotjar.com *.hotjar.io https://*.nr-data.net https://shyrka-prod-cac1.s3.ca-central-1.amazonaws.com https://*.newrelic.com https://*.cac1.pure.cloud wss://*.cac1.pure.cloud; manifest-src 'self'; media-src 'self' https://*.cac1.pure.cloud; object-src 'self' https://*.cac1.pure.cloud; child-src 'self' https://*.cac1.pure.cloud;"
},
{ "key": "Cache-Control", "value": "no-cache, no-store, must-revalidate"},
{ "key": "Pragma", "value": "no-cache"},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-filings-ui",
"version": "6.9.0",
"version": "6.10.0",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
10 changes: 10 additions & 0 deletions src/interfaces/business-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ export interface AllowedActionsIF {
}
}

/** The Alternate Name (aka operating name) object. */
export interface AlternateNameIF {
entityType: CorpTypeCd
identifier: string
nameRegisteredDate: ApiDateTimeUtc
nameStartDate: IsoDatePacific
operatingName: string
}

export interface BusinessWarningIF {
code: string // FUTURE: use an enum
filing?: string // not used
Expand All @@ -27,6 +36,7 @@ export interface BusinessWarningIF {
export interface ApiBusinessIF {
adminFreeze: boolean
allowedActions: AllowedActionsIF
alternateNames?: Array<AlternateNameIF>
arMaxDate?: IsoDatePacific // not used
arMinDate?: IsoDatePacific // not used
associationType: string // COOP only
Expand Down
16 changes: 11 additions & 5 deletions src/stores/businessStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,15 @@ export const useBusinessStore = defineStore('business', {
return state.businessInfo.lastDirectorChangeDate
},

/** The legal name. */
/** The legal name, or operating name if is firm. */
getLegalName (state: BusinessStateIF): string {
return state.businessInfo.legalName
return (this.isFirm && this.getOperatingName) ? this.getOperatingName : state.businessInfo.legalName
},

getOperatingName (state: BusinessStateIF): string {
const { alternateNames, identifier } = state.businessInfo
const operatingName = alternateNames?.find((x) => x.identifier === identifier)?.operatingName
return operatingName || null
},

/** The legal type. */
Expand Down Expand Up @@ -277,17 +283,17 @@ export const useBusinessStore = defineStore('business', {
return new Promise((resolve, reject) => {
const businessId = sessionStorage.getItem('BUSINESS_ID')

// if there is no business id, return error
// If there is no business id, return an error.
if (!businessId) {
reject(new Error('Missing business id'))
return
}

LegalServices.fetchBusiness(businessId)
.then(businessInfo => {
// set data to store
// Set data to store
this.setBusinessInfo(businessInfo)
// return the business info object
// Return the business info object
resolve(businessInfo)
})
.catch(error => {
Expand Down
52 changes: 52 additions & 0 deletions tests/unit/EntityHeader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,55 @@ describe('Entity Header - AUTHORIZED TO CONTINUE OUT badge', () => {
})
})
})

describe('Entity Header - Operating Name', () => {
const router = mockRouter.mock()
it('displays operating name if firm', async () => {
// set store properties
businessStore.setBusinessInfo(
{
legalName: 'My Business',
alternateNames: [
{
operatingName: 'Wayne Enterprises'
}
]
} as any
)
businessStore.setGoodStanding(true)
businessStore.setLegalType(CorpTypeCd.SOLE_PROP)
// mount the component and wait for everything to stabilize
const wrapper = shallowMount(EntityHeader, {
vuetify,
router,
propsData: { businessId: 'FM1052377', tempRegNumber: null }
})
await Vue.nextTick()
// verify displayed text
expect(wrapper.find('#entity-legal-name').text()).toBe('Wayne Enterprises')
})

it('displays legal name if not firm', async () => {
businessStore.setBusinessInfo(
{
legalName: 'My Business',
alternateNames: [
{
operatingName: 'Wayne Enterprises'
}
]
} as any
)
businessStore.setGoodStanding(true)
businessStore.setLegalType(CorpTypeCd.BENEFIT_COMPANY)
// mount the component and wait for everything to stabilize
const wrapper = shallowMount(EntityHeader, {
vuetify,
router,
propsData: { businessId: 'BC1052377', tempRegNumber: null }
})
await Vue.nextTick()
// verify displayed text
expect(wrapper.find('#entity-legal-name').text()).toBe('My Business')
})
})