class ProjectTermsController {

    @PostMapping
    public String acceptTerms(@PathVariable long projectId,
                               @PathVariable long organisationId,
                               Model model,
                               @ModelAttribute(name = "form", binding = false) ProjectTermsForm form,
                               @SuppressWarnings("unused") BindingResult bindingResult,
                               ValidationHandler validationHandler) {
        Supplier<String> failureView = () -> getTerms(projectId, organisationId, model, form);

        return validationHandler.failNowOrSucceedWith(failureView, () -> {

            RestResult<Void> result = pendingPartnerProgressRestService.markTermsAndConditionsComplete(projectId, organisationId);

            return validationHandler.addAnyErrors(result)
                    .failNowOrSucceedWith(
                            failureView,
                            () -> format("redirect:/project/{projectId}/organisation/{organisationId}/terms-and-conditions#terms-accepted", projectId, organisationId));
        });
    }

}