cart

package
v0.0.0-...-3bb7120 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(h *Handler, router *anor.Router)

Types

type AddToCartRequest

type AddToCartRequest struct {
	VariantID int64 `json:"product_variant_id"`
	Qty       int   `json:"qty"`
}

func (*AddToCartRequest) Bind

func (req *AddToCartRequest) Bind(r *http.Request) error

func (*AddToCartRequest) Validate

func (req *AddToCartRequest) Validate() error

type Handler

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

func NewHandler

func NewHandler(cfg *HandlerConfig) *Handler

func (*Handler) AddToCart

func (h *Handler) AddToCart(w http.ResponseWriter, r *http.Request)

func (*Handler) CartView

func (h *Handler) CartView(w http.ResponseWriter, r *http.Request)

func (*Handler) RemoveCartItem

func (h *Handler) RemoveCartItem(w http.ResponseWriter, r *http.Request)

func (*Handler) Render

func (h *Handler) Render(w http.ResponseWriter, r *http.Request, templatePath string, td templates.TemplateData)

func (*Handler) UpdateCartItem

func (h *Handler) UpdateCartItem(w http.ResponseWriter, r *http.Request)

func (*Handler) VerifyCartItemOwnership

func (h *Handler) VerifyCartItemOwnership(next http.Handler) http.Handler

type HandlerConfig

type HandlerConfig struct {
	UserService       anor.UserService
	CartService       anor.CartService
	CategoryService   anor.CategoryService
	Session           *session.Manager
	View              *html.View
	Logger            *slog.Logger
	GetHeaderDataFunc func(ctx context.Context) (header.Base, error)
}

type UpdateCartItemRequest

type UpdateCartItemRequest struct {
	CartItemID int64
	Qty        int
}

func (*UpdateCartItemRequest) Bind

func (req *UpdateCartItemRequest) Bind(r *http.Request) error

func (*UpdateCartItemRequest) Validate

func (req *UpdateCartItemRequest) Validate() error

Jump to

Keyboard shortcuts

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