Documentation ¶
Index ¶
Constants ¶
This section is empty.
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 - idendifies the warehouse or stocklocation LocationCode string //Qty - for the sources items Qty int }
Source - represents the Sourceing info
type Sources ¶
type Sources []Source
Sources - result value object containing all sources (for the request item or product)
func (Sources) MainLocation ¶
MainLocation returns first sourced location (or empty string)
type SourcingEngine ¶
type SourcingEngine struct { SourcingService SourcingService `inject:",optional"` Logger flamingo.Logger `inject:""` Cartservice *application.CartService `inject:""` }
SourcingEngine computes item sources
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 Depricated 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
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 @todo - the methods in the interface will replace the methods in interface above (SourcingServiceDetail will be deleted then)
Click to show internal directories.
Click to hide internal directories.