Skip to content

Commit 81e93d8

Browse files
committed
create confirm swap vos pin credit details routes
1 parent a31139d commit 81e93d8

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

server/routes/applications/swapVosPinCreditDetailsRoutes.ts

+28
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,33 @@ export default function swapVosPinCreditDetailsRoutes({ auditService }: { auditS
2727
}),
2828
)
2929

30+
router.post(
31+
'/log/swap-vos-pin-credit-details',
32+
asyncMiddleware(async (req: Request, res: Response) => {
33+
res.redirect(`/log/swap-vos-pin-credit-details/confirm`)
34+
}),
35+
)
36+
37+
router.get(
38+
'/log/swap-vos-pin-credit-details/confirm',
39+
asyncMiddleware(async (req: Request, res: Response) => {
40+
await auditService.logPageView(Page.CONFIRM_SWAP_VOS_PIN_CREDIT_DETAILS_PAGE, {
41+
who: res.locals.user.username,
42+
correlationId: req.id,
43+
})
44+
45+
const selectedAppType = APPLICATION_TYPES.find(type => type.value === req.session.applicationData?.type.value)
46+
47+
if (!selectedAppType) {
48+
return res.redirect('/log/application-type')
49+
}
50+
51+
return res.render('pages/log/confirm-swap-vos-pin-credit-details', {
52+
title: 'Check details',
53+
appTypeTitle: 'Swap VOs for PIN credit',
54+
})
55+
}),
56+
)
57+
3058
return router
3159
}

server/services/auditService.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export enum Page {
66
LOG_APPLICATION_TYPE_PAGE = 'LOG_APPLICATION_TYPE_PAGE',
77
LOG_PRISONER_DETAILS_PAGE = 'LOG_PRISONER_DETAILS_PAGE',
88
LOG_SWAP_VOS_PIN_CREDIT_DETAILS_PAGE = 'LOG_SWAP_VOS_PIN_CREDIT_DETAILS_PAGE',
9+
CONFIRM_SWAP_VOS_PIN_CREDIT_DETAILS_PAGE = 'CONFIRM_SWAP_VOS_PIN_CREDIT_DETAILS_PAGE',
910
}
1011

1112
export interface PageViewEventDetails {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% from "govuk/components/back-link/macro.njk" import govukBackLink %}
2+
3+
{% extends "../../partials/layout.njk" %}
4+
5+
{% set pageTitle = applicationName + " - " + title %}
6+
{% set mainClasses = "app-container govuk-body applications-landing-page" %}
7+
8+
{% block content %}
9+
<div class="govuk-body govuk-width-container">
10+
{{ govukBackLink({
11+
text: "Back",
12+
href: "/log/prisoner-details"
13+
}) }}
14+
</div>
15+
{% endblock %}

0 commit comments

Comments
 (0)