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

21977 Added new filing statuses and partial handling #680

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "7.3.9",
"version": "7.3.10",
"private": true,
"appName": "Filings UI",
"sbcName": "SBC Common Components",
Expand Down
10 changes: 7 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ export default class App extends Mixins(

const status = filing.header.status as FilingStatus
if (!status) {
throw new Error(`Invalid ${filingName} filing - filing status`)
throw new Error(`Invalid ${filingName} filing - missing filing status`)
}

const isAmalgamation = (filingName === FilingTypes.AMALGAMATION_APPLICATION)
Expand All @@ -631,6 +631,7 @@ export default class App extends Mixins(

let entityStatus: EntityStatus
switch (status) {
case FilingStatus.CHANGE_REQUESTED:
case FilingStatus.DRAFT:
case FilingStatus.PENDING:
// this is a boostrap task
Expand All @@ -641,8 +642,11 @@ export default class App extends Mixins(
else throw new Error(`Invalid ${filingName} filing - filing name`)
break

case FilingStatus.APPROVED:
case FilingStatus.AWAITING_REVIEW:
case FilingStatus.COMPLETED:
case FilingStatus.PAID:
case FilingStatus.REJECTED:
// this is a bootstrap filing
if (isAmalgamation) entityStatus = EntityStatus.FILED_AMALGAMATION
else if (isContinuationInApplication) entityStatus = EntityStatus.FILED_CONTINUATION_IN
Expand All @@ -652,7 +656,7 @@ export default class App extends Mixins(
break

default:
throw new Error(`Invalid ${filingName} filing - filing status`)
throw new Error(`Invalid ${filingName} filing - filing status = ${status}`)
}

// special check for amalgamation application
Expand Down Expand Up @@ -691,7 +695,7 @@ export default class App extends Mixins(
// store the bootstrap data in the right list
if (this.isBootstrapTask) this.storeBootstrapTask(response)
else if (this.isBootstrapFiling) this.storeBootstrapFiling(response)
else throw new Error(`Invalid ${filingName} filing - filing status`)
else throw new Error(`Invalid ${filingName} filing - not a task or filing`)
}

/** Stores bootstrap task in the Todo List. */
Expand Down
4 changes: 4 additions & 0 deletions src/enums/filingStatus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export enum FilingStatus {
APPROVED = 'APPROVED',
AWAITING_REVIEW = 'AWAITING_REVIEW',
CANCELLED = 'CANCELLED',
CHANGE_REQUESTED = 'CHANGE_REQUESTED',
COMPLETED = 'COMPLETED',
CORRECTED = 'CORRECTED',
DELETED = 'DELETED',
Expand All @@ -10,5 +13,6 @@ export enum FilingStatus {
PAID = 'PAID',
PENDING = 'PENDING',
PENDING_CORRECTION = 'PENDING_CORRECTION',
REJECTED = 'REJECTED',
WITHDRAWN = 'WITHDRAWN',
}
20 changes: 20 additions & 0 deletions src/services/enum-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,26 @@ import {
import { FilingNames, FilingTypes } from '@bcrs-shared-components/enums'

export default class EnumUtilities {
/** Returns True if item status is Approved. */
static isStatusApproved (item: any): boolean {
return (item.status === FilingStatus.APPROVED)
}

/** Returns True if item status is Awaiting Review. */
static isStatusAwaitingReview (item: any): boolean {
return (item.status === FilingStatus.AWAITING_REVIEW)
}

/** Returns True if item status is Cancelled. */
static isStatusCancelled (item: any): boolean {
return (item.status === FilingStatus.CANCELLED)
}

/** Returns True if item status is Change Rejected. */
static isStatusChangeRequested (item: any): boolean {
return (item.status === FilingStatus.CHANGE_REQUESTED)
}

/** Returns True if item status is Completed. */
static isStatusCompleted (item: any): boolean {
return (item.status === FilingStatus.COMPLETED)
Expand Down Expand Up @@ -57,6 +72,11 @@ export default class EnumUtilities {
return (item.status === FilingStatus.PENDING_CORRECTION)
}

/** Returns True if item status is Rejected. */
static isStatusRejected (item: any): boolean {
return (item.status === FilingStatus.REJECTED)
}

/** Returns True if item status is Withdrawn. */
static isStatusWithdrawn (item: any): boolean {
return (item.status === FilingStatus.WITHDRAWN)
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/enum-utilities.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import EnumUtilities from '@/services/enum-utilities'

describe('Enum Utilities', () => {
it('returns correct values for filing state helpers', () => {
expect(EnumUtilities.isStatusApproved({ status: 'APPROVED' })).toBe(true)
expect(EnumUtilities.isStatusAwaitingReview({ status: 'AWAITING_REVIEW' })).toBe(true)
expect(EnumUtilities.isStatusCancelled({ status: 'CANCELLED' })).toBe(true)
expect(EnumUtilities.isStatusChangeRequested({ status: 'CHANGE_REQUESTED' })).toBe(true)
expect(EnumUtilities.isStatusCompleted({ status: 'COMPLETED' })).toBe(true)
expect(EnumUtilities.isStatusCorrected({ status: 'CORRECTED' })).toBe(true)
expect(EnumUtilities.isStatusDeleted({ status: 'DELETED' })).toBe(true)
Expand All @@ -12,6 +15,7 @@ describe('Enum Utilities', () => {
expect(EnumUtilities.isStatusPaid({ status: 'PAID' })).toBe(true)
expect(EnumUtilities.isStatusPending({ status: 'PENDING' })).toBe(true)
expect(EnumUtilities.isStatusPendingCorrection({ status: 'PENDING_CORRECTION' })).toBe(true)
expect(EnumUtilities.isStatusRejected({ status: 'REJECTED' })).toBe(true)
expect(EnumUtilities.isStatusWithdrawn({ status: 'WITHDRAWN' })).toBe(true)
})

Expand Down
Loading