application

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 18 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// CartSessionCacheCacheKeyPrefix is a string prefix for Cart Cache Keys
	CartSessionCacheCacheKeyPrefix = "cart.sessioncache."
)
View Source
const (
	// GuestCartSessionKey is a prefix
	GuestCartSessionKey = "cart.guestid"
)

Variables

View Source
var (

	// ErrCacheIsInvalid sets generalized invalid Cache Error
	ErrCacheIsInvalid = errors.New("cache is invalid")
	// ErrNoCacheEntry - used if cache is not found
	ErrNoCacheEntry = errors.New("cache entry not found")
)
View Source
var (
	ErrBundleConfigNotProvided = errors.New("error no bundle config provided")
	ErrProductNotTypeBundle    = errors.New("product not of type bundle")
)
View Source
var (
	// ErrNoBundleConfigurationGiven returned when bundle configuration is not provided
	ErrNoBundleConfigurationGiven = errors.New("no bundle configuration given for configurable product")

	// ErrNoVariantForConfigurable returned when type configurable with active variant do not have variant selected
	ErrNoVariantForConfigurable = errors.New("no variant given for configurable product")

	// ErrVariantDoNotExist returned when selected variant do not exist
	ErrVariantDoNotExist = errors.New("product has not the given variant")
)
View Source
var (
	// ErrTemporaryCartService should be returned if it is likely that the backend service will return a cart on a next try
	ErrTemporaryCartService = errors.New("the cart could not be received currently - try again later")
)

Functions

func ContextWithItemID added in v3.8.0

func ContextWithItemID(ctx context.Context, itemID string) context.Context

func ItemIDFromContext added in v3.8.0

func ItemIDFromContext(ctx context.Context) string

Types

type BaseCartReceiver added in v3.6.0

type BaseCartReceiver struct {
	// contains filtered or unexported fields
}

BaseCartReceiver get undecorated carts only

func (*BaseCartReceiver) GetCart added in v3.6.0

GetCart Get the correct Cart (either Guest or User)

func (*BaseCartReceiver) GetCartWithoutCache added in v3.6.0

func (cs *BaseCartReceiver) GetCartWithoutCache(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)

GetCartWithoutCache - forces to get the cart without cache

func (*BaseCartReceiver) Inject added in v3.6.0

func (cs *BaseCartReceiver) Inject(
	guestCartService cartDomain.GuestCartService,
	customerCartService cartDomain.CustomerCartService,
	webIdentityService *auth.WebIdentityService,
	logger flamingo.Logger,
	eventRouter flamingo.EventRouter,
	optionals *struct {
		CartCache CartCache `inject:",optional"`
	},
)

Inject the dependencies

func (*BaseCartReceiver) ModifyBehaviour added in v3.6.0

func (cs *BaseCartReceiver) ModifyBehaviour(ctx context.Context) (cartDomain.ModifyBehaviour, error)

ModifyBehaviour returns the correct behaviour to modify the cart for the current user (guest/customer)

func (*BaseCartReceiver) RestoreCart added in v3.6.0

func (cs *BaseCartReceiver) RestoreCart(ctx context.Context, session *web.Session, cartToRestore cartDomain.Cart) (*cartDomain.Cart, error)

RestoreCart restores a previously used guest / customer cart deprecated: use CartService.RestoreCart(), ensure that your cart implements the CompleteBehaviour

func (*BaseCartReceiver) ShouldHaveCart added in v3.6.0

func (cs *BaseCartReceiver) ShouldHaveCart(ctx context.Context, session *web.Session) bool

ShouldHaveCart - checks if there should be a cart. Indicated if a call to GetCart should return a real cart

func (*BaseCartReceiver) ShouldHaveGuestCart added in v3.6.0

func (cs *BaseCartReceiver) ShouldHaveGuestCart(session *web.Session) bool

ShouldHaveGuestCart - checks if there should be guest cart

func (*BaseCartReceiver) ViewCart added in v3.6.0

func (cs *BaseCartReceiver) ViewCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)

ViewCart return a Cart for view

func (*BaseCartReceiver) ViewGuestCart added in v3.6.0

func (cs *BaseCartReceiver) ViewGuestCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)

ViewGuestCart try to get the guest Cart - even if the user is logged in

type CachedCartEntry

type CachedCartEntry struct {
	IsInvalid bool
	Entry     cart.Cart
	ExpiresOn time.Time
}

CachedCartEntry defines a single Cart Cache Entry

type CartCache

CartCache describes a cart caches methods

type CartCacheIdentifier

type CartCacheIdentifier struct {
	GuestCartID    string
	IsCustomerCart bool
	CustomerID     string
}

CartCacheIdentifier identifies Cart Caches

func BuildIdentifierFromCart

func BuildIdentifierFromCart(cart *cart.Cart) (*CartCacheIdentifier, error)

BuildIdentifierFromCart creates a Cache Identifier from Cart Data Deprecated: use BuildIdentifier function of concrete implementation

func (*CartCacheIdentifier) CacheKey

func (ci *CartCacheIdentifier) CacheKey() string

CacheKey creates a Cache Key Identifier string

type CartMergeStrategyMerge added in v3.8.0

type CartMergeStrategyMerge struct {
	// contains filtered or unexported fields
}

func (*CartMergeStrategyMerge) Inject added in v3.8.0

func (c *CartMergeStrategyMerge) Inject(
	logger flamingo.Logger,
	cartService Service,
) *CartMergeStrategyMerge

Inject dependencies

func (*CartMergeStrategyMerge) Merge added in v3.8.0

func (c *CartMergeStrategyMerge) Merge(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, customerCart cartDomain.Cart)

type CartMergeStrategyNone added in v3.8.0

type CartMergeStrategyNone struct{}

func (*CartMergeStrategyNone) Merge added in v3.8.0

type CartMergeStrategyReplace added in v3.8.0

type CartMergeStrategyReplace struct {
	// contains filtered or unexported fields
}

func (*CartMergeStrategyReplace) Inject added in v3.8.0

func (c *CartMergeStrategyReplace) Inject(
	logger flamingo.Logger,
	cartService Service,
) *CartMergeStrategyReplace

Inject dependencies

func (*CartMergeStrategyReplace) Merge added in v3.8.0

func (c *CartMergeStrategyReplace) Merge(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, _ cartDomain.Cart)

type CartMerger added in v3.8.0

type CartMerger interface {
	Merge(ctx context.Context, session *web.Session, guestCart cartDomain.Cart, customerCart cartDomain.Cart)
}

type CartReceiverService

type CartReceiverService struct {
	*BaseCartReceiver
	// contains filtered or unexported fields
}

CartReceiverService provides methods to get the correct cart

func (*CartReceiverService) DecorateCart

DecorateCart Get the correct Cart

func (*CartReceiverService) GetDecoratedCart

GetDecoratedCart Get the correct Cart

func (*CartReceiverService) Inject

func (cs *CartReceiverService) Inject(
	guestCartService cartDomain.GuestCartService,
	customerCartService cartDomain.CustomerCartService,
	cartDecoratorFactory *decorator.DecoratedCartFactory,
	webIdentityService *auth.WebIdentityService,
	logger flamingo.Logger,
	eventRouter flamingo.EventRouter,
	optionals *struct {
		CartCache CartCache `inject:",optional"`
	},
)

Inject the dependencies

func (*CartReceiverService) ViewDecoratedCart

func (cs *CartReceiverService) ViewDecoratedCart(ctx context.Context, session *web.Session) (*decorator.DecoratedCart, error)

ViewDecoratedCart return a Cart for view

func (*CartReceiverService) ViewDecoratedCartWithoutCache

func (cs *CartReceiverService) ViewDecoratedCartWithoutCache(ctx context.Context, session *web.Session) (*decorator.DecoratedCart, error)

ViewDecoratedCartWithoutCache return a Cart for view

type CartService

type CartService struct {
	// contains filtered or unexported fields
}

CartService provides methods to modify the cart

func (*CartService) AddProduct

func (cs *CartService) AddProduct(ctx context.Context, session *web.Session, deliveryCode string, addRequest cartDomain.AddRequest) (productDomain.BasicProduct, error)

AddProduct adds a product to the cart

func (*CartService) AdjustItemsToRestrictedQty

func (cs *CartService) AdjustItemsToRestrictedQty(ctx context.Context, session *web.Session) (QtyAdjustmentResults, error)

AdjustItemsToRestrictedQty checks the quantity restrictions for each item of the cart and returns what quantities have been adjusted

func (*CartService) ApplyAny

func (cs *CartService) ApplyAny(ctx context.Context, session *web.Session, anyCode string) (*cartDomain.Cart, error)

ApplyAny applies a voucher or giftcard to the cart

func (*CartService) ApplyGiftCard

func (cs *CartService) ApplyGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)

ApplyGiftCard adds a giftcard to the cart

func (*CartService) ApplyVoucher

func (cs *CartService) ApplyVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)

ApplyVoucher applies a voucher to the cart

func (*CartService) BuildAddRequest

func (cs *CartService) BuildAddRequest(ctx context.Context, marketplaceCode string, variantMarketplaceCode string, qty int, additionalData map[string]string) cartDomain.AddRequest

BuildAddRequest Helper to build Deprecated: build your own add request

func (*CartService) CancelOrder

func (cs *CartService) CancelOrder(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos, cart cartDomain.Cart) (*cartDomain.Cart, error)

CancelOrder cancels a previously placed order and restores the cart content

func (*CartService) CancelOrderWithoutRestore added in v3.1.0

func (cs *CartService) CancelOrderWithoutRestore(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos) error

CancelOrderWithoutRestore cancels a previously placed order

func (*CartService) Clean

func (cs *CartService) Clean(ctx context.Context, session *web.Session) error

Clean current cart

func (*CartService) CompleteCurrentCart added in v3.1.0

func (cs *CartService) CompleteCurrentCart(ctx context.Context) (*cartDomain.Cart, error)

CompleteCurrentCart and remove from cache

func (*CartService) CreateInitialDeliveryIfNotPresent

func (cs *CartService) CreateInitialDeliveryIfNotPresent(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error)

CreateInitialDeliveryIfNotPresent creates the initial delivery

func (*CartService) DeleteAllItems

func (cs *CartService) DeleteAllItems(ctx context.Context, session *web.Session) error

DeleteAllItems in current cart

func (*CartService) DeleteCartInCache

func (cs *CartService) DeleteCartInCache(ctx context.Context, session *web.Session, _ *cartDomain.Cart)

DeleteCartInCache removes the cart from cache

func (*CartService) DeleteDelivery

func (cs *CartService) DeleteDelivery(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error)

DeleteDelivery in current cart

func (*CartService) DeleteItem

func (cs *CartService) DeleteItem(ctx context.Context, session *web.Session, itemID string, deliveryCode string) error

DeleteItem in current cart

func (*CartService) DeleteSavedSessionGuestCartID

func (cs *CartService) DeleteSavedSessionGuestCartID(session *web.Session) error

DeleteSavedSessionGuestCartID deletes a guest cart Key from the Session Values

func (*CartService) ForceReserveOrderIDAndSave

func (cs *CartService) ForceReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)

ForceReserveOrderIDAndSave reserves order id by using the PlaceOrder behaviour, sets and saves it on the cart. Each call of this method reserves a new order ID, even if it is already set on the cart. You may want to use this before proceeding with payment to ensure having a useful reference in the payment processing

func (*CartService) GetCartReceiverService

func (cs *CartService) GetCartReceiverService() *CartReceiverService

GetCartReceiverService returns the injected cart receiver service

func (*CartService) GetDefaultDeliveryCode

func (cs *CartService) GetDefaultDeliveryCode() string

GetDefaultDeliveryCode returns the configured default deliverycode

func (*CartService) GetInitialDelivery

func (cs *CartService) GetInitialDelivery(deliveryCode string) (*cartDomain.DeliveryInfo, error)

GetInitialDelivery - calls the registered deliveryInfoBuilder to get the initial values for a Delivery based on the given code

func (*CartService) Inject

func (cs *CartService) Inject(
	cartReceiverService *CartReceiverService,
	productService productDomain.ProductService,
	eventPublisher events.EventPublisher,
	eventRouter flamingo.EventRouter,
	deliveryInfoBuilder cartDomain.DeliveryInfoBuilder,
	restrictionService *validation.RestrictionService,
	webIdentityService *auth.WebIdentityService,
	logger flamingo.Logger,
	config *struct {
		DefaultDeliveryCode string `inject:"config:commerce.cart.defaultDeliveryCode,optional"`
		DeleteEmptyDelivery bool   `inject:"config:commerce.cart.deleteEmptyDelivery,optional"`
	},
	optionals *struct {
		CartValidator     validation.Validator     `inject:",optional"`
		ItemValidator     validation.ItemValidator `inject:",optional"`
		CartCache         CartCache                `inject:",optional"`
		PlaceOrderService placeorder.Service       `inject:",optional"`
	},
)

Inject dependencies

func (*CartService) PlaceOrder

func (cs *CartService) PlaceOrder(ctx context.Context, session *web.Session, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error)

PlaceOrder converts the cart (possibly cached) with payments into orders by calling the Service

func (*CartService) PlaceOrderWithCart

func (cs *CartService) PlaceOrderWithCart(ctx context.Context, session *web.Session, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error)

PlaceOrderWithCart converts the given cart with payments into orders by calling the Service

func (*CartService) RemoveGiftCard

func (cs *CartService) RemoveGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)

RemoveGiftCard removes a giftcard from the cart

func (*CartService) RemoveVoucher

func (cs *CartService) RemoveVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)

RemoveVoucher removes a voucher from the cart

func (*CartService) ReserveOrderIDAndSave

func (cs *CartService) ReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)

ReserveOrderIDAndSave reserves order id by using the PlaceOrder behaviour, sets and saves it on the cart. If the cart already holds a reserved order id no set/save is performed and the existing cart is returned. You may want to use this before proceeding with payment to ensure having a useful reference in the payment processing

func (*CartService) RestoreCart added in v3.1.0

func (cs *CartService) RestoreCart(ctx context.Context, cart *cartDomain.Cart) (*cartDomain.Cart, error)

RestoreCart and cache

func (*CartService) UpdateAdditionalData added in v3.5.0

func (cs *CartService) UpdateAdditionalData(ctx context.Context, session *web.Session, additionalData map[string]string) (*cartDomain.Cart, error)

UpdateAdditionalData of cart

func (*CartService) UpdateBillingAddress

func (cs *CartService) UpdateBillingAddress(ctx context.Context, session *web.Session, billingAddress *cartDomain.Address) error

UpdateBillingAddress updates the billing address on the cart

func (*CartService) UpdateDeliveryAdditionalData added in v3.5.0

func (cs *CartService) UpdateDeliveryAdditionalData(ctx context.Context, session *web.Session, deliveryCode string, additionalData map[string]string) (*cartDomain.Cart, error)

UpdateDeliveryAdditionalData of cart

func (*CartService) UpdateDeliveryInfo

func (cs *CartService) UpdateDeliveryInfo(ctx context.Context, session *web.Session, deliveryCode string, deliveryInfo cartDomain.DeliveryInfoUpdateCommand) error

UpdateDeliveryInfo updates the delivery info on the cart

func (*CartService) UpdateItemBundleConfig added in v3.9.0

func (cs *CartService) UpdateItemBundleConfig(ctx context.Context, session *web.Session, updateCommand cartDomain.ItemUpdateCommand) error

UpdateItemBundleConfig updates multiple item

func (*CartService) UpdateItemQty

func (cs *CartService) UpdateItemQty(ctx context.Context, session *web.Session, itemID string, deliveryCode string, qty int) error

UpdateItemQty updates a single cart item qty

func (*CartService) UpdateItemSourceID

func (cs *CartService) UpdateItemSourceID(ctx context.Context, session *web.Session, itemID string, sourceID string) error

UpdateItemSourceID updates an item source id

func (*CartService) UpdateItems

func (cs *CartService) UpdateItems(ctx context.Context, session *web.Session, updateCommands []cartDomain.ItemUpdateCommand) error

UpdateItems updates multiple items

func (*CartService) UpdatePaymentSelection

func (cs *CartService) UpdatePaymentSelection(ctx context.Context, session *web.Session, paymentSelection cartDomain.PaymentSelection) error

UpdatePaymentSelection updates the paymentselection in the cart

func (*CartService) UpdatePurchaser

func (cs *CartService) UpdatePurchaser(ctx context.Context, session *web.Session, purchaser *cartDomain.Person, additionalData *cartDomain.AdditionalData) error

UpdatePurchaser updates the purchaser on the cart

func (*CartService) ValidateCart

func (cs *CartService) ValidateCart(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart) validation.Result

ValidateCart validates a carts content

func (*CartService) ValidateCurrentCart

func (cs *CartService) ValidateCurrentCart(ctx context.Context, session *web.Session) (validation.Result, error)

ValidateCurrentCart validates the current active cart

type CartSessionCache

type CartSessionCache struct {
	// contains filtered or unexported fields
}

CartSessionCache defines a Cart Cache

func (*CartSessionCache) BuildIdentifier

func (cs *CartSessionCache) BuildIdentifier(ctx context.Context, session *web.Session) (CartCacheIdentifier, error)

BuildIdentifier creates a CartCacheIdentifier based on the login state

func (*CartSessionCache) CacheCart

func (cs *CartSessionCache) CacheCart(ctx context.Context, session *web.Session, id CartCacheIdentifier, cartForCache *cart.Cart) error

CacheCart adds a Cart to the Cache

func (*CartSessionCache) Delete

func (cs *CartSessionCache) Delete(ctx context.Context, session *web.Session, id CartCacheIdentifier) error

Delete a Cache entry

func (*CartSessionCache) DeleteAll

func (cs *CartSessionCache) DeleteAll(ctx context.Context, session *web.Session) error

DeleteAll empties the Cache

func (*CartSessionCache) GetCart

func (cs *CartSessionCache) GetCart(ctx context.Context, session *web.Session, id CartCacheIdentifier) (*cart.Cart, error)

GetCart fetches a Cart from the Cache

func (*CartSessionCache) Inject

func (cs *CartSessionCache) Inject(
	logger flamingo.Logger,
	webIdentityService *auth.WebIdentityService,
	config *struct {
		LifetimeSeconds float64 `inject:"config:commerce.cart.cacheLifetime"` // in seconds
	},
)

Inject the dependencies

func (*CartSessionCache) Invalidate

func (cs *CartSessionCache) Invalidate(ctx context.Context, session *web.Session, id CartCacheIdentifier) error

Invalidate a Cache Entry

type EventReceiver

type EventReceiver struct {
	// contains filtered or unexported fields
}

EventReceiver handles events from other packages

func (*EventReceiver) Inject

func (e *EventReceiver) Inject(
	logger flamingo.Logger,
	cartReceiverService Receiver,
	eventRouter flamingo.EventRouter,
	cartMerger CartMerger,
	optionals *struct {
		CartCache CartCache `inject:",optional"`
	},
)

Inject dependencies

func (*EventReceiver) Notify

func (e *EventReceiver) Notify(ctx context.Context, event flamingo.Event)

Notify should get called by flamingo Eventlogic

type PostCartMergeEvent added in v3.6.0

type PostCartMergeEvent struct {
	MergedCart cartDomain.Cart
}

PostCartMergeEvent is dispatched after merging the guest cart and the customer cart

type PreCartMergeEvent added in v3.6.0

type PreCartMergeEvent struct {
	GuestCart    cartDomain.Cart
	CustomerCart cartDomain.Cart
}

PreCartMergeEvent is dispatched after getting the (current) guest cart and the customer cart before merging

type QtyAdjustmentResult

type QtyAdjustmentResult struct {
	OriginalItem          cartDomain.Item
	DeliveryCode          string
	WasDeleted            bool
	RestrictionResult     *validation.RestrictionResult
	NewQty                int
	HasRemovedCouponCodes bool
}

QtyAdjustmentResult restriction result enriched with the respective item

type QtyAdjustmentResults

type QtyAdjustmentResults []QtyAdjustmentResult

QtyAdjustmentResults slice of QtyAdjustmentResult

func (QtyAdjustmentResults) HasRemovedCouponCodes added in v3.0.1

func (qar QtyAdjustmentResults) HasRemovedCouponCodes() bool

HasRemovedCouponCodes returns if a QtyAdjustmentResults has any adjustment that removed a coupon code from the cart

type Receiver added in v3.6.0

type Receiver interface {
	ShouldHaveCart(ctx context.Context, session *web.Session) bool
	ShouldHaveGuestCart(session *web.Session) bool
	ViewCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)
	ViewGuestCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)
	ModifyBehaviour(ctx context.Context) (cartDomain.ModifyBehaviour, error)
	GetCart(ctx context.Context, session *web.Session) (*cartDomain.Cart, cartDomain.ModifyBehaviour, error)
	GetCartWithoutCache(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)
}

Receiver that provides functionality regarding fetching the cart

type RestrictionError

type RestrictionError struct {
	CartItemID        string
	RestrictionResult validation.RestrictionResult
	// contains filtered or unexported fields
}

RestrictionError error enriched with result of restrictions

func (*RestrictionError) Error

func (e *RestrictionError) Error() string

Error fetch error message

type Service added in v3.5.0

type Service interface {
	GetCartReceiverService() *CartReceiverService
	ValidateCart(ctx context.Context, session *web.Session, decoratedCart *decorator.DecoratedCart) validation.Result
	ValidateCurrentCart(ctx context.Context, session *web.Session) (validation.Result, error)
	UpdatePaymentSelection(ctx context.Context, session *web.Session, paymentSelection cartDomain.PaymentSelection) error
	UpdateBillingAddress(ctx context.Context, session *web.Session, billingAddress *cartDomain.Address) error
	UpdateDeliveryInfo(ctx context.Context, session *web.Session, deliveryCode string, deliveryInfo cartDomain.DeliveryInfoUpdateCommand) error
	UpdatePurchaser(ctx context.Context, session *web.Session, purchaser *cartDomain.Person, additionalData *cartDomain.AdditionalData) error
	UpdateItemQty(ctx context.Context, session *web.Session, itemID string, deliveryCode string, qty int) error
	UpdateItemSourceID(ctx context.Context, session *web.Session, itemID string, sourceID string) error
	UpdateItems(ctx context.Context, session *web.Session, updateCommands []cartDomain.ItemUpdateCommand) error
	UpdateItemBundleConfig(ctx context.Context, session *web.Session, updateCommand cartDomain.ItemUpdateCommand) error
	DeleteItem(ctx context.Context, session *web.Session, itemID string, deliveryCode string) error
	DeleteAllItems(ctx context.Context, session *web.Session) error
	CompleteCurrentCart(ctx context.Context) (*cartDomain.Cart, error)
	RestoreCart(ctx context.Context, cart *cartDomain.Cart) (*cartDomain.Cart, error)
	Clean(ctx context.Context, session *web.Session) error
	DeleteDelivery(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error)
	// Deprecated: build your own add request
	BuildAddRequest(ctx context.Context, marketplaceCode string, variantMarketplaceCode string, qty int, additionalData map[string]string) cartDomain.AddRequest
	AddProduct(ctx context.Context, session *web.Session, deliveryCode string, addRequest cartDomain.AddRequest) (productDomain.BasicProduct, error)
	CreateInitialDeliveryIfNotPresent(ctx context.Context, session *web.Session, deliveryCode string) (*cartDomain.Cart, error)
	GetInitialDelivery(deliveryCode string) (*cartDomain.DeliveryInfo, error)
	ApplyVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)
	ApplyAny(ctx context.Context, session *web.Session, anyCode string) (*cartDomain.Cart, error)
	RemoveVoucher(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)
	ApplyGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)
	RemoveGiftCard(ctx context.Context, session *web.Session, couponCode string) (*cartDomain.Cart, error)
	DeleteCartInCache(ctx context.Context, session *web.Session, cart *cartDomain.Cart)
	ReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)
	ForceReserveOrderIDAndSave(ctx context.Context, session *web.Session) (*cartDomain.Cart, error)
	PlaceOrderWithCart(ctx context.Context, session *web.Session, cart *cartDomain.Cart, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error)
	PlaceOrder(ctx context.Context, session *web.Session, payment *placeorder.Payment) (placeorder.PlacedOrderInfos, error)
	CancelOrder(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos, cart cartDomain.Cart) (*cartDomain.Cart, error)
	CancelOrderWithoutRestore(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos) error
	GetDefaultDeliveryCode() string
	AdjustItemsToRestrictedQty(ctx context.Context, session *web.Session) (QtyAdjustmentResults, error)
	UpdateAdditionalData(ctx context.Context, session *web.Session, additionalData map[string]string) (*cartDomain.Cart, error)
	UpdateDeliveryAdditionalData(ctx context.Context, session *web.Session, deliveryCode string, additionalData map[string]string) (*cartDomain.Cart, error)
}

Service that provides functionality regarding the cart

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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