service

package
v0.0.0-...-d7022d5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCinemaOrdersService

func NewCinemaOrdersService(logger *logrus.Logger,
	repo repository.CinemaOrdersRepository,
	cache repository.ReserveCache,
	seatReservationTime time.Duration,
	paymentService PaymentService,
	cinemaService CinemaService,
	profilesService ProfilesService,
	orderEvents events.OrdersEventsMQ,
) *cinemaOrdersService

Types

type CinemaOrdersService

type CinemaOrdersService interface {
	GetOccupiedPlaces(ctx context.Context, screeningID int64) ([]models.Place, error)
	ReservePlaces(ctx context.Context, screeningID int64, places []models.Place) (string, time.Duration, error)
	ProcessOrder(ctx context.Context, reservationID, accountID string) (string, error)
	CancelReservation(ctx context.Context, reservationID string) error
	GetScreeningsOccupiedPlacesCounts(ctx context.Context, ids []int64) (map[int64]uint32, error)
	GetOrders(ctx context.Context, accountID string,
		page, limit uint32, sort models.SortDTO) ([]models.OrderPreview, error)
	GetOrder(ctx context.Context, orderID, accountID string) (models.Order, error)
	RefundOrder(ctx context.Context, accountID, ordererID string) error
	RefundOrderItems(ctx context.Context, accountID, ordererID string, itemsIDs []string) error
}

type CinemaService

type CinemaService interface {
	GetScreeningTicketPrice(ctx context.Context, screeningID int64) (uint32, error)
	GetScreening(ctx context.Context, screeningID int64) (Screening, error)
	GetScreeningStartTime(ctx context.Context, screeningID int64) (time.Time, error)
}

type PaymentService

type PaymentService interface {
	PreparePaymentURL(ctx context.Context, email string, amount uint32, orderID string) (string, error)
	RequestOrderRefund(ctx context.Context, percent uint32, orderID string) error
	RequestOrderItemsRefund(ctx context.Context, percent uint32, orderID string, itemsIDs []string) error
}

type ProfilesService

type ProfilesService interface {
	GetEmail(ctx context.Context) (string, error)
}

type RefundPercent

type RefundPercent uint32
const (
	Full     RefundPercent = 100
	Half     RefundPercent = 50
	OneThird RefundPercent = 30
)

type Screening

type Screening struct {
	Places    []models.Place
	StartTime time.Time
}

Jump to

Keyboard shortcuts

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