gitlab_support_readiness 1.0.41 → 1.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/support_readiness/mailgun/client.rb +2 -1
  3. data/lib/support_readiness/mailgun/emails.rb +1 -1
  4. data/lib/support_readiness/support_super_form_processor/create_article.rb +375 -0
  5. data/lib/support_readiness/support_super_form_processor/create_macro.rb +183 -0
  6. data/lib/support_readiness/support_super_form_processor/edit_macro.rb +161 -0
  7. data/lib/support_readiness/support_super_form_processor/enable_us_government.rb +236 -0
  8. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change.rb +218 -0
  9. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_extension.rb +238 -0
  10. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_investigate.rb +238 -0
  11. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_link.rb +213 -0
  12. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_nfr.rb +224 -0
  13. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_reset_seat_qsr.rb +194 -0
  14. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_edit.rb +198 -0
  15. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_extension.rb +228 -0
  16. data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_over_plan.rb +219 -0
  17. data/lib/support_readiness/support_super_form_processor/global_ir_hackerone_license.rb +172 -0
  18. data/lib/support_readiness/support_super_form_processor/global_ir_oem_license.rb +241 -0
  19. data/lib/support_readiness/support_super_form_processor/global_ir_order_management.rb +267 -0
  20. data/lib/support_readiness/support_super_form_processor/global_ir_other.rb +137 -0
  21. data/lib/support_readiness/support_super_form_processor/global_ir_provison_failure.rb +179 -0
  22. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_did_not_receive.rb +191 -0
  23. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_multiyear.rb +188 -0
  24. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_nfr.rb +215 -0
  25. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_resend.rb +188 -0
  26. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_scl.rb +194 -0
  27. data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_temp.rb +234 -0
  28. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_edit.rb +203 -0
  29. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_extension.rb +233 -0
  30. data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_new.rb +223 -0
  31. data/lib/support_readiness/support_super_form_processor/global_ir_wider_community_license.rb +247 -0
  32. data/lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb +151 -0
  33. data/lib/support_readiness/support_super_form_processor/global_set_org_ase.rb +293 -0
  34. data/lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb +142 -0
  35. data/lib/support_readiness/support_super_form_processor/gratis_support_extension.rb +247 -0
  36. data/lib/support_readiness/support_super_form_processor/gratis_support_former_customer.rb +288 -0
  37. data/lib/support_readiness/support_super_form_processor/gratis_support_migration.rb +238 -0
  38. data/lib/support_readiness/support_super_form_processor/gratis_support_other.rb +221 -0
  39. data/lib/support_readiness/support_super_form_processor/gratis_support_prospect.rb +288 -0
  40. data/lib/support_readiness/support_super_form_processor/gratis_support_upgrade.rb +298 -0
  41. data/lib/support_readiness/support_super_form_processor/namespace_availability.rb +213 -0
  42. data/lib/support_readiness/support_super_form_processor/pd_shadow_modification.rb +189 -0
  43. data/lib/support_readiness/support_super_form_processor/sa_request_for_support.rb +214 -0
  44. data/lib/support_readiness/support_super_form_processor/shared.rb +518 -0
  45. data/lib/support_readiness/support_super_form_processor/team_member_license.rb +144 -0
  46. data/lib/support_readiness/support_super_form_processor/two_fa_exemption.rb +260 -0
  47. data/lib/support_readiness/support_super_form_processor/usgov_ir_order_management.rb +252 -0
  48. data/lib/support_readiness/support_super_form_processor/usgov_ir_other.rb +136 -0
  49. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_did_not_receive.rb +162 -0
  50. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_multiyear.rb +159 -0
  51. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_nfr.rb +196 -0
  52. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_resend.rb +159 -0
  53. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_scl.rb +160 -0
  54. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb +219 -0
  55. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_edit.rb +189 -0
  56. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_extension.rb +219 -0
  57. data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_new.rb +209 -0
  58. data/lib/support_readiness/support_super_form_processor/usgov_set_collaboration_id.rb +151 -0
  59. data/lib/support_readiness/support_super_form_processor/usgov_set_org_ase.rb +295 -0
  60. data/lib/support_readiness/support_super_form_processor.rb +67 -0
  61. data/lib/support_readiness/zendesk/tickets.rb +3 -1
  62. data/lib/support_readiness.rb +1 -0
  63. metadata +59 -2
@@ -0,0 +1,162 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class USGovIRSMSubscriptionsDidNotReceive within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class USGovIRSMSubscriptionsDidNotReceive < Readiness::Client
13
+ ##
14
+ # Process a US Government Internal Request Self-Managed Subscriptions Did Not Recieve request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ def self.process!(gitlab_client, gitlab_admin_client, zendesk_client)
19
+ @gitlab_client = gitlab_client
20
+ @gitlab_admin_client = gitlab_admin_client
21
+ @zendesk_client = zendesk_client
22
+ requester
23
+ zd_user
24
+ ticket = Readiness::Zendesk::Tickets.new
25
+ ticket.requester_id = zd_user.id
26
+ ticket.submitter_id = zd_user.id
27
+ ticket.comment = { html_body: body }
28
+ ticket.subject = 'Internal Request - SM - Customer did not receive the license'
29
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_sm_license lnr_sm_license_new_contact]
30
+ ticket.priority = 'normal'
31
+ ticket.status = 'new'
32
+ ticket.ticket_form_id = 360001803151
33
+ ticket.custom_fields = [
34
+ { id: 11717320292244, value: 'ir_sm_did_not_receive' },
35
+ { id: 11717222771604, value: zd_user.email }
36
+ ]
37
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
38
+ puts "Ticket created: https://gitlab-federal-support.zendesk.com/agent/tickets/#{create.id}"
39
+ end
40
+
41
+ ##
42
+ # Sets the global variable requester
43
+ #
44
+ # @author Jason Colyer
45
+ # @since 1.0.42
46
+ def self.requester
47
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
48
+ end
49
+
50
+ ##
51
+ # Sets the global variable zd_user
52
+ #
53
+ # @author Jason Colyer
54
+ # @since 1.0.42
55
+ def self.zd_user
56
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
57
+ end
58
+
59
+ ##
60
+ # Sets the global variable requester_email
61
+ #
62
+ # @author Jason Colyer
63
+ # @since 1.0.42
64
+ def self.requester_email
65
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
66
+ end
67
+
68
+ ##
69
+ # Sets the global variable context
70
+ #
71
+ # @author Jason Colyer
72
+ # @since 1.0.42
73
+ def self.context
74
+ @context ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTEXT')
75
+ end
76
+
77
+ ##
78
+ # Sets the global variable contact_name
79
+ #
80
+ # @author Jason Colyer
81
+ # @since 1.0.42
82
+ def self.contact_name
83
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTACT_NAME')
84
+ end
85
+
86
+ ##
87
+ # Sets the global variable contact_email
88
+ #
89
+ # @author Jason Colyer
90
+ # @since 1.0.42
91
+ def self.contact_email
92
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_USFED_EMAIL')
93
+ end
94
+
95
+ ##
96
+ # Sets the global variable opp_link
97
+ #
98
+ # @author Jason Colyer
99
+ # @since 1.0.42
100
+ def self.opp_link
101
+ @opp_link ||= ENV.fetch('USFED_SM_LICENSE_DID_NOT_RECEIVE_OPP_LINK')
102
+ end
103
+
104
+ ##
105
+ # Sets the global variable sfdc_account
106
+ #
107
+ # @author Jason Colyer
108
+ # @since 1.0.42
109
+ def self.sfdc_account
110
+ @sfdc_account ||= ENV.fetch('INTERNAL_REQUEST_USFED_SFDC_ACCOUNT')
111
+ end
112
+
113
+ ##
114
+ # Sets the global variable version
115
+ #
116
+ # @author Jason Colyer
117
+ # @since 1.0.42
118
+ def self.version
119
+ @version ||= ENV.fetch('INTERNAL_REQUEST_USFED_VERSION')
120
+ end
121
+
122
+ ##
123
+ # Returns the ticket body
124
+ #
125
+ # @author Jason Colyer
126
+ # @since 1.0.42
127
+ # @return [String]
128
+ def self.body
129
+ <<~STRING
130
+ <p>
131
+ Greetings,
132
+ </p>
133
+ <p>
134
+ Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket.
135
+ </p>
136
+ <p>
137
+ A request has been filed for Customer did not receive the license.
138
+ </p>
139
+ <p>
140
+ Please note we cannot send licenses to anyone other than the account owner. To send it to someone else, please ask the customer to file a ticket so we can go through the contact change process.
141
+ </p>
142
+ <p>
143
+ The information for this is as follows:
144
+ </p>
145
+ <ul>
146
+ <li>Contact's name: #{contact_name}</li>
147
+ <li>Contact's email: #{contact_email}</li>
148
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
149
+ <li>GitLab Version: #{version}</li>
150
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account)}</li>
151
+ </ul>
152
+ <p>
153
+ Some additional context for this request is:
154
+ </p>
155
+ <pre>
156
+ #{context}
157
+ </pre>
158
+ STRING
159
+ end
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class USGovIRSMSubscriptionsMultiyear within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class USGovIRSMSubscriptionsMultiyear < Readiness::Client
13
+ ##
14
+ # Process a US Government Internal Request Self-Managed Subscriptions Multiyear request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ def self.process!(gitlab_client, gitlab_admin_client, zendesk_client)
19
+ @gitlab_client = gitlab_client
20
+ @gitlab_admin_client = gitlab_admin_client
21
+ @zendesk_client = zendesk_client
22
+ requester
23
+ zd_user
24
+ ticket = Readiness::Zendesk::Tickets.new
25
+ ticket.requester_id = zd_user.id
26
+ ticket.submitter_id = zd_user.id
27
+ ticket.comment = { html_body: body }
28
+ ticket.subject = 'Internal Request - SM - Multi-year license needs to be generated'
29
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_sm_license lnr_multiyear_license]
30
+ ticket.priority = 'normal'
31
+ ticket.status = 'new'
32
+ ticket.ticket_form_id = 360001803151
33
+ ticket.custom_fields = [
34
+ { id: 11717320292244, value: 'ir_sm_multiyear' },
35
+ { id: 11717222771604, value: zd_user.email }
36
+ ]
37
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
38
+ puts "Ticket created: https://gitlab-federal-support.zendesk.com/agent/tickets/#{create.id}"
39
+ end
40
+
41
+ ##
42
+ # Sets the global variable requester
43
+ #
44
+ # @author Jason Colyer
45
+ # @since 1.0.42
46
+ def self.requester
47
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
48
+ end
49
+
50
+ ##
51
+ # Sets the global variable zd_user
52
+ #
53
+ # @author Jason Colyer
54
+ # @since 1.0.42
55
+ def self.zd_user
56
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
57
+ end
58
+
59
+ ##
60
+ # Sets the global variable requester_email
61
+ #
62
+ # @author Jason Colyer
63
+ # @since 1.0.42
64
+ def self.requester_email
65
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
66
+ end
67
+
68
+ ##
69
+ # Sets the global variable context
70
+ #
71
+ # @author Jason Colyer
72
+ # @since 1.0.42
73
+ def self.context
74
+ @context ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTEXT')
75
+ end
76
+
77
+ ##
78
+ # Sets the global variable contact_name
79
+ #
80
+ # @author Jason Colyer
81
+ # @since 1.0.42
82
+ def self.contact_name
83
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTACT_NAME')
84
+ end
85
+
86
+ ##
87
+ # Sets the global variable contact_email
88
+ #
89
+ # @author Jason Colyer
90
+ # @since 1.0.42
91
+ def self.contact_email
92
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_USFED_EMAIL')
93
+ end
94
+
95
+ ##
96
+ # Sets the global variable opp_link
97
+ #
98
+ # @author Jason Colyer
99
+ # @since 1.0.42
100
+ def self.opp_link
101
+ @opp_link ||= ENV.fetch('USFED_SM_LICENSE_MULTIYEAR_OPP_LINK')
102
+ end
103
+
104
+ ##
105
+ # Sets the global variable sfdc_account
106
+ #
107
+ # @author Jason Colyer
108
+ # @since 1.0.42
109
+ def self.sfdc_account
110
+ @sfdc_account ||= ENV.fetch('INTERNAL_REQUEST_USFED_SFDC_ACCOUNT')
111
+ end
112
+
113
+ ##
114
+ # Sets the global variable version
115
+ #
116
+ # @author Jason Colyer
117
+ # @since 1.0.42
118
+ def self.version
119
+ @version ||= ENV.fetch('INTERNAL_REQUEST_USFED_VERSION')
120
+ end
121
+
122
+ ##
123
+ # Returns the ticket body
124
+ #
125
+ # @author Jason Colyer
126
+ # @since 1.0.42
127
+ # @return [String]
128
+ def self.body
129
+ <<~STRING
130
+ <p>
131
+ Greetings,
132
+ </p>
133
+ <p>
134
+ Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket.
135
+ </p>
136
+ <p>
137
+ A request has been filed for Multi-year license needs to be generated.
138
+ </p>
139
+ <p>
140
+ The information for this is as follows:
141
+ </p>
142
+ <ul>
143
+ <li>Contact name:#{contact_name}</li>
144
+ <li>Contact email:#{contact_email}</li>
145
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
146
+ <li>GitLab Version: #{version}</li>
147
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account)}</li>
148
+ </ul>
149
+ <p>
150
+ Some additional context for this request is:
151
+ </p>
152
+ <pre>
153
+ #{context}
154
+ </pre>
155
+ STRING
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class USGovIRSMSubscriptionsNFR within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class USGovIRSMSubscriptionsNFR < Readiness::Client
13
+ ##
14
+ # Process a US Government Internal Request Self-Managed Subscriptions NFR request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ def self.process!(gitlab_client, gitlab_admin_client, zendesk_client)
19
+ @gitlab_client = gitlab_client
20
+ @gitlab_admin_client = gitlab_admin_client
21
+ @zendesk_client = zendesk_client
22
+ requester
23
+ zd_user
24
+ unless zd_user.tags.include? 'partner_support_agent'
25
+ Readiness::SupportSuperFormProcessor::Shared.not_partner_support_member(requester_email)
26
+ end
27
+ if current.to_i > 25 || Date.parse(license_end_date) > (Date.today + 1.years)
28
+ Readiness::SupportSuperFormProcessor::Shared.invalid_nfr_request(requester_email)
29
+ end
30
+ ticket = Readiness::Zendesk::Tickets.new
31
+ ticket.requester_id = zd_user.id
32
+ ticket.submitter_id = zd_user.id
33
+ ticket.comment = { html_body: body }
34
+ ticket.subject = 'Internal Request - SM - NFR license request'
35
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_sm_license lnr_sm_nfr]
36
+ ticket.priority = 'normal'
37
+ ticket.status = 'new'
38
+ ticket.ticket_form_id = 360001803151
39
+ ticket.custom_fields = [
40
+ { id: 11717320292244, value: 'ir_sm_nfr' },
41
+ { id: 11717222771604, value: zd_user.email }
42
+ ]
43
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
44
+ puts "Ticket created: https://gitlab-federal-support.zendesk.com/agent/tickets/#{create.id}"
45
+ end
46
+
47
+ ##
48
+ # Sets the global variable requester
49
+ #
50
+ # @author Jason Colyer
51
+ # @since 1.0.42
52
+ def self.requester
53
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
54
+ end
55
+
56
+ ##
57
+ # Sets the global variable zd_user
58
+ #
59
+ # @author Jason Colyer
60
+ # @since 1.0.42
61
+ def self.zd_user
62
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
63
+ end
64
+
65
+ ##
66
+ # Sets the global variable requester_email
67
+ #
68
+ # @author Jason Colyer
69
+ # @since 1.0.42
70
+ def self.requester_email
71
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
72
+ end
73
+
74
+ ##
75
+ # Sets the global variable context
76
+ #
77
+ # @author Jason Colyer
78
+ # @since 1.0.42
79
+ def self.context
80
+ @context ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTEXT')
81
+ end
82
+
83
+ ##
84
+ # Sets the global variable contact_name
85
+ #
86
+ # @author Jason Colyer
87
+ # @since 1.0.42
88
+ def self.contact_name
89
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTACT_NAME')
90
+ end
91
+
92
+ ##
93
+ # Sets the global variable contact_email
94
+ #
95
+ # @author Jason Colyer
96
+ # @since 1.0.42
97
+ def self.contact_email
98
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_USFED_EMAIL')
99
+ end
100
+
101
+ ##
102
+ # Sets the global variable company
103
+ #
104
+ # @author Jason Colyer
105
+ # @since 1.0.42
106
+ def self.company
107
+ @company ||= ENV.fetch('INTERNAL_REQUEST_USFED_COMPANY_NAME')
108
+ end
109
+
110
+ ##
111
+ # Sets the global variable license_end_date
112
+ #
113
+ # @author Jason Colyer
114
+ # @since 1.0.42
115
+ def self.license_end_date
116
+ @license_end_date ||= ENV.fetch('USFED_SM_NFR_LICENSE_END_DATE')
117
+ end
118
+
119
+ ##
120
+ # Sets the global variable current
121
+ #
122
+ # @author Jason Colyer
123
+ # @since 1.0.42
124
+ def self.current
125
+ @current ||= ENV.fetch('USFED_SM_NFR_LICENSE_USERS')
126
+ end
127
+
128
+ ##
129
+ # Sets the global variable plan
130
+ #
131
+ # @author Jason Colyer
132
+ # @since 1.0.42
133
+ def self.plan
134
+ @plan ||= ENV.fetch('USFED_SM_NFR_LICENSE_PLAN')
135
+ end
136
+
137
+ ##
138
+ # Sets the global variable sfdc_account
139
+ #
140
+ # @author Jason Colyer
141
+ # @since 1.0.42
142
+ def self.sfdc_account
143
+ @sfdc_account ||= ENV.fetch('INTERNAL_REQUEST_USFED_SFDC_ACCOUNT')
144
+ end
145
+
146
+ ##
147
+ # Sets the global variable version
148
+ #
149
+ # @author Jason Colyer
150
+ # @since 1.0.42
151
+ def self.version
152
+ @version ||= ENV.fetch('INTERNAL_REQUEST_USFED_VERSION')
153
+ end
154
+
155
+ ##
156
+ # Returns the ticket body
157
+ #
158
+ # @author Jason Colyer
159
+ # @since 1.0.42
160
+ # @return [String]
161
+ def self.body
162
+ <<~STRING
163
+ <p>
164
+ Greetings,
165
+ </p>
166
+ <p>
167
+ Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket.
168
+ </p>
169
+ <p>
170
+ A request has been filed for Self-managed NFR license request.
171
+ </p>
172
+ <p>
173
+ The information for this is as follows:
174
+ </p>
175
+ <ul>
176
+ <li>Contact's name: #{contact_name}</li>
177
+ <li>Contact's email: #{contact_email}</li>
178
+ <li>Contact's company: #{company}</li>
179
+ <li>License end date: #{license_end_date}</li>
180
+ <li>User count: #{current}</li>
181
+ <li>Plan: #{plan}</li>
182
+ <li>Trial: Yes</li>
183
+ <li>GitLab Version: #{version}</li>
184
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account)}</li>
185
+ </ul>
186
+ <p>
187
+ Some additional context for this request is:
188
+ </p>
189
+ <pre>
190
+ #{context}
191
+ </pre>
192
+ STRING
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Defines the module Readiness.
4
+ module Readiness
5
+ # Defines the module SupportSuperFormProcessor
6
+ module SupportSuperFormProcessor
7
+ ##
8
+ # Defines the class USGovIRSMSubscriptionsResend within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class USGovIRSMSubscriptionsResend < Readiness::Client
13
+ ##
14
+ # Process a US Government Internal Request Self-Managed Subscription Resend request
15
+ #
16
+ # @author Jason Colyer
17
+ # @since 1.0.42
18
+ def self.process!(gitlab_client, gitlab_admin_client, zendesk_client)
19
+ @gitlab_client = gitlab_client
20
+ @gitlab_admin_client = gitlab_admin_client
21
+ @zendesk_client = zendesk_client
22
+ requester
23
+ zd_user
24
+ ticket = Readiness::Zendesk::Tickets.new
25
+ ticket.requester_id = zd_user.id
26
+ ticket.submitter_id = zd_user.id
27
+ ticket.comment = { html_body: body }
28
+ ticket.subject = 'Internal Request - SM - Customer needs the license resent to a new person'
29
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_sm_license lnr_sm_license_receive_error]
30
+ ticket.priority = 'normal'
31
+ ticket.status = 'new'
32
+ ticket.ticket_form_id = 360001803151
33
+ ticket.custom_fields = [
34
+ { id: 11717320292244, value: 'ir_sm_resend' },
35
+ { id: 11717222771604, value: zd_user.email }
36
+ ]
37
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
38
+ puts "Ticket created: https://gitlab-federal-support.zendesk.com/agent/tickets/#{create.id}"
39
+ end
40
+
41
+ ##
42
+ # Sets the global variable requester
43
+ #
44
+ # @author Jason Colyer
45
+ # @since 1.0.42
46
+ def self.requester
47
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
48
+ end
49
+
50
+ ##
51
+ # Sets the global variable zd_user
52
+ #
53
+ # @author Jason Colyer
54
+ # @since 1.0.42
55
+ def self.zd_user
56
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
57
+ end
58
+
59
+ ##
60
+ # Sets the global variable requester_email
61
+ #
62
+ # @author Jason Colyer
63
+ # @since 1.0.42
64
+ def self.requester_email
65
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
66
+ end
67
+
68
+ ##
69
+ # Sets the global variable context
70
+ #
71
+ # @author Jason Colyer
72
+ # @since 1.0.42
73
+ def self.context
74
+ @context ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTEXT')
75
+ end
76
+
77
+ ##
78
+ # Sets the global variable contact_name
79
+ #
80
+ # @author Jason Colyer
81
+ # @since 1.0.42
82
+ def self.contact_name
83
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_USFED_CONTACT_NAME')
84
+ end
85
+
86
+ ##
87
+ # Sets the global variable contact_email
88
+ #
89
+ # @author Jason Colyer
90
+ # @since 1.0.42
91
+ def self.contact_email
92
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_USFED_EMAIL')
93
+ end
94
+
95
+ ##
96
+ # Sets the global variable opp_link
97
+ #
98
+ # @author Jason Colyer
99
+ # @since 1.0.42
100
+ def self.opp_link
101
+ @opp_link ||= ENV.fetch('USFED_SM_LICENSE_RESEND_OPP_LINK')
102
+ end
103
+
104
+ ##
105
+ # Sets the global variable sfdc_account
106
+ #
107
+ # @author Jason Colyer
108
+ # @since 1.0.42
109
+ def self.sfdc_account
110
+ @sfdc_account ||= ENV.fetch('INTERNAL_REQUEST_USFED_SFDC_ACCOUNT')
111
+ end
112
+
113
+ ##
114
+ # Sets the global variable version
115
+ #
116
+ # @author Jason Colyer
117
+ # @since 1.0.42
118
+ def self.version
119
+ @version ||= ENV.fetch('INTERNAL_REQUEST_USFED_VERSION')
120
+ end
121
+
122
+ ##
123
+ # Returns the ticket body
124
+ #
125
+ # @author Jason Colyer
126
+ # @since 1.0.42
127
+ # @return [String]
128
+ def self.body
129
+ <<~STRING
130
+ <p>
131
+ Greetings,
132
+ </p>
133
+ <p>
134
+ Please note that this is an <b>INTERNAL</b> ticket and should <b>NEVER</b> be shared with anyone. Please do not CC, BCC, forward, or anything else that can send the information from this ticket. <b>NEVER</b> add <i>anyone</i> outside of GitLab to this ticket or communications stemming from this ticket.
135
+ </p>
136
+ <p>
137
+ A request has been filed for Customer needs the license resent to a new person.
138
+ </p>
139
+ <p>
140
+ The information for this is as follows:
141
+ </p>
142
+ <ul>
143
+ <li>Contact's name: #{contact_name}</li>
144
+ <li>Contact's email: #{contact_email}</li>
145
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
146
+ <li>GitLab Version: #{version}</li>
147
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account)}</li>
148
+ </ul>
149
+ <p>
150
+ Some additional context for this request is:
151
+ </p>
152
+ <pre>
153
+ #{context}
154
+ </pre>
155
+ STRING
156
+ end
157
+ end
158
+ end
159
+ end