diff --git a/api/accounts/data.mock.ts b/api/accounts/data.mock.ts deleted file mode 100644 index 78f7b8340..000000000 --- a/api/accounts/data.mock.ts +++ /dev/null @@ -1,67 +0,0 @@ -import {Payments} from '../lib/models/transactions' -export const PaymentMock: Payments = { - payments: [ - { - _links: { - cancel: { - href: 'string', - method: 'string', - }, - next_url: { - href: 'string', - method: 'string', - }, - self: { - href: 'string', - method: 'string', - }, - }, - account_number: 'string', - amount: 0, - case_reference: 'string', - ccd_case_number: 'string', - channel: 'string', - currency: 'GBP', - customer_reference: 'string', - date_created: 'yyyy-MM-dd\'T\'HH:mm:ss.SSSZ', - date_updated: 'yyyy-MM-dd\'T\'HH:mm:ss.SSSZ', - description: 'string', - external_provider: 'string', - external_reference: 'string', - fees: [ - { - calculated_amount: 0, - ccd_case_number: 'string', - code: 'string', - memo_line: 'string', - natural_account_code: 'string', - reference: 'string', - remission_reference: 'string', - version: 'string', - volume: 0, - }, - ], - giro_slip_no: 'string', - id: 'string', - method: 'string', - organisation_name: 'string', - payment_group_reference: 'string', - payment_reference: 'string', - reference: 'string', - reported_date_offline: 'string', - service_name: 'string', - site_id: 'string', - status: 'string', - status_histories: [ - { - date_created: 'yyyy-MM-dd\'T\'HH:mm:ss.SSSZ', - date_updated: 'yyyy-MM-dd\'T\'HH:mm:ss.SSSZ', - error_code: 'string', - error_message: 'string', - external_status: 'string', - status: 'string', - }, - ], - }, -], -} diff --git a/api/accounts/index.ts b/api/accounts/index.ts index f3c738e11..bd2474ce8 100644 --- a/api/accounts/index.ts +++ b/api/accounts/index.ts @@ -1,81 +1,51 @@ +import { AxiosPromise } from 'axios' import * as express from 'express' -import * as log4js from 'log4js' import { config } from '../lib/config' -import { EnhancedRequest } from '../lib/models' -import { PaymentAccountDto } from '../lib/models/transactions' -import { asyncReturnOrError } from '../lib/util' -import { getAccount, getPayments } from '../services/payment' -import { getAccountsForOrganisation } from '../services/rdProfessional' -import { mockReq, mockRes } from 'sinon-express-mock' -const logger = log4js.getLogger('auth') -logger.level = config.logging -export const router = express.Router({ mergeParams: true }) - -export async function accountsForOrganisation(req: EnhancedRequest, res: express.Response): Promise { - return await asyncReturnOrError( - getAccountsForOrganisation(req.session.auth.orgId), - '3rd party service payment api return error - Cannot get accounts for organisation', - res, - logger - ) -} - -export async function handleAccountPbasRoute(req: EnhancedRequest, res: express.Response) { - const accounts: PaymentAccountDto[] = await this.accountsForOrganisation(req, res) - - if (accounts) { - res.send(accounts) - } -} - -export async function validatePBANumberForOrganisation(req: EnhancedRequest, res: express.Response): Promise { - const accounts: PaymentAccountDto[] = await this.accountsForOrganisation(req, res) - - if (accounts && !accounts.some(account => account.pbaNumber === req.params.id)) { - res.status(401).send('Unauthorised PBA number for organisation') - return false - } - - return !!accounts.length || false -} - -export async function handleAccountRoute(req: EnhancedRequest, res: express.Response) { - const isValidPBA = await this.validatePBANumberForOrganisation(req, res) - - if (isValidPBA) { - const response = await asyncReturnOrError( - getAccount(req.params.id), - '3rd party service payment api return error - cannot get account', - res, - logger - ) - - if (response) { - res.send(response.data) +import { http } from '../lib/http' + +async function handleAddressRoute(req, res) { + let errReport: any + if (!req.query.accountNames) { + errReport = { + apiError: 'Account is missing', + apiStatusCode: '400', + message: 'Fee And Pay route error', } + res.status(500).send(errReport) } + const accountNames = req.query.accountNames.split(',') + console.log('accountNames', accountNames) + const accounts = new Array() + const accountPromises = new Array>() + accountNames.forEach((accountName: string) => accountPromises.push(getAccount(accountName))) + + try { + await Promise.all(accountPromises).then(allAccounts => { + allAccounts.forEach(account => { + accounts.push(account.data) + }) + }) + } catch (error) { + console.error(error) + errReport = { + apiError: error && error.data && error.data.message ? error.data.message : error, + apiStatusCode: error && error.status ? error.status : '', + message: `Fee And Pay route error `, + } + res.status(500).send(errReport) + return + } + res.send(accounts) } -export async function handleAccountPbaTransactionsRoute(req: EnhancedRequest, res: express.Response) { - const isValidPBA = await this.validatePBANumberForOrganisation(req, res) +function getAccount(accountName: string): AxiosPromise { + const url = `${config.services.feeAndPayApi}/accounts/${accountName}` + const promise = http.get(url) + return promise + } - if (isValidPBA) { - const response = await asyncReturnOrError( - getPayments(req.params.id), - '3rd party service payment api return error - cannot get account payments', - res, - logger - ) +export const router = express.Router({ mergeParams: true }) - if (response) { - res.send(response.data) - } - } -} -// overview -router.get('/pbas', handleAccountPbasRoute) -// Single account -router.get('/:id', handleAccountRoute) -router.get('/:id/transactions', handleAccountPbaTransactionsRoute) +router.get('', handleAddressRoute) export default router diff --git a/api/lib/config/environments/demo.config.ts b/api/lib/config/environments/demo.config.ts index 2c258617d..a76d102c6 100644 --- a/api/lib/config/environments/demo.config.ts +++ b/api/lib/config/environments/demo.config.ts @@ -1,43 +1,42 @@ export default { - services: { - ccdDataApi: 'https://ccd-data-store-api-demo.service.core-compute-demo.internal', - ccdDefApi: 'https://ccd-definition-store-api-demo.service.core-compute-demo.internal', - idamWeb: 'https://idam-web-public.demo.platform.hmcts.net', - idamApi: 'https://idam-api.demo.platform.hmcts.net', - s2s: 'http://rpe-service-auth-provider-demo.service.core-compute-demo.internal', - draftStoreApi: 'https://draft-store-service-demo.service.core-compute-demo.internal', - dmStoreApi: 'https://dm-store-demo.service.core-compute-demo.internal', - emAnnoApi: 'https://em-anno-demo.service.core-compute-demo.internal', - emNpaApi: 'https://em-npa-demo.service.core-compute-demo.internal', - rdProfessionalApi: 'https://rd-professional-api-demo.service.core-compute-demo.internal', + ccdDataApi: 'http://ccd-data-store-api-demo.service.core-compute-demo.internal', + ccdDefApi: 'http://ccd-definition-store-api-demo.service.core-compute-demo.internal', + idamWeb: 'https://idam-web-public.aat.platform.hmcts.net', + idamApi: 'https://idam-api.aat.platform.hmcts.net', + s2s: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal', + rdProfessionalApi: 'http://rd-professional-api-aat.service.core-compute-aat.internal', + feeAndPayApi: 'https://payment-api-demo.service.core-compute-demo.internal', }, health: { - ccdDataApi: 'https://ccd-data-store-api-demo.service.core-compute-demo.internal/health', - ccdDefApi: 'https://ccd-definition-store-api-demo.service.core-compute-demo.internal/health', - idamWeb: 'https://idam-web-public.demo.platform.hmcts.net/health', - idamApi: 'https://idam-api.demo.platform.hmcts.net/health', - s2s: 'http://rpe-service-auth-provider-demo.service.core-compute-demo.internal/health', - draftStoreApi: 'https://draft-store-service-demo.service.core-compute-demo.internal/health', - dmStoreApi: 'https://dm-store-demo.service.core-compute-demo.internal/health', - emAnnoApi: 'https://em-anno-demo.service.core-compute-demo.internal/health', - emNpaApi: 'https://em-npa-demo.service.core-compute-demo.internal/health', - rdProfessionalApi: 'https://rd-professional-api-demo.service.core-compute-demo.internal/health', + ccdDataApi: 'http://ccd-data-store-api-demo.service.core-compute-demo.internal/health', + ccdDefApi: 'http://ccd-definition-store-api-demo.service.core-compute-demo.internal/health', + idamWeb: 'https://idam-web-public.aat.platform.hmcts.net/health', + idamApi: 'https://idam-api.aat.platform.hmcts.net/health', + s2s: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal/health', + rdProfessionalApi: 'http://rd-professional-api-aat.service.core-compute-aat.internal/health', + feeAndPayApi: 'https://payment-api-demo.service.core-compute-demo.internal/health', + }, - useProxy: false, - secureCookie: false, - sessionSecret: 'secretSauce', - logging: 'debug', - jurisdictions: [ - {id: 'SSCS'}, - {id: 'AUTOTEST1'}, - {id: 'DIVORCE'}, - {id: 'PROBATE'}, - {id: 'PUBLICLAW'}, - {id: 'bulkscan'}, - {id: 'BULKSCAN'}, - {id: 'IA'}, - {id: 'EMPLOYMENT'}, - {id: 'CMC'} - ], -} + proxy: { + host: '172.16.0.7', + port: 8080, + }, + protocol: 'http', + secureCookie: false, + sessionSecret: 'secretSauce', + logging: 'debug', + jurisdictions: [ + {id: 'SSCS'}, + {id: 'SSCS'}, + {id: 'AUTOTEST1'}, + {id: 'DIVORCE'}, + {id: 'PROBATE'}, + {id: 'PUBLICLAW'}, + {id: 'bulkscan'}, + {id: 'BULKSCAN'}, + {id: 'IA'}, + {id: 'EMPLOYMENT'}, + {id: 'CMC'}, + ], +} \ No newline at end of file diff --git a/api/lib/config/environments/local.config.ts b/api/lib/config/environments/local.config.ts index 617567e1c..87b67fe96 100644 --- a/api/lib/config/environments/local.config.ts +++ b/api/lib/config/environments/local.config.ts @@ -6,6 +6,7 @@ export default { idamApi: 'https://idam-api.aat.platform.hmcts.net', s2s: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal', rdProfessionalApi: 'http://rd-professional-api-aat.service.core-compute-aat.internal', + feeAndPayApi: 'https://payment-api-aat.service.core-compute-aat.internal', }, health: { ccdDataApi: 'http://ccd-data-store-api-demo.service.core-compute-demo.internal/health', @@ -14,6 +15,7 @@ export default { idamApi: 'https://idam-api.aat.platform.hmcts.net/health', s2s: 'http://rpe-service-auth-provider-aat.service.core-compute-aat.internal/health', rdProfessionalApi: 'http://rd-professional-api-aat.service.core-compute-aat.internal/health', + feeAndPayApi: 'https://payment-api-aat.service.core-compute-aat.internal/health', }, proxy: { host: '172.16.0.7', @@ -36,4 +38,4 @@ export default { {id: 'EMPLOYMENT'}, {id: 'CMC'}, ], -} +} \ No newline at end of file diff --git a/api/payments/index.ts b/api/payments/index.ts new file mode 100644 index 000000000..d307ec7d9 --- /dev/null +++ b/api/payments/index.ts @@ -0,0 +1,34 @@ +import * as express from 'express' +import { config } from '../lib/config' +import { http } from '../lib/http' + +async function handleAddressRoute(req, res) { + let errReport: any + if (!req.params.account) { + errReport = { + apiError: 'Account is missing', + apiStatusCode: '400', + message: 'Fee And Pay route error', + } + res.status(500).send(errReport) + } + try { + const response = await http.get( + `${config.services.feeAndPayApi}/pba-accounts/${req.params.account}/payments/` + ) + res.send(response.data.payments) + } catch (error) { + errReport = { + apiError: error.data.message, + apiStatusCode: error.status, + message: 'Fee And Pay route error', + } + res.status(500).send(errReport) + } +} + +export const router = express.Router({ mergeParams: true }) + +router.get('', handleAddressRoute) + +export default router diff --git a/api/routes.ts b/api/routes.ts index d9fd132b2..b19c82398 100644 --- a/api/routes.ts +++ b/api/routes.ts @@ -5,6 +5,7 @@ import healthCheck from './healthCheck' import inviteUser from './inviteUser' import getJurisdictions from './jurisdictions' import organisationRouter from './organisation' +import payments from './payments' import userDetailsRouter from './user' import getUserList from './userList' @@ -20,5 +21,6 @@ router.use('/inviteUser', inviteUser) router.use('/userList', getUserList) router.use('/userDetails', getUserList) router.use('/jurisdictions', getJurisdictions) +router.use('/payments/:account', payments) export default router diff --git a/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.html b/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.html index c79641b57..615874ef5 100644 --- a/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.html +++ b/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.html @@ -15,7 +15,8 @@ - {{r[col.key]}} + {{formatDate(r[col.key])}} + {{r[col.key]}} {{r[col.key]}} diff --git a/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.ts b/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.ts index b9b2cb3a0..196ebf56f 100644 --- a/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.ts +++ b/projects/gov-ui/src/lib/components/govuk-table/govuk-table.component.ts @@ -1,4 +1,5 @@ import {Component, Input} from '@angular/core'; +import {formatDate} from '@angular/common'; @Component({ selector: 'app-govuk-table', @@ -21,6 +22,10 @@ export class GovukTableComponent { constructor() { } + formatDate(date: Date): string { + return formatDate(date, 'dd/MM/yyyy', 'en-UK'); + } + } export class GovukTableColumnConfig { diff --git a/src/app/app.constants.ts b/src/app/app.constants.ts index 1b700709a..cda145709 100644 --- a/src/app/app.constants.ts +++ b/src/app/app.constants.ts @@ -6,18 +6,27 @@ const navItemsArray: NavItemModel[] = [ { text: 'Organisation', href: '/organisation', - active: false + active: false, + orderId: 1 }, { text: 'Users', href: '/users', - active: false + active: false, + orderId: 2 + }, + { + text: 'Fee Accounts', + href: '/fee-accounts', + active: false, + orderId: 3 } ]; const roleBasedNav = { + 'pui-organisation-manager': navItemsArray[0], 'pui-user-manager': navItemsArray[1], - 'pui-organisation-manager': navItemsArray[0] + 'pui-finance-manager': navItemsArray[2], }; const userNav: UserNavModel = { diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index a81d81b4a..950fae4ad 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,8 +1,8 @@ import { Routes } from '@angular/router'; import { AuthGuard } from '../user-profile/guards/auth.guard'; -import { RedirectComponent } from './containers/redirect/redirect.component'; -import { CookiePolicyComponent, AccessibilityComponent, PrivacyPolicyComponent, TermsAndConditionsComponent, - ServiceDownComponent } from './components'; +import {RedirectComponent} from './containers/redirect/redirect.component'; +import { ServiceDownComponent, + CookiePolicyComponent, PrivacyPolicyComponent, TermsAndConditionsComponent, AccessibilityComponent } from './components'; export const ROUTES: Routes = [ { @@ -21,6 +21,11 @@ export const ROUTES: Routes = [ canActivate: [AuthGuard], loadChildren: '../users/users.module#UsersModule' }, + { + path: 'fee-accounts', + canActivate: [AuthGuard], + loadChildren: '../fee-accounts/fee-accounts.module#FeeAccountsModule' + }, { path: 'style-guide', canActivate: [AuthGuard], diff --git a/src/app/models/nav-items.model.ts b/src/app/models/nav-items.model.ts index 3b5b6689d..c8ef70b72 100644 --- a/src/app/models/nav-items.model.ts +++ b/src/app/models/nav-items.model.ts @@ -2,6 +2,7 @@ export interface NavItemModel { text: string; href: string; active: boolean; + orderId: number; } export interface NavItemsModel { diff --git a/src/app/store/reducers/app.reducer.spec.ts b/src/app/store/reducers/app.reducer.spec.ts index 35d9fd66d..f2a510f41 100644 --- a/src/app/store/reducers/app.reducer.spec.ts +++ b/src/app/store/reducers/app.reducer.spec.ts @@ -63,12 +63,20 @@ describe('AppReducer', () => { { text: 'Organisation', href: '/organisation', - active: false + active: false, + orderId: 1 }, { text: 'Users', href: '/users', - active: false + active: false, + orderId: 2 + }, + { + href: '/fee-accounts', + text: 'Fee Accounts', + active: false, + orderId: 3 } ]; const action = new fromAppActions.SetUserRoles(payload); diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts index aa53bf978..3d585b01e 100644 --- a/src/app/store/reducers/app.reducer.ts +++ b/src/app/store/reducers/app.reducer.ts @@ -53,8 +53,7 @@ export function reducer( } case fromAction.SET_USER_ROLES: { - // TODO perhaps find better sorting solution for rendering sequence of nav tabs. It will not work Fees Acc - const roles = [...action.payload].sort(); + const roles = [...action.payload]; let navItems = []; roles.forEach(role => { if (state.allNavItems.hasOwnProperty(role)) { @@ -64,6 +63,7 @@ export function reducer( ]; } }); + navItems = navItems.sort((a, b) => (a.orderId > b.orderId) ? 1 : ((b.orderId > a.orderId) ? -1 : 0)); return { ...state, navItems diff --git a/src/fee-accounts/components/summary/summary.component.html b/src/fee-accounts/components/summary/summary.component.html index 4017902fe..953bfeb05 100644 --- a/src/fee-accounts/components/summary/summary.component.html +++ b/src/fee-accounts/components/summary/summary.component.html @@ -5,8 +5,8 @@
Available credit
-
- £ {{data.credit_limit}} +
+ £ {{data[0].credit_limit}}
@@ -16,8 +16,8 @@
Balance
-
- £ {{data.available_balance}} +
+ £ {{data[0].available_balance}}
diff --git a/src/fee-accounts/containers/account-overview/account-overview.component.spec.ts b/src/fee-accounts/containers/account-overview/account-overview.component.spec.ts index 84bdd37c2..9688589af 100644 --- a/src/fee-accounts/containers/account-overview/account-overview.component.spec.ts +++ b/src/fee-accounts/containers/account-overview/account-overview.component.spec.ts @@ -3,6 +3,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AccountOverviewComponent } from './account-overview.component'; import { RouterModule } from '@angular/router'; import { APP_BASE_HREF } from '@angular/common'; +import { StoreModule } from '@ngrx/store'; +import { reducers } from '../../../organisation/store/reducers'; describe('AccountOverviewComponent', () => { let component: AccountOverviewComponent; @@ -12,6 +14,8 @@ describe('AccountOverviewComponent', () => { TestBed.configureTestingModule({ imports: [ RouterModule.forRoot([]), + StoreModule.forRoot({}), + StoreModule.forFeature('org', reducers), ], declarations: [AccountOverviewComponent], providers: [ { provide: APP_BASE_HREF, useValue: '/' }] diff --git a/src/fee-accounts/containers/account-overview/account-overview.component.ts b/src/fee-accounts/containers/account-overview/account-overview.component.ts index c8a719fba..fabc23b00 100644 --- a/src/fee-accounts/containers/account-overview/account-overview.component.ts +++ b/src/fee-accounts/containers/account-overview/account-overview.component.ts @@ -1,4 +1,8 @@ import { Component, OnInit } from '@angular/core'; +import * as fromStore from '../../../organisation/store/index'; +import { Organisation } from 'src/organisation/organisation.model'; +import { Subscription } from 'rxjs'; +import { select, Store } from '@ngrx/store'; @Component({ selector: 'app-account-overview', @@ -6,10 +10,16 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./account-overview.component.scss'] }) export class AccountOverviewComponent implements OnInit { + orgData: Organisation; + organisationSubscription: Subscription; - constructor() { } + constructor(private store: Store) { } ngOnInit() { + this.organisationSubscription = this.store.pipe(select(fromStore.getOrganisationSel)).subscribe(( data) => { + this.orgData = data; + console.log(this.orgData); + }); } } diff --git a/src/fee-accounts/containers/account-summary/account-summary.component.html b/src/fee-accounts/containers/account-summary/account-summary.component.html index eff4153dd..8ed101978 100644 --- a/src/fee-accounts/containers/account-summary/account-summary.component.html +++ b/src/fee-accounts/containers/account-summary/account-summary.component.html @@ -1,3 +1,4 @@ + Back
@@ -10,7 +11,7 @@

Loading...
diff --git a/src/fee-accounts/containers/account-summary/account-summary.component.spec.ts b/src/fee-accounts/containers/account-summary/account-summary.component.spec.ts index 3cc82ef40..b42f4824c 100644 --- a/src/fee-accounts/containers/account-summary/account-summary.component.spec.ts +++ b/src/fee-accounts/containers/account-summary/account-summary.component.spec.ts @@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AccountSummaryComponent } from './account-summary.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { RouterModule, ActivatedRoute } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { APP_BASE_HREF } from '@angular/common'; import { StoreModule } from '@ngrx/store'; import { reducers } from 'src/fee-accounts/store/reducers'; @@ -16,8 +16,8 @@ describe('AccountSummaryComponent', () => { beforeEach(async(() => { activatedRoute = { - parent: { - params: of({}) + snapshot: { + params: of({}) } }; TestBed.configureTestingModule({ diff --git a/src/fee-accounts/containers/account-summary/account-summary.component.ts b/src/fee-accounts/containers/account-summary/account-summary.component.ts index c286e66f0..f42b6871e 100644 --- a/src/fee-accounts/containers/account-summary/account-summary.component.ts +++ b/src/fee-accounts/containers/account-summary/account-summary.component.ts @@ -1,9 +1,13 @@ import {Component, OnDestroy, OnInit} from '@angular/core'; import * as fromfeatureStore from '../../store'; import {select, Store} from '@ngrx/store'; -import {Observable} from 'rxjs'; +import {Observable, Subscription} from 'rxjs'; import {ActivatedRoute} from '@angular/router'; import {map} from 'rxjs/internal/operators'; +import * as fromStore from '../../../organisation/store/index'; +import { Organisation } from 'src/organisation/organisation.model'; +import { FeeAccount } from 'src/fee-accounts/models/pba-accounts'; +import * as fromFeeAccountsStore from '../../../fee-accounts/store'; @Component({ selector: 'app-account-summary', @@ -11,7 +15,7 @@ import {map} from 'rxjs/internal/operators'; styleUrls: ['./account-summary.component.scss'] }) export class AccountSummaryComponent implements OnInit, OnDestroy { - accountSummary$: Observable; + accounts$: Observable>; navItems = [ { text: 'Summary', @@ -30,14 +34,8 @@ export class AccountSummaryComponent implements OnInit, OnDestroy { private store: Store) { } ngOnInit() { - // TODO move to a guard - this.activeRoute.parent.params.pipe( - map(payload => { - this.store.dispatch(new fromfeatureStore.LoadSingleFeeAccount({id: payload.id })); - }) - ).subscribe(); - this.accountSummary$ = this.store.pipe(select(fromfeatureStore.getSingleAccounOverview)); - this.loading$ = this.store.pipe(select(fromfeatureStore.pbaAccountSummaryLoading)); + this.store.dispatch(new fromFeeAccountsStore.LoadFeeAccounts([this.activeRoute.snapshot.params.id])); + this.accounts$ = this.store.pipe(select(fromFeeAccountsStore.feeAccounts)); } ngOnDestroy() { this.store.dispatch(new fromfeatureStore.ResetSingleFeeAccount({})); diff --git a/src/fee-accounts/containers/account-transactions/account-transactions.component.html b/src/fee-accounts/containers/account-transactions/account-transactions.component.html index 5256b0e12..c880a529b 100644 --- a/src/fee-accounts/containers/account-transactions/account-transactions.component.html +++ b/src/fee-accounts/containers/account-transactions/account-transactions.component.html @@ -1,4 +1,4 @@ - +Back
diff --git a/src/fee-accounts/containers/account-transactions/account-transactions.component.spec.ts b/src/fee-accounts/containers/account-transactions/account-transactions.component.spec.ts index 8d4bc669b..1f1bc1f2f 100644 --- a/src/fee-accounts/containers/account-transactions/account-transactions.component.spec.ts +++ b/src/fee-accounts/containers/account-transactions/account-transactions.component.spec.ts @@ -2,11 +2,12 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AccountTransactionsComponent } from './account-transactions.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { RouterModule, ActivatedRoute } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { APP_BASE_HREF } from '@angular/common'; import { StoreModule } from '@ngrx/store'; import { reducers } from 'src/fee-accounts/store/reducers'; import { of } from 'rxjs'; +import { RouterTestingModule } from '@angular/router/testing'; describe('AccountTransactionsComponent', () => { let component: AccountTransactionsComponent; @@ -16,14 +17,15 @@ describe('AccountTransactionsComponent', () => { beforeEach(async(() => { activatedRoute = { - parent: { - params: of({}) + snapshot: { + params: of({}) } }; TestBed.configureTestingModule({ imports: [ StoreModule.forRoot({}), StoreModule.forFeature('feeAccounts', reducers), + RouterTestingModule ], declarations: [ AccountTransactionsComponent ], schemas: [CUSTOM_ELEMENTS_SCHEMA], diff --git a/src/fee-accounts/containers/account-transactions/account-transactions.component.ts b/src/fee-accounts/containers/account-transactions/account-transactions.component.ts index 1e1fdd3fb..9f31bfa50 100644 --- a/src/fee-accounts/containers/account-transactions/account-transactions.component.ts +++ b/src/fee-accounts/containers/account-transactions/account-transactions.component.ts @@ -11,6 +11,7 @@ import {ActivatedRoute} from '@angular/router'; styleUrls: ['./account-transactions.component.scss'] }) export class AccountTransactionsComponent implements OnInit, OnDestroy { + backUrl: string; accountTransactions$: any; navItems = [ { @@ -25,13 +26,12 @@ export class AccountTransactionsComponent implements OnInit, OnDestroy { } ]; columnConfig = [ - { header: 'Payment reference', key: 'paymentReference' }, - { header: 'Case', key: 'case' }, - { header: 'Reference', key: 'reference' }, - { header: 'Submitted by', key: 'submittedBy' }, + { header: 'Payment reference', key: 'payment_reference' }, + { header: 'Case', key: 'ccd_case_number' }, + { header: 'Your reference', key: 'payment_reference' }, { header: 'Status', key: 'status' }, - { header: 'Date created', key: 'dateCreated' }, - { header: 'Last updated', key: 'dateUpdated' }, + { header: 'Date created', key: 'date_created', type: 'date' }, + { header: 'Last updated', key: 'date_updated', type: 'date' }, { header: 'Amount', key: 'amount' } ]; loading$: Observable; @@ -41,15 +41,9 @@ export class AccountTransactionsComponent implements OnInit, OnDestroy { ngOnInit() { this.loading$ = this.store.pipe(select(fromfeatureStore.pbaAccountTransactionsLoading)); - - // TODO move to a guard - find more elegant solution - this.activeRoute.parent.params.pipe( - map(payload => { - this.store.dispatch(new fromfeatureStore.LoadSingleFeeAccountTransactions({id: payload.id })); - }) - ).subscribe(); + this.store.dispatch(new fromfeatureStore.LoadSingleFeeAccountTransactions({id: this.activeRoute.snapshot.params.id })); this.accountTransactions$ = this.store.pipe(select(fromfeatureStore.pbaAccountTransactions)); - + this.backUrl = `/fee-accounts/account/${this.activeRoute.snapshot.params.id}`; } ngOnDestroy() { this.store.dispatch(new fromfeatureStore.ResetSingleFeeAccount({})); diff --git a/src/fee-accounts/containers/overview/account-overview.component.spec.ts b/src/fee-accounts/containers/overview/account-overview.component.spec.ts index 76b4b531f..4ebbc2a20 100644 --- a/src/fee-accounts/containers/overview/account-overview.component.spec.ts +++ b/src/fee-accounts/containers/overview/account-overview.component.spec.ts @@ -24,6 +24,7 @@ describe('OrganisationAccountsComponent', () => { imports: [ StoreModule.forRoot({}), StoreModule.forFeature('feeAccounts', reducers), + StoreModule.forFeature('org', reducers), ], schemas: [CUSTOM_ELEMENTS_SCHEMA], providers: [ diff --git a/src/fee-accounts/containers/overview/account-overview.component.ts b/src/fee-accounts/containers/overview/account-overview.component.ts index 353c33cff..5e27f9bca 100644 --- a/src/fee-accounts/containers/overview/account-overview.component.ts +++ b/src/fee-accounts/containers/overview/account-overview.component.ts @@ -1,31 +1,57 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, OnInit, OnDestroy} from '@angular/core'; import { Store, select } from '@ngrx/store'; -import * as fromFeeAccountsStore from '../../../fee-accounts/store'; +import * as fromAccountStore from '../../../fee-accounts/store'; import { GovukTableColumnConfig } from 'projects/gov-ui/src/lib/components/govuk-table/govuk-table.component'; -import {Observable} from 'rxjs'; -import {PbaAccountsSummary} from '../../models/pba-accounts'; -import {LoadFeeAccounts} from '../../../fee-accounts/store'; +import {Observable, Subscription, combineLatest} from 'rxjs'; +import {FeeAccount} from '../../models/pba-accounts'; +import * as fromOrgStore from '../../../organisation/store/index'; +import { Organisation } from 'src/organisation/organisation.model'; @Component({ selector: 'app-prd-fee-accounts-component', templateUrl: './account-overview.component.html', }) -export class OrganisationAccountsComponent implements OnInit { +export class OrganisationAccountsComponent implements OnInit, OnDestroy { columnConfig: GovukTableColumnConfig[]; tableRows: {}[]; - accounts$: Observable>; + accounts$: Observable>; loading$: Observable; - - constructor(private store: Store) {} + orgData: Organisation; + org$: Observable; + organisationSubscription: Subscription; + dependanciesSubscription: Subscription; + constructor(private feeStore: Store, + private organisationStore: Store) {} ngOnInit(): void { - this.store.dispatch(new fromFeeAccountsStore.LoadFeeAccounts()); - this.accounts$ = this.store.pipe(select(fromFeeAccountsStore.feeAccounts)); - this.loading$ = this.store.pipe(select(fromFeeAccountsStore.feeAccountsLoading)); + const isOrgLoaded$ = this.organisationStore.pipe(select(fromOrgStore.getOrganisationLoaded)); + if (isOrgLoaded$) { + this.dependanciesSubscription = isOrgLoaded$.subscribe((org) => { + if (!org) { + this.organisationStore.dispatch(new fromOrgStore.LoadOrganisation()); + } + this.org$ = this.organisationStore.pipe(select(fromOrgStore.getOrganisationSel)); + }); + } + if (this.org$) { + this.organisationSubscription = this.org$.subscribe(( data) => { + this.orgData = data; + this.feeStore.dispatch(new fromAccountStore.LoadFeeAccounts(data.paymentAccount)); + }); + } + this.accounts$ = this.feeStore.pipe(select(fromAccountStore.feeAccounts)); + this.loading$ = this.feeStore.pipe(select(fromAccountStore.feeAccountsLoading)); this.columnConfig = [ - { header: 'Account number', key: 'pbaNumber', type: 'link' }, - { header: 'Oraganisation Id', key: 'organisationId' } + { header: 'Account number', key: 'account_number', type: 'link' }, + { header: 'Account name', key: 'account_name' } ]; } - + ngOnDestroy(): void { + if (this.organisationSubscription) { + this.organisationSubscription.unsubscribe(); + } + if (this.dependanciesSubscription) { + this.dependanciesSubscription.unsubscribe(); + } + } } diff --git a/src/fee-accounts/fee-accounts.module.ts b/src/fee-accounts/fee-accounts.module.ts index 8fce68696..8e10a10fa 100644 --- a/src/fee-accounts/fee-accounts.module.ts +++ b/src/fee-accounts/fee-accounts.module.ts @@ -14,11 +14,13 @@ import {StoreModule} from '@ngrx/store'; import {HttpClientModule} from '@angular/common/http'; import { EffectsModule } from '@ngrx/effects'; import { reducers, effects } from './store'; +import { reducers as orgReducers, effects as orgEffects } from '../organisation/store'; import { AccountOverviewComponent } from './containers/account-overview/account-overview.component'; import { AccountSummaryComponent } from './containers/account-summary/account-summary.component'; import { AccountTransactionsComponent } from './containers/account-transactions/account-transactions.component'; import {AccountsGuard} from './guards/accounts.guard'; import {AccountSummaryGuard} from './guards/acccounts-summary.guards'; +import { OrganisationService } from 'src/organisation/services'; export const GUARDS = [AccountsGuard, AccountSummaryGuard]; export const COMPONENTS = [ AccountOverviewComponent, AccountSummaryComponent, AccountTransactionsComponent]; @@ -31,10 +33,12 @@ export const COMPONENTS = [ AccountOverviewComponent, AccountSummaryComponent, A SharedModule, StoreModule.forFeature('feeAccounts', reducers), EffectsModule.forFeature(effects), + StoreModule.forFeature('org', orgReducers), + EffectsModule.forFeature(orgEffects), ], exports: [...fromContainers.containers], declarations: [...fromContainers.containers, ...COMPONENTS], - providers: [...fromServices.services, ...GUARDS] + providers: [...fromServices.services, ...GUARDS, OrganisationService] }) /** diff --git a/src/fee-accounts/fee-accounts.routing.ts b/src/fee-accounts/fee-accounts.routing.ts index 0e0b54d50..836ea3333 100644 --- a/src/fee-accounts/fee-accounts.routing.ts +++ b/src/fee-accounts/fee-accounts.routing.ts @@ -6,8 +6,8 @@ import {AccountOverviewComponent} from './containers/account-overview/account-ov import {AccountSummaryComponent} from './containers/account-summary/account-summary.component'; import {AccountTransactionsComponent} from './containers/account-transactions/account-transactions.component'; import {OrganisationAccountsComponent} from './containers/overview/account-overview.component'; -import {AccountsGuard} from './guards/accounts.guard'; import {AccountSummaryGuard} from './guards/acccounts-summary.guards'; +import { AccountsGuard } from './guards/accounts.guard'; export const ROUTES: Routes = [ { diff --git a/src/fee-accounts/guards/accounts.guard.ts b/src/fee-accounts/guards/accounts.guard.ts index be215cb8c..85f276cec 100644 --- a/src/fee-accounts/guards/accounts.guard.ts +++ b/src/fee-accounts/guards/accounts.guard.ts @@ -1,43 +1,32 @@ import { Injectable } from '@angular/core'; import { CanActivate } from '@angular/router'; -import { select, Store } from '@ngrx/store'; +import { take, filter, tap, catchError, switchMap } from 'rxjs/operators'; import { Observable, of } from 'rxjs'; -import { - catchError, - filter, - switchMap, - take, - tap -} from 'rxjs/operators'; -import * as fromFeature from '../store'; -import { LoadFeeAccounts } from '../store/actions/fee-accounts.actions'; -import { feeAccountsLoaded } from '../store/selectors/fee-accounts.selectors'; +import { select, Store } from '@ngrx/store'; +import * as fromStore from '../../organisation/store'; + @Injectable() export class AccountsGuard implements CanActivate { + constructor(private store: Store) { } - constructor(private store: Store) { - } - - canActivate(): Observable { - return this.checkStore() - .pipe( - switchMap(() => of(true)), - catchError((error: any) => of(false)) - ); - } - - checkStore(): Observable { - return this.store.pipe( - select(feeAccountsLoaded), - tap(loaded => { - if (!loaded) { - this.store.dispatch(new LoadFeeAccounts()); - } - }), - filter(loaded => loaded), - take(1) - ); - } + canActivate(): Observable { + return this.checkStore().pipe( + switchMap(() => of(true)), + catchError(() => of(false)) + ); + } + checkStore(): Observable { + return this.store.pipe(select(fromStore.getOrganisationLoaded), + tap(loaded => { + if (!loaded) { + this.store.dispatch(new fromStore.LoadOrganisation()); + } + }), + filter(loaded => loaded), + take(1) + ); + } } + diff --git a/src/fee-accounts/models/pba-accounts.ts b/src/fee-accounts/models/pba-accounts.ts index 52bcf46bd..748724bd5 100644 --- a/src/fee-accounts/models/pba-accounts.ts +++ b/src/fee-accounts/models/pba-accounts.ts @@ -7,4 +7,15 @@ export interface PbaAccountsSummary extends PbaAccounts { routerLink: string; } +export interface FeeAccount { +account_number: string; +account_name: string; +credit_limit: number; +available_balance: number; +status: string; +effective_date: Date; +} +export interface FeeAccountSummary extends FeeAccount { + routerLink: string; +} diff --git a/src/fee-accounts/services/fee-accounts.service.ts b/src/fee-accounts/services/fee-accounts.service.ts index b99b63ed3..abba43118 100644 --- a/src/fee-accounts/services/fee-accounts.service.ts +++ b/src/fee-accounts/services/fee-accounts.service.ts @@ -2,10 +2,8 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import {map} from '../../../node_modules/rxjs/operators'; -import {Payment, Payments} from '../models/pba-transactions'; -import {feeAccountsDummy, PbaAccountsMock} from '../mock/pba-accounts.mock'; -import {PbaAccounts} from '../models/pba-accounts'; -import {PaymentMock} from '../../../api/accounts/data.mock'; +import {Payment} from '../models/pba-transactions'; +import {FeeAccount} from '../models/pba-accounts'; import {SingleAccountSummary} from '../models/single-account-summary'; import {SingleAccontSummaryMock} from '../mock/singleAccontSummary.mock'; @@ -14,10 +12,9 @@ export class FeeAccountsService { constructor(private http: HttpClient) { } - fetchFeeAccounts(): Observable> { - const obj: PbaAccounts[] = PbaAccountsMock; - return of(obj); - // return this.http.get> (`/api/accounts/pbas/`); + fetchFeeAccounts(paymentAccounts: string[]): Observable> { + const accounts = paymentAccounts.join(','); + return this.http.get> (`/api/accounts?accountNames=${accounts}`); } // Overview load fetchSingleFeeAccount(payload): Observable { @@ -26,40 +23,8 @@ export class FeeAccountsService { // return this.http.get(`/api/accounts/${payload.id}`); } // Overview transactions - fetchPbAAccountTransactions(payload): Observable { - const obj: Payments = PaymentMock; - const objMapped = obj.payments.map((item: Payment) => { - return { - paymentReference: item.payment_reference, - case: item.case_reference, - reference: 'NO DATA to MAP', - submittedBy: 'NO DATA to MAP', - status: 'NO DATA to MAP', - dateCreated: item.date_created, - amount: item.amount, - dateUpdated: item.date_updated, - routerLink: `account/${item.account_number}/summary` - }; - }); - - return of(objMapped); - // return this.http.get(`/api/accounts/${payload.id}/transactions`).pipe( - // map((item: Payment) => { - // return { - // paymentReference: item.payment_reference, - // case: item.case_reference, - // reference: 'NO DATA to MAP', - // submittedBy: 'NO DATA to MAP', - // status: 'NO DATA to MAP', - // dateCreated: item.date_created, - // amount: item.amount, - // dateUpdated: item.date_updated, - // routerLink: `account/${item.account_number}/summary` - // }; - // }) - // ); - - + fetchPbAAccountTransactions(payload): Observable> { + return this.http.get>(`/api/payments/${payload.id}`); } } diff --git a/src/fee-accounts/store/actions/fee-accounts.actions.spec.ts b/src/fee-accounts/store/actions/fee-accounts.actions.spec.ts index 694370292..a3801480f 100644 --- a/src/fee-accounts/store/actions/fee-accounts.actions.spec.ts +++ b/src/fee-accounts/store/actions/fee-accounts.actions.spec.ts @@ -5,9 +5,10 @@ describe('Fee accounts actions', () => { // Init state describe('LoadFeeAccounts', () => { it('should create an action', () => { - const action = new fromFeeAccounts.LoadFeeAccounts(); + const action = new fromFeeAccounts.LoadFeeAccounts(['account1', 'account2']); expect({ ...action }).toEqual({ - type: fromFeeAccounts.LOAD_FEE_ACCOUNTS + type: fromFeeAccounts.LOAD_FEE_ACCOUNTS, + paymentAccounts: ['account1', 'account2'] }); }); }); diff --git a/src/fee-accounts/store/actions/fee-accounts.actions.ts b/src/fee-accounts/store/actions/fee-accounts.actions.ts index 8dd2026cc..d3ac57841 100644 --- a/src/fee-accounts/store/actions/fee-accounts.actions.ts +++ b/src/fee-accounts/store/actions/fee-accounts.actions.ts @@ -5,6 +5,8 @@ export const LOAD_FEE_ACCOUNTS_SUCCESS = '[Fee Accounts] Load Fee Accounts Succe export const LOAD_FEE_ACCOUNTS_FAIL = '[Fee Accounts] Load Fee Accounts Fail'; export class LoadFeeAccounts { + constructor(public paymentAccounts: string[]) { + } readonly type = LOAD_FEE_ACCOUNTS; } diff --git a/src/fee-accounts/store/effects/fee-accounts.effects.spec.ts b/src/fee-accounts/store/effects/fee-accounts.effects.spec.ts index 3260c5139..5950d6bb7 100644 --- a/src/fee-accounts/store/effects/fee-accounts.effects.spec.ts +++ b/src/fee-accounts/store/effects/fee-accounts.effects.spec.ts @@ -35,7 +35,7 @@ describe('Fee accounts Effects', () => { it('should return a collection from loadFeeAccounts$ - LoadFeeAccountsSuccess', () => { const payload = [{payload: 'something'}]; FeeAccountsServiceMock.fetchFeeAccounts.and.returnValue(of(payload)); - const action = new LoadFeeAccounts(); + const action = new LoadFeeAccounts(['account1', 'account2']); const completion = new LoadFeeAccountsSuccess([{payload: 'something'}]); actions$ = hot('-a', { a: action }); const expected = cold('-b', { b: completion }); @@ -46,7 +46,7 @@ describe('Fee accounts Effects', () => { describe('loadFeeAccounts$ error', () => { it('should return LoadFeeAccountsFail', () => { FeeAccountsServiceMock.fetchFeeAccounts.and.returnValue(throwError(new Error())); - const action = new LoadFeeAccounts(); + const action = new LoadFeeAccounts(['account1', 'account2']); const completion = new LoadFeeAccountsFail(new Error()); actions$ = hot('-a', { a: action }); const expected = cold('-b', { b: completion }); diff --git a/src/fee-accounts/store/effects/fee-accounts.effects.ts b/src/fee-accounts/store/effects/fee-accounts.effects.ts index abe1fb933..d7eed712f 100644 --- a/src/fee-accounts/store/effects/fee-accounts.effects.ts +++ b/src/fee-accounts/store/effects/fee-accounts.effects.ts @@ -18,8 +18,8 @@ export class FeeAccountsEffects { @Effect() loadFeeAccounts$ = this.actions$.pipe( ofType(feeAccountsActions.LOAD_FEE_ACCOUNTS), - switchMap(() => { - return this.feeAccountsService.fetchFeeAccounts().pipe( + switchMap((payload: any) => { + return this.feeAccountsService.fetchFeeAccounts(payload.paymentAccounts).pipe( map(feeAccountsDetails => new feeAccountsActions.LoadFeeAccountsSuccess(feeAccountsDetails)), catchError(error => of(new feeAccountsActions.LoadFeeAccountsFail(error))) ); diff --git a/src/fee-accounts/store/reducers/fee-accounts.reducer.spec.ts b/src/fee-accounts/store/reducers/fee-accounts.reducer.spec.ts index 8404c2aab..26cf7fcdf 100644 --- a/src/fee-accounts/store/reducers/fee-accounts.reducer.spec.ts +++ b/src/fee-accounts/store/reducers/fee-accounts.reducer.spec.ts @@ -1,6 +1,6 @@ import { initialState, reducer, getFeeAccounts, getFeeAccountsLoading, getFeeAccountsLoaded } from './fee-accounts.reducer'; import { LoadFeeAccountsSuccess } from '../actions'; -import { PbaAccountsSummary } from 'src/fee-accounts/models/pba-accounts'; +import { FeeAccount, FeeAccountSummary } from 'src/fee-accounts/models/pba-accounts'; describe('FeeAccountsReducer', () => { describe('undefined action', () => { @@ -15,15 +15,23 @@ describe('FeeAccountsReducer', () => { it('should update the state.feeAccounts', () => { const action = new LoadFeeAccountsSuccess([ { - pbaNumber: '1', - organisationId: '0' + account_number: '123', + account_name: '', + credit_limit: null, + available_balance: null, + status: null, + effective_date: null, } ]); const state = reducer(initialState, action); - const expected: PbaAccountsSummary = { - routerLink: '/fee-accounts/account/1/', - pbaNumber: '1', - organisationId: '0' + const expected: FeeAccountSummary = { + account_number: '123', + account_name: '', + credit_limit: null, + available_balance: null, + status: null, + effective_date: null, + routerLink: `/fee-accounts/account/123/` }; expect(state.feeAccounts).toEqual([expected]); }); diff --git a/src/fee-accounts/store/reducers/fee-accounts.reducer.ts b/src/fee-accounts/store/reducers/fee-accounts.reducer.ts index e0c7a9bab..669c7e3ed 100644 --- a/src/fee-accounts/store/reducers/fee-accounts.reducer.ts +++ b/src/fee-accounts/store/reducers/fee-accounts.reducer.ts @@ -1,8 +1,8 @@ import * as fromFeeAccountActions from '../actions/fee-accounts.actions'; -import {PbaAccounts, PbaAccountsSummary} from '../../models/pba-accounts'; +import {PbaAccounts, PbaAccountsSummary, FeeAccount, FeeAccountSummary} from '../../models/pba-accounts'; export interface FeeAccountsState { - feeAccounts: Array | null; + feeAccounts: Array | null; loaded: boolean; loading: boolean; } @@ -30,10 +30,10 @@ export function reducer( const payload = action.payload; let feeAccounts = payload; if (feeAccounts.length !== 0) { - feeAccounts = payload.map((entity: PbaAccounts) => { - const element: PbaAccountsSummary = { + feeAccounts = payload.map((entity: FeeAccount) => { + const element: FeeAccountSummary = { ...entity, - routerLink: `/fee-accounts/account/${entity.pbaNumber}/` + routerLink: `/fee-accounts/account/${entity.account_number}/` }; return element; }); diff --git a/src/fee-accounts/store/reducers/single-fee-account.reducer.spec.ts b/src/fee-accounts/store/reducers/single-fee-account.reducer.spec.ts index a471fc43f..de3928b0b 100644 --- a/src/fee-accounts/store/reducers/single-fee-account.reducer.spec.ts +++ b/src/fee-accounts/store/reducers/single-fee-account.reducer.spec.ts @@ -23,7 +23,7 @@ describe('SingleFeeAccountReducer', () => { }; const action = new LoadSingleFeeAccountSuccess(payload); const state = reducer(initialState, action); - expect(state.overview).toEqual({data: payload, loaded: true, loading: false}); + expect(state.overview).toEqual({data: { ...payload }, loaded: true, loading: false}); }); }); diff --git a/src/organisation/organisation.model.ts b/src/organisation/organisation.model.ts index aa0417649..2b66d1f23 100644 --- a/src/organisation/organisation.model.ts +++ b/src/organisation/organisation.model.ts @@ -6,6 +6,7 @@ export class Organisation { townCity: string; country: string; contactInformation: any[]; + paymentAccount: any[]; constructor(prop) { Object.assign(this, prop); } diff --git a/src/organisation/store/actions/organisation.actions.spec.ts b/src/organisation/store/actions/organisation.actions.spec.ts index 90e859a53..3614228bf 100644 --- a/src/organisation/store/actions/organisation.actions.spec.ts +++ b/src/organisation/store/actions/organisation.actions.spec.ts @@ -23,7 +23,8 @@ describe('LoadOrganisationSuccess', () => { postcode: 'W1', addressLine2: '', country: 'UK', - contactInformation: [] + contactInformation: [], + paymentAccount: [] }; const action = new LoadOrganisationSuccess(payload); expect({ ...action }).toEqual({ diff --git a/src/users/containers/invite-user-success/invite-user-success.component.ts b/src/users/containers/invite-user-success/invite-user-success.component.ts index 182ce59e6..e6d2c173b 100644 --- a/src/users/containers/invite-user-success/invite-user-success.component.ts +++ b/src/users/containers/invite-user-success/invite-user-success.component.ts @@ -13,5 +13,4 @@ export class InviteUserSuccessComponent implements OnInit { ngOnInit() { this.store.dispatch(new fromStore.Reset()); } - } diff --git a/src/users/containers/users/users.component.ts b/src/users/containers/users/users.component.ts index fe555f50f..fdae19cfe 100644 --- a/src/users/containers/users/users.component.ts +++ b/src/users/containers/users/users.component.ts @@ -33,4 +33,3 @@ export class UsersComponent implements OnInit { } } - diff --git a/src/users/store/reducers/invite-user.reducer.ts b/src/users/store/reducers/invite-user.reducer.ts index e2b482c52..8a16bcc74 100644 --- a/src/users/store/reducers/invite-user.reducer.ts +++ b/src/users/store/reducers/invite-user.reducer.ts @@ -93,4 +93,3 @@ export const getInviteUserErrorMessage = (state: InviteUserState) => state.error export const getInviteUserIsFormValid = (state: InviteUserState) => state.isFormValid; export const getInviteUserErrorHeader = (state: InviteUserState) => state.errorHeader; export const getInviteUserIsUserConfirmed = (state: InviteUserState) => state.isUserConfirmed; -