Skip to content

Commit

Permalink
Rebased + fixed rebase issues + fixed some of Sev's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JazzarKarim committed Dec 13, 2023
1 parent 5693e40 commit 9ff1f84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
30 changes: 1 addition & 29 deletions src/components/Amalgamation/AmalgamatingBusinesses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,8 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co
// Show spinner since the network calls below can take a few seconds.
this.$root.$emit('showSpinner', true)
// Get the auth info, business info, addresses and latest filing concurrently.
// Return data array; if any call failed, that item will be null.
const data = await Promise.allSettled([
AuthServices.fetchAuthInfo(businessLookup.identifier),
LegalServices.fetchBusinessInfo(businessLookup.identifier),
LegalServices.fetchAddresses(businessLookup.identifier),
LegalServices.fetchFirstOrOnlyFiling(businessLookup.identifier)
]).then(results => results.map((result: any) => result.value || null))
const authInfo = data[0]
const businessInfo = data[1]
const addresses = data[2]
const firstFiling = data[3]
// Get the business information
const business = await this.fetchBusinessInfoForTing(businessLookup)
const business = await this.fetchAmalgamatingBusinessInfo(businessLookup)
// Check for unaffiliated business.
if (!business.authInfo) {
Expand Down Expand Up @@ -256,21 +243,6 @@ export default class AmalgamatingBusinesses extends Mixins(AmalgamationMixin, Co
return
}
// This business is in limited restoration if there is a state filing and restoration expiry date isn't
// in the past and the state filing is a limited restoration or a limited restoration extension.
const isLimitedRestoration = async (): Promise<boolean> => {
// check for no state filing
if (!businessInfo.stateFiling) return false
// check for expired restoration
if (this.getCurrentDate > businessInfo.restorationExpiryDate) return false
// fetch state filing
const stateFiling = await LegalServices.fetchFiling(businessInfo.stateFiling)
return (
stateFiling.restoration.type === RestorationTypes.LIMITED ||
stateFiling.restoration.type === RestorationTypes.LTD_EXTEND
)
}
// Create amalgamating business object.
const tingBusiness: AmalgamatingBusinessIF = {
type: AmlTypes.LEAR,
Expand Down
10 changes: 5 additions & 5 deletions src/mixins/amalgamation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class AmalgamationMixin extends Vue {
* Get the business information, mailing address, email, and first filing if in LEAR.
* Otherwise, return error.
*/
async fetchBusinessInfoForTing (item: any): Promise<any> {
async fetchAmalgamatingBusinessInfo (item: any): Promise<any> {
// Get the auth info, business info, addresses and filings in parallel.
// Return data array; if any call failed, that item will be undefined.
const data = await Promise.allSettled([
Expand All @@ -83,11 +83,11 @@ export default class AmalgamationMixin extends Vue {
}

/**
* If there is a state filing and restoration expiry date isn't in the past and the state filing is a
* limited restoration or limited restoration extension, then this business is in limited restoration.
* This business is in limited restoration if there is a state filing and restoration expiry date isn't
* in the past and the state filing is a limited restoration or a limited restoration extension.
* @param business The business to check if is in Limited Restoration or not.
*/
isLimitedRestoration = async (business: any): Promise<boolean> => {
async isLimitedRestoration (business: any): Promise<boolean> {
// check for no state filing
if (!business.businessInfo.stateFiling) return false
// check for expired restoration
Expand All @@ -106,7 +106,7 @@ export default class AmalgamationMixin extends Vue {
*/
async refetchAmalgamatingBusinessesInfo (): Promise<void> {
const fetchTingInfo = async (item: any): Promise<AmalgamatingBusinessIF> => {
const tingBusiness = await this.fetchBusinessInfoForTing(item)
const tingBusiness = await this.fetchAmalgamatingBusinessInfo(item)
if (!tingBusiness.authInfo) {
return {
type: AmlTypes.LEAR,
Expand Down

0 comments on commit 9ff1f84

Please sign in to comment.