Skip to content

Commit 6da9336

Browse files
authored
25550 - Remove BCOL if feature flag is toggled and payment method i… (#3247)
1 parent 09e7e7b commit 6da9336

File tree

7 files changed

+66
-8
lines changed

7 files changed

+66
-8
lines changed

auth-web/src/components/auth/account-settings/payment/AccountPaymentMethods.vue

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,36 @@
5151
Cancel
5252
</v-btn>
5353
</div>
54+
<!-- Warning Dialog BCOL -->
55+
<ModalDialog
56+
ref="bcolWarningDialog"
57+
title="BC Online Payment Option Alert"
58+
text="After saving your updated payment method, BC Online will no longer be available as a payment option."
59+
max-width="640"
60+
:showIcon="false"
61+
dialog-class="notify-dialog"
62+
>
63+
<template #icon>
64+
<v-icon
65+
large
66+
color="error"
67+
>
68+
mdi-alert-circle-outline
69+
</v-icon>
70+
</template>
71+
<template #actions>
72+
<div class="d-flex align-center justify-center w-100 h-100 ga-3">
73+
<v-btn
74+
large
75+
color="primary"
76+
class="font-weight-bold"
77+
@click="closeBcolWarningDialog"
78+
>
79+
OK
80+
</v-btn>
81+
</div>
82+
</template>
83+
</ModalDialog>
5484
<!-- Alert Dialog (Error) -->
5585
<ModalDialog
5686
ref="errorDialog"
@@ -108,12 +138,13 @@
108138
</template>
109139

110140
<script lang="ts">
111-
import { AccessType, Account, LoginSource, Pages, PaymentTypes, Permission } from '@/util/constants'
141+
import { AccessType, Account, LDFlags, LoginSource, Pages, PaymentTypes, Permission } from '@/util/constants'
112142
import {
113143
CreateRequestBody, Member, MembershipType, OrgPaymentDetails, Organization, PADInfo, PADInfoValidation
114144
} from '@/models/Organization'
115145
import { computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref, toRefs, watch } from '@vue/composition-api'
116146
import { BcolProfile } from '@/models/bcol'
147+
import LaunchDarklyService from 'sbc-common-components/src/services/launchdarkly.services'
117148
import ModalDialog from '@/components/auth/common/ModalDialog.vue'
118149
import PaymentMethods from '@/components/auth/common/PaymentMethods.vue'
119150
import { StatementNotificationSettings } from '@/models/statement'
@@ -170,12 +201,18 @@ export default defineComponent({
170201
171202
const errorDialog = ref<InstanceType<typeof ModalDialog>>()
172203
const unsavedChangesDialog = ref<InstanceType<typeof ModalDialog>>()
204+
const bcolWarningDialog = ref<InstanceType<typeof ModalDialog>>()
173205
174206
const { currentOrganization, currentOrgPaymentType, currentOrgAddress, currentMembership, permissions, currentOrgGLInfo } = useAccount()
175207
176208
const currentUser = computed(() => userStore.currentUser)
177209
178210
function setSelectedPayment (payment) {
211+
if (LaunchDarklyService.getFlag(LDFlags.HideBCOLProductSettings, false) &&
212+
state.selectedPaymentMethod === PaymentTypes.BCOL &&
213+
payment.selectedPaymentMethod !== PaymentTypes.BCOL) {
214+
bcolWarningDialog.value.open()
215+
}
179216
state.selectedPaymentMethod = payment.selectedPaymentMethod
180217
state.isBtnSaved = (state.isBtnSaved && !payment.isTouched) || false
181218
setHasPaymentMethodChanged(payment.isTouched || false)
@@ -231,7 +268,7 @@ export default defineComponent({
231268
232269
const isPaymentViewAllowed = computed(() => {
233270
// checking permission instead of roles to give access for staff
234-
return [Permission.VIEW_REQUEST_PRODUCT_PACKAGE, Permission.MAKE_PAYMENT].some(per => permissions.value.includes(per))
271+
return [Permission.VIEW_REQUEST_PRODUCT_PACKAGE].some(per => permissions.value.includes(per))
235272
})
236273
237274
async function initialize () {
@@ -440,6 +477,10 @@ export default defineComponent({
440477
errorDialog.value.close()
441478
}
442479
480+
function closeBcolWarningDialog () {
481+
bcolWarningDialog.value.close()
482+
}
483+
443484
function setBcolInfo (bcolProfile: BcolProfile) {
444485
state.bcolInfo = bcolProfile
445486
emit('emit-bcol-info', state.bcolInfo)
@@ -479,7 +520,9 @@ export default defineComponent({
479520
verifyPAD,
480521
cancel,
481522
save,
523+
bcolWarningDialog,
482524
closeError,
525+
closeBcolWarningDialog,
483526
errorDialog,
484527
currentOrganization,
485528
currentOrgPaymentType,

auth-web/src/components/auth/account-settings/product/ProductPayment.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<v-container
3+
:key="accountChangeKey"
34
v-can:EDIT_REQUEST_PRODUCT_PACKAGE.disable.card
45
class="view-container"
56
>
@@ -286,7 +287,8 @@ export default defineComponent({
286287
return !state.isEditing && (![AccessType.GOVM].includes(accessType) || state.isBcolAdmin)
287288
}),
288289
displaySavePaymentMethodsFirst: false,
289-
productPaymentReady: false
290+
productPaymentReady: false,
291+
accountChangeKey: 0
290292
})
291293
292294
const loadProduct = async () => {
@@ -482,6 +484,8 @@ export default defineComponent({
482484
// Reload product list when organization changes
483485
watch(() => currentOrganization.value.id, async () => {
484486
await setup()
487+
// Required otherwise changing from USER -> ADMIN will leave it disabled
488+
state.accountChangeKey++
485489
})
486490
487491
watch(() => state.isEditing, (newValue) => {

auth-web/src/components/auth/account-settings/transaction/Transactions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<script lang="ts">
118118
import { Account, Pages } from '@/util/constants'
119119
import { MembershipType, OrgPaymentDetails } from '@/models/Organization'
120-
import { Ref, computed, defineComponent, onBeforeUnmount, onMounted, ref, reactive, toRefs, watch } from '@vue/composition-api'
120+
import { Ref, computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref, toRefs, watch } from '@vue/composition-api'
121121
import { useAccountChangeHandler, useTransactions } from '@/composables'
122122
import { BaseTableHeaderI } from '@/components/datatable/interfaces'
123123
import CommonUtils from '@/util/common-util'

auth-web/src/components/auth/common/PaymentMethods.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@
183183
ref="warningDialog"
184184
max-width="650"
185185
:show-icon="false"
186-
:showCloseIcon="true"
187186
:title="dialogTitle"
188187
:text="dialogText"
189188
dialog-class="warning-dialog"
@@ -339,6 +338,7 @@ export default defineComponent({
339338
})
340339
}
341340
}
341+
342342
const paymentMethodSelected = async (payment, isTouch = true) => {
343343
if (payment.type === PaymentTypes.BCOL && isTouch && state.selectedPaymentMethod !== PaymentTypes.BCOL) {
344344
openBCOnlineDialog()

auth-web/src/composables/product-payment-factory.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { AccessType, PaymentTypes, ProductStatus } from '@/util/constants'
1+
import { AccessType, LDFlags, PaymentTypes, ProductStatus } from '@/util/constants'
22
import { useCodesStore, useOrgStore } from '@/stores'
3+
import LaunchDarklyService from 'sbc-common-components/src/services/launchdarkly.services'
34
import { computed } from '@vue/composition-api'
45
import { storeToRefs } from 'pinia'
56

@@ -96,6 +97,11 @@ export const useProductPayment = (props, state) => {
9697
exclusionSet = [PaymentTypes.INTERNAL, PaymentTypes.EJV]
9798
}
9899

100+
if (LaunchDarklyService.getFlag(LDFlags.HideBCOLProductSettings, false) &&
101+
orgStore.currentOrgPaymentType !== PaymentTypes.BCOL) {
102+
exclusionSet.push(PaymentTypes.BCOL)
103+
}
104+
99105
Object.keys(ppMethods).forEach((product) => {
100106
ppMethods[product] = ppMethods[product].filter((method) => {
101107
if (inclusionSet.length > 0) {
@@ -145,7 +151,7 @@ export const useProductPayment = (props, state) => {
145151
return [PAYMENT_METHODS[state.selectedPaymentMethod]]
146152
}
147153
const methodSupportPerProduct = paymentMethodSupportedForProducts.value
148-
const paymentMethods = []
154+
let paymentMethods = []
149155
const isGovmOrg = orgStore.currentOrganization?.accessType === AccessType.GOVM
150156
const paymentTypes = isGovmOrg ? [PaymentTypes.EJV] : [PaymentTypes.PAD, PaymentTypes.CREDIT_CARD,
151157
PaymentTypes.ONLINE_BANKING, PaymentTypes.BCOL, PaymentTypes.EFT]
@@ -164,6 +170,10 @@ export const useProductPayment = (props, state) => {
164170
paymentMethods.push(paymentMethod)
165171
}
166172
})
173+
if (LaunchDarklyService.getFlag(LDFlags.HideBCOLProductSettings, false) &&
174+
orgStore.currentOrgPaymentType !== PaymentTypes.BCOL) {
175+
paymentMethods = paymentMethods.filter(item => item.type !== PaymentTypes.BCOL)
176+
}
167177
return paymentMethods
168178
})
169179

auth-web/src/util/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ export enum LDFlags {
484484
EnableAffiliationDelegation = 'enable-affiliation-delegation',
485485
EnableEFTBalanceByPAD = 'enable-eft-balance-by-pad',
486486
EnableDRSLookup = 'enable-drs-lookup', // Document Record Services
487+
HideBCOLProductSettings = 'hide-bcol-product-settings',
487488
}
488489

489490
export enum DateFilterCodes {

auth-web/tests/unit/components/ProductPayment.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Account settings ProductPackage.vue', () => {
3434
loginSource: LoginSource.BCROS
3535
} as any
3636
const orgStore = useOrgStore()
37-
orgStore.permissions = [Permission.VIEW_REQUEST_PRODUCT_PACKAGE, Permission.MAKE_PAYMENT]
37+
orgStore.permissions = [Permission.VIEW_REQUEST_PRODUCT_PACKAGE]
3838
orgStore.currentOrganization = {
3939
name: 'test org'
4040
}

0 commit comments

Comments
 (0)