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.
- checksums.yaml +4 -4
- data/lib/support_readiness/mailgun/client.rb +2 -1
- data/lib/support_readiness/mailgun/emails.rb +1 -1
- data/lib/support_readiness/support_super_form_processor/create_article.rb +375 -0
- data/lib/support_readiness/support_super_form_processor/create_macro.rb +183 -0
- data/lib/support_readiness/support_super_form_processor/edit_macro.rb +161 -0
- data/lib/support_readiness/support_super_form_processor/enable_us_government.rb +236 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_billing_entity_change.rb +218 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_extension.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_investigate.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_link.rb +213 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_nfr.rb +224 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_subscriptions_reset_seat_qsr.rb +194 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_edit.rb +198 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_extension.rb +228 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_dotcom_trials_over_plan.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_hackerone_license.rb +172 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_oem_license.rb +241 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_order_management.rb +267 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_other.rb +137 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_provison_failure.rb +179 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_did_not_receive.rb +191 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_multiyear.rb +188 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_nfr.rb +215 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_resend.rb +188 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_scl.rb +194 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_subscriptions_temp.rb +234 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_edit.rb +203 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_extension.rb +233 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_sm_trials_new.rb +223 -0
- data/lib/support_readiness/support_super_form_processor/global_ir_wider_community_license.rb +247 -0
- data/lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb +151 -0
- data/lib/support_readiness/support_super_form_processor/global_set_org_ase.rb +293 -0
- data/lib/support_readiness/support_super_form_processor/global_toggle_escalation.rb +142 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_extension.rb +247 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_former_customer.rb +288 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_migration.rb +238 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_other.rb +221 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_prospect.rb +288 -0
- data/lib/support_readiness/support_super_form_processor/gratis_support_upgrade.rb +298 -0
- data/lib/support_readiness/support_super_form_processor/namespace_availability.rb +213 -0
- data/lib/support_readiness/support_super_form_processor/pd_shadow_modification.rb +189 -0
- data/lib/support_readiness/support_super_form_processor/sa_request_for_support.rb +214 -0
- data/lib/support_readiness/support_super_form_processor/shared.rb +518 -0
- data/lib/support_readiness/support_super_form_processor/team_member_license.rb +144 -0
- data/lib/support_readiness/support_super_form_processor/two_fa_exemption.rb +260 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_order_management.rb +252 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_other.rb +136 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_did_not_receive.rb +162 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_multiyear.rb +159 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_nfr.rb +196 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_resend.rb +159 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_scl.rb +160 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_subs_temp.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_edit.rb +189 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_extension.rb +219 -0
- data/lib/support_readiness/support_super_form_processor/usgov_ir_sm_trials_new.rb +209 -0
- data/lib/support_readiness/support_super_form_processor/usgov_set_collaboration_id.rb +151 -0
- data/lib/support_readiness/support_super_form_processor/usgov_set_org_ase.rb +295 -0
- data/lib/support_readiness/support_super_form_processor.rb +67 -0
- data/lib/support_readiness/zendesk/tickets.rb +3 -1
- data/lib/support_readiness.rb +1 -0
- metadata +59 -2
@@ -0,0 +1,161 @@
|
|
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 EditMacro within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class EditMacro < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process a Edit Macro request
|
15
|
+
#
|
16
|
+
# @author Jason Colyer
|
17
|
+
# @since 1.0.42
|
18
|
+
def self.process!(gitlab_client, gitlab_admin_client)
|
19
|
+
@gitlab_client = gitlab_client
|
20
|
+
@gitlab_admin_client = gitlab_admin_client
|
21
|
+
requester
|
22
|
+
file_path = create_macro_file_if_needed
|
23
|
+
issue = Readiness::GitLab::Issues.new
|
24
|
+
issue.title = 'Edit an existing macro'
|
25
|
+
issue.description = message(file_path)
|
26
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
27
|
+
puts "Issue created: #{create.web_url}"
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.create_macro_file_if_needed
|
32
|
+
return nil if comment == 'none'
|
33
|
+
|
34
|
+
macro_project_id = if instance == 'Zendesk Global'
|
35
|
+
53382456
|
36
|
+
else
|
37
|
+
53561363
|
38
|
+
end
|
39
|
+
macro_project = Readiness::GitLab::Projects.find!(@gitlab_client, macro_project_id)
|
40
|
+
path = "active/#{name.split('::').join('/')}.md"
|
41
|
+
file = Readiness::GitLab::Repositories.file(@gitlab_client, macro_project, path, 'master')
|
42
|
+
unless file.key? 'file_name'
|
43
|
+
commit_params = {
|
44
|
+
branch: 'master',
|
45
|
+
commit_message: 'Creating placeholder file for macro',
|
46
|
+
actions: [
|
47
|
+
{
|
48
|
+
file_path: path,
|
49
|
+
content: 'PLACEHOLDER',
|
50
|
+
action: 'create'
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
Readiness::GitLab::Repositories.create_commit!(@gitlab_client, macro_project, commit_params)
|
55
|
+
end
|
56
|
+
path
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Sets the global variable requester
|
61
|
+
#
|
62
|
+
# @author Jason Colyer
|
63
|
+
# @since 1.0.42
|
64
|
+
def self.requester
|
65
|
+
@requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Sets the global variable requester_email
|
70
|
+
#
|
71
|
+
# @author Jason Colyer
|
72
|
+
# @since 1.0.42
|
73
|
+
def self.requester_email
|
74
|
+
@requester_email ||= ENV.fetch('REQUESTER_EMAIL')
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Sets the global variable project
|
79
|
+
#
|
80
|
+
# @author Jason Colyer
|
81
|
+
# @since 1.0.42
|
82
|
+
def self.project
|
83
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 12811526)
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Sets the global variable comment
|
88
|
+
#
|
89
|
+
# @author Jason Colyer
|
90
|
+
# @since 1.0.42
|
91
|
+
def self.comment
|
92
|
+
@comment ||= ENV.fetch('EDIT_MACRO_COMMENT')
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Sets the global variable instance
|
97
|
+
#
|
98
|
+
# @author Jason Colyer
|
99
|
+
# @since 1.0.42
|
100
|
+
def self.instance
|
101
|
+
@instance ||= ENV.fetch('EDIT_MACRO_INSTANCE')
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# Sets the global variable name
|
106
|
+
#
|
107
|
+
# @author Jason Colyer
|
108
|
+
# @since 1.0.42
|
109
|
+
def self.name
|
110
|
+
@name ||= ENV.fetch('EDIT_MACRO_CURRENT_NAME')
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Sets the global variable description
|
115
|
+
#
|
116
|
+
# @author Jason Colyer
|
117
|
+
# @since 1.0.42
|
118
|
+
def self.description
|
119
|
+
@tag ||= ENV.fetch('EDIT_MACRO_DESCRIPTION')
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.issue_assignees
|
123
|
+
return '@jcolyer @secole' if instance == 'Zendesk US Government'
|
124
|
+
|
125
|
+
'@jcolyer @nabeel.bilgrami @avilla4 @dtragjasi @secole @rverschoor'
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Return the string for the issue body
|
130
|
+
#
|
131
|
+
# @author Jason Colyer
|
132
|
+
# @since 1.0.42
|
133
|
+
def self.message(file_path)
|
134
|
+
<<~STRING
|
135
|
+
## Edit an existing macro
|
136
|
+
|
137
|
+
Greetings @#{requester.username} !
|
138
|
+
|
139
|
+
This is a request to edit an existing macro within a Zendesk instance. The details are as follows:
|
140
|
+
|
141
|
+
- Name of Macro: #{name}
|
142
|
+
- Zendesk Instance: #{instance}
|
143
|
+
- Type of comment: #{comment}
|
144
|
+
- Description of changes:
|
145
|
+
|
146
|
+
```
|
147
|
+
|
148
|
+
#{description}
|
149
|
+
|
150
|
+
```
|
151
|
+
|
152
|
+
/label ~"Readiness Priority::Current Quarter"
|
153
|
+
|
154
|
+
/label ~"Readiness::Triage"
|
155
|
+
|
156
|
+
/assign #{issue_assignees}
|
157
|
+
STRING
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,236 @@
|
|
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 EnableUSGov within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class EnableUSGov < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process a Enable US Government request
|
15
|
+
#
|
16
|
+
# @author Jason Colyer
|
17
|
+
# @since 1.0.42
|
18
|
+
def self.process!(gitlab_client, gitlab_admin_client, zendesk_client, sfdc_client)
|
19
|
+
@gitlab_client = gitlab_client
|
20
|
+
@gitlab_admin_client = gitlab_admin_client
|
21
|
+
@zendesk_client = zendesk_client
|
22
|
+
@sfdc_client = sfdc_client
|
23
|
+
requester
|
24
|
+
zd_user
|
25
|
+
checks
|
26
|
+
unless errors.count.zero?
|
27
|
+
Readiness::SupportSuperFormProcessor::Shared.invalid_enable_usgov(requester, errors)
|
28
|
+
end
|
29
|
+
issue = Readiness::GitLab::Issues.new
|
30
|
+
issue.title = 'Enable US Government Support'
|
31
|
+
issue.description = message(file_path)
|
32
|
+
create = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
|
33
|
+
puts "Issue created: #{create.web_url}"
|
34
|
+
exit 0
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Peform validity checks for this request
|
39
|
+
#
|
40
|
+
# @author Jason Colyer
|
41
|
+
# @since 1.0.42
|
42
|
+
def self.checks
|
43
|
+
errors.push("Invalid SFDC account given: #{account_id}") if account.nil?
|
44
|
+
errors.push("Invalid SFDC opportunity given: #{opportunity_id}") if opportunity.nil?
|
45
|
+
return unless errors.count.zero?
|
46
|
+
|
47
|
+
errors.push("SFDC account #{account_id} is already entitled") if Readiness::Salesforce::Client.us_gover_enabled?(@sfdc_client, account_id)
|
48
|
+
errors.push("Missing US Government SKU on #{account_id}") unless correct_sku?
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Check the SFDC account for a US Gov SKU
|
53
|
+
#
|
54
|
+
# @author Jason Colyer
|
55
|
+
# @since 1.0.42
|
56
|
+
def self.correct_sku?
|
57
|
+
account.Zuora__R00N40000001lGjTEAU__r.map { |r| r.Name }.each do |name|
|
58
|
+
return true if Readiness::Salesforce::SubscriptionDefinitions.usgov_12x5.include? name
|
59
|
+
return true if Readiness::Salesforce::SubscriptionDefinitions.usgov_24x7.include? name
|
60
|
+
end
|
61
|
+
false
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# Sets the global variable errors
|
66
|
+
#
|
67
|
+
# @author Jason Colyer
|
68
|
+
# @since 1.0.42
|
69
|
+
def self.errors
|
70
|
+
@errors ||= []
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Sets the global variable requester
|
75
|
+
#
|
76
|
+
# @author Jason Colyer
|
77
|
+
# @since 1.0.42
|
78
|
+
def self.requester
|
79
|
+
@requester ||= Readiness::SupportSuperFormProcessor::Shared.gitlab_user_check(@gitlab_admin_client, requester_email)
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Sets the global variable zd_user
|
84
|
+
#
|
85
|
+
# @author Jason Colyer
|
86
|
+
# @since 1.0.42
|
87
|
+
def self.zd_user
|
88
|
+
@zd_user ||= Readiness::SupportSuperFormProcessor::Shared.zendesk_user_check(@zendesk_client, requester_email)
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Sets the global variable requester_email
|
93
|
+
#
|
94
|
+
# @author Jason Colyer
|
95
|
+
# @since 1.0.42
|
96
|
+
def self.requester_email
|
97
|
+
@requester_email ||= ENV.fetch('REQUESTER_EMAIL')
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Sets the global variable account
|
102
|
+
#
|
103
|
+
# @author Jason Colyer
|
104
|
+
# @since 1.0.42
|
105
|
+
def self.account
|
106
|
+
@account ||= fetch_account
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Sets the global variable opportunity
|
111
|
+
#
|
112
|
+
# @author Jason Colyer
|
113
|
+
# @since 1.0.42
|
114
|
+
def self.opportunity
|
115
|
+
@opportunity ||= fetch_opportunity
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Run a SQOL query to get account information
|
120
|
+
#
|
121
|
+
# @author Jason Colyer
|
122
|
+
# @since 1.0.42
|
123
|
+
def self.fetch_account
|
124
|
+
query = Readiness::Salesforce::Queries.new(account_query)
|
125
|
+
results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
|
126
|
+
results.first
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Run a SQOL query to get opportunity information
|
131
|
+
#
|
132
|
+
# @author Jason Colyer
|
133
|
+
# @since 1.0.42
|
134
|
+
def self.fetch_opportunity
|
135
|
+
query = Readiness::Salesforce::Queries.new(opportunity_query)
|
136
|
+
results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
|
137
|
+
results.first
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# Sets the global variable account_id
|
142
|
+
#
|
143
|
+
# @author Jason Colyer
|
144
|
+
# @since 1.0.42
|
145
|
+
def self.account_id
|
146
|
+
@account_id ||= ENV.fetch('ENABLE_US_GOV_SUPPORT_SFDC_ACCOUNT')
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Sets the global variable opportunity_id
|
151
|
+
#
|
152
|
+
# @author Jason Colyer
|
153
|
+
# @since 1.0.42
|
154
|
+
def self.opportunity_id
|
155
|
+
@opportunity_id ||= ENV.fetchh('ENABLE_US_GOV_SUPPORT_SFDC_OPP')
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Returns a String to get account information
|
160
|
+
#
|
161
|
+
# @author Jason Colyer
|
162
|
+
# @since 1.0.42
|
163
|
+
def self.account_query
|
164
|
+
<<~STRING
|
165
|
+
SELECT
|
166
|
+
Account_ID_18__c,
|
167
|
+
Name,
|
168
|
+
Ultimate_Parent_Sales_Segment_Employees__c,
|
169
|
+
Account_Owner_Calc__c,
|
170
|
+
Technical_Account_Manager_Name__c,
|
171
|
+
GS_Health_Score_Color__c,
|
172
|
+
Restricted_Account__c,
|
173
|
+
Solutions_Architect_Lookup__r.Name,
|
174
|
+
Support_Hold__c,
|
175
|
+
(
|
176
|
+
SELECT
|
177
|
+
Id,
|
178
|
+
Name,
|
179
|
+
Zuora__ProductName__c,
|
180
|
+
Zuora__EffectiveEndDate__c,
|
181
|
+
Zuora__Quantity__c,
|
182
|
+
Zuora__TotalContractValue__c,
|
183
|
+
Subscription_Status__c
|
184
|
+
FROM Zuora__R00N40000001lGjTEAU__r
|
185
|
+
)
|
186
|
+
FROM Account
|
187
|
+
WHERE
|
188
|
+
Id = '#{account_id}'
|
189
|
+
STRING
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Returns a String to get opportunity information
|
194
|
+
#
|
195
|
+
# @author Jason Colyer
|
196
|
+
# @since 1.0.42
|
197
|
+
def self.opportunity_query
|
198
|
+
<<~STRING
|
199
|
+
SELECT
|
200
|
+
Id
|
201
|
+
FROM Opportunity
|
202
|
+
WHERE
|
203
|
+
Id = '#{opportunity_id}'
|
204
|
+
STRING
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Return the string for the issue body
|
209
|
+
#
|
210
|
+
# @author Jason Colyer
|
211
|
+
# @since 1.0.42
|
212
|
+
def self.message
|
213
|
+
<<~STRING
|
214
|
+
## Enable US Government Support for #{account.Account_ID_18__c}
|
215
|
+
|
216
|
+
A request has been filed to enable US Government Support for a SFDC account. The details are as follows:
|
217
|
+
|
218
|
+
- Requester: @#{requester.username}
|
219
|
+
- SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.my.salesforce.com/#{account.Account_ID_18__c})
|
220
|
+
- SFDC Opportunity: [#{opportunity.Account_ID_18__c}](https://gitlab.my.salesforce.com/#{opportunity.Account_ID_18__c})
|
221
|
+
- Product Charges on SFDC account:
|
222
|
+
#{account.Zuora__R00N40000001lGjTEAU__r.map { |r| " - #{r.Name}" }.join("\n")}
|
223
|
+
|
224
|
+
#### Readiness TODO list
|
225
|
+
|
226
|
+
- [ ] Review above information
|
227
|
+
- [ ] Follow the process detailed in [this handbook page](https://handbook.gitlab.com/handbook/support/readiness/operations/docs/policies/enable_us_gov_support)
|
228
|
+
|
229
|
+
/assign @#{requester.username} @jcolyer @secole @lyle
|
230
|
+
|
231
|
+
cc @jscarborough @JamesRLopes
|
232
|
+
STRING
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,218 @@
|
|
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 GlobalIRDotcomSubscriptionsBillingEntityChange within the module {Readiness::Zendesk}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.42
|
12
|
+
class GlobalIRDotcomSubscriptionsBillingEntityChange < Readiness::Client
|
13
|
+
##
|
14
|
+
# Process a Global Internal Request GitLab.com Subscriptions Billing Entity Change 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 - Billing Entity change'
|
34
|
+
ticket.tags = %w[lnr_internal_request lnr_valid_request lnr_billing_entity_change]
|
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_billing_entity_change' },
|
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('BILLING_ENTITY_CHANGE_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 customer_link
|
140
|
+
#
|
141
|
+
# @author Jason Colyer
|
142
|
+
# @since 1.0.42
|
143
|
+
def self.customer_link
|
144
|
+
@customer_link ||= ENV.fetch('BILLING_ENTITY_CHANGE_CDOT')
|
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 ||= ENV.fetch('BILLING_ENTITY_CHANGE_SFDC_ACCOUNT')
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Sets the global variable old_opp_link
|
158
|
+
#
|
159
|
+
# @author Jason Colyer
|
160
|
+
# @since 1.0.42
|
161
|
+
def self.old_opp_link
|
162
|
+
@old_opp_link ||= ENV.fetch('BILLING_ENTITY_CHANGE_OLD_OPP')
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Sets the global variable new_opp_link
|
167
|
+
#
|
168
|
+
# @author Jason Colyer
|
169
|
+
# @since 1.0.42
|
170
|
+
def self.new_opp_link
|
171
|
+
@new_opp_link ||= ENV.fetch('BILLING_ENTITY_CHANGE_NEW_OPP')
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Returns the ticket body
|
176
|
+
#
|
177
|
+
# @author Jason Colyer
|
178
|
+
# @since 1.0.42
|
179
|
+
# @return [String]
|
180
|
+
def self.body
|
181
|
+
<<~STRING
|
182
|
+
<p>
|
183
|
+
Greetings,
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
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.
|
187
|
+
</p>
|
188
|
+
<p>
|
189
|
+
A request has been filed for Billing Entity change.
|
190
|
+
</p>
|
191
|
+
<p>
|
192
|
+
The information for this is as follows:
|
193
|
+
</p>
|
194
|
+
<ul>
|
195
|
+
<li>Customer's name: #{contact_name}</li>
|
196
|
+
<li>
|
197
|
+
Contact's email: #{contact_email}
|
198
|
+
<a href="https://www.zuora.com/platform/apps/search?searchTerm=#{contact_email}" target='_blank'>(Zuora Search)</a>
|
199
|
+
<a href="https://customers.gitlab.com/admin/customer?model_name=customer&query=#{contact_email}" target='_blank'>(Portal Search)</a>
|
200
|
+
</li>
|
201
|
+
<li>Customer's company: #{company}</li>
|
202
|
+
<li>Link to customer in cDot: <a href='#{customer_link}' target='_blank'>#{customer_link}</a></li>
|
203
|
+
<li>GitLab.com namespace: #{@namespace.path}</li>
|
204
|
+
<li>#{Readiness::SupportSuperFormProcessor::Shared.sfdc_account_string(sfdc_account_link)}</li>
|
205
|
+
<li>Original #{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(old_opp_link)}</li>
|
206
|
+
<li>New #{Readiness::SupportSuperFormProcessor::Shared.sfdc_opportunity_string(new_opp_link)}</li>
|
207
|
+
</ul>
|
208
|
+
<p>
|
209
|
+
Some additional context for this request is:
|
210
|
+
</p>
|
211
|
+
<pre>
|
212
|
+
<%= @context %>
|
213
|
+
</pre>
|
214
|
+
STRING
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|