controller

package
v0.0.0-...-3669a94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToOrderId

func ToOrderId(id int64) string

func ToUzOrderId

func ToUzOrderId(id int64) string

Types

type BillbeeHandler

type BillbeeHandler struct {
	Emailer *Emailer
	// contains filtered or unexported fields
}

BillbeeHandler can forward orders to billbee.

func NewBillbeeHandler

func NewBillbeeHandler(apiKey string, authUsername string, authPassword string, url string) *BillbeeHandler

NewBillbeeHandler instantiates a new forwarder.

func (*BillbeeHandler) AttachEmailer

func (billbee *BillbeeHandler) AttachEmailer(emailAddr string, emailPassword string, smtpHost string, smtpPort string, destEmails []string)

func (*BillbeeHandler) ForwardOrder

func (billbee *BillbeeHandler) ForwardOrder(order *model.Order) (string, error)

ForwardOrder forwards an order to billbee.

func (*BillbeeHandler) ForwardUzOrder

func (billbee *BillbeeHandler) ForwardUzOrder(order *model.Order, convivium string) (string, error)

ForwardOrder forwards an Unterstuetzer order to billbee.

type Emailer

type Emailer struct {
	// contains filtered or unexported fields
}

func NewEmailer

func NewEmailer(emailAddr string, emailPassword string, smtpHost string, smtpPort string) *Emailer

func (*Emailer) SendEmail

func (emailer *Emailer) SendEmail(destEmail []string, subject string, message string) error

type Server

type Server struct {
	Db                *sql.DB
	Mutex             sync.Mutex
	BillbeeForwarder  *BillbeeHandler
	BasicAuthUsername string
	BasicAuthPassword string
	// contains filtered or unexported fields
}

Server implements a REST API server.

func NewServer

func NewServer(db *sql.DB, BasicAuthUsername string, BasicAuthPassword string) *Server

NewServer instantiates a new API server.

func (*Server) AttachBillbeeForwarder

func (server *Server) AttachBillbeeForwarder(billbeeAPIKey string, billbeeAuthUsername string, billbeeAuthPw string, billbeeUrl string)

func (*Server) AttachEmailer

func (server *Server) AttachEmailer(emailAddr string, emailPassword string, smtpHost string, smtpPort string, destEmails []string)

func (*Server) ListenAndServe

func (server *Server) ListenAndServe(port int)

ListenAndServe starts the HTTP server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL