gitlab_support_readiness 1.0.41 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) 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.rb +1 -0
  62. metadata +59 -2
@@ -0,0 +1,238 @@
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 GlobalIRDotcomSubscriptionsExtension within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomSubscriptionsExtension < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com Subscriptions Extension 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 Readiness::GitLab::Namespaces.exists?(client, namespace_provided)
25
+ Readiness::SupportSuperFormProcessor::Shared.invalid_namespace(requester_email, namespace_provided)
26
+ end
27
+ @namespace = Readiness::GitLab::Namespaces.find!(@gitlab_admin_client, namespace_provided)
28
+ ticket = Readiness::Zendesk::Tickets.new
29
+ ticket.email_cc_ids = [zd_user.id]
30
+ ticket.requester_id = 379855863520
31
+ ticket.submitter_id = 379855863520
32
+ ticket.comment = { html_body: body }
33
+ ticket.subject = 'Internal Request - GitLab.com - Extend an (almost) expired subscription'
34
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_subscription lnr_saas_sub_extension]
35
+ ticket.priority = request_priority
36
+ ticket.status = 'new'
37
+ ticket.ticket_form_id = 360000071293
38
+ ticket.custom_fields = [
39
+ { id: 4414446722578, value: 'ticket_group_not_applicable' },
40
+ { id: 360020614420, value: 'aof_lnr' },
41
+ { id: 360020735259, value: 'stage-frt' },
42
+ { id: 360018253094, value: 'all_regions' },
43
+ { id: 360004394559, value: 'free_plan' },
44
+ { id: 360005183820, value: zd_user.name },
45
+ { id: 360005248219, value: zd_user.email },
46
+ { id: 360020735319, value: 'sev3' },
47
+ { id: 360020288373, value: '0' },
48
+ { id: 360014776453, value: 'medium' },
49
+ { id: 6978426204828, value: 'ir_extend_saas_sub' },
50
+ { id: 6978366086428, value: zd_user.email },
51
+ { id: 45195248, value: 'created_by_agent' }
52
+ ]
53
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
54
+ puts "Ticket created: https://gitlab.zendesk.com/agent/tickets/#{create.id}"
55
+ end
56
+
57
+ ##
58
+ # Sets the global variable requester
59
+ #
60
+ # @author Jason Colyer
61
+ # @since 1.0.42
62
+ def self.requester
63
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
64
+ end
65
+
66
+ ##
67
+ # Sets the global variable zd_user
68
+ #
69
+ # @author Jason Colyer
70
+ # @since 1.0.42
71
+ def self.zd_user
72
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
73
+ end
74
+
75
+ ##
76
+ # Sets the global variable requester_email
77
+ #
78
+ # @author Jason Colyer
79
+ # @since 1.0.42
80
+ def self.requester_email
81
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
82
+ end
83
+
84
+ ##
85
+ # Sets the global variable request_priority
86
+ #
87
+ # @author Jason Colyer
88
+ # @since 1.0.42
89
+ def self.request_priority
90
+ @request_priority ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_PRIORITY')
91
+ end
92
+
93
+ ##
94
+ # Sets the global variable context
95
+ #
96
+ # @author Jason Colyer
97
+ # @since 1.0.42
98
+ def self.context
99
+ @context ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTEXT')
100
+ end
101
+
102
+ ##
103
+ # Sets the global variable contact_name
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.contact_name
108
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTACT_NAME')
109
+ end
110
+
111
+ ##
112
+ # Sets the global variable contact_email
113
+ #
114
+ # @author Jason Colyer
115
+ # @since 1.0.42
116
+ def self.contact_email
117
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_EMAIL')
118
+ end
119
+
120
+ ##
121
+ # Sets the global variable company
122
+ #
123
+ # @author Jason Colyer
124
+ # @since 1.0.42
125
+ def self.company
126
+ @company ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_COMPANY_NAME')
127
+ end
128
+
129
+ ##
130
+ # Sets the global variable opp_link
131
+ #
132
+ # @author Jason Colyer
133
+ # @since 1.0.42
134
+ def self.opp_link
135
+ @opp_link ||= ENV.fetch('SAAS_SUB_EXTENSION_SFDC_OPPORTUNITY')
136
+ end
137
+
138
+ ##
139
+ # Sets the global variable namespace_provided
140
+ #
141
+ # @author Jason Colyer
142
+ # @since 1.0.42
143
+ def self.namespace_provided
144
+ @namespace_provided ||= ENV.fetch('SAAS_SUB_EXTENSION_NAMESPACE')
145
+ end
146
+
147
+ ##
148
+ # Sets the global variable plan
149
+ #
150
+ # @author Jason Colyer
151
+ # @since 1.0.42
152
+ def self.plan
153
+ @plan ||= ENV.fetch('SAAS_SUB_EXTENSION_SUB_PLAN')
154
+ end
155
+
156
+ ##
157
+ # Sets the global variable sfdc_account_link
158
+ #
159
+ # @author Jason Colyer
160
+ # @since 1.0.42
161
+ def self.sfdc_account_link
162
+ @sfdc_account_link ||= ENV.fetch('SAAS_SUB_EXTENSION_SFDC_ACCOUNT')
163
+ end
164
+
165
+ ##
166
+ # Sets the global variable extension_date
167
+ #
168
+ # @author Jason Colyer
169
+ # @since 1.0.42
170
+ def self.extension_date
171
+ @extension_date ||= ENV.fetch('SAAS_SUB_EXTENSION_EXPIRATION')
172
+ end
173
+
174
+ ##
175
+ # Sets the global variable sub_name
176
+ #
177
+ # @author Jason Colyer
178
+ # @since 1.0.42
179
+ def self.sub_name
180
+ @sub_name ||= ENV.fetch('SAAS_SUB_EXTENSION_SUB_NAME')
181
+ end
182
+
183
+ ##
184
+ # Sets the global variable reason
185
+ #
186
+ # @author Jason Colyer
187
+ # @since 1.0.42
188
+ def self.reason
189
+ @reason ||= ENV.fetch('SAAS_SUB_EXTENSION_REASON')
190
+ end
191
+
192
+ ##
193
+ # Returns the ticket body
194
+ #
195
+ # @author Jason Colyer
196
+ # @since 1.0.42
197
+ # @return [String]
198
+ def self.body
199
+ <<~STRING
200
+ <p>
201
+ Greetings,
202
+ </p>
203
+ <p>
204
+ 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.
205
+ </p>
206
+ <p>
207
+ A request has been filed for Extend an (almost) expired subscription (GitLab.com).
208
+ </p>
209
+ <p>
210
+ The information for this is as follows:
211
+ </p>
212
+ <ul>
213
+ <li>Customer's name: #{contact_name}</li>
214
+ <li>
215
+ Contact's email: #{contact_email}
216
+ <a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
217
+ <a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
218
+ </li>
219
+ <li>Customer's company: #{company}</li>
220
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
221
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
222
+ <li>GitLab.com namespace: #{@namespace.path}</li>
223
+ <li>Plan: #{plan}</li>
224
+ <li>Requested expiration date: #{extension_date}</li>
225
+ <li>Subscription name: #{sub_name}</li>
226
+ <li>Reason for extension: #{reason}</li>
227
+ </ul>
228
+ <p>
229
+ Some additional context for this request is:
230
+ </p>
231
+ <pre>
232
+ #{context}
233
+ </pre>
234
+ STRING
235
+ end
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,238 @@
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 GlobalIRDotcomSubscriptionsInvestigate within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomSubscriptionsInvestigate < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com Subscriptions Investigate 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 Readiness::GitLab::Namespaces.exists?(client, namespace_provided)
25
+ Readiness::SupportSuperFormProcessor::Shared.invalid_namespace(requester_email, namespace_provided)
26
+ end
27
+ @namespace = Readiness::GitLab::Namespaces.find!(@gitlab_admin_client, namespace_provided)
28
+ ticket = Readiness::Zendesk::Tickets.new
29
+ ticket.email_cc_ids = [zd_user.id]
30
+ ticket.requester_id = 379855863520
31
+ ticket.submitter_id = 379855863520
32
+ ticket.comment = { html_body: body }
33
+ ticket.subject = 'Internal Request - GitLab.com - Investigate incorrect subscription info'
34
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_subscription lnr_saas_sub_issue]
35
+ ticket.priority = request_priority
36
+ ticket.status = 'new'
37
+ ticket.ticket_form_id = 360000071293
38
+ ticket.custom_fields = [
39
+ { id: 4414446722578, value: 'ticket_group_not_applicable' },
40
+ { id: 360020614420, value: 'aof_lnr' },
41
+ { id: 360020735259, value: 'stage-frt' },
42
+ { id: 360018253094, value: 'all_regions' },
43
+ { id: 360004394559, value: 'free_plan' },
44
+ { id: 360005183820, value: zd_user.name },
45
+ { id: 360005248219, value: zd_user.email },
46
+ { id: 360020735319, value: 'sev3' },
47
+ { id: 360020288373, value: '0' },
48
+ { id: 360014776453, value: 'medium' },
49
+ { id: 6978426204828, value: 'ir_issues_saas_sub' },
50
+ { id: 6978366086428, value: zd_user.email },
51
+ { id: 45195248, value: 'created_by_agent' }
52
+ ]
53
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
54
+ puts "Ticket created: https://gitlab.zendesk.com/agent/tickets/#{create.id}"
55
+ end
56
+
57
+ ##
58
+ # Sets the global variable requester
59
+ #
60
+ # @author Jason Colyer
61
+ # @since 1.0.42
62
+ def self.requester
63
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
64
+ end
65
+
66
+ ##
67
+ # Sets the global variable zd_user
68
+ #
69
+ # @author Jason Colyer
70
+ # @since 1.0.42
71
+ def self.zd_user
72
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
73
+ end
74
+
75
+ ##
76
+ # Sets the global variable requester_email
77
+ #
78
+ # @author Jason Colyer
79
+ # @since 1.0.42
80
+ def self.requester_email
81
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
82
+ end
83
+
84
+ ##
85
+ # Sets the global variable request_priority
86
+ #
87
+ # @author Jason Colyer
88
+ # @since 1.0.42
89
+ def self.request_priority
90
+ @request_priority ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_PRIORITY')
91
+ end
92
+
93
+ ##
94
+ # Sets the global variable context
95
+ #
96
+ # @author Jason Colyer
97
+ # @since 1.0.42
98
+ def self.context
99
+ @context ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTEXT')
100
+ end
101
+
102
+ ##
103
+ # Sets the global variable contact_name
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.contact_name
108
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTACT_NAME')
109
+ end
110
+
111
+ ##
112
+ # Sets the global variable contact_email
113
+ #
114
+ # @author Jason Colyer
115
+ # @since 1.0.42
116
+ def self.contact_email
117
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_EMAIL')
118
+ end
119
+
120
+ ##
121
+ # Sets the global variable company
122
+ #
123
+ # @author Jason Colyer
124
+ # @since 1.0.42
125
+ def self.company
126
+ @company ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_COMPANY_NAME')
127
+ end
128
+
129
+ ##
130
+ # Sets the global variable opp_link
131
+ #
132
+ # @author Jason Colyer
133
+ # @since 1.0.42
134
+ def self.opp_link
135
+ @opp_link ||= ENV.fetch('INVESTIGATE_SUB_SFDC_OPPORTUNITY')
136
+ end
137
+
138
+ ##
139
+ # Sets the global variable namespace_provided
140
+ #
141
+ # @author Jason Colyer
142
+ # @since 1.0.42
143
+ def self.namespace_provided
144
+ @namespace_provided ||= ENV.fetch('INVESTIGATE_SUB_NAMESPACE')
145
+ end
146
+
147
+ ##
148
+ # Sets the global variable sub_start_date
149
+ #
150
+ # @author Jason Colyer
151
+ # @since 1.0.42
152
+ def self.sub_start_date
153
+ @sub_start_date ||= ENV.fetch('INVESTIGATE_SUB_START_DATE')
154
+ end
155
+
156
+ ##
157
+ # Sets the global variable sub_end_date
158
+ #
159
+ # @author Jason Colyer
160
+ # @since 1.0.42
161
+ def self.sub_end_date
162
+ @sub_end_date ||= ENV.fetch('INVESTIGATE_SUB_END_DATE')
163
+ end
164
+
165
+ ##
166
+ # Sets the global variable plan
167
+ #
168
+ # @author Jason Colyer
169
+ # @since 1.0.42
170
+ def self.plan
171
+ @plan ||= ENV.fetch('INVESTIGATE_SUB_PLAN')
172
+ end
173
+
174
+ ##
175
+ # Sets the global variable sfdc_account_link
176
+ #
177
+ # @author Jason Colyer
178
+ # @since 1.0.42
179
+ def self.sfdc_account_link
180
+ @sfdc_account_link ||= ENV.fetch('INVESTIGATE_SUB_SFDC_ACCOUNT')
181
+ end
182
+
183
+ ##
184
+ # Sets the global variable seats
185
+ #
186
+ # @author Jason Colyer
187
+ # @since 1.0.42
188
+ def self.seats
189
+ @seats ||= ENV.fetch('INVESTIGATE_SUB_SEATS')
190
+ end
191
+
192
+ ##
193
+ # Returns the ticket body
194
+ #
195
+ # @author Jason Colyer
196
+ # @since 1.0.42
197
+ # @return [String]
198
+ def self.body
199
+ <<~STRING
200
+ <p>
201
+ Greetings,
202
+ </p>
203
+ <p>
204
+ 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.
205
+ </p>
206
+ <p>
207
+ A request has been filed for Investigate incorrect subscription info (GitLab.com).
208
+ </p>
209
+ <p>
210
+ The information for this is as follows:
211
+ </p>
212
+ <ul>
213
+ <li>Customer's name: #{contact_name}</li>
214
+ <li>
215
+ Contact's email: #{contact_email}
216
+ <a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
217
+ <a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
218
+ </li>
219
+ <li>Customer's company: #{company}</li>
220
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
221
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(opp_link)}</li>
222
+ <li>GitLab.com namespace: #{@namespace.path}</li>
223
+ <li>Subscription start date: #{sub_start_date}</li>
224
+ <li>Subscription end date: #{sub_end_date}</li>
225
+ <li>Subscription plan: #{plan}</li>
226
+ <li>Desired seats: #{seats}</li>
227
+ </ul>
228
+ <p>
229
+ Some additional context for this request is:
230
+ </p>
231
+ <pre>
232
+ #{context}
233
+ </pre>
234
+ STRING
235
+ end
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,213 @@
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 GlobalIRDotcomSubscriptionsLink within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomSubscriptionsLink < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com Subscriptions Link 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 Readiness::GitLab::Namespaces.exists?(client, namespace_provided)
25
+ Readiness::SupportSuperFormProcessor::Shared.invalid_namespace(requester_email, namespace_provided)
26
+ end
27
+ @namespace = Readiness::GitLab::Namespaces.find!(@gitlab_admin_client, namespace_provided)
28
+ ticket = Readiness::Zendesk::Tickets.new
29
+ ticket.email_cc_ids = [zd_user.id]
30
+ ticket.requester_id = 379855863520
31
+ ticket.submitter_id = 379855863520
32
+ ticket.comment = { html_body: body }
33
+ ticket.subject = 'Internal Request - GitLab.com - Link subscription to namespace'
34
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_subscription lnr_saas_sub_link]
35
+ ticket.priority = request_priority
36
+ ticket.status = 'new'
37
+ ticket.ticket_form_id = 360000071293
38
+ ticket.custom_fields = [
39
+ { id: 4414446722578, value: 'ticket_group_not_applicable' },
40
+ { id: 360020614420, value: 'aof_lnr' },
41
+ { id: 360020735259, value: 'stage-frt' },
42
+ { id: 360018253094, value: 'all_regions' },
43
+ { id: 360004394559, value: 'free_plan' },
44
+ { id: 360005183820, value: zd_user.name },
45
+ { id: 360005248219, value: zd_user.email },
46
+ { id: 360020735319, value: 'sev3' },
47
+ { id: 360020288373, value: '0' },
48
+ { id: 360014776453, value: 'medium' },
49
+ { id: 6978426204828, value: 'ir_link_sub' },
50
+ { id: 6978366086428, value: zd_user.email },
51
+ { id: 45195248, value: 'created_by_agent' }
52
+ ]
53
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
54
+ puts "Ticket created: https://gitlab.zendesk.com/agent/tickets/#{create.id}"
55
+ end
56
+
57
+ ##
58
+ # Sets the global variable requester
59
+ #
60
+ # @author Jason Colyer
61
+ # @since 1.0.42
62
+ def self.requester
63
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
64
+ end
65
+
66
+ ##
67
+ # Sets the global variable zd_user
68
+ #
69
+ # @author Jason Colyer
70
+ # @since 1.0.42
71
+ def self.zd_user
72
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
73
+ end
74
+
75
+ ##
76
+ # Sets the global variable requester_email
77
+ #
78
+ # @author Jason Colyer
79
+ # @since 1.0.42
80
+ def self.requester_email
81
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
82
+ end
83
+
84
+ ##
85
+ # Sets the global variable request_priority
86
+ #
87
+ # @author Jason Colyer
88
+ # @since 1.0.42
89
+ def self.request_priority
90
+ @request_priority ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_PRIORITY')
91
+ end
92
+
93
+ ##
94
+ # Sets the global variable context
95
+ #
96
+ # @author Jason Colyer
97
+ # @since 1.0.42
98
+ def self.context
99
+ @context ||= ENF.fetch('INTERNAL_REQUEST_GLOBAL_CONTEXT')
100
+ end
101
+
102
+ ##
103
+ # Sets the global variable contact_name
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.contact_name
108
+ @contact_name ||= ENF.fetch('INTERNAL_REQUEST_GLOBAL_CONTACT_NAME')
109
+ end
110
+
111
+ ##
112
+ # Sets the global variable contact_email
113
+ #
114
+ # @author Jason Colyer
115
+ # @since 1.0.42
116
+ def self.contact_email
117
+ @contact_email ||= ENF.fetch('INTERNAL_REQUEST_GLOBAL_EMAIL')
118
+ end
119
+
120
+ ##
121
+ # Sets the global variable company
122
+ #
123
+ # @author Jason Colyer
124
+ # @since 1.0.42
125
+ def self.company
126
+ @company ||= ENF.fetch('INTERNAL_REQUEST_GLOBAL_COMPANY_NAME')
127
+ end
128
+
129
+ ##
130
+ # Sets the global variable sub_name
131
+ #
132
+ # @author Jason Colyer
133
+ # @since 1.0.42
134
+ def self.sub_name
135
+ @sub_name ||= ENF.fetch('SAAS_SUB_LINK_SUB_NAME')
136
+ end
137
+
138
+ ##
139
+ # Sets the global variable namespace_provided
140
+ #
141
+ # @author Jason Colyer
142
+ # @since 1.0.42
143
+ def self.namespace_provided
144
+ @namespace_provided ||= ENF.fetch('SAAS_SUB_LINK_NAMESPACE')
145
+ end
146
+
147
+ ##
148
+ # Sets the global variable sfdc_account_link
149
+ #
150
+ # @author Jason Colyer
151
+ # @since 1.0.42
152
+ def self.sfdc_account_link
153
+ @sfdc_account_link ||= ENF.fetch('SAAS_SUB_LINK_SFDC_ACCOUNT')
154
+ end
155
+
156
+ ##
157
+ # Sets the global variable sfdc_upload_link
158
+ #
159
+ # @author Jason Colyer
160
+ # @since 1.0.42
161
+ def self.sfdc_upload_link
162
+ @sfdc_upload_link ||= ENF.fetch('SAAS_SUB_LINK_OWNER_CONFIRMATION')
163
+ end
164
+
165
+ ##
166
+ # Returns the ticket body
167
+ #
168
+ # @author Jason Colyer
169
+ # @since 1.0.42
170
+ # @return [String]
171
+ def self.body
172
+ <<~STRING
173
+ <p>
174
+ Greetings,
175
+ </p>
176
+ <p>
177
+ 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.
178
+ </p>
179
+ <p>
180
+ A request has been filed for Link subscription to namespace.
181
+ </p>
182
+ <p>
183
+ The information for this is as follows:
184
+ </p>
185
+ <ul>
186
+ <li>Customer's name: #{contact_name}</li>
187
+ <li>
188
+ Contact's email: #{contact_email}
189
+ <a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
190
+ <a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
191
+ </li>
192
+ <li>Customer's company: #{company}</li>
193
+ <li>Subscription name: #{sub_name}</li>
194
+ <li>GitLab.com namespace: #{@namespace.path}</li>
195
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
196
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_upload_string(sfdc_upload_link)}</li>
197
+
198
+ </ul>
199
+ <p>
200
+ Some additional context for this request is:
201
+ </p>
202
+ <pre>
203
+ #{context}
204
+ </pre>
205
+ <p>
206
+ You can find the workflow for this ticket
207
+ <a href='https://handbook.gitlab.com/handbook/support/license-and-renewals/workflows/saas/associate_subscription_and_namespace/' target='_blank'>here</a>
208
+ </p>
209
+ STRING
210
+ end
211
+ end
212
+ end
213
+ end