-
Notifications
You must be signed in to change notification settings - Fork 1
/
zoneZip.go
112 lines (93 loc) · 3.36 KB
/
zoneZip.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
package six910api
import (
"encoding/json"
"strconv"
sdbi "github.com/Ulbora/six910-database-interface"
)
/*
Six910 is a shopping cart and E-commerce system.
Copyright (C) 2020 Ulbora Labs LLC. (www.ulboralabs.com)
All rights reserved.
Copyright (C) 2020 Ken Williamson
All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//ZoneZipReq ZoneZipReq
type ZoneZipReq struct {
StoreID int64 `json:"storeId"`
ZoneZip *sdbi.ZoneZip `json:"zoneZip"`
}
//AddZoneZip AddZoneZip
func (a *Six910API) AddZoneZip(z *sdbi.ZoneZip, headers *Headers) *ResponseID {
var rtn ResponseID
var zzr ZoneZipReq
zzr.ZoneZip = z
zzr.StoreID = a.getStoreID(headers)
var url = a.restURL + "/rs/zoneZip/add"
a.log.Debug("url: ", url)
aJSON, err := json.Marshal(zzr)
if err == nil {
reqazz := a.buildRequest(post, url, headers, aJSON)
sucazz, stat := a.proxy.Do(reqazz, &rtn)
a.log.Debug("suc: ", sucazz)
a.log.Debug("stat: ", stat)
if !sucazz {
rtn.Code = int64(stat)
}
}
a.log.Debug("rtn: ", rtn)
return &rtn
}
//GetZoneZipListByExclusion GetZoneZipListByExclusion
func (a *Six910API) GetZoneZipListByExclusion(exID int64, headers *Headers) *[]sdbi.ZoneZip {
var rtn []sdbi.ZoneZip
var sid = a.getStoreID(headers)
excidStrGctl := strconv.FormatInt(exID, 10)
sidStrGctl := strconv.FormatInt(sid, 10)
var url = a.restURL + "/rs/zoneZip/exc/get/list/" + excidStrGctl + "/" + sidStrGctl
a.log.Debug("url: ", url)
req := a.buildRequest(get, url, headers, nil)
gexclsuc, stat := a.proxy.Do(req, &rtn)
a.log.Debug("suc: ", gexclsuc)
a.log.Debug("stat: ", stat)
return &rtn
}
//GetZoneZipListByInclusion GetZoneZipListByInclusion
func (a *Six910API) GetZoneZipListByInclusion(incID int64, headers *Headers) *[]sdbi.ZoneZip {
var rtn []sdbi.ZoneZip
var sid = a.getStoreID(headers)
inccidStrGctl := strconv.FormatInt(incID, 10)
sidStrGctl := strconv.FormatInt(sid, 10)
var url = a.restURL + "/rs/zoneZip/inc/get/list/" + inccidStrGctl + "/" + sidStrGctl
a.log.Debug("url: ", url)
req := a.buildRequest(get, url, headers, nil)
ginclsuc, stat := a.proxy.Do(req, &rtn)
a.log.Debug("suc: ", ginclsuc)
a.log.Debug("stat: ", stat)
return &rtn
}
//DeleteZoneZip DeleteZoneZip
func (a *Six910API) DeleteZoneZip(id int64, incID int64, exID int64, headers *Headers) *Response {
var rtn Response
var sid = a.getStoreID(headers)
zzidStrdct := strconv.FormatInt(id, 10)
zzincIDStrdct := strconv.FormatInt(incID, 10)
zzexIDStrdct := strconv.FormatInt(exID, 10)
sidStrdct := strconv.FormatInt(sid, 10)
var url = a.restURL + "/rs/zoneZip/delete/" + zzidStrdct + "/" + zzincIDStrdct + "/" + zzexIDStrdct + "/" + sidStrdct
a.log.Debug("url: ", url)
req := a.buildRequest(delete, url, headers, nil)
dzzsuc, stat := a.proxy.Do(req, &rtn)
a.log.Debug("suc: ", dzzsuc)
a.log.Debug("stat: ", stat)
return &rtn
}