-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b3c792
commit 9f0bcaf
Showing
14 changed files
with
280 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
runner/src/server/plugins/applicationStatus/paymentSkippedWarning.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { HapiRequest, HapiResponseToolkit } from "server/types"; | ||
import { FormModel } from "server/plugins/engine/models"; | ||
|
||
export async function paymentSkippedWarning( | ||
request: HapiRequest, | ||
h: HapiResponseToolkit | ||
) { | ||
const form: FormModel = request.server.app.forms[request.params.id]; | ||
const { allowSubmissionWithoutPayment } = form.feeOptions; | ||
|
||
if (allowSubmissionWithoutPayment) { | ||
const { customText } = form.specialPages?.paymentSkippedWarningPage ?? {}; | ||
return h | ||
.view("payment-skip-warning", { | ||
customText, | ||
backLink: "./../summary", | ||
}) | ||
.takeover(); | ||
} | ||
|
||
return h.redirect(`${request.params.id}/status`); | ||
} | ||
|
||
export async function continueToPayAfterPaymentSkippedWarning( | ||
request: HapiRequest, | ||
h: HapiResponseToolkit | ||
) { | ||
const { cacheService } = request.services([]); | ||
const state = await cacheService.getState(request); | ||
|
||
const payState = state.pay; | ||
payState.meta++; | ||
await cacheService.mergeState(request, payState); | ||
|
||
const payRedirectUrl = payState.next_url; | ||
return h.redirect(payRedirectUrl); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.