order

package
v0.0.0-...-290c2ba Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeOrderStatusCommand

type ChangeOrderStatusCommand struct {
	OrderID string
	Status  string
}

type Order

type Order struct {
	ID           string      `json:"order_id,omitempty"`
	CustomerID   string      `json:"customer_id,omitempty"`
	Status       string      `json:"status,omitempty"`
	CreatedOn    time.Time   `json:"created_on,omitempty"`
	RestaurantId string      `json:"restaurant_id,omitempty"`
	Amount       float64     `json:"amount,omitempty"`
	OrderItems   []OrderItem `json:"order_items,omitempty"`
}

Order aggregate

func (Order) GetAmount

func (order Order) GetAmount() float64

GetAmount returns total amount of the order

type OrderItem

type OrderItem struct {
	ProductCode string  `json:"code,omitempty"`
	Name        string  `json:"name,omitempty"`
	UnitPrice   float64 `json:"unit_price,omitempty"`
	Quantity    int     `json:"quantity,omitempty"`
}

OrderItem value type

type PaymentDebitedCommand

type PaymentDebitedCommand struct {
	OrderID    string
	CustomerID string
	Amount     float64
}

type QueryRepository

type QueryRepository interface {
	GetOrderByID(context.Context, string) (Order, error)
	GetOrdersByCustomer(context.Context, string) ([]Order, error)
	GetOrderItems(context.Context, string) ([]OrderItem, error)
}

type Repository

type Repository interface {
	CreateOrder(context.Context, Order) error
	ChangeOrderStatus(context.Context, ChangeOrderStatusCommand) error
}

Jump to

Keyboard shortcuts

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