Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidArgument occurs when payload argument is invalid ErrInvalidArgument = errors.New("invalid argument") )
Functions ¶
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 ¶
NewLoggingService create new logging service
func NewService ¶
func NewService( orders transaction.OrderRepository, customers transaction.CustomerRepository, products transaction.ProductRepository, coupons transaction.CouponRepository, logistics transaction.LogisticsPartner, ) Service
NewService creates a ordering service with necessary dependencies
Click to show internal directories.
Click to hide internal directories.