Versions in this module Expand all Collapse all v0 v0.0.3 Mar 13, 2024 Changes in this version + const CartSessionCacheCacheKeyPrefix + const GuestCartSessionKey + var ErrBundleConfigNotProvided = errors.New("error no bundle config provided") + var ErrCacheIsInvalid = errors.New("cache is invalid") + var ErrNoBundleConfigurationGiven = errors.New("no bundle configuration given for configurable product") + var ErrNoCacheEntry = errors.New("cache entry not found") + var ErrNoVariantForConfigurable = errors.New("no variant given for configurable product") + var ErrProductNotTypeBundle = errors.New("product not of type bundle") + var ErrTemporaryCartService = errors.New("the cart could not be received currently - try again later") + var ErrVariantDoNotExist = errors.New("product has not the given variant") + func ContextWithItemID(ctx context.Context, itemID string) context.Context + func ItemIDFromContext(ctx context.Context) string + type BaseCartReceiver struct + func (cs *BaseCartReceiver) GetCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, cartDomain.ModifyBehaviour, error) + func (cs *BaseCartReceiver) GetCartWithoutCache(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + func (cs *BaseCartReceiver) Inject(guestCartService cartDomain.GuestCartService, ...) + func (cs *BaseCartReceiver) ModifyBehaviour(ctx context.Context) (cartDomain.ModifyBehaviour, error) + func (cs *BaseCartReceiver) RestoreCart(ctx context.Context, session *web.Session, cartToRestore cartDomain.Cart) (*cartDomain.Cart, error) + func (cs *BaseCartReceiver) ShouldHaveCart(ctx context.Context, session *web.Session) bool + func (cs *BaseCartReceiver) ShouldHaveGuestCart(session *web.Session) bool + func (cs *BaseCartReceiver) ViewCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + func (cs *BaseCartReceiver) ViewGuestCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + type CachedCartEntry struct + Entry cart.Cart + ExpiresOn time.Time + IsInvalid bool + type CartCache interface + BuildIdentifier func(context.Context, *web.Session) (CartCacheIdentifier, error) + CacheCart func(context.Context, *web.Session, CartCacheIdentifier, *cart.Cart) error + Delete func(context.Context, *web.Session, CartCacheIdentifier) error + DeleteAll func(context.Context, *web.Session) error + GetCart func(context.Context, *web.Session, CartCacheIdentifier) (*cart.Cart, error) + Invalidate func(context.Context, *web.Session, CartCacheIdentifier) error + type CartCacheIdentifier struct + CustomerID string + GuestCartID string + IsCustomerCart bool + func BuildIdentifierFromCart(cart *cart.Cart) (*CartCacheIdentifier, error) + func (ci *CartCacheIdentifier) CacheKey() string + type CartMergeStrategyMerge struct + func (c *CartMergeStrategyMerge) Inject(logger flamingo.Logger, cartService Service) *CartMergeStrategyMerge + func (c *CartMergeStrategyMerge) Merge(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, ...) + type CartMergeStrategyNone struct + func (c *CartMergeStrategyNone) Merge(_ context.Context, _ *web.Session, _ cartDomain.Cart, _ cartDomain.Cart) + type CartMergeStrategyReplace struct + func (c *CartMergeStrategyReplace) Inject(logger flamingo.Logger, cartService Service) *CartMergeStrategyReplace + func (c *CartMergeStrategyReplace) Merge(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, ...) + type CartMerger interface + Merge func(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, ...) + type CartReceiverService struct + func (cs *CartReceiverService) DecorateCart(ctx context.Context, cart *cartDomain.Cart) (*decorator.DecoratedCart, error) + func (cs *CartReceiverService) GetDecoratedCart(ctx context.Context, session *web.Session) (*decorator.DecoratedCart, cartDomain.ModifyBehaviour, error) + func (cs *CartReceiverService) Inject(guestCartService cartDomain.GuestCartService, ...) + func (cs *CartReceiverService) ViewDecoratedCart(ctx context.Context, session *web.Session) (*decorator.DecoratedCart, error) + func (cs *CartReceiverService) ViewDecoratedCartWithoutCache(ctx context.Context, session *web.Session) (*decorator.DecoratedCart, error) + type CartService struct + func (cs *CartService) AddProduct(ctx context.Context, session *web.Session, deliveryCode string, ...) (productDomain.BasicProduct, error) + func (cs *CartService) AdjustItemsToRestrictedQty(ctx context.Context, session *web.Session) (QtyAdjustmentResults, error) + func (cs *CartService) ApplyAny(ctx context.Context, session *web.Session, anyCode string) (*cartDomain.Cart, error) + func (cs *CartService) ApplyGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + func (cs *CartService) ApplyVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + func (cs *CartService) BuildAddRequest(ctx context.Context, marketplaceCode string, variantMarketplaceCode string, ...) cartDomain.AddRequest + func (cs *CartService) CancelOrder(ctx context.Context, session *web.Session, ...) (*cartDomain.Cart, error) + func (cs *CartService) CancelOrderWithoutRestore(ctx context.Context, session *web.Session, ...) error + func (cs *CartService) Clean(ctx context.Context, session *web.Session) error + func (cs *CartService) CompleteCurrentCart(ctx context.Context) (*cartDomain.Cart, error) + func (cs *CartService) CreateInitialDeliveryIfNotPresent(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error) + func (cs *CartService) DeleteAllItems(ctx context.Context, session *web.Session) error + func (cs *CartService) DeleteCartInCache(ctx context.Context, session *web.Session, _ *cartDomain.Cart) + func (cs *CartService) DeleteDelivery(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error) + func (cs *CartService) DeleteItem(ctx context.Context, session *web.Session, itemID string, deliveryCode string) error + func (cs *CartService) DeleteSavedSessionGuestCartID(session *web.Session) error + func (cs *CartService) ForceReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + func (cs *CartService) GetCartReceiverService() *CartReceiverService + func (cs *CartService) GetDefaultDeliveryCode() string + func (cs *CartService) GetInitialDelivery(deliveryCode string) (*cartDomain.DeliveryInfo, error) + func (cs *CartService) Inject(cartReceiverService *CartReceiverService, ...) + func (cs *CartService) PlaceOrder(ctx context.Context, session *web.Session, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) + func (cs *CartService) PlaceOrderWithCart(ctx context.Context, session *web.Session, cart *cartDomain.Cart, ...) (placeorder.PlacedOrderInfos, error) + func (cs *CartService) RemoveGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + func (cs *CartService) RemoveVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + func (cs *CartService) ReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + func (cs *CartService) RestoreCart(ctx context.Context, cart *cartDomain.Cart) (*cartDomain.Cart, error) + func (cs *CartService) UpdateAdditionalData(ctx context.Context, session *web.Session, additionalData map[string]string) (*cartDomain.Cart, error) + func (cs *CartService) UpdateBillingAddress(ctx context.Context, session *web.Session, billingAddress *cartDomain.Address) error + func (cs *CartService) UpdateDeliveryAdditionalData(ctx context.Context, session *web.Session, deliveryCode string, ...) (*cartDomain.Cart, error) + func (cs *CartService) UpdateDeliveryInfo(ctx context.Context, session *web.Session, deliveryCode string, ...) error + func (cs *CartService) UpdateItemBundleConfig(ctx context.Context, session *web.Session, ...) error + func (cs *CartService) UpdateItemQty(ctx context.Context, session *web.Session, itemID string, deliveryCode string, ...) error + func (cs *CartService) UpdateItemSourceID(ctx context.Context, session *web.Session, itemID string, sourceID string) error + func (cs *CartService) UpdateItems(ctx context.Context, session *web.Session, ...) error + func (cs *CartService) UpdatePaymentSelection(ctx context.Context, session *web.Session, ...) error + func (cs *CartService) UpdatePurchaser(ctx context.Context, session *web.Session, purchaser *cartDomain.Person, ...) error + func (cs *CartService) ValidateCart(ctx context.Context, session *web.Session, ...) validation.Result + func (cs *CartService) ValidateCurrentCart(ctx context.Context, session *web.Session) (validation.Result, error) + type CartSessionCache struct + func (cs *CartSessionCache) BuildIdentifier(ctx context.Context, session *web.Session) (CartCacheIdentifier, error) + func (cs *CartSessionCache) CacheCart(ctx context.Context, session *web.Session, id CartCacheIdentifier, ...) error + func (cs *CartSessionCache) Delete(ctx context.Context, session *web.Session, id CartCacheIdentifier) error + func (cs *CartSessionCache) DeleteAll(ctx context.Context, session *web.Session) error + func (cs *CartSessionCache) GetCart(ctx context.Context, session *web.Session, id CartCacheIdentifier) (*cart.Cart, error) + func (cs *CartSessionCache) Inject(logger flamingo.Logger, webIdentityService *auth.WebIdentityService, ...) + func (cs *CartSessionCache) Invalidate(ctx context.Context, session *web.Session, id CartCacheIdentifier) error + type EventReceiver struct + func (e *EventReceiver) Inject(logger flamingo.Logger, cartReceiverService Receiver, ...) + func (e *EventReceiver) Notify(ctx context.Context, event flamingo.Event) + type PostCartMergeEvent struct + MergedCart cartDomain.Cart + type PreCartMergeEvent struct + CustomerCart cartDomain.Cart + GuestCart cartDomain.Cart + type QtyAdjustmentResult struct + DeliveryCode string + HasRemovedCouponCodes bool + NewQty int + OriginalItem cartDomain.Item + RestrictionResult *validation.RestrictionResult + WasDeleted bool + type QtyAdjustmentResults []QtyAdjustmentResult + func (qar QtyAdjustmentResults) HasRemovedCouponCodes() bool + type Receiver interface + GetCart func(ctx context.Context, session *web.Session) (*cartDomain.Cart, cartDomain.ModifyBehaviour, error) + GetCartWithoutCache func(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + ModifyBehaviour func(ctx context.Context) (cartDomain.ModifyBehaviour, error) + ShouldHaveCart func(ctx context.Context, session *web.Session) bool + ShouldHaveGuestCart func(session *web.Session) bool + ViewCart func(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + ViewGuestCart func(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + type RestrictionError struct + CartItemID string + RestrictionResult validation.RestrictionResult + func (e *RestrictionError) Error() string + type Service interface + AddProduct func(ctx context.Context, session *web.Session, deliveryCode string, ...) (productDomain.BasicProduct, error) + AdjustItemsToRestrictedQty func(ctx context.Context, session *web.Session) (QtyAdjustmentResults, error) + ApplyAny func(ctx context.Context, session *web.Session, anyCode string) (*cartDomain.Cart, error) + ApplyGiftCard func(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + ApplyVoucher func(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + BuildAddRequest func(ctx context.Context, marketplaceCode string, variantMarketplaceCode string, ...) cartDomain.AddRequest + CancelOrder func(ctx context.Context, session *web.Session, ...) (*cartDomain.Cart, error) + CancelOrderWithoutRestore func(ctx context.Context, session *web.Session, ...) error + Clean func(ctx context.Context, session *web.Session) error + CompleteCurrentCart func(ctx context.Context) (*cartDomain.Cart, error) + CreateInitialDeliveryIfNotPresent func(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error) + DeleteAllItems func(ctx context.Context, session *web.Session) error + DeleteCartInCache func(ctx context.Context, session *web.Session, cart *cartDomain.Cart) + DeleteDelivery func(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error) + DeleteItem func(ctx context.Context, session *web.Session, itemID string, deliveryCode string) error + ForceReserveOrderIDAndSave func(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + GetCartReceiverService func() *CartReceiverService + GetDefaultDeliveryCode func() string + GetInitialDelivery func(deliveryCode string) (*cartDomain.DeliveryInfo, error) + PlaceOrder func(ctx context.Context, session *web.Session, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error) + PlaceOrderWithCart func(ctx context.Context, session *web.Session, cart *cartDomain.Cart, ...) (placeorder.PlacedOrderInfos, error) + RemoveGiftCard func(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + RemoveVoucher func(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error) + ReserveOrderIDAndSave func(ctx context.Context, session *web.Session) (*cartDomain.Cart, error) + RestoreCart func(ctx context.Context, cart *cartDomain.Cart) (*cartDomain.Cart, error) + UpdateAdditionalData func(ctx context.Context, session *web.Session, additionalData map[string]string) (*cartDomain.Cart, error) + UpdateBillingAddress func(ctx context.Context, session *web.Session, billingAddress *cartDomain.Address) error + UpdateDeliveryAdditionalData func(ctx context.Context, session *web.Session, deliveryCode string, ...) (*cartDomain.Cart, error) + UpdateDeliveryInfo func(ctx context.Context, session *web.Session, deliveryCode string, ...) error + UpdateItemBundleConfig func(ctx context.Context, session *web.Session, ...) error + UpdateItemQty func(ctx context.Context, session *web.Session, itemID string, deliveryCode string, ...) error + UpdateItemSourceID func(ctx context.Context, session *web.Session, itemID string, sourceID string) error + UpdateItems func(ctx context.Context, session *web.Session, ...) error + UpdatePaymentSelection func(ctx context.Context, session *web.Session, ...) error + UpdatePurchaser func(ctx context.Context, session *web.Session, purchaser *cartDomain.Person, ...) error + ValidateCart func(ctx context.Context, session *web.Session, ...) validation.Result + ValidateCurrentCart func(ctx context.Context, session *web.Session) (validation.Result, error)