order

package
v0.0.0-...-9a5c20e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 11 Imported by: 1

README

order

import "github.com/blueprint-uservices/blueprint/examples/sockshop/workflow/order"

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

type Order

A successfully placed 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
}

type OrderService

The service calls other services to collect information and then submits the order to the shipping service

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

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]

Generated by gomarkdoc

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]

Jump to

Keyboard shortcuts

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