-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
46 lines (39 loc) · 1.19 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
package coupon
import (
"github.com/ottemo/commerce/env"
)
// setupConfig setups package configuration values for a system
func setupConfig() error {
config := env.GetConfig()
if config == nil {
err := env.ErrorNew(ConstErrorModule, env.ConstErrorLevelStartStop, "6a991234-a2bb-454e-9d5b-a7c2da1cdeb1", "can't obtain config")
return env.ErrorDispatch(err)
}
err := config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathDiscounts,
Value: nil,
Type: env.ConstConfigTypeGroup,
Editor: "",
Options: nil,
Label: "Discounts",
Description: "Discounts related options",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
err = config.RegisterItem(env.StructConfigItem{
Path: ConstConfigPathDiscountApplyPriority,
Value: 2.10,
Type: env.ConstConfigTypeFloat,
Editor: "line_text",
Options: nil,
Label: "Discounts calculating position",
Description: "This value used for using position to calculate it's possible applicable amount (Subtotal - 1, Shipping - 2, Grand total - 3)",
Image: "",
}, nil)
if err != nil {
return env.ErrorDispatch(err)
}
return nil
}