Skip to content

Commit 6bbdd76

Browse files
committed
Merge branch 'main' of https://github.com/Jxio/sbc-auth into 21131_2
2 parents bec4abe + e78abf9 commit 6bbdd76

File tree

13 files changed

+140
-49
lines changed

13 files changed

+140
-49
lines changed

auth-api/migrations/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Generic single-database configuration.
22

3-
1. Proper usage of migrations: python manage.py db migrate
3+
1. Add a new migration: /migrations poetry run alembic revision --autogenerate -m "migration message"

auth-api/migrations/alembic.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[alembic]
44
# template used to generate migration files
5+
script_location = .
56
file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(rev)s_%%(slug)s
67

78
# set to 'true' to run the environment during

auth-api/src/auth_api/utils/util.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ def mask_email(email: str) -> str:
7474

7575
def get_request_environment():
7676
"""Return the environment corresponding to the user request."""
77-
env = None
78-
sandbox_host = current_app.config["AUTH_WEB_SANDBOX_HOST"]
79-
if os.getenv("FLASK_ENV") == "production" and sandbox_host in request.host_url:
80-
env = "sandbox"
81-
return env
77+
env_override = request.headers.get("Environment-Override")
78+
sandbox_host = current_app.config.get("AUTH_WEB_SANDBOX_HOST")
79+
is_production = os.getenv("FLASK_ENV") == "production"
80+
81+
if env_override:
82+
return env_override
83+
if is_production and sandbox_host in request.host_url:
84+
return "sandbox"
85+
return None
8286

8387

8488
def extract_numbers(input_string: str):

auth-web/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

auth-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auth-web",
3-
"version": "2.6.127",
3+
"version": "2.6.128",
44
"appName": "Auth Web",
55
"sbcName": "SBC Common Components",
66
"private": true,

auth-web/src/resources/display-mappers/product-display.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export const productDisplay = {
1010
[Product.PPR]: 'Personal Property Registry',
1111
[Product.RPPR]: 'Restricted Personal Property Registry',
1212
[Product.RPT]: 'Rural Property Tax',
13+
[Product.STRR]: 'Short-Term Rental Registry',
1314
[Product.VS]: 'Vital Statistics'
1415
}

auth-web/src/resources/table-headers/transactions-table/headers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const TransactionTableHeaders: BaseTableHeaderI[] = [
3333
{ text: productDisplay[Product.PPR], value: Product.PPR },
3434
{ text: productDisplay[Product.RPPR], value: Product.RPPR },
3535
{ text: productDisplay[Product.RPT], value: Product.RPT },
36+
{ text: productDisplay[Product.STRR], value: Product.STRR },
3637
{ text: productDisplay[Product.VS], value: Product.VS }
3738
],
3839
label: 'Application Type',

auth-web/src/services/business.services.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export default class BusinessService {
4848
return axios.get(`${ConfigHelper.getLegalAPIV2Url()}/businesses/${businessRegNumber}/filings`)
4949
}
5050

51+
static async searchFiling (filingID: string): Promise<AxiosResponse<any>> {
52+
return axios.get(`${ConfigHelper.getLegalAPIV2Url()}/businesses/filings/search/${filingID}`)
53+
}
54+
5155
static async updateFolioNumber (folioNumber: FolioNumberload): Promise<AxiosResponse<any>> {
5256
return axios.patch(`${ConfigHelper.getAuthAPIUrl()}/entities/${folioNumber.businessIdentifier}`, folioNumber)
5357
}

auth-web/src/stores/business.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export const useBusinessStore = defineStore('business', () => {
3737
const state = reactive({
3838
currentBusiness: undefined as Business,
3939
businesses: [] as Business[],
40-
removeExistingAffiliationInvitation: false
40+
removeExistingAffiliationInvitation: false,
41+
filingID: ''
4142
})
4243

4344
function $reset () {
@@ -268,6 +269,26 @@ export const useBusinessStore = defineStore('business', () => {
268269
}
269270
}
270271

272+
async function loadFiling () {
273+
const filingID = ConfigHelper.getFromSession(SessionStorageKeys.FilingIdentifierKey)
274+
state.filingID = filingID
275+
const response = await BusinessService.searchFiling(filingID).catch(() => null)
276+
if (response?.status === 200) {
277+
const businessIdentifier = response?.data.filing.business.identifier
278+
ConfigHelper.addToSession(SessionStorageKeys.BusinessIdentifierKey, businessIdentifier)
279+
280+
if (!state.currentBusiness) {
281+
state.currentBusiness = {} as Business
282+
}
283+
284+
state.currentBusiness.businessIdentifier = businessIdentifier
285+
} else if (response?.status === 404) {
286+
throw Error('No match found for Filing Number')
287+
} else {
288+
throw Error('Search failed')
289+
}
290+
}
291+
271292
async function addBusiness (payload: LoginPayload) {
272293
const requestBody: CreateAffiliationRequestBody = {
273294
businessIdentifier: payload.businessIdentifier,
@@ -558,6 +579,11 @@ export const useBusinessStore = defineStore('business', () => {
558579
ConfigHelper.removeFromSession(SessionStorageKeys.BusinessIdentifierKey)
559580
}
560581

582+
function resetFilingID (): void {
583+
state.filingID = ''
584+
ConfigHelper.removeFromSession(SessionStorageKeys.FilingIdentifierKey)
585+
}
586+
561587
async function resetBusinessPasscode (passCodeResetLoad: PasscodeResetLoad) {
562588
await BusinessService.resetBusinessPasscode(passCodeResetLoad)
563589
}
@@ -571,6 +597,7 @@ export const useBusinessStore = defineStore('business', () => {
571597
currentOrganization,
572598
syncBusinesses,
573599
loadBusiness,
600+
loadFiling,
574601
addBusiness,
575602
addNameRequest,
576603
createNamedBusiness,
@@ -589,6 +616,7 @@ export const useBusinessStore = defineStore('business', () => {
589616
saveContact,
590617
updateFolioNumber,
591618
resetCurrentBusiness,
619+
resetFilingID,
592620
resetBusinessPasscode,
593621
searchNRIndex,
594622
setRemoveExistingAffiliationInvitation,

auth-web/src/util/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export enum SessionStorageKeys {
33
KeyCloakToken = 'KEYCLOAK_TOKEN',
44
ApiConfigKey = 'AUTH_API_CONFIG',
55
BusinessIdentifierKey = 'BUSINESS_ID',
6+
FilingIdentifierKey = 'FILING_ID',
67
CurrentAccount = 'CURRENT_ACCOUNT',
78
LaunchDarklyFlags = 'LD_FLAGS',
89
ExtraProvincialUser = 'EXTRAPROVINCIAL_USER',
@@ -640,6 +641,7 @@ export enum Product {
640641
PPR = 'PPR',
641642
RPPR = 'RPPR',
642643
RPT = 'RPT',
644+
STRR = 'STRR',
643645
VS = 'VS'
644646
}
645647

auth-web/src/views/auth/staff/IncorporationSearchResultView.vue

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export default class IncorporationSearchResultView extends Vue {
8383
@Action(useOrgStore) readonly syncMembership!: (affiliatedOrganizationId: number) => Promise<Member>
8484
@Action(useOrgStore) readonly setCurrentAccountSettings!: (accountSettings: AccountSettings) => void
8585
@State(useBusinessStore) currentBusiness!: Business
86+
@State(useBusinessStore) filingID!: string
8687
8788
@Prop({ default: false }) isVisible: boolean
8889
@Prop() affiliatedOrg: Organization
@@ -94,9 +95,9 @@ export default class IncorporationSearchResultView extends Vue {
9495
get actions (): object[] {
9596
if (this.isThereAnAffiliatedAccount) {
9697
return [
97-
{ title: 'Entity Dashboard',
98+
{ title: 'Manage Business',
9899
icon: 'mdi-view-dashboard',
99-
event: this.entityDashboardEvent
100+
event: this.manageBusinessEvent
100101
},
101102
{ title: 'Manage Account',
102103
icon: 'mdi-domain',
@@ -105,9 +106,9 @@ export default class IncorporationSearchResultView extends Vue {
105106
]
106107
} else {
107108
return [
108-
{ title: 'Entity Dashboard',
109+
{ title: 'Manage Business',
109110
icon: 'mdi-view-dashboard',
110-
event: this.entityDashboardEvent
111+
event: this.manageBusinessEvent
111112
},
112113
{ title: 'Generate Passcode',
113114
icon: 'mdi-lock-outline',
@@ -122,7 +123,7 @@ export default class IncorporationSearchResultView extends Vue {
122123
name: this.currentBusiness?.name,
123124
orgType: this.affiliatedOrg?.orgType,
124125
account: this.affiliatedOrg?.name || 'No Affiliation',
125-
businessIdentifier: this.currentBusiness?.businessIdentifier,
126+
businessIdentifier: this.filingID || this.currentBusiness?.businessIdentifier,
126127
businessNumber: this.currentBusiness?.businessNumber,
127128
accessType: this.affiliatedOrg?.accessType,
128129
statusCode: this.affiliatedOrg?.statusCode
@@ -137,7 +138,7 @@ export default class IncorporationSearchResultView extends Vue {
137138
width: '25%'
138139
},
139140
{
140-
text: 'Entity#',
141+
text: 'Number',
141142
align: 'left',
142143
sortable: false,
143144
value: 'businessIdentifier',
@@ -176,8 +177,17 @@ export default class IncorporationSearchResultView extends Vue {
176177
return orgTypeDisplay
177178
}
178179
179-
async entityDashboardEvent () {
180-
window.location.href = `${ConfigHelper.getBusinessURL()}${this.currentBusiness.businessIdentifier}`
180+
async manageBusinessEvent () {
181+
const businessIdentifier = this.currentBusiness.businessIdentifier
182+
const filingId = this.filingID
183+
184+
let url = `${ConfigHelper.getBusinessURL()}${businessIdentifier}`
185+
186+
if (filingId) {
187+
url += `?filing_id=${filingId}`
188+
}
189+
190+
window.location.href = url
181191
}
182192
183193
async manageAccountEvent () {
@@ -188,7 +198,7 @@ export default class IncorporationSearchResultView extends Vue {
188198
this.$router.push(`/account/${this.currentOrganization.id}/business`)
189199
} catch (error) {
190200
// eslint-disable-next-line no-console
191-
console.log('Error during entity dashboard click event!')
201+
console.log('Error during manage business click event!')
192202
}
193203
}
194204

0 commit comments

Comments
 (0)