ordering

package
v0.0.0-...-87f3e45 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidArgument occurs when payload argument is invalid
	ErrInvalidArgument = errors.New("invalid argument")
)

Functions

func MakeHandler

func MakeHandler(s Service) http.Handler

MakeHandler create RestAPI handler

Types

type Service

type Service interface {
	// MakeOrder creates new open order for the customer
	MakeOrder(ctx context.Context, customerID string) (*transaction.Order, error)
	// AddProduct adds product with set quantity to the order
	AddProduct(ctx context.Context, orderID, productID string, quantity int64) error
	// ApplyCoupon applies coupon to the order
	ApplyCoupon(ctx context.Context, orderID, couponCode string) error
	// SubmitOrder reserves added products and its quantity and finalize order
	SubmitOrder(ctx context.Context, orderID string) error
	// MakePayment makes payment for submitted order
	MakePayment(ctx context.Context, orderID string, ps transaction.PaymentSpecification) error
	// CheckOrderStatus checks status order
	CheckOrderStatus(ctx context.Context, orderID string) (transaction.OrderStatus, error)
	// CheckShipmentStatus checks shipment status
	CheckShipmentStatus(ctx context.Context, shippingID transaction.ShippingID) (transaction.ShipmentStatus, error)
}

Service is the interface that provides ordering methods.

func NewInstrumentinService

func NewInstrumentinService(
	request *prometheus.CounterVec,
	latency *prometheus.SummaryVec,
	s Service,
) Service

NewInstrumentinService creates new instrumenting service

func NewLoggingService

func NewLoggingService(log *log.Logger, s Service) Service

NewLoggingService create new logging service

func NewService

NewService creates a ordering service with necessary dependencies

Jump to

Keyboard shortcuts

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