-
Notifications
You must be signed in to change notification settings - Fork 15
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-13313: Worldpay details index page #4365
PP-13313: Worldpay details index page #4365
Conversation
d71d578
to
9a3bb58
Compare
|
||
const { getActiveCredential } = require('@utils/credentials') | ||
|
||
class WorldpayTasks { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably doesn't need to be a class, if it just produces a list of tasks from a gateway account object it can just be a single function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't need to be a class, but I don't think it's wrong either? My thinking was to encapsulate all the logic in a class to keep the controller simple. Sure a list of tasks can be returned but I'd like to keep the controller simple by doing worldpayTasks.incompleteTasks rather than calculate that in the controller or worse still the nunjucks file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could follow the pattern established for stripe tasks and create a utility function instead of a class: https://github.com/alphagov/pay-selfservice/blob/master/app/utils/simplified-account/settings/stripe-details/tasks.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Stripe tasks are more complex and their state is stored in connector db, so I imagine that's why they'd be handled differently. For me the question to ask when reviewing is the code readable? I think what I've got here currently is easily understandable. I'm not sure it could be classed as bad code either. We can refactor it to be more like the Stripe tasks pattern if we need be (for example when we come to add more Worldpay tasks). Trying to make this more like Stripe tasks is going to hurt my head at the moment.
e49b0ad
to
e1c1ff1
Compare
external_id: SERVICE_ID | ||
})) | ||
.withAccountType(ACCOUNT_TYPE) | ||
.withAccount(new GatewayAccount({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good idea, we should probably update the ControllerTestBuilder to create a new GatewayAccount when calling withAccount
instead of relying on individual tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but think this should be done in another PR. If withAccount
creates a new GatewayAccount, what happens to the withAccountType
method, and should it even exist at all? It touches a lot of test classes. Hence I think it'll be better to fix this in a separate PR (which I'm happy to do).
ae712d1
to
642200e
Compare
app/models/GatewayAccount.class.js
Outdated
* @property {string} analyticsId - Google analyticsId of the gateway account | ||
* @property {boolean} toggle3ds - whether 3DS is enabled or not on this gateway account | ||
* @property {[GatewayAccountCredential]} gatewayAccountCredentials - available credentials for gateway account | ||
* @property {GatewayAccountCredential} activeCredential - the active credential for the gateway account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an optional property so should be wrapped in square brackets, see gatewayAccountCredentials
above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? I thought [GatewayAccountCredential]
means a list of credentials, which a gateway account does have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I meant @property {GatewayAccountCredential} [activeCredential]
. My B! It's the property name that should be in brackets if optional, not the type
You need to link your Worldpay account to GOV.UK Pay. | ||
</p> | ||
|
||
<ul class="govuk-task-list"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be using the task list component now that DSv5 is live.
See this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the nunjucks component change is the important thing that needs to be done before this can be approved.
This commit deals with a moto-enabled gateway account that hasn't configured the one_off_customer_initiated credentials yet.
642200e
to
3541d73
Compare
This commit deals with a moto-enabled gateway account that hasn't configured the one_off_customer_initiated credentials yet. We just want to show that there's an outstanding task ('Link your Worldpay account with GOV.UK Pay') here; the link currently doesn't go anywhere.