Documentation ¶
Overview ¶
Package order implements the SockShop orders microservice.
The service calls other services to collect information and then submits the order to the shipping service
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Order ¶
type Order struct { ID string CustomerID string Customer user.User Address user.Address Card user.Card Items []cart.Item Shipment shipping.Shipment Date string Total float32 }
A successfully placed order
type OrderService ¶
type OrderService interface { // Place an order for the specified items NewOrder(ctx context.Context, customerID, addressID, cardID, cartID string) (Order, error) // Get all orders for a customer, sorted by date GetOrders(ctx context.Context, customerID string) ([]Order, error) // Get an order by ID GetOrder(ctx context.Context, orderID string) (Order, error) }
The service calls other services to collect information and then submits the order to the shipping service
func NewOrderService ¶
func NewOrderService(ctx context.Context, userService user.UserService, cartService cart.CartService, payments payment.PaymentService, shipping shipping.ShippingService, orderDB backend.NoSQLDatabase) (OrderService, error)
Creates a new OrderService instance. Customer, Address, and Card information will be looked up in the provided userService Successfully placed orders will be stored in [orderDB]
Click to show internal directories.
Click to hide internal directories.