Class: Clickwrap::CapturesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/clickwrap/captures_controller.rb

Overview

The standalone screen for one policy: the same server-owned presentation the form-builder helper renders inline, on a page of its own.

This is what stops a required agreement from becoming a dead end. A gate redirects here, the person completes the policy in place, and they are returned to whatever they were trying to do. It is also the screen a host links to directly for a declaration that has expired or a new Terms version that needs accepting.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Clickwrap::ApplicationController

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/clickwrap/captures_controller.rb', line 24

def create
  capture_clickwrap!(@policy.key, subject: @remediation_subject,
                                  acting_for: @remediation_represented_party,
                                  **remediation_tenant_option)

  redirect_to @return_to, allow_other_host: false, notice: t("clickwrap.captures.recorded")
rescue AnswerInvalid => error
  re_present_with_error(error.statement_key, t("clickwrap.errors.answer_not_accepted"))
rescue SubmissionInvalid, PresentationExpired, PresentationInvalid, ReplayRejected,
       OneTimeAuthorizationConflict
  # A stale, replayed, or swapped presentation is not something to repair
  # quietly: the server offers the policy again and the person answers the
  # offer they can actually see.
  re_present_with_error(nil, t("clickwrap.errors.presentation_no_longer_valid"))
rescue AuthorityNotVerified
  # Authority is rechecked at submit. A role removed after the page was
  # rendered must not become a 500 or a fresh offer that can never succeed.
  head :forbidden
rescue RetryableTransactionError
  response.set_header("Retry-After", "1")
  re_present_with_error(nil, t("clickwrap.errors.temporarily_unavailable"), status: :service_unavailable)
end

#showObject



20
21
22
# File 'app/controllers/clickwrap/captures_controller.rb', line 20

def show
  @presentation = present_policy
end