Documentation
¶
Index ¶
- Constants
- Variables
- type Attribute
- type Attributes
- type BasicProduct
- type BasicProductData
- type CategoryTeaser
- type Charges
- type ConfigurableProduct
- func (p ConfigurableProduct) BaseData() BasicProductData
- func (p ConfigurableProduct) GetConfigurableWithActiveVariant(variantMarketplaceCode string) (ConfigurableProductWithActiveVariant, error)
- func (p ConfigurableProduct) GetDefaultVariant() (*Variant, error)
- func (p ConfigurableProduct) GetIdentifier() string
- func (p ConfigurableProduct) GetMedia(group string, usage string) Media
- func (p ConfigurableProduct) HasMedia(group string, usage string) bool
- func (p ConfigurableProduct) HasVariant(variantMarketplaceCode string) bool
- func (p ConfigurableProduct) IsSaleable() bool
- func (p ConfigurableProduct) SaleableData() Saleable
- func (p ConfigurableProduct) TeaserData() TeaserData
- func (p ConfigurableProduct) Type() string
- func (p ConfigurableProduct) Variant(variantMarketplaceCode string) (*Variant, error)
- type ConfigurableProductWithActiveVariant
- func (p ConfigurableProductWithActiveVariant) BaseData() BasicProductData
- func (p ConfigurableProductWithActiveVariant) ConfigurableBaseData() BasicProductData
- func (p ConfigurableProductWithActiveVariant) GetDefaultVariant() (*Variant, error)
- func (p ConfigurableProductWithActiveVariant) GetIdentifier() string
- func (p ConfigurableProductWithActiveVariant) GetMedia(group string, usage string) Media
- func (p ConfigurableProductWithActiveVariant) HasMedia(group string, usage string) bool
- func (p ConfigurableProductWithActiveVariant) HasVariant(variantMarketplaceCode string) bool
- func (p ConfigurableProductWithActiveVariant) IsSaleable() bool
- func (p ConfigurableProductWithActiveVariant) SaleableData() Saleable
- func (p ConfigurableProductWithActiveVariant) TeaserData() TeaserData
- func (p ConfigurableProductWithActiveVariant) Type() string
- func (p ConfigurableProductWithActiveVariant) Variant(variantMarketplaceCode string) (*Variant, error)
- type LoyaltyPriceInfo
- type Media
- type PriceContext
- type PriceInfo
- type ProductNotFound
- type ProductService
- type Saleable
- type SearchResult
- type SearchService
- type SimpleProduct
- func (p SimpleProduct) BaseData() BasicProductData
- func (p SimpleProduct) GetIdentifier() string
- func (p SimpleProduct) GetMedia(group string, usage string) Media
- func (p SimpleProduct) HasMedia(group string, usage string) bool
- func (p SimpleProduct) IsSaleable() bool
- func (p SimpleProduct) SaleableData() Saleable
- func (p SimpleProduct) TeaserData() TeaserData
- func (p SimpleProduct) Type() string
- type SpecificationEntry
- type SpecificationGroup
- type Specifications
- type TeaserData
- type Unit
- type Variant
- type WishedToPay
Constants ¶
const ( MediaUsageList = "list" MediaUsageDetail = "detail" MediaUsageThumbnail = "thumbnail" )
Media usage constants
const ( // TypeConfigurable denotes configurable products TypeConfigurable = "configurable" // TypeConfigurableWithActiveVariant denotes configurable products that has a variant selected TypeConfigurableWithActiveVariant = "configurable_with_activevariant" )
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)
const (
// TypeSimple denotes simple products
TypeSimple = "simple"
)
Variables ¶
var Units = map[string]Unit{}/* 140 elements not displayed */
Units provides the unit map
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
Attribute for product attributes
func (Attribute) HasMultipleValues ¶
HasMultipleValues checks for multiple raw values
func (Attribute) HasUnitCode ¶
HasUnitCode checks if a unit code is set on the attribute
func (Attribute) IsDisabledValue ¶
IsDisabledValue returns true if the value can be seen as a disable toggle/swicth value
func (Attribute) IsEnabledValue ¶
IsEnabledValue returns true if the value can be seen as a toogle and is enabled
type BasicProduct ¶
type BasicProduct interface { BaseData() BasicProductData GetSpecifications() Specifications //IsSaleable - indicates if that product type can be purchased IsSaleable() bool SaleableData() Saleable Type() string GetIdentifier() string HasMedia(group string, usage string) bool GetMedia(group string, usage string) Media }
BasicProduct interface - Need to be implements by all Product Types!
type BasicProductData ¶
type BasicProductData struct { Title string Attributes Attributes ShortDescription string Description string Media []Media 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 StockLevel string Keywords []string IsNew bool }
BasicProductData is the basic product model
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) 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
type CategoryTeaser ¶
CategoryTeaser - Represents some Teaser infos for Category
type Charges ¶
type Charges struct {
// contains filtered or unexported fields
}
Charges - Represents the Charges the product need to be payed with
type ConfigurableProduct ¶
type ConfigurableProduct struct { Identifier string BasicProductData VariantVariationAttributes []string Variants []Variant VariantVariationAttributesSorting map[string][]string }
ConfigurableProduct - A product that can be teasered and that has Sellable Variants Aggregated
func (ConfigurableProduct) BaseData ¶
func (p ConfigurableProduct) BaseData() BasicProductData
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
type ConfigurableProductWithActiveVariant ¶
type ConfigurableProductWithActiveVariant struct { Identifier string BasicProductData VariantVariationAttributes []string Variants []Variant ActiveVariant Variant }
ConfigurableProductWithActiveVariant - A product that can be teasered and that has Sellable Variants Aggregated, One Variant is Active
func (ConfigurableProductWithActiveVariant) BaseData ¶
func (p ConfigurableProductWithActiveVariant) BaseData() BasicProductData
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) 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 ¶
func (p ConfigurableProductWithActiveVariant) IsSaleable() bool
IsSaleable is true
func (ConfigurableProductWithActiveVariant) SaleableData ¶
func (p ConfigurableProductWithActiveVariant) SaleableData() Saleable
SaleableData getter for ConfigurableProduct Gets either the first or the active variants saleableData
func (ConfigurableProductWithActiveVariant) TeaserData ¶
func (p ConfigurableProductWithActiveVariant) TeaserData() TeaserData
TeaserData interface implementation for SimpleProduct
func (ConfigurableProductWithActiveVariant) Type ¶
func (p ConfigurableProductWithActiveVariant) Type() string
Type getter
type LoyaltyPriceInfo ¶
type LoyaltyPriceInfo struct { //Type - Name( or Type) of the Loyalty program Type string PointPrice priceDomain.Price MinPointsToSpent big.Float MaxPointsToSpent big.Float }
LoyaltyPriceInfo - contains info used for product with
func (LoyaltyPriceInfo) GetAmountToSpend ¶
func (l LoyaltyPriceInfo) GetAmountToSpend(wishedAmount *big.Float) big.Float
GetAmountToSpend - takes the whishedamaount and evaluates min and max and returns the points that need to be payed.
func (LoyaltyPriceInfo) GetRate ¶
func (l LoyaltyPriceInfo) GetRate(valuedPrice priceDomain.Price) big.Float
GetRate - get the currency conversion rate of the current loyaltyprice in relation to the passed value
type PriceContext ¶
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 ActiveBaseAmount big.Float 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 //LoyaltyPrices - Optional infos for products that can be payed in a loyalty program LoyaltyPrices []LoyaltyPriceInfo }
Saleable are properties required for being selled
func (Saleable) GetChargesToPay ¶
func (p Saleable) GetChargesToPay(wishedToPay *WishedToPay) Charges
GetChargesToPay Gets the Charges that need to be payed by type
func (Saleable) IsSaleableNow ¶
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 }
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) 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 ¶
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 TeaserData ¶
type TeaserData struct { PriceInfo TeaserPriceIsFromPrice bool PreSelectedVariantSku string Media []Media //The sku that should be used to link from Teasers }TeaserPrice
TeaserData is the teaser-information for product previews
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 ¶
SaleableData getter for Saleable
type WishedToPay ¶
type WishedToPay struct {
// contains filtered or unexported fields
}
WishedToPay - list of prices by type
func NewWishedToPay ¶
func NewWishedToPay() WishedToPay
NewWishedToPay - factory to get new WishedToPay struct
func (WishedToPay) Add ¶
func (w WishedToPay) Add(ctype string, price priceDomain.Price) WishedToPay
Add - returns new WishedToPay instance with the given whish added
func (WishedToPay) GetByType ¶
func (w WishedToPay) GetByType(ctype string) *priceDomain.Price
GetByType - returns the wihsed price for the given type or nil