diff --git a/.secrets.baseline b/.secrets.baseline index 1a6d084bcb..6e33eb9a23 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "package-lock.json", "lines": null }, - "generated_at": "2021-01-19T17:38:25Z", + "generated_at": "2021-01-19T16:07:47Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -72,7 +72,7 @@ "hashed_secret": "ece65afda87c1c6120602c9a3b66890308d7e53c", "is_secret": false, "is_verified": false, - "line_number": 138, + "line_number": 127, "type": "Secret Keyword" } ], diff --git a/app/controllers/credentials.controller.js b/app/controllers/credentials.controller.js index 1c25941d9d..d5ab40efde 100644 --- a/app/controllers/credentials.controller.js +++ b/app/controllers/credentials.controller.js @@ -97,7 +97,7 @@ module.exports = { if (_.get(req, 'session.flash.genericError.length')) { _.set(req, 'session.pageData.editNotificationCredentials', { username, password }) - return res.redirect(formatAccountPathsFor(paths.account.notificationCredentials.edit, req.account && req.account.external_id)) + return res.redirect(paths.notificationCredentials.edit) } const correlationId = req.headers[CORRELATION_HEADER] || '' diff --git a/app/paths.js b/app/paths.js index 14ebbcb794..982a573110 100644 --- a/app/paths.js +++ b/app/paths.js @@ -19,10 +19,6 @@ module.exports = { revoke: '/api-keys/revoke', update: '/api-keys/update' }, - credentials: { - index: '/credentials', - edit: '/credentials/edit' - }, digitalWallet: { applePay: '/digital-wallet/apple-pay', googlePay: '/digital-wallet/google-pay' @@ -39,10 +35,6 @@ module.exports = { confirmation: '/email-settings-confirmation', refund: '/email-settings-refund' }, - notificationCredentials: { - edit: '/notification-credentials/edit', - update: '/notification-credentials' - }, paymentLinks: { start: '/create-payment-link', information: '/create-payment-link/information', @@ -87,15 +79,6 @@ module.exports = { }, settings: { index: '/settings' - }, - stripe: { - addPspAccountDetails: '/stripe/add-psp-account-details' - }, - stripeSetup: { - bankDetails: '/bank-details', - responsiblePerson: '/responsible-person', - vatNumber: '/vat-number', - companyNumber: '/company-number' }, toggle3ds: { index: '/3ds' @@ -111,6 +94,15 @@ module.exports = { index: '/your-psp', flex: '/your-psp/flex', worldpay3dsFlex: '/your-psp/worldpay-3ds-flex' + }, + stripeSetup: { + bankDetails: '/bank-details', + responsiblePerson: '/responsible-person', + vatNumber: '/vat-number', + companyNumber: '/company-number' + }, + stripe: { + addPspAccountDetails: '/stripe/add-psp-account-details' } }, redirects: { @@ -127,7 +119,16 @@ module.exports = { index: '/all-service-transactions', download: '/all-service-transactions/download' }, - + credentials: { + index: '/credentials', + edit: '/credentials/edit', + create: '/credentials' + }, + notificationCredentials: { + index: '/credentials', + edit: '/notification-credentials/edit', + update: '/notification-credentials' + }, user: { logIn: '/login', otpLogIn: '/otp-login', diff --git a/app/routes.js b/app/routes.js index d6628a924a..b39efe4d4e 100644 --- a/app/routes.js +++ b/app/routes.js @@ -86,27 +86,26 @@ const stripeSetupDashboardRedirectController = require('./controllers/stripe-set // Assignments const { - healthcheck, registerUser, user, dashboard, selfCreateService, transactions, - serviceSwitcher,teamMembers, staticPaths, inviteValidation, editServiceName, merchantDetails, + healthcheck, registerUser, user, dashboard, selfCreateService, transactions, credentials, + serviceSwitcher, teamMembers, staticPaths, inviteValidation, editServiceName, merchantDetails, + notificationCredentials, requestToGoLive, policyPages, allServiceTransactions, payouts, redirects } = paths const { apiKeys, - credentials, digitalWallet, emailNotifications, - notificationCredentials, paymentLinks, paymentTypes, prototyping, settings, - stripe, - stripeSetup, toggle3ds, toggleBillingAddress, toggleMotoMaskCardNumberAndSecurityCode, - yourPsp + yourPsp, + stripeSetup, + stripe } = paths.account // Exports @@ -184,10 +183,13 @@ module.exports.bind = function (app) { const authenticatedPaths = [ ...lodash.values(transactions), ...lodash.values(allServiceTransactions), + ...lodash.values(credentials), + ...lodash.values(notificationCredentials), ...lodash.values(editServiceName), ...lodash.values(serviceSwitcher), ...lodash.values(teamMembers), ...lodash.values(merchantDetails), + ...lodash.values(paymentLinks), ...lodash.values(user.profile), ...lodash.values(requestToGoLive), ...lodash.values(policyPages), @@ -289,9 +291,17 @@ module.exports.bind = function (app) { account.post(yourPsp.flex, permission('gateway-credentials:update'), paymentMethodIsCard, yourPspController.postFlex) // Credentials + app.get(credentials.index, permission('gateway-credentials:read'), getAccount, paymentMethodIsCard, credentialsController.index) + app.get(credentials.edit, permission('gateway-credentials:update'), getAccount, paymentMethodIsCard, credentialsController.editCredentials) + app.post(credentials.index, permission('gateway-credentials:update'), getAccount, paymentMethodIsCard, credentialsController.update) + app.get(notificationCredentials.index, permission('gateway-credentials:read'), getAccount, paymentMethodIsCard, credentialsController.index) + app.get(notificationCredentials.edit, permission('gateway-credentials:update'), getAccount, paymentMethodIsCard, credentialsController.editNotificationCredentials) + app.post(notificationCredentials.update, permission('gateway-credentials:update'), getAccount, paymentMethodIsCard, credentialsController.updateNotificationCredentials) + account.get(credentials.index, permission('gateway-credentials:read'), paymentMethodIsCard, credentialsController.index) account.get(credentials.edit, permission('gateway-credentials:update'), paymentMethodIsCard, credentialsController.editCredentials) account.post(credentials.index, permission('gateway-credentials:update'), paymentMethodIsCard, credentialsController.update) + account.get(notificationCredentials.index, permission('gateway-credentials:read'), paymentMethodIsCard, credentialsController.index) account.get(notificationCredentials.edit, permission('gateway-credentials:update'), paymentMethodIsCard, credentialsController.editNotificationCredentials) account.post(notificationCredentials.update, permission('gateway-credentials:update'), paymentMethodIsCard, credentialsController.updateNotificationCredentials) diff --git a/app/utils/nav-builder.js b/app/utils/nav-builder.js index 6ab35cc713..85ca327500 100644 --- a/app/utils/nav-builder.js +++ b/app/utils/nav-builder.js @@ -17,8 +17,8 @@ const mainSettingsPaths = [ const yourPspPaths = [ paths.account.yourPsp, - paths.account.credentials, - paths.account.notificationCredentials + paths.credentials, + paths.notificationCredentials ] const serviceNavigationItems = (currentPath, permissions, type, account = {}) => { diff --git a/app/views/credentials/epdq.njk b/app/views/credentials/epdq.njk index fe1291e8fd..daad52f1ae 100644 --- a/app/views/credentials/epdq.njk +++ b/app/views/credentials/epdq.njk @@ -3,7 +3,7 @@ {% block provider_content %} {% if permissions.gateway_credentials_update %} -
{% else %} {% if permissions.gateway_credentials_update %} -