Documentation ¶
Index ¶
- type DecoratedCart
- func (dc DecoratedCart) GetAllDecoratedItems() []DecoratedCartItem
- func (dc DecoratedCart) GetDecoratedDeliveryByCode(deliveryCode string) (*DecoratedDelivery, bool)
- func (dc DecoratedCart) GetDecoratedDeliveryByCodeWithoutBool(deliveryCode string) *DecoratedDelivery
- func (dc DecoratedCart) GetGroupedBy(group string, sortGroup bool, params ...string) []*GroupedDecoratedCartItem
- func (dc DecoratedCart) HasAppliedDiscounts() bool
- func (dc DecoratedCart) HasAppliedGiftCards() bool
- func (dc DecoratedCart) HasRemainingGiftCards() bool
- func (dc DecoratedCart) MergeDiscounts() cart.AppliedDiscounts
- func (dc DecoratedCart) SumAppliedGiftCards() domain.Price
- func (dc DecoratedCart) SumGrandTotalWithGiftCards() domain.Price
- type DecoratedCartFactory
- func (df *DecoratedCartFactory) Create(ctx context.Context, Cart cart.Cart) *DecoratedCart
- func (df *DecoratedCartFactory) CreateDecorateCartItems(ctx context.Context, items []cart.Item) []DecoratedCartItem
- func (df *DecoratedCartFactory) Inject(productService domain.ProductService, logger flamingo.Logger)
- type DecoratedCartItem
- func (dci DecoratedCartItem) GetChargesToPay(wishedToPaySum *domain.WishedToPay) priceDomain.Charges
- func (dci DecoratedCartItem) GetDisplayMarketplaceCode() string
- func (dci DecoratedCartItem) GetDisplayTitle() string
- func (dci DecoratedCartItem) GetVariant() (*domain.Variant, error)
- func (dci DecoratedCartItem) GetVariantsVariationAttributeCodes() []string
- func (dci DecoratedCartItem) GetVariantsVariationAttributes() domain.Attributes
- func (dci *DecoratedCartItem) HasAppliedDiscounts() bool
- func (dci DecoratedCartItem) IsConfigurable() bool
- func (dci DecoratedCartItem) MergeDiscounts() cart.AppliedDiscounts
- type DecoratedDelivery
- func (dc DecoratedDelivery) GetDecoratedCartItemByID(ID string) *DecoratedCartItem
- func (dc DecoratedDelivery) GetGroupedBy(group string, sortGroup bool, params ...string) []*GroupedDecoratedCartItem
- func (dc DecoratedDelivery) HasAppliedDiscounts() bool
- func (dc DecoratedDelivery) MergeDiscounts() cart.AppliedDiscounts
- type DecoratedWithDiscount
- type DecoratedWithGiftCard
- type GroupedDecoratedCartItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecoratedCart ¶
type DecoratedCart struct { Cart cart.Cart DecoratedDeliveries []DecoratedDelivery Ctx context.Context `json:"-"` Logger flamingo.Logger `json:"-"` }
DecoratedCart Decorates Access To a Cart
func (DecoratedCart) GetAllDecoratedItems ¶
func (dc DecoratedCart) GetAllDecoratedItems() []DecoratedCartItem
GetAllDecoratedItems getter
func (DecoratedCart) GetDecoratedDeliveryByCode ¶
func (dc DecoratedCart) GetDecoratedDeliveryByCode(deliveryCode string) (*DecoratedDelivery, bool)
GetDecoratedDeliveryByCode getter
func (DecoratedCart) GetDecoratedDeliveryByCodeWithoutBool ¶
func (dc DecoratedCart) GetDecoratedDeliveryByCodeWithoutBool(deliveryCode string) *DecoratedDelivery
GetDecoratedDeliveryByCodeWithoutBool - used inside a template, therefor we need the method with a single return param
func (DecoratedCart) GetGroupedBy ¶
func (dc DecoratedCart) GetGroupedBy(group string, sortGroup bool, params ...string) []*GroupedDecoratedCartItem
GetGroupedBy legacy function deprecated: only here to support the old structure of accesing DecoratedItems in the Decorated Cart Use instead:
or iterate over DecoratedCart.DecoratedDelivery
func (DecoratedCart) HasAppliedDiscounts ¶
func (dc DecoratedCart) HasAppliedDiscounts() bool
HasAppliedDiscounts checks whether decorated cart has discounts
func (DecoratedCart) HasAppliedGiftCards ¶
func (dc DecoratedCart) HasAppliedGiftCards() bool
HasAppliedGiftCards checks if a gift card is applied to the cart
func (DecoratedCart) HasRemainingGiftCards ¶
func (dc DecoratedCart) HasRemainingGiftCards() bool
HasRemainingGiftCards check whether there are gift cards with remaining balance
func (DecoratedCart) MergeDiscounts ¶
func (dc DecoratedCart) MergeDiscounts() cart.AppliedDiscounts
MergeDiscounts sum up discounts applied to cart
func (DecoratedCart) SumAppliedGiftCards ¶
func (dc DecoratedCart) SumAppliedGiftCards() domain.Price
SumAppliedGiftCards sum up all applied amounts of giftcads price is returned as a payable
func (DecoratedCart) SumGrandTotalWithGiftCards ¶
func (dc DecoratedCart) SumGrandTotalWithGiftCards() domain.Price
SumGrandTotalWithGiftCards calculate the grand total of the cart minus gift cards
type DecoratedCartFactory ¶
type DecoratedCartFactory struct {
// contains filtered or unexported fields
}
DecoratedCartFactory - Factory to be injected: If you need to create a new Decorator then get the factory injected and use the factory
func (*DecoratedCartFactory) Create ¶
func (df *DecoratedCartFactory) Create(ctx context.Context, Cart cart.Cart) *DecoratedCart
Create Factory method to get Decorated Cart
func (*DecoratedCartFactory) CreateDecorateCartItems ¶
func (df *DecoratedCartFactory) CreateDecorateCartItems(ctx context.Context, items []cart.Item) []DecoratedCartItem
CreateDecorateCartItems Factory method to get Decorated Cart
func (*DecoratedCartFactory) Inject ¶
func (df *DecoratedCartFactory) Inject( productService domain.ProductService, logger flamingo.Logger, )
Inject dependencies
type DecoratedCartItem ¶
type DecoratedCartItem struct { Item cart.Item Product domain.BasicProduct // contains filtered or unexported fields }
DecoratedCartItem Decorates a CartItem with its Product
func (DecoratedCartItem) GetChargesToPay ¶
func (dci DecoratedCartItem) GetChargesToPay(wishedToPaySum *domain.WishedToPay) priceDomain.Charges
GetChargesToPay getter
func (DecoratedCartItem) GetDisplayMarketplaceCode ¶
func (dci DecoratedCartItem) GetDisplayMarketplaceCode() string
GetDisplayMarketplaceCode getter
func (DecoratedCartItem) GetDisplayTitle ¶
func (dci DecoratedCartItem) GetDisplayTitle() string
GetDisplayTitle getter
func (DecoratedCartItem) GetVariant ¶
func (dci DecoratedCartItem) GetVariant() (*domain.Variant, error)
GetVariant getter
func (DecoratedCartItem) GetVariantsVariationAttributeCodes ¶
func (dci DecoratedCartItem) GetVariantsVariationAttributeCodes() []string
GetVariantsVariationAttributeCodes getter
func (DecoratedCartItem) GetVariantsVariationAttributes ¶
func (dci DecoratedCartItem) GetVariantsVariationAttributes() domain.Attributes
GetVariantsVariationAttributes getter
func (*DecoratedCartItem) HasAppliedDiscounts ¶
func (dci *DecoratedCartItem) HasAppliedDiscounts() bool
HasAppliedDiscounts checks whether decorated item has discounts
func (DecoratedCartItem) IsConfigurable ¶
func (dci DecoratedCartItem) IsConfigurable() bool
IsConfigurable - checks if current CartItem is a Configurable Product
func (DecoratedCartItem) MergeDiscounts ¶
func (dci DecoratedCartItem) MergeDiscounts() cart.AppliedDiscounts
MergeDiscounts sum up discounts applied to item
type DecoratedDelivery ¶
type DecoratedDelivery struct { Delivery cart.Delivery DecoratedItems []DecoratedCartItem // contains filtered or unexported fields }
DecoratedDelivery Decorates a CartItem with its Product
func (DecoratedDelivery) GetDecoratedCartItemByID ¶
func (dc DecoratedDelivery) GetDecoratedCartItemByID(ID string) *DecoratedCartItem
GetDecoratedCartItemByID getter
func (DecoratedDelivery) GetGroupedBy ¶
func (dc DecoratedDelivery) GetGroupedBy(group string, sortGroup bool, params ...string) []*GroupedDecoratedCartItem
GetGroupedBy getter
func (DecoratedDelivery) HasAppliedDiscounts ¶
func (dc DecoratedDelivery) HasAppliedDiscounts() bool
HasAppliedDiscounts checks whether decorated delivery has discounts
func (DecoratedDelivery) MergeDiscounts ¶
func (dc DecoratedDelivery) MergeDiscounts() cart.AppliedDiscounts
MergeDiscounts sum up discounts applied to delivery
type DecoratedWithDiscount ¶
type DecoratedWithDiscount interface { HasAppliedDiscounts() bool MergeDiscounts() cart.AppliedDiscounts }
DecoratedWithDiscount interface for a decorated object to be able to handle discounts the difference to cart.WithDiscount is, that these functions do NOT provide the client with an error, errors are just logged
type DecoratedWithGiftCard ¶
type DecoratedWithGiftCard interface { HasRemainingGiftCards() bool HasAppliedGiftCards() bool SumAppliedGiftCards() domain.Price SumGrandTotalWithGiftCards() domain.Price }
DecoratedWithGiftCard interface for a decorated object to be able to handle giftcards the difference to cart.WithGiftCard is, that these functions do NOT provide the client with an error, errors are just logged
type GroupedDecoratedCartItem ¶
type GroupedDecoratedCartItem struct { DecoratedItems []DecoratedCartItem Group string }
GroupedDecoratedCartItem - value object used for grouping (generated on the fly)