/
account_type_helper.rb
60 lines (53 loc) · 2.16 KB
/
account_type_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This file should be synched with Central
module AccountTypeHelper
# Customer-facing plan name. Front is responsible of shortening long ones.
def plan_name(account_type)
PLAN_NAME_BY_ACCOUNT_TYPE_DOWN.fetch(account_type.downcase, account_type)
end
def plan_name_no_time(account_type)
plan_name(account_type).gsub(' - Monthly', '').gsub(' - Annual', '')
end
def plan_name_no_trial(account_type)
plan_name(account_type).gsub(' Trial', '')
end
def public_plan_name(account_type)
PUBLIC_PLAN_NAME.fetch(account_type)
end
# "private": use the methods instead
PUBLIC_PLAN_NAME = {
'FREE' => 'Free',
'PERSONAL30' => 'Professional Trial',
'BASIC' => 'Professional',
'BASIC LUMP-SUM' => 'Professional Lump-Sum',
'ENTERPRISE' => 'Enterprise'
}.freeze
PLAN_NAME_BY_ACCOUNT_TYPE = {
'FREE' => 'Free',
'PERSONAL30' => 'Professional Trial',
'BASIC' => 'Professional',
'BASIC LUMP-SUM' => 'Professional',
'BASIC ACADEMIC' => 'Professional Non-Profit',
'BASIC NON-PROFIT' => 'Professional Non-Profit',
'BASIC LUMP-SUM ACADEMIC' => 'Professional Non-Profit',
'BASIC LUMP-SUM NON-PROFIT' => 'Professional Non-Profit',
'Enterprise Builder - Annual' => 'Enterprise',
'Enterprise Builder - On-premises - Annual' => 'Enterprise',
'Cloud Engine & Enterprise Builder - Annual' => 'Enterprise',
'Internal use engine - Cloud - Annual' => 'Internal',
'Internal use engine - On-premises - Annual' => 'Internal',
'Internal use engine - On-premises Lite - Annual' => 'Internal',
'OEM engine - Cloud - Annual' => 'Enterprise',
'OEM engine - On-premises - Annual' => 'Enterprise',
'PARTNERS' => 'Partner',
'CARTO for the Classroom - Annual' => 'Student',
'Site License' => 'Student',
'CARTO for students - Annual' => 'Student',
'AMBASSADOR' => 'Ambassador',
'ire' => 'Ambassador',
'CARTO for Community - Annual' => 'Ambassador',
'Free Basemap LDS - Annual' => 'Free',
'Enterprise LDS - Annual' => 'Enterprise',
'CARTO Trial Account - Annual' => 'Trial'
}.freeze
PLAN_NAME_BY_ACCOUNT_TYPE_DOWN = Hash[PLAN_NAME_BY_ACCOUNT_TYPE.map { |k, v| [k.downcase, v] }]
end