domain

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: OSL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExternalSourceIDKey specifies the key for the ItemUpdateCommand.AdditionalData map where the external source id should be stored
	ExternalSourceIDKey = "external_source_id"
)

Variables

View Source
var (
	// ErrInsufficientSourceQty - use to indicate that the requested qty exceeds the available qty
	ErrInsufficientSourceQty = errors.New("Available Source Qty insufficient")
	// ErrNoSourceAvailable - use to indicate that no source for item is available at all
	ErrNoSourceAvailable = errors.New("No Available Source Qty")
)

Functions

This section is empty.

Types

type Source

type Source struct {
	// LocationCode identifies the warehouse or stock location
	LocationCode string
	// Qty for the sources items
	Qty int
	// ExternalLocationCode identifies the source location in an external system
	ExternalLocationCode string
}

Source represents the Sourcing info Deprecated: Sourcing moved to separate module

type Sources

type Sources []Source

Sources is the result value object containing all sources (for the request item or product) Deprecated: Sourcing moved to separate module

func (Sources) MainLocation

func (s Sources) MainLocation() string

MainLocation returns first sourced location (or empty string)

func (Sources) Next

func (s Sources) Next() (Source, Sources, error)

Next - returns the next source and the remaining, or error if nothing remains

func (Sources) QtySum

func (s Sources) QtySum() int

QtySum returns the sum of all sourced items

func (Sources) Reduce

func (s Sources) Reduce(reduceby Sources) Sources

Reduce returns new Source

type SourcingEngine

type SourcingEngine struct {
	SourcingService SourcingService          `inject:",optional"`
	Logger          flamingo.Logger          `inject:""`
	Cartservice     *application.CartService `inject:""`
}

SourcingEngine computes item sources Deprecated: Sourcing moved to separate module

func (*SourcingEngine) SetSourcesForCartItems

func (se *SourcingEngine) SetSourcesForCartItems(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart) error

SetSourcesForCartItems gets Sources and modifies the Cart Items todo move to application layer ?

type SourcingService

type SourcingService interface {
	//GetSourceID  returns one source location code where the product should be sourced
	//@todo will be Deprecated in future in favor of SourcingServiceDetail interface
	GetSourceID(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart, deliveryCode string, item *decorator.DecoratedCartItem) (string, error)
}

SourcingService helps in retrieving item sources Deprecated: Sourcing moved to separate module

type SourcingServiceDetail

type SourcingServiceDetail interface {
	//GetSourcesForItem returns Sources for the given item in the cart
	GetSourcesForItem(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart, deliveryCode string, item *decorator.DecoratedCartItem) (Sources, error)
	//GetAvailableSources returns Sources for the product - containing the maximum possible qty per source
	GetAvailableSources(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart, deliveryCode string, product domain.BasicProduct) (Sources, error)
}

SourcingServiceDetail additional interface to return Deprecated: Sourcing moved to separate module

Directories

Path Synopsis
placeorder

Jump to

Keyboard shortcuts

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