fix saving and project improvments
This commit is contained in:
@ -12,41 +12,51 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.loyso.art/frx/eway/internal/config"
|
||||
"git.loyso.art/frx/eway/internal/entity"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
}
|
||||
|
||||
type client struct {
|
||||
http *resty.Client
|
||||
log zerolog.Logger
|
||||
}
|
||||
|
||||
func NewClientWithSession(sessionid, sessionuser string, log zerolog.Logger) client {
|
||||
type Config config.Eway
|
||||
|
||||
func New(cfg Config, log zerolog.Logger) client {
|
||||
if cfg.Contract == "" {
|
||||
cfg.Contract = "6101"
|
||||
}
|
||||
|
||||
cookies := []*http.Cookie{
|
||||
{
|
||||
Name: "session_id",
|
||||
Value: sessionid,
|
||||
Value: cfg.SessionID,
|
||||
Domain: "eway.elevel.ru",
|
||||
HttpOnly: true,
|
||||
},
|
||||
{
|
||||
Name: "session_user",
|
||||
Value: sessionuser,
|
||||
Value: cfg.SessionUser,
|
||||
Domain: "eway.elevel.ru",
|
||||
HttpOnly: true,
|
||||
},
|
||||
{
|
||||
Name: "contract",
|
||||
Value: "6101",
|
||||
Value: cfg.Contract,
|
||||
Domain: "eway.elevel.ru",
|
||||
HttpOnly: true,
|
||||
},
|
||||
}
|
||||
|
||||
httpclient := resty.New().
|
||||
SetDebug(false).
|
||||
SetDebug(cfg.Debug).
|
||||
SetCookies(cookies).
|
||||
SetBaseURL("https://eway.elevel.ru/api")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user