-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy patherror_component_preview.rb
More file actions
84 lines (72 loc) · 3.36 KB
/
error_component_preview.rb
File metadata and controls
84 lines (72 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# frozen_string_literal: true
module Page
module Utility
# Displays unfixable error message in accept invitation process
class ErrorComponentPreview < ViewComponent::Preview
def invalid_invitation
invitation = Invitation.new(provider_organization: ProviderOrganization.new(name: 'Health Hut'))
reason = 'invalid'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def pii_mismatch
user = User.new(email: 'bilbo.baggins@cms.hms.gov')
invitation = Invitation.new(provider_organization: ProviderOrganization.new(name: 'Health Hut'),
invited_by: user)
reason = 'pii_mismatch'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def email_mismatch
invitation = Invitation.new(provider_organization: ProviderOrganization.new(name: 'Health Hut'))
reason = 'email_mismatch'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
# @param error_code
def verification_failure(error_code: :user_not_authorized_official)
invitation = Invitation.new(id: 3, provider_organization: ProviderOrganization.new(id: 1, name: 'Health Hut'))
render(Page::Utility::ErrorComponent.new(invitation, error_code))
end
def ao_expired
invitation = Invitation.new(id: 5, provider_organization: ProviderOrganization.new(id: 1, name: 'Health Hut'),
invitation_type: :authorized_official, created_at: 49.hours.ago)
reason = 'ao_expired'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def cd_expired
user = User.new(email: 'bilbo.baggins@cms.hms.gov')
invitation = Invitation.new(id: 6, provider_organization: ProviderOrganization.new(id: 1, name: 'Health Hut'),
invited_by: user, invitation_type: :credential_delegate, created_at: 49.hours.ago)
reason = 'cd_expired'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def ao_renewed
invitation = Invitation.new(id: 7, provider_organization: ProviderOrganization.new(id: 1, name: 'Health Hut'),
status: :renewed)
reason = 'ao_renewed'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def cd_accepted
invitation = Invitation.new(id: 8, provider_organization: ProviderOrganization.new(id: 1, name: 'Health Hut'),
invitation_type: :credential_delegate, status: :renewed)
reason = 'cd_accepted'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def server_error
invitation = Invitation.new(provider_organization: ProviderOrganization.new(name: 'Health Hut'))
reason = 'server_error'
render(Page::Utility::ErrorComponent.new(invitation, reason))
end
def no_account
reason = 'no_account'
render(Page::Utility::ErrorComponent.new(nil, reason))
end
def login_gov_signin_cancel
reason = 'login_gov_signin_cancel'
render(Page::Utility::ErrorComponent.new(nil, reason))
end
def login_gov_signin_fail
reason = 'login_gov_signin_fail'
render(Page::Utility::ErrorComponent.new(nil, reason))
end
end
end
end