Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
severinbeauvais committed Aug 28, 2023
1 parent b52e46c commit 0df81c1
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ VUE_APP_SOCIETIES_ONLINE_HOME_URL="https://dev.bcregistry.ca/societies/"
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"
VUE_APP_LEGAL_API_VERSION="/api/v1"
VUE_APP_LEGAL_API_VERSION="/api/v2"
VUE_APP_NAMEX_API_URL="https://namex-dev.apps.silver.devops.gov.bc.ca"
VUE_APP_NAMEX_API_VERSION="/api/v1"
VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca"
Expand Down
1 change: 1 addition & 0 deletions src/components/new-request/business-fetch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default class BusinessFetch extends Vue {
]
/** When an item has been selected, emits event with business object. */
// *** TODO: fix validation issues
@Emit('business')
async onItemSelected (): Promise<any> {
console.log(`*** validating = [${this.searchField}]`)
Expand Down
1 change: 1 addition & 0 deletions src/components/new-request/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
readonly
filled
hide-details
:label="business.identifier"
:value="business.name"
@click:append="onBusiness(null)"
@keydown.delete="onBusiness(null)"
Expand Down
10 changes: 7 additions & 3 deletions src/services/business-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ export default class BusinessServices {
/** Legal API URL. */
static legalApiUrl = sessionStorage.getItem('LEGAL_API_URL')

/** Creates a temporary (draft) business record. */
/** Creates (posts) a draft (temporary) business record. */
// *** TODO: verify this with V2 API
static async createBusiness (businessRequest: BusinessRequest): Promise<any> {
return axios.post(`${BusinessServices.legalApiUrl}/businesses?draft=true`, businessRequest)
const url = `${BusinessServices.legalApiUrl}/businesses?draft=true`
return axios.post(url, businessRequest)
}

/** Fetches a business record. */
// *** TODO: this only works with V2 API -- need to update 1Password
static async fetchBusiness (identifier: string): Promise<any> {
return axios.get(`${BusinessServices.legalApiUrl}/businesses/${identifier}`)
const url = `${BusinessServices.legalApiUrl}/businesses/${identifier}`
return axios.get(url)
.then(response => response.data?.business)
}
}
16 changes: 15 additions & 1 deletion src/services/namex-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ axiosNamex.interceptors.request.use(
config.headers.common['BCREG-NRL'] = sessionStorage.getItem('BCREG-NRL')
config.headers.common['BCREG-User-Phone'] = sessionStorage.getItem('BCREG-phoneNumber')
config.headers.common['BCREG-User-Email'] = sessionStorage.getItem('BCREG-emailAddress')
console.log('in interceptor, headers: ', config?.headers?.common) // eslint-disable-line
// console.log('in interceptor, headers: ', config?.headers?.common) // eslint-disable-line
return config
},
error => {
Expand Down Expand Up @@ -122,6 +122,20 @@ export default class NamexServices {
}
}

/** Searches LEAR (Legal API) for business record for specified corp num. */
static async searchLear (corpNum: string): Promise<any> {
const url = `${appBaseURL}/businesses/${corpNum}`
return this.axios.get(url).then(response => response.data?.business)
}

/** Searches COLIN for business record for specified corp num. */
static async searchColin (corpNum: string): Promise<any> {
// remove BC prefix as COLIN only supports base number with no prefix for BC's
const cleanedCorpNum = corpNum.replace(/^BC+/i, '')
const url = `${appBaseURL}/colin/${cleanedCorpNum}`
return this.axios.post(url).then(response => response.data)
}

static async checkinNameRequest (nrId: number, nrState: NrState): Promise<boolean> {
try {
// Approved or Rejected or Consumed Name Requests are not checked out due to limited data that is editable.
Expand Down
Loading

0 comments on commit 0df81c1

Please sign in to comment.