-
Notifications
You must be signed in to change notification settings - Fork 48
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
19390 Added draft task TING validation #629
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ export default class AmalgamationMixin extends Vue { | |
this.notInGoodStanding, | ||
this.limitedRestoration, | ||
this.futureEffectiveFiling, | ||
this.draftTask, | ||
this.pendingFiling, | ||
this.foreign, | ||
this.foreignUnlimited, | ||
|
@@ -96,6 +97,14 @@ export default class AmalgamationMixin extends Vue { | |
return null | ||
} | ||
|
||
/** Disallow if a draft task exists. */ | ||
draftTask (business: AmalgamatingBusinessIF): AmlStatuses { | ||
if (business.type === AmlTypes.LEAR && business.isDraftTask) { | ||
return AmlStatuses.ERROR_DRAFT_TASK | ||
} | ||
return null | ||
} | ||
|
||
/** Disallow if a pending filing exists. */ | ||
pendingFiling (business: AmalgamatingBusinessIF): AmlStatuses { | ||
if (business.type === AmlTypes.LEAR && business.isPendingFiling) { | ||
|
@@ -192,21 +201,22 @@ export default class AmalgamationMixin extends Vue { | |
} | ||
|
||
/** | ||
* Get the business information, mailing address, email, and first filing if in LEAR. | ||
* Otherwise, return error. | ||
* Fetches the business' auth information, business info, addresses, first task, and first filing. | ||
* @param identifier The business identifier. | ||
*/ | ||
async fetchAmalgamatingBusinessInfo (item: any): Promise<any> { | ||
// Get the auth info, business info, addresses and filings concurrently. | ||
async fetchAmalgamatingBusinessInfo (identifier: string): Promise<any> { | ||
// Make all API calls concurrently without rejection. | ||
// NB - if any call failed, that item will be null. | ||
const [ authInfo, businessInfo, addresses, firstFiling ] = | ||
const [ authInfo, businessInfo, addresses, firstTask, firstFiling ] = | ||
await Promise.allSettled([ | ||
AuthServices.fetchAuthInfo(item.identifier), | ||
LegalServices.fetchBusinessInfo(item.identifier), | ||
LegalServices.fetchAddresses(item.identifier), | ||
LegalServices.fetchFirstOrOnlyFiling(item.identifier) | ||
AuthServices.fetchAuthInfo(identifier), | ||
LegalServices.fetchBusinessInfo(identifier), | ||
LegalServices.fetchAddresses(identifier), | ||
LegalServices.fetchFirstTask(identifier), | ||
LegalServices.fetchFirstOrOnlyFiling(identifier) | ||
]).then(results => results.map((result: any) => result.value || null)) | ||
|
||
return { authInfo, businessInfo, addresses, firstFiling } | ||
return { authInfo, businessInfo, addresses, firstTask, firstFiling } | ||
} | ||
|
||
/** | ||
|
@@ -241,6 +251,17 @@ export default class AmalgamationMixin extends Vue { | |
) | ||
} | ||
|
||
/** | ||
* This business is draft task if the first task in the Todo List is still draft (or pending). | ||
* @param business The business to check if is Draft Task or not. | ||
*/ | ||
isDraftTask (business: any): boolean { | ||
return ( | ||
business.firstTask?.header.status === FilingStatus.DRAFT || | ||
business.firstTask?.header.status === FilingStatus.PENDING | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB - Pending is if the filing was filed-and-paid but the payment failed. The user can retry or cancel the payment. If they cancel the payment then the filing goes back to Draft status. |
||
} | ||
|
||
/** | ||
* This business is pending filing if the first filing in the ledger is still not complete or corrected | ||
* (ie, it's paid or pending). | ||
|
@@ -259,7 +280,7 @@ export default class AmalgamationMixin extends Vue { | |
*/ | ||
async refetchAmalgamatingBusinessesInfo (): Promise<void> { | ||
const fetchTingInfo = async (item: any): Promise<AmalgamatingBusinessIF> => { | ||
const tingBusiness = await this.fetchAmalgamatingBusinessInfo(item) | ||
const tingBusiness = await this.fetchAmalgamatingBusinessInfo(item.identifier) | ||
// no auth info and business info means foreign, otherwise LEAR (affiliated or non-affiliated) | ||
if (!tingBusiness.authInfo && !tingBusiness.businessInfo) { | ||
return { | ||
|
@@ -281,6 +302,7 @@ export default class AmalgamationMixin extends Vue { | |
isNotInGoodStanding: (tingBusiness.businessInfo.goodStanding === false), | ||
isFrozen: (tingBusiness.businessInfo.adminFreeze === true), | ||
isFutureEffective: this.isFutureEffective(tingBusiness), | ||
isDraftTask: this.isDraftTask(tingBusiness), | ||
isPendingFiling: this.isPendingFiling(tingBusiness), | ||
isLimitedRestoration: await this.isLimitedRestoration(tingBusiness), | ||
isHistorical: (tingBusiness.businessInfo.state === EntityStates.HISTORICAL) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM | |
@Action(useStore) setBusinessContact!: (x: ContactPointIF) => void | ||
@Action(useStore) setCertifyState!: (x: CertifyIF) => void | ||
@Action(useStore) setCooperativeType!: (x: CoopTypes) => void | ||
@Action(useStore) setCorrectNameOption!: (x: CorrectNameOptions) => void | ||
// @Action(useStore) setCorrectNameOption!: (x: CorrectNameOptions) => void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VS Code was giving me a warning that this action is already imported (via another mixin). Instead of deleting the declaration here, I just commented it out. This should help a curious developer understand why this declaration is not needed. |
||
@Action(useStore) setCourtOrderFileNumber!: (x: string) => void | ||
@Action(useStore) setCustodianOfRecords!: (x: OrgPersonIF) => void | ||
@Action(useStore) setDissolutionDate!: (x: string) => void | ||
|
@@ -94,8 +94,8 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM | |
@Action(useStore) setFoundingDate!: (x: string) => void | ||
@Action(useStore) setLegalName!: (x: string) => void | ||
@Action(useStore) setMemorandum!: (x: CreateMemorandumIF) => void | ||
@Action(useStore) setNameRequestApprovedName!: (x: string) => void | ||
@Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void | ||
// @Action(useStore) setNameRequestApprovedName!: (x: string) => void | ||
// @Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void | ||
@Action(useStore) setOfficeAddresses!: (x: RegisteredRecordsAddressesIF) => void | ||
@Action(useStore) setOrgPersonList!: (x: OrgPersonIF[]) => void | ||
@Action(useStore) setRegistrationBusinessAddress!: (x: BusinessAddressIF) => void | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { AxiosInstance as axios } from '@/utils' | ||
import { StatusCodes } from 'http-status-codes' | ||
import { AmalgamationFilingIF, BusinessIF, DissolutionFilingIF, IncorporationFilingIF, NameRequestIF, | ||
RegistrationFilingIF, RestorationFilingIF } from '@/interfaces' | ||
import { BusinessIF, DissolutionFilingIF, IncorporationFilingIF, NameRequestIF } from '@/interfaces' | ||
import { FilingTypes } from '@/enums' | ||
|
||
/** | ||
|
@@ -29,12 +28,11 @@ export default class LegalServices { | |
|
||
/** | ||
* Fetches the first or only filing. | ||
* This is expected to be a draft IA or Registration. | ||
* This is probably a draft Amalgamation, IA or Registration. | ||
* @param tempId the temp registration number | ||
* @returns a promise to return the draft filing, else exception | ||
*/ | ||
// eslint-disable-next-line max-len | ||
static async fetchFirstOrOnlyFiling (tempId: string): Promise<AmalgamationFilingIF | IncorporationFilingIF | RegistrationFilingIF> { | ||
static async fetchFirstOrOnlyFiling (tempId: string): Promise<any> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this function is used by amalgamation code, the type of filing could actually be any of our filings in the ledger. Ditto for tasks below. |
||
const url = `businesses/${tempId}/filings` | ||
|
||
return axios.get(url) | ||
|
@@ -65,12 +63,11 @@ export default class LegalServices { | |
|
||
/** | ||
* Fetches the first task. | ||
* This is expected to be a draft Dissolution or Restoration. | ||
* This is probably a draft Dissolution or Restoration. | ||
* @param businessId the business identifier | ||
* @returns a promise to return the draft filing, else exception | ||
*/ | ||
// eslint-disable-next-line max-len | ||
static async fetchFirstTask (businessId: string): Promise<DissolutionFilingIF | RestorationFilingIF> { | ||
static async fetchFirstTask (businessId: string): Promise<any> { | ||
const url = `businesses/${businessId}/tasks` | ||
return axios.get(url) | ||
.then(response => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was better to pass in
identifier
instead of an untyped business object in which we "hope" there is an identifier. Identifier is the only thing we need from the business object in this function.