order

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	CacheWriter
	CacheReader
}

type CacheReader

type CacheReader interface {
	GetOrder(orderId string) (*entity.OrderStatus, error)
}

type CacheWriter

type CacheWriter interface {
	SetOrder(o *entity.Order) error
}

type OrderError

type OrderError struct {
	Message            string
	AnnouncementsError []struct {
		// contains filtered or unexported fields
	}
}

func (*OrderError) Error

func (o *OrderError) Error() string

type OrderMessage

type OrderMessage struct {
	Store         string
	OrderId       string
	Attempts      int
	ReceiptHandle string
}

type OrderService

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

func NewOrderService

func NewOrderService(
	queue Queue,
	mercadolivre common.MercadoLivre,
	storeUseCase store.UseCase,
	announceUseCase announcement.UseCase,
	repository Repository,
	cache Cache,
	logger metrics.Logger,
) *OrderService

func (*OrderService) ProcessOrder

func (o *OrderService) ProcessOrder(order OrderMessage) error

func (*OrderService) ProcessWebhook

func (o *OrderService) ProcessWebhook(input OrderWebhookDtoInput) error

type OrderWebhookDtoInput

type OrderWebhookDtoInput struct {
	ID            string `json:"_id"`
	Resource      string `json:"resource"`
	UserID        int    `json:"user_id"`
	Topic         string `json:"topic"`
	ApplicationID int64  `json:"application_id"`
	Attempts      int    `json:"attempts"`
	// Can be converted to time
	Sent string `json:"sent"`
	// Can be converted to time
	Received string `json:"received"`
}

type Queue

type Queue interface {
	QueueProducer
	QueueConsumer
}

type QueueConsumer

type QueueConsumer interface {
	ConsumeOrderNotification() []OrderMessage
	DeleteOrderNotification(receiptHandle string) error
}

type QueueProducer

type QueueProducer interface {
	PostOrderNotification(input OrderWebhookDtoInput) error
}

Queue producer interface

type RepoReader

type RepoReader interface {
	GetOrder(orderMarketplaceId string) (*entity.Order, error)
}

type RepoWriter

type RepoWriter interface {
	RegisterOrder(o *entity.Order) error
}

type Repository

type Repository interface {
	RepoWriter
	RepoReader
}

type UseCase

type UseCase interface {
	ProcessWebhook(input OrderWebhookDtoInput) error
	ProcessOrder(order OrderMessage) error
}

Jump to

Keyboard shortcuts

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