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

PP-11591 Set 3ds Flex by default for Worldpay accounts #4157

Merged
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
8 changes: 6 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -591,7 +595,7 @@
"filename": "test/cypress/integration/settings/your-psp.cy.js",
"hashed_secret": "0ea7458942ab65e0a340cf4fd28ca00d93c494f3",
"is_verified": false,
"line_number": 463
"line_number": 456
}
],
"test/cypress/integration/switch-psp/organisation-url.cy.js": [
Expand Down Expand Up @@ -899,5 +903,5 @@
}
]
},
"generated_at": "2023-10-19T14:35:18Z"
"generated_at": "2023-11-27T13:23:06Z"
}
1 change: 0 additions & 1 deletion app/controllers/your-psp/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict'

exports.getIndex = require('./get.controller')
exports.postToggleWorldpay3dsFlex = require('./post-toggle-worldpay-3ds-flex.controller')
exports.getFlex = require('./get-flex.controller')
exports.postFlex = require('./post-flex.controller')
5 changes: 1 addition & 4 deletions app/controllers/your-psp/post-flex.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ module.exports = async function submit3dsFlexCredentials (req, res, next) {
}

await connector.post3dsFlexAccountCredentials(flexParams)

if (req.account.type === 'live') {
await connector.updateIntegrationVersion3ds(accountId, INTEGRATION_VERSION_3DS)
}
await connector.updateIntegrationVersion3ds(accountId, INTEGRATION_VERSION_3DS)

req.flash('generic', 'Your Worldpay 3DS Flex settings have been updated')
return res.redirect(indexUrl)
Expand Down
6 changes: 4 additions & 2 deletions app/controllers/your-psp/post-flex.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ describe('Post 3DS Flex controller', () => {
sinon.assert.calledWith(res.redirect, `/account/${gatewayAccountExternalId}/your-psp/${credentialId}`)
})

it('should NOT set 3DS integration version to 2 for TEST account', async () => {
it('should set 3DS integration version to 2 for TEST account', async () => {
req.account = getGatewayAcountWithType('test')

const controller = getControllerWithMocks()

await controller(req, res, next)

sinon.assert.notCalled(updateIntegrationVersion3dsMock)
sinon.assert.calledWith(updateIntegrationVersion3dsMock, req.account.gateway_account_id, 2)
sinon.assert.calledWith(req.flash, 'generic', 'Your Worldpay 3DS Flex settings have been updated')
sinon.assert.calledWith(res.redirect, `/account/${gatewayAccountExternalId}/your-psp/${credentialId}`)
})

it('should call next when there is an error checking flex credentials', async () => {
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ module.exports.bind = function (app) {

// Your PSP
account.get(yourPsp.index, permission('gateway-credentials:read'), yourPspController.getIndex)
account.post(yourPsp.worldpay3dsFlex, permission('toggle-3ds:update'), yourPspController.postToggleWorldpay3dsFlex)
account.get([yourPsp.flex, switchPSP.flex], permission('gateway-credentials:update'), yourPspController.getFlex)
account.post([yourPsp.flex, switchPSP.flex], permission('gateway-credentials:update'), yourPspController.postFlex)

Expand Down
48 changes: 0 additions & 48 deletions app/views/your-psp/_worldpay-flex.njk
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
{% set paymentProvider = 'worldpay' %}
{% set isTest = currentGatewayAccount.type === "test" %}

{% if isTest %}
<div data-cy="3ds-flex-section-for-test-worldpay-accounts">
<h2 class="govuk-heading-m govuk-!-margin-top-9">3DS Flex</h2>

{{ govukInsetText({
"attributes": {
"id": "worldpay-3ds-flex-is-on" if isWorldpay3dsFlexEnabled else "worldpay-3ds-flex-is-off"
},
text: "3DS Flex is turned on." if isWorldpay3dsFlexEnabled else "3DS Flex is turned off."
}) }}

{% if (not isWorldpay3dsFlexCredentialsConfigured) %}
<p class="govuk-body" data-cy="set-up-3ds-flex-credentials-text">
To set up 3DS Flex on your Worldpay test account, you need to enter the following test details to turn 3DS Flex on.
</p>
{% endif %}

{% if (is3dsEnabled and isWorldpay3dsFlexCredentialsConfigured) or isWorldpay3dsFlexEnabled %}
<form method="post" action="{{ formatAccountPathsFor(routes.account.yourPsp.worldpay3dsFlex, currentGatewayAccount.external_id, credential.external_id) }}" novalidate>
<input id="csrf" name="csrfToken" type="hidden" value="{{csrf}}">
{% if is3dsEnabled and isWorldpay3dsFlexCredentialsConfigured and not isWorldpay3dsFlexEnabled %}
<input id="toggle-worldpay-3ds-flex" name="toggle-worldpay-3ds-flex" type="hidden" value="on" data-cy="toggle-3ds-button">
{{ govukButton({
attributes: {
id: "enable-worldpay-3ds-flex-button"
},
text: "Turn on 3DS Flex",
classes: "govuk-button--secondary"
}) }}
{% elif isWorldpay3dsFlexEnabled %}
<input id="toggle-worldpay-3ds-flex" name="toggle-worldpay-3ds-flex" type="hidden" value="off" data-cy="toggle-3ds-button">
{{ govukButton({
attributes: {
id: "disable-worldpay-3ds-flex-button"
},
text: "Turn off 3DS Flex",
classes: "govuk-button--secondary"
}) }}
{% endif %}
</form>
{% endif %}

</div>
{% endif %}

{{govukSummaryList({
attributes: {'data-cy': 'worldpay-flex-settings-summary-list'},
card: {
Expand Down
3 changes: 2 additions & 1 deletion test/cypress/integration/settings/switch-psp.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ describe('Switch PSP settings page', () => {
organisational_unit_id: organisationalUnitId,
issuer: issuer,
jwt_mac_key: jwtMacKey
})
}),
gatewayAccountStubs.patchUpdate3dsVersionSuccess(gatewayAccountId, 2)
])

cy.visit(`/account/${gatewayAccountExternalId}/switch-psp`)
Expand Down
Loading