From 73cb7b0e3e454107f79d51fae8cdbac7265a3675 Mon Sep 17 00:00:00 2001 From: AbrahamRostampoor <144154569+AbrahamRostampoor@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:19:47 -0800 Subject: [PATCH] 17869 - Adding CFS account number BUSINESS-FILINGS-UI (#565) * 17869 - Adding CFS account number BUSINESS-FILINGS-UI Signed-off-by: AbrahamRostampoor * cfs Update * Latest Updates * Formatting * Updated package.json and package-lock.json version number --------- Signed-off-by: AbrahamRostampoor --- package-lock.json | 4 +-- package.json | 2 +- src/components/Dashboard/TodoList.vue | 7 +++-- .../TodoList/PaymentPendingOnlineBanking.vue | 15 ++++++++++ src/services/pay-services.ts | 17 +++++++++++ .../unit/PaymentPendingOnlineBanking.spec.ts | 29 +++++++++++-------- tests/unit/pay-services.spec.ts | 17 +++++++++++ 7 files changed, 74 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 085b41383..c2578372b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-filings-ui", - "version": "7.0.24", + "version": "7.0.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "7.0.24", + "version": "7.0.25", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/base-address": "2.0.9", diff --git a/package.json b/package.json index a452e3d05..7d4a63266 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "7.0.24", + "version": "7.0.25", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", diff --git a/src/components/Dashboard/TodoList.vue b/src/components/Dashboard/TodoList.vue index 5e6176e63..f8783e725 100644 --- a/src/components/Dashboard/TodoList.vue +++ b/src/components/Dashboard/TodoList.vue @@ -541,6 +541,8 @@ @@ -659,6 +661,7 @@ export default class TodoList extends Mixins(AllowableActionsMixin, DateMixin, E inProcessFiling: number = null fetchAffiliationInvitationsErrorDialog = false authorizeAffiliationInvitationErrorDialog = false + accountId: number = null @Prop({ default: null }) readonly highlightId!: number @@ -960,9 +963,9 @@ export default class TodoList extends Mixins(AllowableActionsMixin, DateMixin, E } // load all the invitations here and push them into todo items - const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id + this.accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id const response = - await AuthServices.fetchAffiliationInvitations(this.getAuthApiUrl, this.getIdentifier, accountId) + await AuthServices.fetchAffiliationInvitations(this.getAuthApiUrl, this.getIdentifier, this.accountId) .catch((err) => { console.log('Error fetching affiliation invitations for todo', err) // eslint-disable-line no-console this.fetchAffiliationInvitationsErrorDialog = true diff --git a/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue b/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue index 6856ad8e9..1099cfa7d 100644 --- a/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue +++ b/src/components/Dashboard/TodoList/PaymentPendingOnlineBanking.vue @@ -11,6 +11,12 @@ If you have not done so, log in to your online bank account to pay the outstanding balance on your BC Registries and Online Services account. +
  • + Enter "BC Registries and Online Services" as payee. +
  • +
  • + Enter the following account number: {{ cfsAccountId }} +
  • Once submitted through your bank, Online Banking payments can take 2 to 5 days to be processed. @@ -30,16 +36,25 @@ diff --git a/src/services/pay-services.ts b/src/services/pay-services.ts index e176455ac..a9183d136 100644 --- a/src/services/pay-services.ts +++ b/src/services/pay-services.ts @@ -18,4 +18,21 @@ export default class PayServices { .then(response => response?.data) .catch(() => {}) // ignore errors } + + /** + * Fetches the CFS account ID from the pay-api. + * @param payApiUrl the URL of the pay-api + * @param accountId the ID for which to fetch the CFS account ID + * @returns the CFS account ID + */ + static async fetchCfsAccountId (payApiUrl: string, accountId: number): Promise { + const url = `${payApiUrl}accounts/${accountId}` + try { + const response = await axios.get(url) + return response?.data?.cfsAccount?.cfsAccountNumber + } catch (error) { + console.error('Error fetching data from Pay API:', error) + throw error + } + } } diff --git a/tests/unit/PaymentPendingOnlineBanking.spec.ts b/tests/unit/PaymentPendingOnlineBanking.spec.ts index ad51709a2..dfd14f31e 100644 --- a/tests/unit/PaymentPendingOnlineBanking.spec.ts +++ b/tests/unit/PaymentPendingOnlineBanking.spec.ts @@ -18,13 +18,16 @@ describe('Payment Pending Online Banking', () => { expect(wrapper.find('p').text()).toContain('This filing is pending') const listItems = wrapper.findAll('li') - expect(listItems.length).toBe(4) + expect(listItems.length).toBe(6) expect(listItems.at(0).text()).toContain('If you have not done so') - expect(listItems.at(1).text()).toContain('Once submitted through your bank') - expect(listItems.at(2).text()).toContain('Changes based on this filing') - expect(listItems.at(2).text()).toContain('for this filing is received') - expect(listItems.at(3).text()).toContain('You can use a credit card') - expect(listItems.at(3).text()).toContain('for this filing immediately') + expect(listItems.at(1).text()).toContain('Enter') + expect(listItems.at(1).text()).toContain('as payee') + expect(listItems.at(2).text()).toContain('Enter the following account number:') + expect(listItems.at(3).text()).toContain('Once submitted through your bank') + expect(listItems.at(4).text()).toContain('Changes based on this filing') + expect(listItems.at(4).text()).toContain('until the payment for this filing') + expect(listItems.at(5).text()).toContain('You can use a credit card') + expect(listItems.at(5).text()).toContain('for this filing immediately') wrapper.destroy() }) @@ -40,13 +43,15 @@ describe('Payment Pending Online Banking', () => { expect(wrapper.find('p').text()).toContain('This Director Change is pending') const listItems = wrapper.findAll('li') - expect(listItems.length).toBe(4) + expect(listItems.length).toBe(6) expect(listItems.at(0).text()).toContain('If you have not done so') - expect(listItems.at(1).text()).toContain('Once submitted through your bank') - expect(listItems.at(2).text()).toContain('Changes based on this Director Change') - expect(listItems.at(2).text()).toContain('for this Director Change is received') - expect(listItems.at(3).text()).toContain('You can use a credit card') - expect(listItems.at(3).text()).toContain('for this Director Change immediately') + expect(listItems.at(1).text()).toContain('Enter "BC Registries and Online Services"') + expect(listItems.at(2).text()).toContain('Enter the following account number:') + expect(listItems.at(3).text()).toContain('Once submitted through your bank') + expect(listItems.at(4).text()).toContain('Changes based on this Director Change') + expect(listItems.at(4).text()).toContain('until the payment for this Director Change') + expect(listItems.at(5).text()).toContain('You can use a credit card') + expect(listItems.at(5).text()).toContain('for this Director Change immediately') wrapper.destroy() }) diff --git a/tests/unit/pay-services.spec.ts b/tests/unit/pay-services.spec.ts index c3b14db5b..e730b3275 100644 --- a/tests/unit/pay-services.spec.ts +++ b/tests/unit/pay-services.spec.ts @@ -32,4 +32,21 @@ describe('Pay Services', () => { // verify data expect(response).toEqual({ ...paymentErrorObj }) }) + + it('fetches cfs account number correctly', async () => { + get.withArgs(`accounts/123`) + .returns(new Promise(resolve => resolve({ + data: { + cfsAccount: { + cfsAccountNumber: '99' + } + } + }))) + + const response = await PayServices.fetchCfsAccountId('', 123) + + sinon.assert.called(get) + // verify data + expect(response).toEqual('99') + }) })