Skip to content

Commit

Permalink
PP-11212 Remove payment method selection for creating gateway account
Browse files Browse the repository at this point in the history
This was added when we supported Direct Debit, which has now been
retired. If we add another new payment method we might configure
accounts in a different way - so remove radio buttons on the create
gateway account page which only had one option - "Card".
  • Loading branch information
stephencdaly committed Jan 10, 2024
1 parent 4d2294e commit db82588
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 66 deletions.
2 changes: 0 additions & 2 deletions src/web/modules/gateway_accounts/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
{{ govukTable({
firstCellIsHeader: true,
rows: [
[ { text: 'Payment method' }, { text: request.paymentMethod | capitalize } ],
[ { text: 'Account type' }, { text: request.provider | capitalize } ],
[ { text: 'Service name' }, { text: request.serviceName } ],
[ { text: 'Description' }, { text: request.description } ],
Expand All @@ -22,7 +21,6 @@
}}

<form method="post" action="/gateway_accounts/create">
<input type="hidden" name="paymentMethod" value="{{ request.paymentMethod }}">
<input type="hidden" name="provider" value="{{ request.provider }}">
<input type="hidden" name="serviceName" value="{{ request.serviceName }}">
<input type="hidden" name="description" value="{{ request.description }}">
Expand Down
16 changes: 0 additions & 16 deletions src/web/modules/gateway_accounts/create.njk
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,6 @@
})
}}

{{ govukRadios({
classes: "govuk-radios--inline",
idPrefix: "paymentMethod",
name: "paymentMethod",
fieldset: {
legend: {
text: "Payment method",
isPageHeading: false
}
},
items: [
{ value: "card", text: "Card", checked: recovered.paymentMethod and recovered.paymentMethod === "card" or true }
]
})
}}

{{ govukRadios({
classes: "govuk-radios--inline",
idPrefix: "provider",
Expand Down
15 changes: 0 additions & 15 deletions src/web/modules/gateway_accounts/gatewayAccount.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,11 @@ const cardProviders = {
stripe: 'stripe'
}

const paymentMethod = {
card: 'card'
}

class GatewayAccount extends Validated {
@IsIn(Object.values(liveStatus))
@IsNotEmpty()
public live: string;

@IsIn(Object.values(paymentMethod))
@IsString()
@IsNotEmpty()
public paymentMethod: string;

@IsString()
@IsNotEmpty({message: 'Please enter a description'})
public description: string;
Expand All @@ -66,11 +57,6 @@ class GatewayAccount extends Validated {
public validate(): void {
super.validate()

if (this.paymentMethod === paymentMethod.card
&& !Object.values(cardProviders).includes(this.provider)) {
throw new ValidationError(`For Card accounts, provider must be one of ${Object.values(cardProviders)}`)
}

if (this.live === liveStatus.live && Object.values(sandbox).includes(this.provider)) {
throw new ValidationError('Live accounts cannot have Sandbox provider')
}
Expand All @@ -83,7 +69,6 @@ class GatewayAccount extends Validated {
public constructor(formValues: { [key: string]: string }) {
super()
this.live = formValues.live
this.paymentMethod = formValues.paymentMethod
this.description = formValues.description
this.serviceName = formValues.serviceName
this.provider = formValues.provider
Expand Down
32 changes: 0 additions & 32 deletions src/web/modules/gateway_accounts/gateway_accounts.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { ValidationError, IOValidationError } = require('./../../../lib/errors')

const validGatewayAccountDetails = {
live: 'live',
paymentMethod: 'card',
description: 'Valid gateway account details',
serviceName: 'Valid gateway account service',
provider: 'stripe',
Expand Down Expand Up @@ -42,26 +41,6 @@ describe('Gateway Accounts', () => {
}).to.throw(IOValidationError)
})

it('rejects when payment method is empty', () => {
expect(() => {
const details = _.cloneDeep(validGatewayAccountDetails)
details.paymentMethod = ''

// eslint-disable-next-line no-new
new GatewayAccount(details)
}).to.throw(IOValidationError)
})

it('rejects when payment method is not allowed value', () => {
expect(() => {
const details = _.cloneDeep(validGatewayAccountDetails)
details.paymentMethod = 'not-allowed'

// eslint-disable-next-line no-new
new GatewayAccount(details)
}).to.throw(IOValidationError)
})

it('rejects when description is empty', () => {
expect(() => {
const details = _.cloneDeep(validGatewayAccountDetails)
Expand Down Expand Up @@ -92,21 +71,10 @@ describe('Gateway Accounts', () => {
}).to.throw(Error)
})

it('rejects when paymentMethod is direct-debit ', () => {
expect(() => {
const details = _.cloneDeep(validGatewayAccountDetails)
details.paymentMethod = 'direct-debit'

// eslint-disable-next-line no-new
new GatewayAccount(details)
}).to.throw(Error)
})

it('rejects when account is live and provider is card sandbox', () => {
expect(() => {
const details = _.cloneDeep(validGatewayAccountDetails)
details.live = 'live'
details.paymentMethod = 'card'
details.provider = 'card-sandbox'

// eslint-disable-next-line no-new
Expand Down
1 change: 0 additions & 1 deletion src/web/modules/stripe/test-account.http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const createTestAccountConfirm = async function createTestAccountConfirm(req: Re
async function createTestGatewayAccount(serviceId: string, serviceName: string, stripeConnectId: string): Promise<CreateGatewayAccountResponse> {
const account = new GatewayAccountFormModel({
live: 'not-live',
paymentMethod: 'card',
description: `Stripe test account for service ${serviceName}`,
sector: 'Other',
serviceName: serviceName,
Expand Down

0 comments on commit db82588

Please sign in to comment.