Skip to content

Commit

Permalink
23072 - EFT - Consolidated invoices / unlock - frontend changes (#3005)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Sep 11, 2024
1 parent a24af0e commit 5a5f8ed
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 59 deletions.
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.84",
"version": "2.6.85",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
19 changes: 15 additions & 4 deletions auth-web/src/components/auth/account-freeze/AccountOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
outlined
flat
class="suspended-info-card mb-12"
:loading="loading"
>
<v-card-text class="py-2 px-6">
<v-row>
Expand All @@ -36,9 +37,12 @@
:key="statement.id"
>
<v-col class="pt-0">
<div class="link">
<a
class="text-decoration-underline"
@click="downloadStatement(statement)"
>
{{ formatDateRange(statement.fromDate, statement.toDate) }}
</div>
</a>
</v-col>
</v-row>
<v-divider class="my-2" />
Expand Down Expand Up @@ -79,6 +83,7 @@
import { computed, defineComponent, onMounted, reactive, toRefs } from '@vue/composition-api'
import CommonUtils from '@/util/common-util'
import { FailedInvoice } from '@/models/invoice'
import { useDownloader } from '@/composables/downloader'
import { useOrgStore } from '@/stores/org'
export default defineComponent({
Expand All @@ -93,11 +98,12 @@ export default defineComponent({
const formatDate = CommonUtils.formatDisplayDate
const formatDateRange = CommonUtils.formatDateRange
const suspendedDate = (currentOrganization.value?.suspendedOn) ? formatDate(new Date(currentOrganization.value.suspendedOn)) : ''
const state = reactive({
statements: [],
totalAmountDue: 0
totalAmountDue: 0,
loading: false
})
const { downloadStatement } = useDownloader(orgStore, state)
const goNext = () => {
emit('step-forward')
Expand All @@ -113,6 +119,7 @@ export default defineComponent({
...toRefs(state),
currentOrganization,
currentMembership,
downloadStatement,
suspendedDate,
downloadNSFInvoicesPDF,
goNext,
Expand All @@ -126,6 +133,10 @@ export default defineComponent({
<style lang="scss" scoped>
@import "$assets/scss/theme.scss";
.text-decoration-underline {
text-decoration: underline;
}
.link {
color: var(--v-primary-base) !important;
text-decoration: underline;
Expand Down
15 changes: 13 additions & 2 deletions auth-web/src/components/auth/account-freeze/MakePayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
<div>
<h2>Electronic Funds Transfer</h2>
<p>
Follow the <span class="link">payment instruction</span> to make a payment.
Follow the <a
class="text-decoration-underline"
@click="downloadEFTInstructions"
>payment instructions </a>to make a payment.
Processing may take 2-5 business days after you paid.
You will receive an email notification once your account is unlocked.
</p>
Expand Down Expand Up @@ -104,6 +107,7 @@
import { CreateRequestBody, OrgPaymentDetails, PADInfo, PADInfoValidation } from '@/models/Organization'
import { defineComponent, onMounted, reactive, toRefs } from '@vue/composition-api'
import { PaymentTypes } from '@/util/constants'
import { useDownloader } from '@/composables/downloader'
import { useOrgStore } from '@/stores/org'
export default defineComponent({
Expand Down Expand Up @@ -162,7 +166,7 @@ export default defineComponent({
async function goNext () {
if (!state.isTouched) {
emit('final-step-action')
emit('final-step-action', state.paymentMethod === PaymentTypes.EFT ? 'eft-payment-instructions' : '')
} else {
state.isLoading = true
let isValid = state.isTouched ? await verifyPAD() : true
Expand Down Expand Up @@ -192,8 +196,11 @@ export default defineComponent({
emit('step-back')
}
const { downloadEFTInstructions } = useDownloader(orgStore, state)
return {
...toRefs(state),
downloadEFTInstructions,
onPaymentMethodChange,
goNext,
goBack
Expand All @@ -205,6 +212,10 @@ export default defineComponent({
<style lang="scss" scoped>
@import '@/assets/styles/theme.scss';
.text-decoration-underline {
text-decoration: underline;
}
.radio {
transform: scale(1.5);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</div>
<div class="instructions d-flex ma-0 justify-end align-end">
<p class="text-right ma-0">
<a @click="getEftInstructions">How to pay with electronic funds transfer</a>
<a @click="downloadEFTInstructions">How to pay with electronic funds transfer</a>
</p>
</div>
</div>
Expand Down Expand Up @@ -187,13 +187,13 @@ import { PropType, computed, defineComponent, onMounted, reactive, toRefs, watch
import { StatementFilterParams, StatementListItem } from '@/models/statement'
import AccountChangeMixin from '@/components/auth/mixins/AccountChangeMixin.vue'
import CommonUtils from '@/util/common-util'
import DocumentService from '@/services/document.services'
import LaunchDarklyService from 'sbc-common-components/src/services/launchdarkly.services'
import StatementsSettings from '@/components/auth/account-settings/statement/StatementsSettings.vue'
import moment from 'moment'
import { paymentTypeDisplay } from '../../../../resources/display-mappers'
import { useAccountChangeHandler } from '@/composables'
import { useDownloader } from '@/composables/downloader'
import { useOrgStore } from '@/stores/org'
export default defineComponent({
Expand Down Expand Up @@ -268,6 +268,8 @@ export default defineComponent({
})
})
const { downloadEFTInstructions } = useDownloader(orgStore, state)
const isStatementNew = (item: StatementListItem) => {
let isNew = item.isNew
const statementsDownloaded = JSON.parse(sessionStorage.getItem(SessionStorageKeys.StatementsDownloaded)) || []
Expand All @@ -281,19 +283,6 @@ export default defineComponent({
return item.isOverdue
}
const getEftInstructions = async (): Promise<any> => {
state.isLoading = true
try {
const downloadData = await DocumentService.getEftInstructions()
CommonUtils.fileDownload(downloadData?.data, `bcrs_eft_instructions.pdf`, downloadData?.headers['content-type'])
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
} finally {
state.isLoading = false
}
}
const getStatementsList = async (filterParams: any): Promise<any> => {
const data = await orgStore.getStatementsList(filterParams)
return data
Expand Down Expand Up @@ -455,10 +444,10 @@ export default defineComponent({
formatDate,
formatAmount,
downloadStatement,
downloadEFTInstructions,
enableEFTPaymentMethod,
isStatementNew,
isStatementOverdue,
getEftInstructions,
getPaginationOptions,
customSortActive,
formatDateRange,
Expand Down
18 changes: 5 additions & 13 deletions auth-web/src/components/auth/common/PaymentMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
To send us a payment through electronic funds transfer (EFT), please read the
<a
class="text-decoration-underline"
@click="getEftInstructions"
@click="downloadEFTInstructions"
>Electronic Funds Transfer Payment Instructions</a>.
</div>
</div>
Expand Down Expand Up @@ -213,14 +213,13 @@
import { LDFlags, Pages, PaymentTypes } from '@/util/constants'
import { computed, defineComponent, onMounted, reactive, ref, toRefs } from '@vue/composition-api'
import { BcolProfile } from '@/models/bcol'
import CommonUtils from '@/util/common-util'
import ConfigHelper from '@/util/config-helper'
import DocumentService from '@/services/document.services'
import GLPaymentForm from '@/components/auth/common/GLPaymentForm.vue'
import LaunchDarklyService from 'sbc-common-components/src/services/launchdarkly.services'
import LinkedBCOLBanner from '@/components/auth/common/LinkedBCOLBanner.vue'
import ModalDialog from '@/components/auth/common/ModalDialog.vue'
import PADInfoForm from '@/components/auth/common/PADInfoForm.vue'
import { useDownloader } from '@/composables/downloader'
import { useOrgStore } from '@/stores/org'
const PAYMENT_METHODS = {
Expand Down Expand Up @@ -314,6 +313,7 @@ export default defineComponent({
const { fetchCurrentOrganizationGLInfo, currentOrgPaymentDetails, getStatementsSummary } = useOrgStore()
const warningDialog: InstanceType<typeof ModalDialog> = ref(null)
const orgStore = useOrgStore()
const state = reactive({
bcOnlineWarningMessage: 'This payment method will soon be retired.',
dialogTitle: '',
Expand Down Expand Up @@ -375,15 +375,7 @@ export default defineComponent({
return (selectedPaymentMethod.value === payment.type)
}
const getEftInstructions = async () => {
try {
const downloadData = await DocumentService.getEftInstructions()
CommonUtils.fileDownload(downloadData?.data, `bcrs_eft_instructions.pdf`, downloadData?.headers['content-type'])
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
}
}
const { downloadEFTInstructions } = useDownloader(orgStore, state)
const hasBalanceOwing = async () => {
try {
Expand Down Expand Up @@ -496,7 +488,7 @@ export default defineComponent({
allowedPaymentMethods,
forceEditModeBCOL,
isPaymentEJV,
getEftInstructions,
downloadEFTInstructions,
paymentMethodSelected,
getPADInfo,
setBcolInfo,
Expand Down
16 changes: 2 additions & 14 deletions auth-web/src/components/pay/OutstandingBalances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ import CommonUtils from '@/util/common-util'
import ConfigHelper from 'sbc-common-components/src/util/config-helper'
import { Pages } from '@/util/constants'
import { Payment } from '@/models/Payment'
import { StatementListItem } from '@/models/statement'
import moment from 'moment'
import { useDownloader } from '@/composables/downloader'
import { useOrgStore } from '@/stores'
export default defineComponent({
Expand Down Expand Up @@ -248,6 +248,7 @@ export default defineComponent({
statementOwingError: false,
selectedPaymentMethod: 'cc'
})
const { downloadStatement } = useDownloader(orgStore, state)
const handlePayment = async () => {
state.handlingPayment = true
Expand Down Expand Up @@ -308,19 +309,6 @@ export default defineComponent({
return CommonUtils.formatDisplayDate(moment(), 'MMMM DD, YYYY')
}
async function downloadStatement (statement: StatementListItem) {
try {
const fileType = 'application/pdf'
const response = await orgStore.getStatement({ statementId: statement.id, type: fileType })
const contentDispArr = response?.headers['content-disposition'].split('=')
const fileName = (contentDispArr.length && contentDispArr[1]) ? contentDispArr[1] : `bcregistry-statement-pdf`
CommonUtils.fileDownload(response.data, fileName, 'application/pdf')
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
}
}
function alertMessage () {
return 'Please settle any outstanding statements and transactions before changing your payment method, ' +
'or wait until all unpaid transactions are settled by your current method.'
Expand Down
38 changes: 38 additions & 0 deletions auth-web/src/composables/downloader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import CommonUtils from '@/util/common-util'
import DocumentService from '@/services/document.services'
import { StatementListItem } from '@/models/statement'

export function useDownloader (orgStore, state) {
async function downloadStatement (statement: StatementListItem) {
try {
state.loading = true
const fileType = 'application/pdf'
const response = await orgStore.getStatement({ statementId: statement.id, type: fileType })
const contentDispArr = response?.headers['content-disposition'].split('=')
const fileName = (contentDispArr.length && contentDispArr[1]) ? contentDispArr[1] : `bcregistry-statement-pdf`
CommonUtils.fileDownload(response.data, fileName, 'application/pdf')
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
} finally {
state.loading = false
}
}

async function downloadEFTInstructions () {
state.isLoading = true
try {
const downloadData = await DocumentService.getEftInstructions()
CommonUtils.fileDownload(downloadData?.data, `bcrs_eft_instructions.pdf`, downloadData?.headers['content-type'])
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
} finally {
state.isLoading = false
}
}
return {
downloadEFTInstructions,
downloadStatement
}
}
3 changes: 2 additions & 1 deletion auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export enum Pages {
AFFIDAVIT_COMPLETE = 'upload-affidavit',
LOGIN = 'login',
PAY_OUTSTANDING_BALANCE = 'pay-outstanding-balance',
PAYMENT_OPTION = 'payment-option'
PAYMENT_OPTION = 'payment-option',
ACCOUNT_HOLD = 'account-hold'
}

export enum Account {
Expand Down
4 changes: 4 additions & 0 deletions auth-web/src/views/auth/AccountLoginOptionsChooser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default class AccountLoginOptionsChooser extends Mixins(AccountChangeMixi
<style lang="scss" scoped>
@import '$assets/scss/theme.scss';
.text-decoration-underline {
text-decoration: underline;
}
.view-container {
max-width: 60rem;
}
Expand Down
Loading

0 comments on commit 5a5f8ed

Please sign in to comment.