domain

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 9 Imported by: 35

Documentation

Index

Constants

View Source
const (
	MediaUsageList      = "list"
	MediaUsageDetail    = "detail"
	MediaUsageThumbnail = "thumbnail"
)

Media usage constants

View Source
const (
	StockLevelOutOfStock = "out"
	StockLevelInStock    = "in"
	StockLevelLowStock   = "low"
)

Stock Level values

View Source
const (
	// TypeBundle denotes bundle products
	TypeBundle                  = "bundle"
	TypeBundleWithActiveChoices = "bundle_with_active_choices"
)
View Source
const (
	// TypeConfigurable denotes configurable products
	TypeConfigurable = "configurable"

	// TypeConfigurableWithActiveVariant denotes configurable products that has a variant selected
	TypeConfigurableWithActiveVariant = "configurable_with_activevariant"
)
View Source
const (
	// Area Units
	SQUARE_MILLIMETER = "SQUARE_MILLIMETER"
	SQUARE_CENTIMETER = "SQUARE_CENTIMETER"
	SQUARE_DECIMETER  = "SQUARE_DECIMETER"
	SQUARE_METER      = "SQUARE_METER"
	CENTIARE          = "CENTIARE"
	SQUARE_DEKAMETER  = "SQUARE_DEKAMETER"
	ARE               = "ARE"
	SQUARE_HECTOMETER = "SQUARE_HECTOMETER"
	HECTARE           = "HECTARE"
	SQUARE_KILOMETER  = "SQUARE_KILOMETER"
	SQUARE_MIL        = "SQUARE_MIL"
	SQUARE_INCH       = "SQUARE_INCH"
	SQUARE_FOOT       = "SQUARE_FOOT"
	SQUARE_YARD       = "SQUARE_YARD"
	ARPENT            = "ARPENT"
	ACRE              = "ACRE"
	SQUARE_FURLONG    = "SQUARE_FURLONG"
	SQUARE_MILE       = "SQUARE_MILE"

	// Binary Units
	BIT      = "BIT"
	BYTE     = "BYTE"
	KILOBYTE = "KILOBYTE"
	MEGABYTE = "MEGABYTE"
	GIGABYTE = "GIGABYTE"
	TERABYTE = "TERABYTE"

	// Loudness Units
	DECIBEL = "DECIBEL"

	// Frequency Units
	HERTZ     = "HERTZ"
	KILOHERTZ = "KILOHERTZ"
	MEGAHERTZ = "MEGAHERTZ"
	GIGAHERTZ = "GIGAHERTZ"
	TERAHERTZ = "TERAHERTZ"

	// Length Unit
	MILLIMETER = "MILLIMETER"
	CENTIMETER = "CENTIMETER"
	DECIMETER  = "DECIMETER"
	METER      = "METER"
	DEKAMETER  = "DEKAMETER"
	HECTOMETER = "HECTOMETER"
	KILOMETER  = "KILOMETER"
	MIL        = "MIL"
	INCH       = "INCH"
	FEET       = "FEET"
	YARD       = "YARD"
	CHAIN      = "CHAIN"
	FURLONG    = "FURLONG"
	MILE       = "MILE"

	// Power Units
	WATT     = "WATT"
	KILOWATT = "KILOWATT"
	MEGAWATT = "MEGAWATT"
	GIGAWATT = "GIGAWATT"
	TERAWATT = "TERAWATT"

	// Voltage Units
	MILLIVOLT = "MILLIVOLT"
	CENTIVOLT = "CENTIVOLT"
	DECIVOLT  = "DECIVOLT"
	VOLT      = "VOLT"
	DEKAVOLT  = "DEKAVOLT"
	HECTOVOLT = "HECTOVOLT"
	KILOVOLT  = "KILOVOLT"

	// Intensity
	MILLIAMPERE = "MILLIAMPERE"
	CENTIAMPERE = "CENTIAMPERE"
	DECIAMPERE  = "DECIAMPERE"
	AMPERE      = "AMPERE"
	DEKAMPERE   = "DEKAMPERE"
	HECTOAMPERE = "HECTOAMPERE"
	KILOAMPERE  = "KILOAMPERE"

	// Resistance
	MILLIOHM = "MILLIOHM"
	CENTIOHM = "CENTIOHM"
	DECIOHM  = "DECIOHM"
	OHM      = "OHM"
	DEKAOHM  = "DEKAOHM"
	HECTOHM  = "HECTOHM"
	KILOHM   = "KILOHM"
	MEGOHM   = "MEGOHM"

	// Speed
	METER_PER_SECOND   = "METER_PER_SECOND"
	METER_PER_MINUTE   = "METER_PER_MINUTE"
	METER_PER_HOUR     = "METER_PER_HOUR"
	KILOMETER_PER_HOUR = "KILOMETER_PER_HOUR"
	FOOT_PER_SECOND    = "FOOT_PER_SECOND"
	FOOT_PER_HOUR      = "FOOT_PER_HOUR"
	YARD_PER_HOUR      = "YARD_PER_HOUR"
	MILE_PER_HOUR      = "MILE_PER_HOUR"

	// Electric Charge
	MILLIAMPEREHOUR = "MILLIAMPEREHOUR"
	AMPEREHOUR      = "AMPEREHOUR"
	MILLICOULOMB    = "MILLICOULOMB"
	CENTICOULOMB    = "CENTICOULOMB"
	DECICOULOMB     = "DECICOULOMB"
	COULOMB         = "COULOMB"
	DEKACOULOMB     = "DEKACOULOMB"
	HECTOCOULOMB    = "HECTOCOULOMB"
	KILOCOULOMB     = "KILOCOULOMB"

	// Duration
	MILLISECOND = "MILLISECOND"
	SECOND      = "SECOND"
	MINUTE      = "MINUTE"
	HOUR        = "HOUR"
	DAY         = "DAY"
	WEEK        = "WEEK"
	MONTH       = "MONTH"
	YEAR        = "YEAR"

	// Temperature
	CELSIUS    = "CELSIUS"
	FAHRENHEIT = "FAHRENHEIT"
	KELVIN     = "KELVIN"
	RANKINE    = "RANKINE"
	REAUMUR    = "REAUMUR"

	// Volume Units
	CUBIC_MILLIMETER = "CUBIC_MILLIMETER"
	CUBIC_CENTIMETER = "CUBIC_CENTIMETER"
	MILLILITER       = "MILLILITER"
	CENTILITER       = "CENTILITER"
	DECILITER        = "DECILITER"
	CUBIC_DECIMETER  = "CUBIC_DECIMETER"
	LITER            = "LITER"
	CUBIC_METER      = "CUBIC_METER"
	OUNCE            = "OUNCE"
	PINT             = "PINT"
	BARREL           = "BARREL"
	GALLON           = "GALLON"
	CUBIC_FOOT       = "CUBIC_FOOT"
	CUBIC_INCH       = "CUBIC_INCH"
	CUBIC_YARD       = "CUBIC_YARD"

	// Weigt Units
	MILLIGRAM = "MILLIGRAM"
	GRAM      = "GRAM"
	KILOGRAM  = "KILOGRAM"
	TON       = "TON"
	GRAIN     = "GRAIN"
	DENIER    = "DENIER"
	POUND     = "POUND"
	MARC      = "MARC"
	LIVRE     = "LIVRE"

	// Pressure
	BAR         = "BAR"
	PASCAL      = "PASCAL"
	HECTOPASCAL = "HECTOPASCAL"
	MILLIBAR    = "MILLIBAR"
	ATM         = "ATM"
	PSI         = "PSI"
	TORR        = "TORR"
	MMHG        = "MMHG"

	// Energy
	JOULE       = "JOULE"
	CALORIE     = "CALORIE"
	KILOCALORIE = "KILOCALORIE"
	KILOJOULE   = "KILOJOULE"

	// Piece / CaseBox Units
	PCS   = "PCS"
	PIECE = "PIECE"
	DOZEN = "DOZEN"
)

Constants of the unit codes See also the PIM unit codes on which these are based (and no other will get into this system)

View Source
const (
	// TypeSimple denotes simple products
	TypeSimple = "simple"
)

Variables

View Source
var (
	ErrRequiredChoicesAreNotSelected = errors.New("required choices are not selected")
	ErrSelectedQuantityOutOfRange    = errors.New("selected quantity is out of range")
	ErrMarketplaceCodeDoNotExists    = errors.New("selected marketplace code does not exist")
)
View Source
var Units = map[string]Unit{}/* 140 elements not displayed */

Units provides the unit map

Functions

This section is empty.

Types

type ActiveChoice added in v3.6.0

type ActiveChoice struct {
	Identifier string
	Required   bool
	Label      string
	Product    BasicProduct
	Qty        int
}

type Attribute

type Attribute struct {
	// Code is the internal attribute identifier
	Code string
	// CodeLabel is the human-readable (perhaps localized) attribute name
	CodeLabel string
	// Label is the human-readable (perhaps localized) attribute value
	Label string
	// RawValue is the untouched original value of the attribute
	RawValue interface{}
	// UnitCode is the internal code of the attribute values measuring unit
	UnitCode string

} // @name ProductAttribute

Attribute for product attributes Example:

Attribute{
		Code:      "my-attribute",
		CodeLabel: "My Attribute",
		Label:     "My attribute value",
		RawValue:  2,
		UnitCode:  "PCS",
	}

func (Attribute) GetUnit

func (at Attribute) GetUnit() Unit

GetUnit returns the unit on an attribute

func (Attribute) HasMultipleValues

func (at Attribute) HasMultipleValues() bool

HasMultipleValues checks for multiple raw values

func (Attribute) HasUnitCode

func (at Attribute) HasUnitCode() bool

HasUnitCode checks if a unit code is set on the attribute

func (Attribute) IsDisabledValue

func (at Attribute) IsDisabledValue() bool

IsDisabledValue returns true if the value can be seen as a disable toggle/switch value

func (Attribute) IsEnabledValue

func (at Attribute) IsEnabledValue() bool

IsEnabledValue returns true if the value can be seen as a toggle and is enabled

func (Attribute) Labels added in v3.6.0

func (at Attribute) Labels() []string

Labels builds a list of human-readable product attribute values in case the raw value is a slice of Attribute, uses Values() as fallback

func (Attribute) Value

func (at Attribute) Value() string

Value returns the raw value

func (Attribute) Values

func (at Attribute) Values() []string

Values builds a list of product attribute values in case the raw value is a slice

type Attributes

type Attributes map[string]Attribute // @name ProductAttributes

Attributes describe a product attributes map

func (Attributes) Attribute

func (a Attributes) Attribute(key string) Attribute

Attribute returns a specified attribute

func (Attributes) AttributeKeys

func (a Attributes) AttributeKeys() []string

AttributeKeys lists all available keys

func (Attributes) Attributes

func (a Attributes) Attributes() []Attribute

Attributes lists all attributes

func (Attributes) AttributesByKey added in v3.2.0

func (a Attributes) AttributesByKey(keys []string) []Attribute

AttributesByKey returns slice of attributes by given attribute keys

func (Attributes) HasAttribute

func (a Attributes) HasAttribute(key string) bool

HasAttribute checks if an attribute is available

type Badge added in v3.4.0

type Badge struct {
	Code  string
	Label string
}

Badge for a product Example:

Badge {
  Code: "new",
  Label: "New Product",
}

type Badges added in v3.4.0

type Badges []Badge

Badges slice of Badge

func (Badges) First added in v3.4.0

func (b Badges) First() *Badge

First of the badges, returns nil if there is no first badge

type BasicProduct

type BasicProduct interface {
	// BaseData gives you basic product information
	// like attributes, title, media, marketplacecode etc
	BaseData() BasicProductData
	// TeaserData gives you basic information to typically show in list views - including a teaser prices
	TeaserData() TeaserData
	// GetSpecifications return grouped specifications - typically used for comparisons
	GetSpecifications() Specifications
	// IsSaleable indicates if that product type can be purchased in general
	IsSaleable() bool
	// SaleableData returns information required to purchase - like the definite price information
	// makes only sense to call if IsSaleable() returns true
	SaleableData() Saleable
	// Type returns product type
	Type() string
	// GetIdentifier returns an identifier for the product instance
	GetIdentifier() string
	HasMedia(group string, usage string) bool
	GetMedia(group string, usage string) Media
}

BasicProduct interface need to be implemented by all Product Types!

type BasicProductData

type BasicProductData struct {
	Title            string
	Attributes       Attributes
	ShortDescription string
	Description      string
	Media            []Media
	Badges           Badges

	MarketPlaceCode string
	RetailerCode    string
	RetailerSku     string
	RetailerName    string

	CreatedAt   time.Time
	UpdatedAt   time.Time
	VisibleFrom time.Time
	VisibleTo   time.Time

	Categories   []CategoryTeaser
	MainCategory CategoryTeaser

	CategoryToCodeMapping []string

	// Deprecated: use Stock[x].Level instead
	StockLevel string
	Stock      []Stock

	Keywords []string
	IsNew    bool
}

BasicProductData is the basic product model

func (BasicProductData) Attribute

func (bpd BasicProductData) Attribute(key string) Attribute

Attribute get Attribute by key

func (BasicProductData) GetListMedia

func (bpd BasicProductData) GetListMedia() Media

GetListMedia returns the product media for listing

func (BasicProductData) GetMedia

func (bpd BasicProductData) GetMedia(usage string) Media

GetMedia returns the FIRST found product media by usage

func (BasicProductData) GetSpecifications

func (bpd BasicProductData) GetSpecifications() Specifications

GetSpecifications getter

func (BasicProductData) HasAllAttributes added in v3.4.0

func (bpd BasicProductData) HasAllAttributes(keys []string) bool

HasAllAttributes returns true, if all attributes are set

func (BasicProductData) HasAttribute

func (bpd BasicProductData) HasAttribute(key string) bool

HasAttribute check

func (BasicProductData) IsInStock

func (bpd BasicProductData) IsInStock() bool

IsInStock returns information if current product whether in stock or not

func (BasicProductData) IsInStockForDeliveryCode added in v3.6.0

func (bpd BasicProductData) IsInStockForDeliveryCode(deliveryCode string) bool

IsInStockForDeliveryCode returns information if current product whether in stock or not for provided delivery code

type BundleConfiguration added in v3.6.0

type BundleConfiguration map[Identifier]ChoiceConfiguration

func (BundleConfiguration) Equals added in v3.7.0

func (bc BundleConfiguration) Equals(other BundleConfiguration) bool

Equals compares the marketplace codes of all choices

type BundleProduct added in v3.6.0

type BundleProduct struct {
	Identifier string
	Choices    []Choice
	BasicProductData
	Teaser TeaserData
	Saleable
}

func (BundleProduct) BaseData added in v3.6.0

func (b BundleProduct) BaseData() BasicProductData

func (BundleProduct) GetBundleProductWithActiveChoices added in v3.6.0

func (b BundleProduct) GetBundleProductWithActiveChoices(bundleConfiguration BundleConfiguration) (BundleProductWithActiveChoices, error)

func (BundleProduct) GetIdentifier added in v3.6.0

func (b BundleProduct) GetIdentifier() string

func (BundleProduct) GetMedia added in v3.6.0

func (b BundleProduct) GetMedia(group string, usage string) Media

func (BundleProduct) HasMedia added in v3.6.0

func (b BundleProduct) HasMedia(group string, usage string) bool

func (BundleProduct) IsSaleable added in v3.6.0

func (b BundleProduct) IsSaleable() bool

func (BundleProduct) SaleableData added in v3.6.0

func (b BundleProduct) SaleableData() Saleable

func (BundleProduct) TeaserData added in v3.6.0

func (b BundleProduct) TeaserData() TeaserData

func (BundleProduct) Type added in v3.6.0

func (b BundleProduct) Type() string

type BundleProductWithActiveChoices added in v3.6.0

type BundleProductWithActiveChoices struct {
	BundleProduct
	ActiveChoices map[Identifier]ActiveChoice
}

BundleProductWithActiveChoices - A product with preselected choices

func (BundleProductWithActiveChoices) ExtractBundleConfig added in v3.6.0

func (b BundleProductWithActiveChoices) ExtractBundleConfig() BundleConfiguration

func (BundleProductWithActiveChoices) Type added in v3.6.0

type CategoryTeaser

type CategoryTeaser struct {
	// Code the identifier of the Category
	Code string
	// The Path (root to leaf) for this Category - separated by "/"
	Path string
	// Name is the speaking name of the category
	Name string
	// Parent is an optional link to parent teaser
	Parent *CategoryTeaser `swaggerignore:"true"`
}

CategoryTeaser represents some Teaser infos for Category

func (*CategoryTeaser) CPath added in v3.4.0

func (c *CategoryTeaser) CPath() string

CPath returns the constructed Path from this category to the root - splitted by /

type Choice added in v3.6.0

type Choice struct {
	Identifier string
	Required   bool
	Label      string
	Options    []Option
}

type ChoiceConfiguration added in v3.6.0

type ChoiceConfiguration struct {
	MarketplaceCode        string
	VariantMarketplaceCode string
	Qty                    int
}

type Configurable

type Configurable interface {
	GetConfigurableWithActiveVariant(variantMarketplaceCode string) (ConfigurableProductWithActiveVariant, error)
	Variant(variantMarketplaceCode string) (*Variant, error)
	GetDefaultVariant() (*Variant, error)
	HasVariant(variantMarketplaceCode string) bool
}

Configurable - interface that is implemented by ConfigurableProduct and ConfigurableProductWithActiveVariant

type ConfigurableProduct

type ConfigurableProduct struct {
	Identifier string
	BasicProductData
	Teaser                            TeaserData
	VariantVariationAttributes        []string
	Variants                          []Variant
	VariantVariationAttributesSorting map[string][]string
}

ConfigurableProduct - A product that can be teasered and that has Sellable Variants Aggregated

func (ConfigurableProduct) BaseData

BaseData interface implementation for ConfigurableProduct

func (ConfigurableProduct) GetConfigurableWithActiveVariant

func (p ConfigurableProduct) GetConfigurableWithActiveVariant(variantMarketplaceCode string) (ConfigurableProductWithActiveVariant, error)

GetConfigurableWithActiveVariant getter

func (ConfigurableProduct) GetDefaultVariant

func (p ConfigurableProduct) GetDefaultVariant() (*Variant, error)

GetDefaultVariant getter

func (ConfigurableProduct) GetIdentifier

func (p ConfigurableProduct) GetIdentifier() string

GetIdentifier interface implementation for SimpleProduct

func (ConfigurableProduct) GetMedia

func (p ConfigurableProduct) GetMedia(group string, usage string) Media

GetMedia for ConfigurableProduct

func (ConfigurableProduct) HasMedia

func (p ConfigurableProduct) HasMedia(group string, usage string) bool

HasMedia for ConfigurableProduct

func (ConfigurableProduct) HasVariant

func (p ConfigurableProduct) HasVariant(variantMarketplaceCode string) bool

HasVariant for ConfigurableProduct

func (ConfigurableProduct) IsSaleable

func (p ConfigurableProduct) IsSaleable() bool

IsSaleable defaults to false

func (ConfigurableProduct) SaleableData

func (p ConfigurableProduct) SaleableData() Saleable

SaleableData getter for ConfigurableProduct - Configurable is NOT Salable

func (ConfigurableProduct) TeaserData

func (p ConfigurableProduct) TeaserData() TeaserData

TeaserData interface implementation for SimpleProduct

func (ConfigurableProduct) Type

func (p ConfigurableProduct) Type() string

Type interface implementation for SimpleProduct

func (ConfigurableProduct) Variant

func (p ConfigurableProduct) Variant(variantMarketplaceCode string) (*Variant, error)

Variant getter for ConfigurableProduct Variant is retrieved via marketplaceCode of the variant

type ConfigurableProductWithActiveVariant

type ConfigurableProductWithActiveVariant struct {
	Identifier string
	BasicProductData
	Teaser                            TeaserData
	VariantVariationAttributes        []string
	Variants                          []Variant
	VariantVariationAttributesSorting map[string][]string
	ActiveVariant                     Variant
}

ConfigurableProductWithActiveVariant - A product that can be teasered and that has Sellable Variants Aggregated, One Variant is Active

func (ConfigurableProductWithActiveVariant) BaseData

BaseData returns only BaseData for Active Variant. If you need the BaseData of the Configurable - use ConfigurableBaseData()

func (ConfigurableProductWithActiveVariant) ConfigurableBaseData

func (p ConfigurableProductWithActiveVariant) ConfigurableBaseData() BasicProductData

ConfigurableBaseData getter

func (ConfigurableProductWithActiveVariant) GetConfigurableWithActiveVariant

func (p ConfigurableProductWithActiveVariant) GetConfigurableWithActiveVariant(variantMarketplaceCode string) (ConfigurableProductWithActiveVariant, error)

GetConfigurableWithActiveVariant getter

func (ConfigurableProductWithActiveVariant) GetDefaultVariant

func (p ConfigurableProductWithActiveVariant) GetDefaultVariant() (*Variant, error)

GetDefaultVariant getter

func (ConfigurableProductWithActiveVariant) GetIdentifier

func (p ConfigurableProductWithActiveVariant) GetIdentifier() string

GetIdentifier getter

func (ConfigurableProductWithActiveVariant) GetMedia

func (p ConfigurableProductWithActiveVariant) GetMedia(group string, usage string) Media

GetMedia for ConfigurableProduct

func (ConfigurableProductWithActiveVariant) HasMedia

func (p ConfigurableProductWithActiveVariant) HasMedia(group string, usage string) bool

HasMedia for ConfigurableProduct

func (ConfigurableProductWithActiveVariant) HasVariant

func (p ConfigurableProductWithActiveVariant) HasVariant(variantMarketplaceCode string) bool

HasVariant for ConfigurableProduct

func (ConfigurableProductWithActiveVariant) IsSaleable

IsSaleable is true

func (ConfigurableProductWithActiveVariant) SaleableData

SaleableData getter for ConfigurableProduct Gets either the first or the active variants saleableData

func (ConfigurableProductWithActiveVariant) TeaserData

TeaserData interface implementation for SimpleProduct

func (ConfigurableProductWithActiveVariant) Type

Type getter

func (ConfigurableProductWithActiveVariant) Variant

func (p ConfigurableProductWithActiveVariant) Variant(variantMarketplaceCode string) (*Variant, error)

Variant getter for ConfigurableProduct Variant is retrieved via marketplaceCode of the variant

type Identifier added in v3.6.0

type Identifier string

type LoyaltyEarningInfo added in v3.3.0

type LoyaltyEarningInfo struct {
	Type    string
	Default priceDomain.Price
}

LoyaltyEarningInfo contains earning infos

type LoyaltyPriceInfo

type LoyaltyPriceInfo struct {
	// Type or Name of the Loyalty program
	Type             string
	Default          priceDomain.Price
	IsDiscounted     bool
	Discounted       priceDomain.Price
	DiscountText     string
	MinPointsToSpent big.Float  `swaggertype:"string"`
	MaxPointsToSpent *big.Float `swaggertype:"string"`
	Context          PriceContext
}

LoyaltyPriceInfo contains info used for product with

func (LoyaltyPriceInfo) GetFinalPrice

func (l LoyaltyPriceInfo) GetFinalPrice() priceDomain.Price

GetFinalPrice gets either the Default or the Discounted Loyaltyprice

func (LoyaltyPriceInfo) GetRate

func (l LoyaltyPriceInfo) GetRate(valuedPrice priceDomain.Price) big.Float

GetRate returns the currency conversion rate of the current loyaltyprice final price in relation to the passed value

func (LoyaltyPriceInfo) HasMax

func (l LoyaltyPriceInfo) HasMax() bool

HasMax checks if product has a maximum (points to spend) restriction

type Media

type Media struct {
	Type      string
	MimeType  string
	Usage     string
	Title     string
	Reference string

} // @name ProductMedia

Media holds product media information

type Option added in v3.6.0

type Option struct {
	Product BasicProduct
	MinQty  int
	MaxQty  int
}

func (*Option) UnmarshalJSON added in v3.6.0

func (o *Option) UnmarshalJSON(optionData []byte) error

type PriceContext

type PriceContext struct {
	DeliveryCode  string
	CustomerGroup string
	ChannelCode   string
	Locale        string
}

PriceContext defines the scope in which the price was calculated

type PriceInfo

type PriceInfo struct {
	Default           priceDomain.Price
	Discounted        priceDomain.Price
	DiscountText      string
	ActiveBase        big.Float `swaggertype:"string"`
	ActiveBaseAmount  big.Float `swaggertype:"string"`
	ActiveBaseUnit    string
	IsDiscounted      bool
	CampaignRules     []string
	DenyMoreDiscounts bool
	Context           PriceContext
	TaxClass          string
}

PriceInfo holds product price information

func (PriceInfo) GetFinalPrice

func (p PriceInfo) GetFinalPrice() priceDomain.Price

GetFinalPrice getter for price that should be used in calculations (either discounted or default)

type ProductNotFound

type ProductNotFound struct {
	MarketplaceCode string
}

ProductNotFound is an error

func (ProductNotFound) Error

func (err ProductNotFound) Error() string

Error implements the error interface

type ProductService

type ProductService interface {
	// Get a product
	Get(ctx context.Context, marketplaceCode string) (BasicProduct, error)
}

ProductService interface

type Saleable

type Saleable struct {
	IsSaleable         bool
	SaleableFrom       time.Time
	SaleableTo         time.Time
	ActivePrice        PriceInfo
	AvailablePrices    []PriceInfo
	ActiveLoyaltyPrice *LoyaltyPriceInfo
	// LoyaltyPrices holds optional infos for products that can be paid in a loyalty program
	LoyaltyPrices []LoyaltyPriceInfo
	// LoyaltyEarnings holds optional infos about potential loyalty earnings
	LoyaltyEarnings []LoyaltyEarningInfo
}

Saleable are properties required for being selled

func (Saleable) GetLoyaltyChargeSplit

func (p Saleable) GetLoyaltyChargeSplit(valuedPriceToPay *priceDomain.Price, loyaltyPointsWishedToPay *WishedToPay, qty int) priceDomain.Charges

GetLoyaltyChargeSplit gets the Charges that need to be paid by type: Type "main" is the remaining charge in the main currency and the other charges returned are the loyalty price charges that need to be paid. The method takes the min, max and the calculated loyalty conversion rate into account

* valuedPriceToPay Optional the price that need to be paid - if not given the products final price will be used * loyaltyPointsWishedToPay Optional a list of loyaltyPrices that the (customer) wants to spend. Its used as a wish and may not be fulfilled because of min, max properties on the products loyaltyPrices * qty the quantity of the current item affects min max loyalty charge

func (Saleable) GetLoyaltyChargeSplitIgnoreMin

func (p Saleable) GetLoyaltyChargeSplitIgnoreMin(valuedPriceToPay *priceDomain.Price, loyaltyPointsWishedToPay *WishedToPay, qty int) priceDomain.Charges

GetLoyaltyChargeSplitIgnoreMin same as GetLoyaltyChargeSplit but ignoring the min points to spend

func (Saleable) GetLoyaltyEarningByType added in v3.3.0

func (p Saleable) GetLoyaltyEarningByType(ltype string) (*LoyaltyEarningInfo, bool)

GetLoyaltyEarningByType returns the loyalty earning infos for a specific loyalty type

func (Saleable) GetLoyaltyPriceByType

func (p Saleable) GetLoyaltyPriceByType(ltype string) (*LoyaltyPriceInfo, bool)

GetLoyaltyPriceByType returns first encountered loyalty price with this type

func (Saleable) IsSaleableNow

func (p Saleable) IsSaleableNow() bool

IsSaleableNow checks flag and time

type SearchResult

type SearchResult struct {
	searchDomain.Result
	Hits []BasicProduct
}

SearchResult returns product hits

type SearchService

type SearchService interface {
	//Search returns Products based on given Filters
	Search(ctx context.Context, filter ...searchDomain.Filter) (*SearchResult, error)
	// SearchBy returns Products prefiltered by the given attribute (also based on additional given Filters)
	// e.g. SearchBy(ctx,"brandCode","apple")
	SearchBy(ctx context.Context, attribute string, values []string, filter ...searchDomain.Filter) (*SearchResult, error)
}

SearchService is a typed search for products

type SimpleProduct

type SimpleProduct struct {
	Identifier string
	BasicProductData
	Saleable
	Teaser TeaserData
}

SimpleProduct - A product without Variants that can be teasered and being sold

func (SimpleProduct) BaseData

func (p SimpleProduct) BaseData() BasicProductData

BaseData interface implementation for SimpleProduct

func (SimpleProduct) GetIdentifier

func (p SimpleProduct) GetIdentifier() string

GetIdentifier interface implementation for SimpleProduct

func (SimpleProduct) GetMedia

func (p SimpleProduct) GetMedia(group string, usage string) Media

GetMedia for SimpleProduct

func (SimpleProduct) HasMedia

func (p SimpleProduct) HasMedia(group string, usage string) bool

HasMedia for SimpleProduct

func (SimpleProduct) IsSaleable

func (p SimpleProduct) IsSaleable() bool

IsSaleable is true

func (SimpleProduct) SaleableData

func (p SimpleProduct) SaleableData() Saleable

SaleableData getter for SimpleProduct

func (SimpleProduct) TeaserData

func (p SimpleProduct) TeaserData() TeaserData

TeaserData interface implementation for SimpleProduct

func (SimpleProduct) Type

func (p SimpleProduct) Type() string

Type interface implementation for SimpleProduct

type SpecificationEntry

type SpecificationEntry struct {
	Label  string
	Values []string
}

SpecificationEntry data

type SpecificationGroup

type SpecificationGroup struct {
	Title   string
	Entries []SpecificationEntry
}

SpecificationGroup groups specifications

type Specifications

type Specifications struct {
	Groups []SpecificationGroup
}

Specifications of a product

type Stock added in v3.6.0

type Stock struct {
	InStock      bool
	Level        string
	Amount       int
	DeliveryCode string
}

Stock holds data with product availability info

type TeaserData

type TeaserData struct {
	ShortTitle       string
	ShortDescription string
	URLSlug          string
	// TeaserPrice is the price that should be shown in teasers (listview)
	TeaserPrice PriceInfo
	// TeaserPriceIsFromPrice is set to true in cases where a product might have different prices (e.g. configurable)
	TeaserPriceIsFromPrice bool
	// PreSelectedVariantSku might be set for configurables to give a hint to link to a variant of a configurable (That might be the case if a user filters for an attribute and in the teaser the variant with that attribute is shown)
	PreSelectedVariantSku string
	// Media
	Media []Media
	// The sku that should be used to link from Teasers
	MarketPlaceCode       string
	TeaserAvailablePrices []PriceInfo
	// TeaserLoyaltyPriceInfo is the loyalty price that can be used for teaser (e.g. on listing views)
	TeaserLoyaltyPriceInfo *LoyaltyPriceInfo
	// TeaserLoyaltyEarning is the teaser for the loyalty earning used in grid / list view
	TeaserLoyaltyEarningInfo *LoyaltyEarningInfo
	// Badges optional slice of badges to teaser a product
	Badges Badges
}

TeaserData is the teaser-information for product previews

type Unit

type Unit struct {
	Code   string
	Symbol string
}

Unit describes a unit on an attribute

type Variant

type Variant struct {
	BasicProductData
	Saleable
}

Variant is a concrete kind of a product

func (Variant) BaseData

func (v Variant) BaseData() BasicProductData

BaseData getter for BasicProductData

func (Variant) SaleableData

func (v Variant) SaleableData() Saleable

SaleableData getter for Saleable

type WishedToPay

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

WishedToPay is the list of prices by type

func NewWishedToPay

func NewWishedToPay() WishedToPay

NewWishedToPay returns a new WishedToPay struct

func (WishedToPay) Add

func (w WishedToPay) Add(ctype string, price priceDomain.Price) WishedToPay

Add returns new WishedToPay instance with the given wish added

func (WishedToPay) GetByType

func (w WishedToPay) GetByType(ctype string) *priceDomain.Price

GetByType returns the wished price for the given type or nil

func (WishedToPay) Split

func (w WishedToPay) Split(count int) []WishedToPay

Split splits the given WishedToPay in payable childs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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