-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
153 lines (132 loc) · 3.82 KB
/
config.go
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package mailchimp
import (
"github.com/ottemo/commerce/env"
)
func setupConfig() error {
config := env.GetConfig()
if config == nil {
err := env.ErrorNew(ConstErrorModule, env.ConstErrorLevelStartStop, "6b78d38a-35c5-4aa2-aec1-eaa16830ff61", "Error configuring Mailchimp module")
return env.ErrorDispatch(err)
}
err := config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimp,
Value: nil,
Type: env.ConstConfigTypeGroup,
Editor: "",
Options: nil,
Label: "MailChimp",
Description: "MailChimp Settings",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpEnabled,
Value: false,
Type: env.ConstConfigTypeBoolean,
Editor: "boolean",
Options: nil,
Label: "MailChimp Enabled",
Description: "Enable MailChimp integration(defaults to false)",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpAPIKey,
Value: "",
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "MailChimp API Key",
Description: "Enter your MailChimp API Key",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpBaseURL,
Value: nil,
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "MailChimp Base URL",
Description: "Defines the base url for this account",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpEmailTemplate,
Value: `Warning ....
<br />
<br />
The following email address could not be added to Mailchimp:
{{.email_address}}`,
Type: env.ConstConfigTypeHTML,
Editor: "multiline_text",
Options: "",
Label: "Support Email Template",
Description: "Template for sending support emails",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpSupportAddress,
Value: "",
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "Support Email Address",
Description: "Email address to send errors encountered when adding to lists",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpSubjectLine,
Value: "",
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "Support Email Subject",
Description: "Subject Line for emails describing mailchimp list addition failures",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpList,
Value: nil,
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "MailChimp List ID",
Description: "Enter your MailChimp List ID",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathMailchimpSKU,
Value: nil,
Type: env.ConstConfigTypeVarchar,
Editor: "line_text",
Options: nil,
Label: "Trigger SKU (comma seperated list of SKUs)",
Description: "Enter the SKU you want to use as a trigger",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
return nil
}