woltserver

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchOrder = fmt.Errorf("no such order. Make sure you created an order first")
View Source
var ErrNoSuchParticipant = fmt.Errorf("no such participant. Make sure you created a participant in that order fist")
View Source
var ErrNoSuchVenue = fmt.Errorf("no such venue. Make sure you created a venue fist")

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	Lat float64 // 34.77900266647339
	Lon float64 // 32.072447331148844
}

type DeliveryMethod

type DeliveryMethod string
const (
	DeliveryMethodHome      DeliveryMethod = "homedelivery"
	DeliveryMethodTakeaways DeliveryMethod = "takeaway"
)

type Item

type Item struct {
	BasePrice int
	EndAmount int
}

type Order

type Order struct {
	ID             string
	ShortID        string
	VenueID        string
	Host           string
	Status         OrderStatus
	Location       Coordinate
	DeliveryMethod DeliveryMethod
	Participants   []*Participant
	// contains filtered or unexported fields
}

func (*Order) AddParticipant

func (o *Order) AddParticipant(name string) *Participant

func (*Order) ParticipantByID

func (o *Order) ParticipantByID(id string) (*Participant, bool)

type OrderStatus

type OrderStatus string
const (
	StatusActive       OrderStatus = "active"
	StatusCanceled     OrderStatus = "cancelled"
	StatusPendingTrans OrderStatus = "pending_transaction"
	StatusPurchased    OrderStatus = "purchased"
)

type Participant

type Participant struct {
	FirstName string
	ID        string
	Status    ParticipantStatus
	Items     []Item
	// contains filtered or unexported fields
}

func (*Participant) AddItem

func (p *Participant) AddItem(amount int)

type ParticipantStatus

type ParticipantStatus string
const (
	ParticipantStatusReady  ParticipantStatus = "ready"
	ParticipantStatusJoined ParticipantStatus = "joined"
)

type Venue

type Venue struct {
	ID       string
	Location Coordinate
}

type WoltServer

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

func NewWoltServer

func NewWoltServer(t *testing.T) *WoltServer

func (*WoltServer) AddParticipant

func (ws *WoltServer) AddParticipant(orderID string, name string) (string, error)

func (*WoltServer) AddParticipantItem

func (ws *WoltServer) AddParticipantItem(orderID, participantID string, itemAmount int) error

func (*WoltServer) Addr

func (ws *WoltServer) Addr() string

func (*WoltServer) ChangeParticipantStatus

func (ws *WoltServer) ChangeParticipantStatus(orderID, participantID string, status ParticipantStatus) error

func (*WoltServer) CreateOrder

func (ws *WoltServer) CreateOrder(host, venueID string, location Coordinate) (shortID, ID string)

func (*WoltServer) CreateVenue

func (ws *WoltServer) CreateVenue(location Coordinate) string

func (*WoltServer) GetOrder

func (ws *WoltServer) GetOrder(orderID string) (*Order, error)

func (*WoltServer) GetVenue

func (ws *WoltServer) GetVenue(venueID string) (*Venue, error)

func (*WoltServer) RegisterEndpoint

func (ws *WoltServer) RegisterEndpoint(pattern string, handler http.HandlerFunc)

func (*WoltServer) Start

func (ws *WoltServer) Start()

func (*WoltServer) Stop

func (ws *WoltServer) Stop()

func (*WoltServer) UpdateOrderStatus

func (ws *WoltServer) UpdateOrderStatus(orderID string, status OrderStatus) error

Jump to

Keyboard shortcuts

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