Skip to content

Commit

Permalink
PP-13261: More explicit naming for updating one off customer initiate…
Browse files Browse the repository at this point in the history
…d creds (#4460)
  • Loading branch information
oswaldquek authored Feb 13, 2025
1 parent 799d089 commit e1e1eb7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { WorldpayTasks } = require('@models/WorldpayTasks.class')
function get (req, res) {
const existingCredentials = req.account.getCurrentCredential().credentials?.oneOffCustomerInitiated || {}

return response(req, res, 'simplified-account/settings/worldpay-details/credentials', {
return response(req, res, 'simplified-account/settings/worldpay-details/one-off-customer-initiated-credentials', {
backLink: formatSimplifiedAccountPathsFor(paths.simplifiedAccount.settings.worldpayDetails.index,
req.service.externalId, req.account.type),
credentials: existingCredentials
Expand Down Expand Up @@ -57,7 +57,7 @@ async function post (req, res) {
})
}

await worldpayDetailsService.updateCredentials(
await worldpayDetailsService.updateOneOffCustomerInitiatedCredentials(
req.service.externalId,
req.account.type,
req.account.getCurrentCredential().externalId,
Expand Down Expand Up @@ -85,7 +85,7 @@ async function post (req, res) {
}

const errorResponse = (req, res, errors) => {
return response(req, res, 'simplified-account/settings/worldpay-details/credentials', {
return response(req, res, 'simplified-account/settings/worldpay-details/one-off-customer-initiated-credentials', {
errors,
credentials: {
merchantCode: req.body.merchantCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Controller: settings/worldpay-details/credentials', () => {
it('should pass req, res and template path to the response method', () => {
expect(mockResponse.args[0][0]).to.deep.equal(req)
expect(mockResponse.args[0][1]).to.deep.equal(res)
expect(mockResponse.args[0][2]).to.equal('simplified-account/settings/worldpay-details/credentials')
expect(mockResponse.args[0][2]).to.equal('simplified-account/settings/worldpay-details/one-off-customer-initiated-credentials')
})

it('should pass context data to the response method', () => {
Expand All @@ -72,7 +72,7 @@ describe('Controller: settings/worldpay-details/credentials', () => {
expect(mockResponse).to.have.been.calledWith(
sinon.match.any,
sinon.match.any,
'simplified-account/settings/worldpay-details/credentials',
'simplified-account/settings/worldpay-details/one-off-customer-initiated-credentials',
{
errors: {
summary: [
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Controller: settings/worldpay-details/credentials', () => {
expect(mockResponse).to.have.been.calledWith(
sinon.match.any,
sinon.match.any,
'simplified-account/settings/worldpay-details/credentials',
'simplified-account/settings/worldpay-details/one-off-customer-initiated-credentials',
{
errors: {
summary: [
Expand Down
4 changes: 2 additions & 2 deletions src/services/worldpay-details.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function check3dsFlexCredential (serviceExternalId, accountType, flexCrede
* @param {WorldpayCredential} credential
* @returns {Promise<GatewayAccountCredential>}
*/
async function updateCredentials (serviceExternalId, accountType, credentialId, userExternalId, credential) { // TODO rename method to updateOneOffCustomerInitiatedCredentials
async function updateOneOffCustomerInitiatedCredentials (serviceExternalId, accountType, credentialId, userExternalId, credential) {
const patchRequest = new GatewayAccountCredentialUpdateRequest(userExternalId)
.replace().credentials().oneOffCustomerInitiated(credential.toJson())
return connectorClient.patchGatewayAccountCredentialsByServiceExternalIdAndAccountType(serviceExternalId, accountType, credentialId, patchRequest)
Expand Down Expand Up @@ -105,7 +105,7 @@ async function updateIntegrationVersion3ds (serviceExternalId, accountType, inte

module.exports = {
checkCredential,
updateCredentials,
updateOneOffCustomerInitiatedCredentials,
check3dsFlexCredential,
update3dsFlexCredentials,
updateIntegrationVersion3ds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{% if incompleteTasks %}
<p class="govuk-body govuk-!-margin-bottom-6">
You need to link your Worldpay account to GOV.UK Pay.
Before you can start taking payments, you need to link your Worldpay account to GOV.UK Pay.
</p>

{{ taskList({
Expand Down

0 comments on commit e1e1eb7

Please sign in to comment.