cart

package
v0.0.0-...-1bf90d9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CartRepository

type CartRepository interface {
	Add(ctx context.Context, userID int64, skuID int64, count uint16) error
	DeleteItem(ctx context.Context, userID int64, skuID int64) error
	DeleteItemsByUserID(_ context.Context, userID int64) (int, error)
	GetCart(ctx context.Context, userID int64) ([]models.ItemCount, error)
}

type LomsService

type LomsService interface {
	OrderCreate(ctx context.Context, order lomsserviceModels.OrderCreate) (orderID int64, err error)
	StocksInfo(ctx context.Context, sku uint32) (count uint64, err error)
}

type ProductService

type ProductService interface {
	GetProduct(ctx context.Context, sku int64) (*productserviceModels.GetProductResponse, error)
	GetProducts(ctx context.Context, skus []int64) ([]productserviceModels.GetProductResponse, error)
	GetListSkus(ctx context.Context, startAfterSku, count int64) (
		*productserviceModels.ListSkusResponse,
		error,
	)
}

type Service

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

func NewCartService

func NewCartService(
	productService ProductService,
	repo CartRepository,
	lomsService LomsService,
) *Service

func (*Service) AddItem

func (s *Service) AddItem(ctx context.Context, userID int64, skuID int64, count uint16) (err error)

func (*Service) Checkout

func (s *Service) Checkout(ctx context.Context, userID int64) (orderID int64, err error)

func (*Service) DeleteItem

func (s *Service) DeleteItem(ctx context.Context, userID int64, skuID int64) (err error)

func (*Service) DeleteItemsByUserID

func (s *Service) DeleteItemsByUserID(ctx context.Context, userID int64) (err error)

func (*Service) GetCart

func (s *Service) GetCart(ctx context.Context, userID int64) (cart *models.Cart, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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