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,224 @@
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 GlobalIRDotcomSubscriptionsNFR within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomSubscriptionsNFR < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com 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 seats.to_i > 25 || Date.parse(sub_end_date) > (Date.today + 1.years)
28
+ Readiness::SupportSuperFormProcessor::Shared.invalid_nfr_request(requester_email)
29
+ end
30
+ unless Readiness::GitLab::Namespaces.exists?(client, namespace_provided)
31
+ Readiness::SupportSuperFormProcessor::Shared.invalid_namespace(requester_email, namespace_provided)
32
+ end
33
+ @namespace = Readiness::GitLab::Namespaces.find!(@gitlab_admin_client, namespace_provided)
34
+ ticket = Readiness::Zendesk::Tickets.new
35
+ ticket.email_cc_ids = [zd_user.id]
36
+ ticket.requester_id = 379855863520
37
+ ticket.submitter_id = 379855863520
38
+ ticket.comment = { html_body: body }
39
+ ticket.subject = 'Internal Request - GitLab.com - NFR license request'
40
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_nfr]
41
+ ticket.priority = request_priority
42
+ ticket.status = 'new'
43
+ ticket.ticket_form_id = 360000071293
44
+ ticket.custom_fields = [
45
+ { id: 4414446722578, value: 'ticket_group_not_applicable' },
46
+ { id: 360020614420, value: 'aof_lnr' },
47
+ { id: 360020735259, value: 'stage-frt' },
48
+ { id: 360018253094, value: 'all_regions' },
49
+ { id: 360004394559, value: 'free_plan' },
50
+ { id: 360005183820, value: zd_user.name },
51
+ { id: 360005248219, value: zd_user.email },
52
+ { id: 360020735319, value: 'sev3' },
53
+ { id: 360020288373, value: '0' },
54
+ { id: 360014776453, value: 'medium' },
55
+ { id: 6978426204828, value: 'ir_saas_nfr' },
56
+ { id: 6978366086428, value: zd_user.email },
57
+ { id: 45195248, value: 'created_by_agent' }
58
+ ]
59
+ create = Readiness::Zendesk::Tickets.create!(@zendesk_client, ticket)
60
+ puts "Ticket created: https://gitlab.zendesk.com/agent/tickets/#{create.id}"
61
+ end
62
+
63
+ ##
64
+ # Sets the global variable requester
65
+ #
66
+ # @author Jason Colyer
67
+ # @since 1.0.42
68
+ def self.requester
69
+ @requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
70
+ end
71
+
72
+ ##
73
+ # Sets the global variable zd_user
74
+ #
75
+ # @author Jason Colyer
76
+ # @since 1.0.42
77
+ def self.zd_user
78
+ @zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
79
+ end
80
+
81
+ ##
82
+ # Sets the global variable requester_email
83
+ #
84
+ # @author Jason Colyer
85
+ # @since 1.0.42
86
+ def self.requester_email
87
+ @requester_email ||= ENV.fetch('REQUESTER_EMAIL')
88
+ end
89
+
90
+ ##
91
+ # Sets the global variable request_priority
92
+ #
93
+ # @author Jason Colyer
94
+ # @since 1.0.42
95
+ def self.request_priority
96
+ @request_priority ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_PRIORITY')
97
+ end
98
+
99
+ ##
100
+ # Sets the global variable context
101
+ #
102
+ # @author Jason Colyer
103
+ # @since 1.0.42
104
+ def self.context
105
+ @context ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTEXT')
106
+ end
107
+
108
+ ##
109
+ # Sets the global variable contact_name
110
+ #
111
+ # @author Jason Colyer
112
+ # @since 1.0.42
113
+ def self.contact_name
114
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTACT_NAME')
115
+ end
116
+
117
+ ##
118
+ # Sets the global variable contact_email
119
+ #
120
+ # @author Jason Colyer
121
+ # @since 1.0.42
122
+ def self.contact_email
123
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_EMAIL')
124
+ end
125
+
126
+ ##
127
+ # Sets the global variable company
128
+ #
129
+ # @author Jason Colyer
130
+ # @since 1.0.42
131
+ def self.company
132
+ @company ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_COMPANY_NAME')
133
+ end
134
+
135
+ ##
136
+ # Sets the global variable namespace_provided
137
+ #
138
+ # @author Jason Colyer
139
+ # @since 1.0.42
140
+ def self.namespace_provided
141
+ @namespace_provided ||= ENV.fetch('SAAS_NFR_LICENSE_NAMESPACE')
142
+ end
143
+
144
+ ##
145
+ # Sets the global variable sub_start_date
146
+ #
147
+ # @author Jason Colyer
148
+ # @since 1.0.42
149
+ def self.sub_start_date
150
+ @sub_start_date ||= ENV.fetch('SAAS_NFR_LICENSE_START_DATE')
151
+ end
152
+
153
+ ##
154
+ # Sets the global variable sub_end_date
155
+ #
156
+ # @author Jason Colyer
157
+ # @since 1.0.42
158
+ def self.sub_end_date
159
+ @sub_end_date ||= ENV.fetch('SAAS_NFR_LICENSE_END_DATE')
160
+ end
161
+
162
+ ##
163
+ # Sets the global variable sfdc_account_link
164
+ #
165
+ # @author Jason Colyer
166
+ # @since 1.0.42
167
+ def self.sfdc_account_link
168
+ @sfdc_account_link ||= ENV.fetch('SAAS_NFR_LICENSE_SFDC_ACCOUNT')
169
+ end
170
+
171
+ ##
172
+ # Sets the global variable seats
173
+ #
174
+ # @author Jason Colyer
175
+ # @since 1.0.42
176
+ def self.seats
177
+ @seats ||= ENV.fetch('SAAS_NFR_LICENSE_SEATS')
178
+ end
179
+
180
+ ##
181
+ # Returns the ticket body
182
+ #
183
+ # @author Jason Colyer
184
+ # @since 1.0.42
185
+ # @return [String]
186
+ def self.body
187
+ <<~STRING
188
+ <p>
189
+ Greetings,
190
+ </p>
191
+ <p>
192
+ 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.
193
+ </p>
194
+ <p>
195
+ A request has been filed for GitLab.com NFR license request.
196
+ </p>
197
+ <p>
198
+ The information for this is as follows:
199
+ </p>
200
+ <ul>
201
+ <li>Customer's name: #{contact_name}</li>
202
+ <li>
203
+ Contact's email: #{contact_email}
204
+ <a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
205
+ <a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
206
+ </li>
207
+ <li>Customer's company: #{company}</li>
208
+ <li>GitLab.com namespace: #{@namespace.path}</li>
209
+ <li>Subscription start date: #{sub_start_date}</li>
210
+ <li>Subscription end date: #{sub_end_date}</li>
211
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
212
+ <li>Seats needed: #{seats}</li>
213
+ </ul>
214
+ <p>
215
+ Some additional context for this request is:
216
+ </p>
217
+ <pre>
218
+ #{context}
219
+ </pre>
220
+ STRING
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,194 @@
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 GlobalIRDotcomSubscriptionsResetSeatQSR within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomSubscriptionsResetSeatQSR < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com Subscriptions Reset Seats QSR 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 - Reset max seats for QSR'
34
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_subscription lnr_saas_sub_qsr_reset]
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_reset_qsr' },
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 sub_name
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.sub_name
108
+ @sub_name ||= ENV.fetch('RESET_SEATS_QSR_SUB_NAME')
109
+ end
110
+
111
+ ##
112
+ # Sets the global variable customer_link
113
+ #
114
+ # @author Jason Colyer
115
+ # @since 1.0.42
116
+ def self.customer_link
117
+ @customer_link ||= ENV.fetch('RESET_SEATS_QSR_CDOT')
118
+ end
119
+
120
+ ##
121
+ # Sets the global variable namespace
122
+ #
123
+ # @author Jason Colyer
124
+ # @since 1.0.42
125
+ def self.namespace
126
+ @namespace ||= ENV.fetch('RESET_SEATS_QSR_NAMESPACE')
127
+ end
128
+
129
+ ##
130
+ # Sets the global variable sfdc_account_link
131
+ #
132
+ # @author Jason Colyer
133
+ # @since 1.0.42
134
+ def self.sfdc_account_link
135
+ @sfdc_account_link ||= ENV.fetch('RESET_SEATS_QSR_SFDC_ACCOUNT')
136
+ end
137
+
138
+ ##
139
+ # Sets the global variable chattr_link
140
+ #
141
+ # @author Jason Colyer
142
+ # @since 1.0.42
143
+ def self.chattr_link
144
+ @chattr_link ||= ENV.fetch('RESET_SEATS_QSR_SFDC_CHATTER')
145
+ end
146
+
147
+ ##
148
+ # Sets the global variable seats_waived
149
+ #
150
+ # @author Jason Colyer
151
+ # @since 1.0.42
152
+ def self.seats_waived
153
+ @seats_waived ||= ENV.fetch('RESET_SEATS_QSR_SEATS_WAIVED')
154
+ end
155
+
156
+ ##
157
+ # Returns the ticket body
158
+ #
159
+ # @author Jason Colyer
160
+ # @since 1.0.42
161
+ # @return [String]
162
+ def self.body
163
+ <<~STRING
164
+ <p>
165
+ Greetings,
166
+ </p>
167
+ <p>
168
+ 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.
169
+ </p>
170
+ <p>
171
+ A request has been filed for a Reset max seats for QSR request.
172
+ </p>
173
+ <p>
174
+ The information for this is as follows:
175
+ </p>
176
+ <ul>
177
+ <li>Subscription name: #{sub_name}</li>
178
+ <li>cDot link: <a href='<%= @customer_link %>' target='_blank'>#{customer_link}</a></li>
179
+ <li>GitLab.com namespace: <%= @namespace['path'] %></li>
180
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
181
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_chattr_string(chattr_link)}</li>
182
+ <li>Number of seats waived/refunded: #{seats_waived}</li>
183
+ </ul>
184
+ <p>
185
+ Some additional context for this request is:
186
+ </p>
187
+ <pre>
188
+ #{context}
189
+ </pre>
190
+ STRING
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,198 @@
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 GlobalIRDotcomTrialsEdit within the module {Readiness::Zendesk}.
9
+ #
10
+ # @author Jason Colyer
11
+ # @since 1.0.42
12
+ class GlobalIRDotcomTrialsEdit < Readiness::Client
13
+ ##
14
+ # Process a Global Internal Request GitLab.com Trials XXX 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 - Change existing gitlab.com trial plan'
34
+ ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_saas_trial lnr_saas_trial_edit]
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 namespace_provided
95
+ #
96
+ # @author Jason Colyer
97
+ # @since 1.0.42
98
+ def self.namespace_provided
99
+ @namespace_provided ||= ENV.fetch('SAAS_TRIAL_EDIT_NAMESPACE')
100
+ end
101
+
102
+ ##
103
+ # Sets the global variable context
104
+ #
105
+ # @author Jason Colyer
106
+ # @since 1.0.42
107
+ def self.context
108
+ @context ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTEXT')
109
+ end
110
+
111
+ ##
112
+ # Sets the global variable contact_name
113
+ #
114
+ # @author Jason Colyer
115
+ # @since 1.0.42
116
+ def self.contact_name
117
+ @contact_name ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_CONTACT_NAME')
118
+ end
119
+
120
+ ##
121
+ # Sets the global variable contact_email
122
+ #
123
+ # @author Jason Colyer
124
+ # @since 1.0.42
125
+ def self.contact_email
126
+ @contact_email ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_EMAIL')
127
+ end
128
+
129
+ ##
130
+ # Sets the global variable company
131
+ #
132
+ # @author Jason Colyer
133
+ # @since 1.0.42
134
+ def self.company
135
+ @company ||= ENV.fetch('INTERNAL_REQUEST_GLOBAL_COMPANY_NAME')
136
+ end
137
+
138
+ ##
139
+ # Sets the global variable sfdc_account_link
140
+ #
141
+ # @author Jason Colyer
142
+ # @since 1.0.42
143
+ def self.sfdc_account_link
144
+ @sfdc_account_link ||= ENV.fetch('SAAS_TRIAL_EDIT_SFDC_ACCOUNT')
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_TRIAL_EDIT_PLAN')
154
+ end
155
+
156
+ ##
157
+ # Returns the ticket body
158
+ #
159
+ # @author Jason Colyer
160
+ # @since 1.0.42
161
+ # @return [String]
162
+ def self.body
163
+ <<~STRING
164
+ <p>
165
+ Greetings,
166
+ </p>
167
+ <p>
168
+ 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.
169
+ </p>
170
+ <p>
171
+ A request has been filed for Change existing GitLab.com trial plan.
172
+ </p>
173
+ <p>
174
+ The information for this is as follows:
175
+ </p>
176
+ <ul>
177
+ <li>Customer's name: #{contact_name}</li>
178
+ <li>
179
+ Contact's email: #{contact_email}
180
+ <a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
181
+ <a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
182
+ </li>
183
+ <li>Customer's company: #{company}</li>
184
+ <li>GitLab.com namespace: #{@namespace.path}</li>
185
+ <li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
186
+ <li>Desired Plan: #{plan}</li>
187
+ </ul>
188
+ <p>
189
+ Some additional context for this request is:
190
+ </p>
191
+ <pre>
192
+ #{context}
193
+ </pre>
194
+ STRING
195
+ end
196
+ end
197
+ end
198
+ end