Skip to content

Commit

Permalink
20421 - Show suspension for eft overdue payment accounts (#2812)
Browse files Browse the repository at this point in the history
* show suspension for eft overdue payment account

* tweaks

* lint fix

* code review fix

* add CfsAccountStatus enums

* fix migration error and change overdue eft status to NSF_SUSPENDED
  • Loading branch information
Jxio authored May 10, 2024
1 parent 246bb7c commit 8a39855
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,25 @@ def upgrade():
sa.Column('external_source_id', sa.String(length=75), nullable=True))

# Add MHR sub product codes
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url, keycloak_group, "
"parent_code) "
"VALUES "
"('MHR_QSLN', 'Qualified Supplier - Lawyers and Notaries', false, 'INTERNAL', false, true, true, "
"'https://www.bcregistry.ca/ppr', 'mhr_qualified_user', 'MHR')")
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url, keycloak_group, "
"parent_code) "
"VALUES "
"('MHR_QSHM', 'Qualified Supplier - Home Manufacturers', false, 'INTERNAL', false, true, true, "
"'https://www.bcregistry.ca/ppr', 'mhr_manufacturer', 'MHR')")
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url, keycloak_group, "
"parent_code) "
"VALUES "
"('MHR_QSHD', 'Qualified Supplier - Home Dealers', false, 'INTERNAL', false, true, true, "
"'https://www.bcregistry.ca/ppr', 'mhr_general_user', 'MHR')")

op.execute("commit")


def downgrade():
op.execute("DELETE FROM product_codes WHERE code in ('MHR_QSLN')")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@


def upgrade():
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url) "
"VALUES "
"('NDS', 'New Director Search', false, 'INTERNAL', true, true, false,'')")
op.execute("commit")


def downgrade():
op.execute("DELETE FROM product_codes WHERE code in ('NDS')")
op.execute("commit")
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@ def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('product_codes', sa.Column('need_system_admin', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
op.execute("UPDATE public.product_codes "
op.execute("UPDATE product_codes "
"SET need_review=false, need_system_admin=true "
"WHERE code='NDS'")
op.execute("UPDATE public.product_codes "
op.execute("UPDATE product_codes "
"SET need_system_admin=false "
"WHERE code!='NDS'")
op.execute("commit")


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('product_codes', 'need_system_admin')
# ### end Alembic commands ###
op.execute("UPDATE public.product_codes "
op.execute("UPDATE product_codes "
"SET need_review=true "
"WHERE code='NDS'")
op.execute("commit")
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@


def upgrade():
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, need_system_admin, premium_only, url) "
"VALUES "
"('CA_SEARCH', 'Competent Authority Search', false, 'INTERNAL', true, false, true, false,'')")
op.execute("commit")

def downgrade():
op.execute("DELETE FROM product_codes WHERE code in ('CA_SEARCH')")
op.execute("commit")
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""empty message
Revision ID: e2d1d6417607
Revises: 17369fa9416d
Create Date: 2024-05-09 15:39:36.678009
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e2d1d6417607'
down_revision = '17369fa9416d'
branch_labels = None
depends_on = None


def upgrade():
op.execute("INSERT INTO suspension_reason_codes "
"(code, description,\"default\") "
"VALUES "
"('OVERDUE_EFT', 'Overdue EFT Payments', false)")


def downgrade():
op.execute("DELETE FROM suspension_reason_codes WHERE code in ('OVERDUE_EFT')")
3 changes: 1 addition & 2 deletions auth-api/migrations/versions/211deb552319_.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@


def upgrade():
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url) "
"VALUES "
"('BUSINESS_SEARCH', 'Business Search', false, 'INTERNAL', false, false, true, "
"'https://www.bcregistry.ca/business/search')")
op.execute("commit")


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@


def upgrade():
op.execute("INSERT INTO public.product_codes "
op.execute("INSERT INTO product_codes "
"(code, description,\"default\", type_code, hidden, need_review, premium_only, url) "
"VALUES "
"('MHR', 'Manufactured Home Registry', false, 'INTERNAL', true, false, true, "
"'https://www.bcregistry.ca/ppr')")
op.execute("commit")



Expand Down
1 change: 1 addition & 0 deletions auth-api/src/auth_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class SuspensionReasonCode(Enum):
DISPUTE = 'Account Ownership Dispute'
COURT_ORDER = 'Court Order'
FRAUDULENT = 'Fraudulent Activity'
OVERDUE_EFT = 'Overdue EFT Payments'


class InvitationType(Enum):
Expand Down
13 changes: 11 additions & 2 deletions auth-web/src/components/auth/common/AccountSuspendAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<div class="font-weight-bold">
Account Suspended
</div>
<div>Account has been suspended for outstanding balance (NSF).</div>
<div>
Account has been suspended for {{ accountSuspendReason }}.
</div>
<div class="mt-6 title font-weight-bold">
BALANCE DUE: ${{ totalAmountToPay.toFixed(2) }}
</div>
Expand Down Expand Up @@ -48,9 +50,9 @@
</template>

<script lang="ts">
import { AccountStatus, SuspensionReasonCode } from '@/util/constants'
import { Action, State } from 'pinia-class'
import { Component, Vue } from 'vue-property-decorator'
import { AccountStatus } from '@/util/constants'
import { Code } from '@/models/Code'
import CommonUtils from '@/util/common-util'
import { FailedInvoice } from '@/models/invoice'
Expand Down Expand Up @@ -82,6 +84,13 @@ export default class AccountSuspendAlert extends Vue {
return this.currentOrganization?.decisionMadeBy
}
get accountSuspendReason (): string {
if (this.currentOrganization?.suspensionReasonCode === SuspensionReasonCode.OVERDUE_EFT) {
return 'overdue EFT payments'
}
return 'outstanding balance (NSF)'
}
suspendedReason (): string {
return this.suspensionReasonCodes?.find(suspensionReasonCode =>
suspensionReasonCode?.code === this.currentOrganization?.suspensionReasonCode)?.desc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</template>

<script lang="ts">
import { AccessType, Account, AccountStatus } from '@/util/constants'
import { AccessType, Account, AccountStatus, SuspensionReason, SuspensionReasonCode } from '@/util/constants'
import { Action, State } from 'pinia-class'
import { Component, Mixins, Watch } from 'vue-property-decorator'
import { Member, OrgFilterParams, OrgList, Organization } from '@/models/Organization'
Expand Down Expand Up @@ -176,12 +176,11 @@ export default class StaffActiveAccountsTable extends Mixins(PaginationMixin) {
getStatusText (org: Organization) {
if (org.statusCode === AccountStatus.NSF_SUSPENDED) {
return 'NSF'
} else if (org.statusCode === AccountStatus.SUSPENDED) {
return this.getSuspensionReasonCode(org)
} else {
return org.statusCode
return org.suspensionReasonCode === SuspensionReasonCode.OVERDUE_EFT ? SuspensionReason.OVERDUE_EFT : SuspensionReason.NSF
}
return org.statusCode === AccountStatus.SUSPENDED
? this.getSuspensionReasonCode(org)
: org.statusCode
}
private getSuspensionReasonCode (org: Organization) : string {
Expand Down
21 changes: 19 additions & 2 deletions auth-web/src/components/pay/LinkedShortNameTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
</v-icon>
</v-btn>
</template>
<template #item-slot-accountName="{ item }">
<span>{{ item.accountName }}</span>
<v-chip
v-if="item.cfsAccountStatus === CfsAccountStatus.FREEZE"
small
label
color="error"
class="item-chip"
>
{{ AccountStatus.SUSPENDED }}
</v-chip>
</template>
<template #item-slot-amountOwing="{ item }">
<span>{{ formatAmount(item.amountOwing) }}</span>
</template>
Expand All @@ -65,7 +77,7 @@
</div>
</template>
<script lang="ts">
import { SessionStorageKeys, ShortNameStatus } from '@/util/constants'
import { AccountStatus, CfsAccountStatus, SessionStorageKeys, ShortNameStatus } from '@/util/constants'
import { defineComponent, onMounted, reactive, watch } from '@vue/composition-api'
import { BaseVDataTable } from '..'
import CommonUtils from '@/util/common-util'
Expand Down Expand Up @@ -237,7 +249,9 @@ export default defineComponent({
state,
updateFilter,
viewDetails,
formatAmount
formatAmount,
CfsAccountStatus,
AccountStatus
}
}
})
Expand All @@ -259,4 +273,7 @@ export default defineComponent({
border: 1px solid #e9ecef;
font-weight: bold;
}
.item-chip {
margin-left: 1em;
}
</style>
21 changes: 21 additions & 0 deletions auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ export enum AccountStatus {
PENDING_INVITE_ACCEPT = 'PENDING_INVITE_ACCEPT'
}

export enum SuspensionReasonCode {
OWNER_CHANGE = 'OWNER_CHANGE',
DISPUTE = 'DISPUTE',
COURT_ORDER = 'COURT_ORDER',
FRAUDULENT = 'FRAUDULENT',
OVERDUE_EFT = 'OVERDUE_EFT'
}

export enum SuspensionReason {
NSF = 'NSF',
OVERDUE_EFT = 'Overdue EFT Payments'
}

export enum IdpHint {
BCROS = 'bcros',
IDIR = 'idir',
Expand Down Expand Up @@ -630,3 +643,11 @@ export enum ShortNameStatus {
export enum ShortNameResponseStatus {
EFT_SHORT_NAME_ALREADY_MAPPED = 'EFT_SHORT_NAME_ALREADY_MAPPED'
}

export enum CfsAccountStatus {
PENDING = 'PENDING',
PENDING_PAD_ACTIVATION = 'PENDING_PAD_ACTIVATION',
ACTIVE = 'ACTIVE',
INACTIVE = 'INACTIVE',
FREEZE = 'FREEZE'
}

0 comments on commit 8a39855

Please sign in to comment.