diff --git a/app/services/stripe-details.service.js b/app/services/stripe-details.service.js index 5f885933b..ea6d5dbcd 100644 --- a/app/services/stripe-details.service.js +++ b/app/services/stripe-details.service.js @@ -146,7 +146,7 @@ const updateStripeDetailsUploadEntityDocument = async (service, account, file) = } /** - * Updates Stripe account director for the given service and account type + * Updates Stripe account organisation name and address for the given service and account type * @param {GatewayAccount} account * @param {GOVUKPayService} service * @param {StripeOrganisationDetailsParams} newOrgDetails diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/bank-details.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/bank-details.cy.js index 1a41e5502..111e6467e 100644 --- a/test/cypress/integration/simplified-account/service-settings/stripe-details/bank-details.cy.js +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/bank-details.cy.js @@ -73,7 +73,7 @@ describe('Stripe details settings', () => { describe('Completed', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true @@ -89,7 +89,7 @@ describe('Stripe details settings', () => { describe('Not yet started', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -119,7 +119,7 @@ describe('Stripe details settings', () => { describe('When inputting bank details', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -192,7 +192,7 @@ describe('Stripe details settings', () => { describe('When submitting valid bank details', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -210,7 +210,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/company-number.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/company-number.cy.js index 464d5053f..391ac110f 100644 --- a/test/cypress/integration/simplified-account/service-settings/stripe-details/company-number.cy.js +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/company-number.cy.js @@ -73,7 +73,7 @@ describe('Stripe details settings', () => { describe('Completed', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, companyNumber: true @@ -89,7 +89,7 @@ describe('Stripe details settings', () => { describe('Not yet started', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -119,7 +119,7 @@ describe('Stripe details settings', () => { describe('When inputting a company registration number', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -158,7 +158,7 @@ describe('Stripe details settings', () => { describe('When selecting yes and submitting a company number', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -176,7 +176,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, companyNumber: true @@ -206,7 +206,7 @@ describe('Stripe details settings', () => { describe('When selecting no and completing the task', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -221,7 +221,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, companyNumber: true diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/confirm-org-details.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/confirm-org-details.cy.js new file mode 100644 index 000000000..9f7e2d2e8 --- /dev/null +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/confirm-org-details.cy.js @@ -0,0 +1,307 @@ +const userStubs = require('@test/cypress/stubs/user-stubs') +const gatewayAccountStubs = require('@test/cypress/stubs/gateway-account-stubs') +const stripeAccountSetupStubs = require('@test/cypress/stubs/stripe-account-setup-stub') +const stripePspStubs = require('@test/cypress/stubs/stripe-psp-stubs') +const serviceStubs = require('@test/cypress/stubs/service-stubs') +const { STRIPE, WORLDPAY } = require('@models/payment-providers') +const ROLES = require('@test/fixtures/roles.fixtures') + +const USER_EXTERNAL_ID = 'user-123-abc' +const SERVICE_EXTERNAL_ID = 'service-456-def' +const SERVICE_NAME = { + en: 'McDuck Enterprises', cy: 'Mentrau McDuck' +} +const LIVE_ACCOUNT_TYPE = 'live' +const GATEWAY_ACCOUNT_ID = 10 +const STRIPE_ACCOUNT_ID = 'acct_123example123' + +const STRIPE_DETAILS_SETTINGS_URL = `/simplified/service/${SERVICE_EXTERNAL_ID}/account/${LIVE_ACCOUNT_TYPE}/settings/stripe-details` + +const setStubs = (opts = {}, additionalStubs = []) => { + cy.task('setupStubs', [ + userStubs.getUserSuccess({ + userExternalId: USER_EXTERNAL_ID, + gatewayAccountId: GATEWAY_ACCOUNT_ID, + serviceName: SERVICE_NAME, + serviceExternalId: SERVICE_EXTERNAL_ID, + merchantDetails: { + name: 'McDuck Enterprises', + address_line1: 'McDuck Manor', + address_city: 'Duckburg', + address_postcode: 'SW1A 1AA' + }, + role: ROLES[opts.role || 'admin'], + features: 'degatewayaccountification' // TODO remove features once simplified accounts are live + }), + gatewayAccountStubs.getAccountByServiceIdAndAccountType(SERVICE_EXTERNAL_ID, LIVE_ACCOUNT_TYPE, { + gateway_account_id: GATEWAY_ACCOUNT_ID, + type: LIVE_ACCOUNT_TYPE, + payment_provider: opts.paymentProvider || STRIPE, + provider_switch_enabled: opts.providerSwitchEnabled || false + }), + ...additionalStubs]) +} + +describe('Stripe details settings', () => { + beforeEach(() => { + cy.setEncryptedCookies(USER_EXTERNAL_ID) + }) + describe('The confirm organisation details task', () => { + describe('For a non-admin', () => { + beforeEach(() => { + setStubs({ + role: 'view-and-refund' + }) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index', { failOnStatusCode: false }) + }) + it('should show not found page', () => { + cy.title().should('eq', 'Page not found - GOV.UK Pay') + cy.get('h1').should('contain.text', 'Page not found') + }) + }) + describe('For a non-stripe service', () => { + beforeEach(() => { + setStubs({ + paymentProvider: WORLDPAY + }) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index', { failOnStatusCode: false }) + }) + it('should show not found page', () => { + cy.title().should('eq', 'Page not found - GOV.UK Pay') + cy.get('h1').should('contain.text', 'Page not found') + }) + }) + describe('Completed', () => { + beforeEach(() => { + setStubs({}, [ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE, + organisationDetails: true + }) + ]) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index') + }) + it('should show the task already completed page', () => { + cy.title().should('eq', 'An error occurred - GOV.UK Pay') + cy.get('h1').should('contain', 'You\'ve already completed this task') + }) + }) + describe('Not yet started', () => { + beforeEach(() => { + setStubs({}, [ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + }) + ]) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index') + }) + describe('The settings navigation', () => { + it('should show stripe details', () => { + cy.get('.service-settings-nav') + .find('li') + .contains('Stripe details') + .then(li => { + cy.wrap(li) + .should('have.attr', 'href', STRIPE_DETAILS_SETTINGS_URL) + .parent().should('have.class', 'service-settings-nav__li--active') + }) + }) + }) + describe('The task page', () => { + it('should show the correct title', () => { + cy.title().should('eq', 'Settings - Stripe details - Organisation details - GOV.UK Pay') + }) + it('should show the correct heading', () => { + cy.get('h1').should('contain', 'Organisation details') + }) + }) + describe('When selecting yes', () => { + beforeEach(() => { + setStubs({}, [ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + }), + gatewayAccountStubs.getStripeAccountByServiceIdAndAccountType( + SERVICE_EXTERNAL_ID, + LIVE_ACCOUNT_TYPE, + { + stripeAccountId: STRIPE_ACCOUNT_ID + } + ), + stripePspStubs.updateAccount({ + stripeAccountId: STRIPE_ACCOUNT_ID + }), + stripeAccountSetupStubs.patchStripeProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + }), + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE, + organisationDetails: true + }) + ]) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index') + }) + + it('should redirect to the task summary page on success', () => { + cy.get('.govuk-summary-list__row').should('have.length', 2) + + cy.get('.govuk-summary-list__row') + .first() + .should('contain.text', 'McDuck Enterprises') + + cy.get('.govuk-summary-list__row') + .last() + .contains('McDuck Manor').should('exist') + .contains('Duckburg').should('exist') + .contains('SW1A 1AA').should('exist') + + cy.get('input[type="radio"]') + .siblings('label') + .contains('Yes, these organisation details match') + .prev('input[type="radio"]') + .check() + + cy.get('#confirm-org-details-form button[type="submit"]').click() + cy.title().should('eq', 'Settings - Stripe details - GOV.UK Pay') + cy.get('h1').should('contain', 'Stripe details') + cy.location('pathname').should('not.contain', '/organisation-details/index') + cy.get('.govuk-task-list__item') + .contains('Confirm your organisation\'s name and address match your government entity document') + .parent() + .parent() + .within(() => { + cy.get('.govuk-task-list__status').should('contain.text', 'Complete') + }) + }) + }) + describe('When selecting no', () => { + describe('When submitting valid organisation details', () => { + beforeEach(() => { + setStubs({}, [ + ...Array(3).fill(stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + })), + gatewayAccountStubs.getStripeAccountByServiceIdAndAccountType( + SERVICE_EXTERNAL_ID, + LIVE_ACCOUNT_TYPE, + { + stripeAccountId: STRIPE_ACCOUNT_ID + } + ), + stripePspStubs.updateAccount({ + stripeAccountId: STRIPE_ACCOUNT_ID + }), + stripeAccountSetupStubs.patchStripeProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + }), + serviceStubs.patchUpdateServiceGatewayAccounts({ + serviceExternalId: SERVICE_EXTERNAL_ID + }), + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE, + organisationDetails: true + }) + ]) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index') + }) + + it('should redirect to the task summary page on success', () => { + cy.get('input[type="radio"]') + .siblings('label') + .contains('No, these organisation details do not match') + .prev('input[type="radio"]') + .check() + + cy.get('#confirm-org-details-form button[type="submit"]').click() + cy.location('pathname').should('contain', '/organisation-details/update') + cy.get('h1').should('contain', 'What is the name and address of your organisation on your government entity document?') + + cy.get('input[name="organisationName"]') + .should('have.value', 'McDuck Enterprises') + cy.get('input[name="addressLine1"]') + .should('have.value', 'McDuck Manor') + cy.get('input[name="addressCity"]') + .should('have.value', 'Duckburg') + cy.get('input[name="addressPostcode"]') + .should('have.value', 'SW1A 1AA') + + cy.get('input[name="organisationName"]') + .clear({ force: true }) + .type('Glomgold Industries') + + cy.get('#update-organisation-details-submit').click() + cy.title().should('eq', 'Settings - Stripe details - GOV.UK Pay') + cy.get('h1').should('contain', 'Stripe details') + cy.location('pathname').should('not.contain', '/organisation-details') + cy.get('.govuk-task-list__item') + .contains('Confirm your organisation\'s name and address match your government entity document') + .parent() + .parent() + .within(() => { + cy.get('.govuk-task-list__status').should('contain.text', 'Complete') + }) + }) + }) + describe('When submitting invalid organisation details', () => { + beforeEach(() => { + setStubs({}, [ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ + serviceExternalId: SERVICE_EXTERNAL_ID, + accountType: LIVE_ACCOUNT_TYPE + }) + ]) + cy.visit(STRIPE_DETAILS_SETTINGS_URL + '/organisation-details/index') + }) + + it('should render errors when submitting bad inputs', () => { + const orgNameError = 'Enter an organisation name' + const addressLine1Error = 'Enter a building and street' + const addressPostcodeError = 'Enter a postcode' + + cy.get('input[type="radio"]') + .siblings('label') + .contains('No, these organisation details do not match') + .prev('input[type="radio"]') + .check() + + cy.get('#confirm-org-details-form button[type="submit"]').click() + cy.location('pathname').should('contain', '/organisation-details/update') + cy.get('h1').should('contain', 'What is the name and address of your organisation on your government entity document?') + + cy.get('.govuk-error-summary').should('not.exist') + + cy.get('input[name="organisationName"]') + .clear({ force: true }) + + cy.get('input[name="addressLine1"]') + .clear({ force: true }) + + cy.get('input[name="addressPostcode"]') + .clear({ force: true }) + + cy.get('#update-organisation-details-submit').click() + cy.get('.govuk-error-summary') + .should('exist') + .should('contain', orgNameError) + .should('contain', addressLine1Error) + .should('contain', addressPostcodeError) + cy.get('input[name="organisationName"]').should('have.class', 'govuk-input--error') + cy.get('input[name="addressLine1"]').should('have.class', 'govuk-input--error') + cy.get('input[name="addressPostcode"]').should('have.class', 'govuk-input--error') + cy.get('#organisation-name-error').should('contain.text', orgNameError) + cy.get('#address-line1-error').should('contain.text', addressLine1Error) + cy.get('#address-postcode-error').should('contain.text', addressPostcodeError) + }) + }) + }) + }) + }) +}) diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/director.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/director.cy.js index d38db16bb..89af53d80 100644 --- a/test/cypress/integration/simplified-account/service-settings/stripe-details/director.cy.js +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/director.cy.js @@ -73,7 +73,7 @@ describe('Stripe details settings', () => { describe('Completed', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, director: true @@ -89,7 +89,7 @@ describe('Stripe details settings', () => { describe('Not yet started', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -119,7 +119,7 @@ describe('Stripe details settings', () => { describe('When inputting director details', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -171,7 +171,7 @@ describe('Stripe details settings', () => { describe('When submitting valid director details', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -189,7 +189,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, director: true diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/task-summary.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/task-summary.cy.js index cf438a9a1..20314b80e 100644 --- a/test/cypress/integration/simplified-account/service-settings/stripe-details/task-summary.cy.js +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/task-summary.cy.js @@ -49,7 +49,7 @@ describe('Stripe details settings', () => { describe('For an admin user', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true @@ -113,7 +113,7 @@ describe('Stripe details settings', () => { describe('When all tasks are complete', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true, @@ -166,7 +166,7 @@ describe('Stripe details settings', () => { describe('When no tasks are complete', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -228,7 +228,7 @@ describe('Stripe details settings', () => { describe('When all tasks except Government Entity Document are complete', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true, @@ -298,7 +298,7 @@ describe('Stripe details settings', () => { setStubs({ providerSwitchEnabled: true }, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, bankAccount: true, diff --git a/test/cypress/integration/simplified-account/service-settings/stripe-details/vat-number.cy.js b/test/cypress/integration/simplified-account/service-settings/stripe-details/vat-number.cy.js index 51d55fccb..89d4f4cde 100644 --- a/test/cypress/integration/simplified-account/service-settings/stripe-details/vat-number.cy.js +++ b/test/cypress/integration/simplified-account/service-settings/stripe-details/vat-number.cy.js @@ -73,7 +73,7 @@ describe('Stripe details settings', () => { describe('Completed', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, vatNumber: true @@ -89,7 +89,7 @@ describe('Stripe details settings', () => { describe('Not yet started', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -119,7 +119,7 @@ describe('Stripe details settings', () => { describe('When inputting a VAT registration number', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }) @@ -158,7 +158,7 @@ describe('Stripe details settings', () => { describe('When selecting yes and submitting a VAT number', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -176,7 +176,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, vatNumber: true @@ -206,7 +206,7 @@ describe('Stripe details settings', () => { describe('When selecting no and completing the task', () => { beforeEach(() => { setStubs({}, [ - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), @@ -221,7 +221,7 @@ describe('Stripe details settings', () => { serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE }), - stripeAccountSetupStubs.getServiceAndAccountTypeStripeSetupSuccess({ + stripeAccountSetupStubs.getStripeSetupProgressByServiceExternalIdAndAccountType({ serviceExternalId: SERVICE_EXTERNAL_ID, accountType: LIVE_ACCOUNT_TYPE, vatNumber: true diff --git a/test/cypress/stubs/stripe-account-setup-stub.js b/test/cypress/stubs/stripe-account-setup-stub.js index 9dbbcc57b..3fc947e64 100644 --- a/test/cypress/stubs/stripe-account-setup-stub.js +++ b/test/cypress/stubs/stripe-account-setup-stub.js @@ -3,7 +3,7 @@ const stripeAccountSetupFixtures = require('../../fixtures/stripe-account-setup.fixtures') const { stubBuilder } = require('./stub-builder') -function getServiceAndAccountTypeStripeSetupSuccess (opts) { +function getStripeSetupProgressByServiceExternalIdAndAccountType (opts) { const path = `/v1/api/service/${opts.serviceExternalId}/account/${opts.accountType}/stripe-setup` return getStripeSetupSuccess(path, opts) } @@ -155,7 +155,7 @@ function patchStripeProgressByServiceExternalIdAndAccountType (opts) { module.exports = { getGatewayAccountStripeSetupSuccess, - getServiceAndAccountTypeStripeSetupSuccess, + getStripeSetupProgressByServiceExternalIdAndAccountType, getGatewayAccountStripeSetupFlagForMultipleCalls, patchUpdateStripeSetupSuccess, patchStripeProgressByServiceExternalIdAndAccountType