service

package
v0.0.0-...-f5f0fde Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 14 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

func OrderStatusFromString

func OrderStatusFromString(str string) (cinema_orders_service.Status, error)

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 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