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

22841 - Add tooltip and pop-up window reminder to EFT payment #2971

Merged
merged 2 commits into from
Aug 20, 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 auth-web/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 auth-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth-web",
"version": "2.6.71",
"version": "2.6.72",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
57 changes: 57 additions & 0 deletions auth-web/src/assets/scss/tooltip.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.tooltip-activator {
width: 100%;
}
.tooltip {
background-color: transparent;
opacity: 1 !important;

.tooltip-content {
min-width: 30rem;
padding: 2rem;
}
}
.tooltip-text {
border-bottom: 2px dotted;
}
.tooltip-text:hover {
cursor: pointer;
}
.v-tooltip__content {
background-color: RGBA(73, 80, 87, 0.95) !important;
color: white !important;
border-radius: 4px;
font-size: 14px !important;
line-height: 18px !important;
padding: 15px !important;
letter-spacing: 0;
max-width: 360px !important;
}
.v-tooltip__content:after {
content: "" !important;
position: absolute !important;
top: 50% !important;
right: 100% !important;
margin-top: -10px !important;
border-top: 10px solid transparent !important;
border-bottom: 10px solid transparent !important;
border-right: 8px solid RGBA(73, 80, 87, .95) !important;
}

.top-tooltip:after {
top: 100% !important;
left: 45% !important;
margin-top: 0 !important;
border-right: 10px solid transparent !important;
border-left: 10px solid transparent !important;
border-top: 8px solid RGBA(73, 80, 87, 0.95) !important;
}

.right-tooltip:after {
top: 50% !important;
right: 100% !important;
margin-top: -10px !important;
border-bottom: 10px solid transparent !important;
border-left: 10px solid transparent !important;
border-top: 10px solid transparent !important;
border-right: 8px solid RGBA(73, 80, 87, 0.95) !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@emit-bcol-info="setBcolInfo"
@is-pad-valid="isPADValid"
@is-ejv-valid="isEJVValid"
@cancel="cancel"
/>
<v-slide-y-transition>
<div
Expand Down
58 changes: 1 addition & 57 deletions auth-web/src/components/auth/common/AccountBusinessType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ export default defineComponent({

<style lang="scss" scoped>
@import '$assets/scss/theme.scss';
@import '@/assets/scss/tooltip.scss';
.view-container {
padding: 0 !important;
}
Expand All @@ -467,63 +468,6 @@ export default defineComponent({
background-color: $BCgovInputBG !important;
}
}
.tooltip-activator {
width: 100%;
}
.tooltip {
background-color: transparent;
opacity: 1 !important;

.tooltip-content {
min-width: 30rem;
padding: 2rem;
}
}
.tooltip-text {
border-bottom: 2px dotted;
}
.tooltip-text:hover {
cursor: pointer;
}
.v-tooltip__content {
background-color: RGBA(73, 80, 87, 0.95) !important;
color: white !important;
border-radius: 4px;
font-size: 14px !important;
line-height: 18px !important;
padding: 15px !important;
letter-spacing: 0;
max-width: 360px !important;
}
.v-tooltip__content:after {
content: "" !important;
position: absolute !important;
top: 50% !important;
right: 100% !important;
margin-top: -10px !important;
border-top: 10px solid transparent !important;
border-bottom: 10px solid transparent !important;
border-right: 8px solid RGBA(73, 80, 87, .95) !important;
}

.top-tooltip:after {
top: 100% !important;
left: 45% !important;
margin-top: 0 !important;
border-right: 10px solid transparent !important;
border-left: 10px solid transparent !important;
border-top: 8px solid RGBA(73, 80, 87, 0.95) !important;
}

.right-tooltip:after {
top: 50% !important;
right: 100% !important;
margin-top: -10px !important;
border-bottom: 10px solid transparent !important;
border-left: 10px solid transparent !important;
border-top: 10px solid transparent !important;
border-right: 8px solid RGBA(73, 80, 87, 0.95) !important;
}

.align-vertical {
align-items: center;
Expand Down
122 changes: 92 additions & 30 deletions auth-web/src/components/auth/common/PaymentMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:data-test="`div-payment-${payment.type}`"
>
<div>
<header class="d-flex align-center">
<header class="d-flex align-center flex-grow-1">
<div class="payment-icon-container mt-n2">
<v-icon
x-large
Expand All @@ -28,22 +28,50 @@
{{ payment.icon }}
</v-icon>
</div>
<div class="pr-8">
<div class="pr-8 flex-grow-1">
<h3 class="title font-weight-bold payment-title mt-n1">
{{ payment.title }}
</h3>
<div>{{ payment.subtitle }}</div>
</div>
<v-tooltip
v-if="!isChangePaymentEnabled() && !isPaymentSelected(payment)"
top
content-class="top-tooltip"
transition="fade-transition"
>
<template #activator="{ on, attrs }">
<div
v-bind="attrs"
class="btn-tooltip-wrap"
v-on="on"
>
<v-btn
large
depressed
color="primary"
width="120"
:class="['font-weight-bold', 'ml-auto', { 'disabled': !isChangePaymentEnabled() }]"
:aria-label="'Select' + ' ' + payment.title"
:data-test="`btn-payment-${payment.type}`"
disabled
>
<span>{{ isPaymentSelected(payment) ? 'SELECTED' : 'SELECT' }}</span>
</v-btn>
</div>
</template>
<span>This payment method is not available after EFT is selected.</span>
</v-tooltip>
<v-btn
v-if="isPaymentSelected(payment) || isChangePaymentEnabled()"
large
depressed
color="primary"
width="120"
:class="['font-weight-bold', 'ml-auto', { 'disabled': !isChangeFromEFTEnabled() }]"
:outlined="!isPaymentSelected(payment) && isChangeFromEFTEnabled()"
:class="['font-weight-bold', 'ml-auto', { 'disabled': !isChangePaymentEnabled() }]"
:outlined="!isPaymentSelected(payment) && isChangePaymentEnabled()"
:aria-label="'Select' + ' ' + payment.title"
:data-test="`btn-payment-${payment.type}`"
:disabled="!isChangeFromEFTEnabled()"
@click="paymentMethodSelected(payment)"
>
<span>{{ (isPaymentSelected(payment)) ? 'SELECTED' : 'SELECT' }}</span>
Expand Down Expand Up @@ -138,7 +166,7 @@
</v-col>
</v-row>
<ModalDialog
ref="bcOnlineDialog"
ref="warningDialog"
max-width="650"
:show-icon="false"
:showCloseIcon="true"
Expand Down Expand Up @@ -278,17 +306,30 @@ export default defineComponent({
isInitialAcknowledged: { default: false },
isBcolAdmin: { default: false }
},
emits: ['get-PAD-info', 'emit-bcol-info', 'is-pad-valid', 'is-ejv-valid', 'payment-method-selected'],
emits: ['cancel', 'get-PAD-info', 'emit-bcol-info', 'is-pad-valid', 'is-ejv-valid', 'payment-method-selected'],
setup (props, { emit, root }) {
const { fetchCurrentOrganizationGLInfo, currentOrgPaymentDetails, getStatementsSummary } = useOrgStore()
const bcOnlineDialog: InstanceType<typeof ModalDialog> = ref(null)
const warningDialog: InstanceType<typeof ModalDialog> = ref(null)

const state = reactive({
dialogTitle: 'BC Online Payment Option Ending Soon',
dialogText: 'The "BC Online" payment option will soon be retired. Are you sure you want to continue?',
bcOnlineWarningMessage: 'This payment method will soon be retired.'
bcOnlineWarningMessage: 'This payment method will soon be retired.',
dialogTitle: '',
dialogText: ''
})

const openBCOnlineDialog = () => {
state.dialogTitle = 'BC Online Payment Option Ending Soon'
state.dialogText = 'The "BC Online" payment option will soon be retired. Are you sure you want to continue?'
warningDialog.value.open()
}

const openEFTWarningDialog = () => {
state.dialogTitle = 'Confirm Payment Method Change'
state.dialogText = `Are you sure you want to change your payment method to Electronic Funds Transfer?
This action cannot be undone, and you will not be able to select a different payment method later.`
warningDialog.value.open()
}

const selectedPaymentMethod = ref('')
const paymentTypes = PaymentTypes
const padInfo = ref({})
Expand Down Expand Up @@ -350,9 +391,20 @@ export default defineComponent({
}
}

const enableEFTPaymentMethod = () => {
const enableEFTPayment: boolean = LaunchDarklyService.getFlag(LDFlags.EnablePaymentChangeFromEFT, false)
return enableEFTPayment
}

const isChangePaymentEnabled = () => {
return props.currentOrgPaymentType !== PaymentTypes.EFT || enableEFTPaymentMethod()
}

const paymentMethodSelected = async (payment, isTouch = true) => {
const isFromEFT = props.currentOrgPaymentType === PaymentTypes.EFT
if (payment.type === PaymentTypes.PAD && isFromEFT) {
if (payment.type === PaymentTypes.EFT && isTouch && selectedPaymentMethod.value !== PaymentTypes.EFT && !enableEFTPaymentMethod()) {
openEFTWarningDialog()
} else if (payment.type === PaymentTypes.PAD && isFromEFT) {
const hasOutstandingBalance = await hasBalanceOwing()
if (hasOutstandingBalance) {
await root.$router.push({
Expand All @@ -362,7 +414,7 @@ export default defineComponent({
})
}
} else if (payment.type === PaymentTypes.BCOL && isTouch && selectedPaymentMethod.value !== PaymentTypes.BCOL) {
bcOnlineDialog.value.open()
openBCOnlineDialog()
} else {
state.bcOnlineWarningMessage = 'This payment method will soon be retired.'
}
Expand Down Expand Up @@ -397,28 +449,30 @@ export default defineComponent({
}

const cancelModal = () => {
bcOnlineDialog.value.close()
warningDialog.value.close()
selectedPaymentMethod.value = ''
}

const isChangeFromEFTEnabled = () => {
const enableEFTPaymentMethod: boolean = LaunchDarklyService.getFlag(LDFlags.EnablePaymentChangeFromEFT, false)
return props.currentOrgPaymentType !== PaymentTypes.EFT || enableEFTPaymentMethod
emit('cancel')
}

const continueModal = async () => {
const hasOutstandingBalance = await hasBalanceOwing()
const isFromEFT = props.currentOrgPaymentType === PaymentTypes.EFT
if (!hasOutstandingBalance) {
bcOnlineDialog.value.close()
} else if (isFromEFT) {
await root.$router.push({
name: Pages.PAY_OUTSTANDING_BALANCE,
params: { orgId: props.currentOrganization.id },
query: { changePaymentType: props.currentSelectedPaymentMethod }
})
const isEFTSelected = selectedPaymentMethod.value === PaymentTypes.EFT

if (isEFTSelected) {
warningDialog.value.close()
} else {
if (!hasOutstandingBalance) {
warningDialog.value.close()
} else if (isFromEFT) {
await root.$router.push({
name: Pages.PAY_OUTSTANDING_BALANCE,
params: { orgId: props.currentOrganization.id },
query: { changePaymentType: props.currentSelectedPaymentMethod }
})
}
state.bcOnlineWarningMessage = 'This payment method will soon be retired. It is recommended to select a different payment method.'
}
state.bcOnlineWarningMessage = 'This payment method will soon be retired. It is recommended to select a different payment method.'
}

onMounted(async () => {
Expand All @@ -445,11 +499,11 @@ export default defineComponent({
isPADValid,
isPadInfoTouched,
isPaymentSelected,
bcOnlineDialog,
warningDialog,
cancelModal,
continueModal,
isGLInfoValid,
isChangeFromEFTEnabled
isChangePaymentEnabled
}
}
})
Expand All @@ -458,6 +512,7 @@ export default defineComponent({
<style lang="scss" scoped>
@import '@/assets/scss/theme.scss';
@import '@/assets/scss/actions.scss';
@import '@/assets/scss/tooltip.scss';
.important {
background-color: #fff7e3;
border: 2px solid #fcba19;
Expand Down Expand Up @@ -530,4 +585,11 @@ export default defineComponent({
pointer-events: none;
}

.d-flex {
display: flex;
}

.flex-grow-1 {
flex-grow: 1;
}
</style>
Loading