Documentation
¶
Overview ¶
Package basket_item is a generated GoMock package.
Index ¶
- Constants
- func CalculateBonus(user *userv1.User, prices *productv1.ProductPriceByRegion) int
- func NewTypeServices(serviceClient servicev1.ServiceAPIClient, ...) *typeService
- type AllowResale
- type CatalogServicesToDomainMapper
- type ChangedItemInfoAdditions
- type CompositeFactory
- type ConfId
- type ConfItem
- type ConfItemService
- type ConfType
- type ConfigurationProblemAdditions
- type ConfiguratorItemAdditions
- func (c *ConfiguratorItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
- func (c *ConfiguratorItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
- func (c *ConfiguratorItemAdditions) GetConfId() string
- func (c *ConfiguratorItemAdditions) GetConfType() ConfType
- func (c *ConfiguratorItemAdditions) IsMutable() bool
- func (c *ConfiguratorItemAdditions) SetConfId(v string)
- func (c *ConfiguratorItemAdditions) SetConfType(v ConfType)
- type CountMoreThenAvailInfoAdditions
- type Group
- type Info
- type InfoAdditions
- type InfoId
- type Item
- func (i *Item) AddChild(child *Item) error
- func (i *Item) AddInfo(infos ...*Info)
- func (i *Item) AddProblem(problems ...*Problem)
- func (i *Item) Additions() *ItemAdditions
- func (i *Item) AllowResale() *AllowResale
- func (i *Item) AllowUnselect() bool
- func (i *Item) Bonus() int
- func (i *Item) CalculateMaxCount(maxAvailable int) int
- func (i *Item) CancelSimulateProblems()
- func (i *Item) CommitChanges()
- func (i *Item) CommitInfo(id InfoId)
- func (i *Item) CorrectCountFromMultiplicity(count int) int
- func (i *Item) Cost() int
- func (i *Item) Count() int
- func (i *Item) CountMultiplicity() int
- func (i *Item) DecodeMsgpack(d *msgpack.Decoder) error
- func (i *Item) DeleteProblems()
- func (i *Item) EncodeMsgpack(e *msgpack.Encoder) error
- func (i *Item) Fingerprint() string
- func (i *Item) FixBonus(bonus int)
- func (i *Item) FixCount(count int)
- func (i *Item) FixName(name string)
- func (i *Item) FixPrice(price int)
- func (i *Item) GetDiscount() ItemDiscount
- func (i *Item) HasFairPrice() bool
- func (i *Item) IgnoreFairPrice() bool
- func (i *Item) IgnoreFairPriceChanged() bool
- func (i *Item) Image() string
- func (i *Item) Infos() map[InfoId]*Info
- func (i *Item) IsChanged() bool
- func (i *Item) IsChild() bool
- func (i *Item) IsChildOf(parent *Item) bool
- func (i *Item) IsMovableFromConfiguration() bool
- func (i *Item) IsMovableToConfiguration() bool
- func (i *Item) IsPrepaymentMandatory() bool
- func (i *Item) IsSelected() bool
- func (i *Item) ItemId() ItemId
- func (i *Item) MakeChildOf(parent *Item) error
- func (i *Item) MarkedPurchaseReason() MarkedPurchaseReason
- func (i *Item) Name() string
- func (i *Item) ParentUniqId() UniqId
- func (i *Item) Price() int
- func (i *Item) PriceColumn() catalog_types.PriceColumn
- func (i *Item) Problems() []*Problem
- func (i *Item) Rules() *Rules
- func (i *Item) SetAllowResale(v *AllowResale)
- func (i *Item) SetBonus(bonus int)
- func (i *Item) SetCount(count int) error
- func (i *Item) SetCountMultiplicity(countMultiplicity int)
- func (i *Item) SetDiscount(v ItemDiscount)
- func (i *Item) SetHasFairPrice(hasFairPrice bool)
- func (i *Item) SetIgnoreFairPrice(isIgnoreFairPrice bool)
- func (i *Item) SetImage(image string)
- func (i *Item) SetIsSelected(isSelected bool)
- func (i *Item) SetMarkedPurchaseReason(purchaseReason MarkedPurchaseReason)
- func (i *Item) SetMovableFromConfiguration(v bool)
- func (i *Item) SetMovableToConfiguration(v bool)
- func (i *Item) SetPrepaymentMandatory(isPrepaymentMandatory bool)
- func (i *Item) SetPrice(price int)
- func (i *Item) SetPriceColumn(priceColumn catalog_types.PriceColumn)
- func (i *Item) SetSpaceId(spaceId store_types.SpaceId)
- func (i *Item) SetType(v Type)
- func (i *Item) SimulateProblem(problems ...*Problem)
- func (i *Item) SortTypeValue() int
- func (i *Item) SpaceId() store_types.SpaceId
- func (i *Item) Spec() *Spec
- func (i *Item) ToXItem() *XItem
- func (i *Item) ToXmlItem() *XMLItem
- func (i *Item) Type() Type
- func (i *Item) UniqId() UniqId
- type ItemAdditions
- func (i *ItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
- func (i *ItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
- func (i *ItemAdditions) GetConfiguration() *ConfiguratorItemAdditions
- func (i *ItemAdditions) GetProduct() *ProductItemAdditions
- func (i *ItemAdditions) GetService() *Service
- func (i *ItemAdditions) GetSubcontractServiceForProduct() *SubcontractItemAdditions
- func (i *ItemAdditions) SetConfiguration(v *ConfiguratorItemAdditions)
- func (i *ItemAdditions) SetProduct(v *ProductItemAdditions)
- func (i *ItemAdditions) SetService(v *Service)
- func (i *ItemAdditions) SetSubcontractServiceForProduct(info *SubcontractItemAdditions)
- type ItemDiscount
- type ItemFactory
- type ItemId
- type ItemList
- type ItemMap
- type Items
- type MarkedPurchaseReason
- type MaxItemCountError
- type MockItemFactory
- type MockItemFactoryMockRecorder
- type MockSpecer
- type MockSpecerMockRecorder
- type MockXItemRecursiver
- type MockXItemRecursiverMockRecorder
- type MockXItemer
- type MockXItemerMockRecorder
- type NavType
- type PriceChangedInfoAddition
- type Problem
- func (p *Problem) Additions() *ProblemAdditions
- func (p *Problem) DecodeMsgpack(d *msgpack.Decoder) error
- func (p *Problem) EncodeMsgpack(e *msgpack.Encoder) error
- func (p *Problem) Id() ProblemId
- func (p *Problem) IsHidden() bool
- func (p *Problem) Message() string
- func (p *Problem) SetIsHidden(v bool)
- type ProblemAdditions
- type ProblemId
- type ProductItemAdditions
- func (p *ProductItemAdditions) AvailTotal() int
- func (p *ProductItemAdditions) BrandName() string
- func (p *ProductItemAdditions) CategoryId() catalog_types.CategoryId
- func (p *ProductItemAdditions) CategoryName() string
- func (p *ProductItemAdditions) CategoryPath() string
- func (p *ProductItemAdditions) CreditPrograms() []catalog_types.CreditProgram
- func (p *ProductItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
- func (p *ProductItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
- func (p *ProductItemAdditions) IsAvailForDPD() bool
- func (p *ProductItemAdditions) IsAvailInStore() bool
- func (p *ProductItemAdditions) IsCountMoreThenAvailChecked() bool
- func (p *ProductItemAdditions) IsDiscounted() bool
- func (p *ProductItemAdditions) IsFnsTracked() bool
- func (p *ProductItemAdditions) IsMarked() bool
- func (p *ProductItemAdditions) IsOEM() bool
- func (p *ProductItemAdditions) MarkedPurchaseReason() MarkedPurchaseReason
- func (p *ProductItemAdditions) SetAvailTotal(v int)
- func (p *ProductItemAdditions) SetBrandName(v string)
- func (p *ProductItemAdditions) SetCategoryId(v catalog_types.CategoryId)
- func (p *ProductItemAdditions) SetCategoryName(v string)
- func (p *ProductItemAdditions) SetCategoryPath(v string)
- func (p *ProductItemAdditions) SetCreditPrograms(v []catalog_types.CreditProgram)
- func (p *ProductItemAdditions) SetIsAvailForDPD(v bool)
- func (p *ProductItemAdditions) SetIsAvailInStore(v bool)
- func (p *ProductItemAdditions) SetIsCountMoreThenAvailChecked(v bool)
- func (p *ProductItemAdditions) SetIsDiscounted(v bool)
- func (p *ProductItemAdditions) SetIsFnsTracked(isFnsTracked bool)
- func (p *ProductItemAdditions) SetIsMarked(v bool)
- func (p *ProductItemAdditions) SetIsOEM(v bool)
- func (p *ProductItemAdditions) SetMarkedPurchaseReason(m MarkedPurchaseReason)
- func (p *ProductItemAdditions) SetShortName(v string)
- func (p *ProductItemAdditions) SetVat(v int)
- func (p *ProductItemAdditions) ShortName() string
- func (p *ProductItemAdditions) Vat() int
- type Rules
- type Service
- func (s *Service) DecodeMsgpack(d *msgpack.Decoder) error
- func (s *Service) EncodeMsgpack(e *msgpack.Encoder) error
- func (s *Service) GetIsAvailableForInstallments() bool
- func (s *Service) GetIsCreditAvail() bool
- func (s *Service) SetIsAvailableForInstallments(v bool)
- func (s *Service) SetIsCreditAvail(v bool)
- type ServiceType
- type Spec
- func (s *Spec) CanHaveChild(itemType Type) bool
- func (s *Spec) CanHaveChildren() bool
- func (s *Spec) ChildrenTypes() []Type
- func (s *Spec) IsAllowedForB2bUser() bool
- func (s *Spec) IsAllowedForPerson() bool
- func (s *Spec) IsCountChangeable() bool
- func (s *Spec) IsCountEqualToParentCount() bool
- func (s *Spec) IsCountLessOrEqualThenParent() bool
- func (s *Spec) IsDeletable() bool
- func (s *Spec) IsOnlyOnePositionPerParent() bool
- func (s *Spec) IsOnlyOnePositionPossible() bool
- func (s *Spec) MustBeAChild() bool
- type Specer
- type SubcontractApplyServiceInfo
- func (s *SubcontractApplyServiceInfo) DecodeMsgpack(d *msgpack.Decoder) error
- func (s *SubcontractApplyServiceInfo) EncodeMsgpack(e *msgpack.Encoder) error
- func (s *SubcontractApplyServiceInfo) GetAddress() string
- func (s *SubcontractApplyServiceInfo) GetCityKladrId() store_types.KladrId
- func (s *SubcontractApplyServiceInfo) GetCityName() string
- func (s *SubcontractApplyServiceInfo) GetDate() time.Time
- func (s *SubcontractApplyServiceInfo) SetAddress(address string)
- func (s *SubcontractApplyServiceInfo) SetCityKladrId(kladrId store_types.KladrId)
- func (s *SubcontractApplyServiceInfo) SetCityName(city string)
- func (s *SubcontractApplyServiceInfo) SetDate(date time.Time)
- func (s *SubcontractApplyServiceInfo) Validate() error
- type SubcontractItemAdditions
- type Type
- func (t Type) IsAddedByServer() bool
- func (t Type) IsConfiguration() bool
- func (t Type) IsPartOfConfiguration() bool
- func (t Type) IsPresent() bool
- func (t Type) IsProduct() bool
- func (t Type) IsService() bool
- func (t Type) Name() string
- func (t Type) NavType() NavType
- func (t Type) ServiceType() ServiceType
- func (t Type) Spec() *Spec
- func (t Type) Validate() error
- type TypeService
- type UniqId
- type XItem
- type XItemRecursiver
- type XItemer
- type XMLItem
Constants ¶
const ( // LimitTotalGoods лимит количества добавленных товаров в корзину LimitTotalGoods = 1000 LimitOnePosition = 999 )
const ( // GiftCertificateCategoryID название категории - "Подарочные сертификаты" GiftCertificateCategoryID catalog_types.CategoryId = 219 // PCCaseCategoryID id категории компьютерного корпуса PCCaseCategoryID catalog_types.CategoryId = 41 )
const ConfSpecialItemId = ItemId("553081")
const DefaultConfId = ConfId("q0000")
Variables ¶
This section is empty.
Functions ¶
func CalculateBonus ¶
func CalculateBonus(user *userv1.User, prices *productv1.ProductPriceByRegion) int
func NewTypeServices ¶
func NewTypeServices(serviceClient servicev1.ServiceAPIClient, mapper *CatalogServicesToDomainMapper) *typeService
Types ¶
type AllowResale ¶
type AllowResale struct {
// contains filtered or unexported fields
}
AllowResale структура с информацией о возможности приобретать позицию для перепродажи
func NewAllowResale ¶
func NewAllowResale(isAllow bool, commodityGroupName string) *AllowResale
func (*AllowResale) DecodeMsgpack ¶
func (a *AllowResale) DecodeMsgpack(d *msgpack.Decoder) error
func (*AllowResale) EncodeMsgpack ¶
func (a *AllowResale) EncodeMsgpack(e *msgpack.Encoder) error
func (*AllowResale) IsAllow ¶
func (a *AllowResale) IsAllow() bool
func (*AllowResale) Message ¶
func (a *AllowResale) Message() string
Message вспомогательное сообщение в случае невозможности перепродажи
type CatalogServicesToDomainMapper ¶
type CatalogServicesToDomainMapper struct { }
CatalogServicesToDomainMapper Маппер response mic catalog к доменным моделям
func NewCatalogServicesToDomainMapper ¶
func NewCatalogServicesToDomainMapper() *CatalogServicesToDomainMapper
func (*CatalogServicesToDomainMapper) MapCatalogServicesTypeToBasketItemType ¶
func (m *CatalogServicesToDomainMapper) MapCatalogServicesTypeToBasketItemType(services []*servicev1.ServiceInfo) Type
type ChangedItemInfoAdditions ¶
type ChangedItemInfoAdditions struct { // Идентификатор позиции (не уникален) ItemId string // 1 // Уникальный идентификатор позиции UniqId string // 2 // Кол-во позиции (например 2 телефона) Count int // 3 // Название позиции Name string // 4 // Цена за позицию Price int // 5 }
ChangedItemInfoAdditions Информация о замененном товаре/услуге. Указывается для идентификатора INFO_ID_POSITION_CHANGED
func (*ChangedItemInfoAdditions) DecodeMsgpack ¶
func (c *ChangedItemInfoAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ChangedItemInfoAdditions) EncodeMsgpack ¶
func (c *ChangedItemInfoAdditions) EncodeMsgpack(e *msgpack.Encoder) error
type CompositeFactory ¶
type CompositeFactory struct {
// contains filtered or unexported fields
}
func NewBasketItemFactory ¶
func NewBasketItemFactory(factory ...ItemFactory) *CompositeFactory
func (*CompositeFactory) Add ¶
func (f *CompositeFactory) Add(factory ...ItemFactory)
func (*CompositeFactory) Creatable ¶
func (f *CompositeFactory) Creatable(itemType Type) bool
func (*CompositeFactory) Create ¶
func (f *CompositeFactory) Create( ctx context.Context, itemId ItemId, spaceId store_types.SpaceId, itemType Type, count int, parentItem *Item, priceColumn catalog_types.PriceColumn, user *userv1.User, ignoreFairPrice bool, ) (*Item, error)
type ConfItem ¶
type ConfItem struct { ProductId catalog_types.ProductId Count int Services []*ConfItemService }
type ConfItemService ¶
type ConfigurationProblemAdditions ¶
type ConfigurationProblemAdditions struct { // Идентификаторы позиций, которые не в наличии или невозможно купить. // // В связи с уникальным поведением самой конфигурации мы не можем указывать проблемы о не наличии/невозможности // купить к самим позициям внутри конфигурации, так как их нельзя удалять и получится так, что проблема нерешаемая. // Проблему решить возможно только удалением/разборкой самой конфигурации // // Эти данные проставляются вместе с проблемой ProblemProductItemInConfigurationNotAvailable NotAvailableProductItemIds []ItemId // 1 }
ConfigurationProblemAdditions дополнительные данные по проблемам с конфигурацией
func (*ConfigurationProblemAdditions) DecodeMsgpack ¶
func (c *ConfigurationProblemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ConfigurationProblemAdditions) EncodeMsgpack ¶
func (c *ConfigurationProblemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
type ConfiguratorItemAdditions ¶
type ConfiguratorItemAdditions struct { ConfId string // 1 ConfType ConfType // 2 // contains filtered or unexported fields }
func NewConfiguratorItemAdditions ¶
func NewConfiguratorItemAdditions( confId string, confType ConfType, ) *ConfiguratorItemAdditions
func (*ConfiguratorItemAdditions) DecodeMsgpack ¶
func (c *ConfiguratorItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ConfiguratorItemAdditions) EncodeMsgpack ¶
func (c *ConfiguratorItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
func (*ConfiguratorItemAdditions) GetConfId ¶
func (c *ConfiguratorItemAdditions) GetConfId() string
func (*ConfiguratorItemAdditions) GetConfType ¶
func (c *ConfiguratorItemAdditions) GetConfType() ConfType
func (*ConfiguratorItemAdditions) IsMutable ¶
func (c *ConfiguratorItemAdditions) IsMutable() bool
func (*ConfiguratorItemAdditions) SetConfId ¶
func (c *ConfiguratorItemAdditions) SetConfId(v string)
func (*ConfiguratorItemAdditions) SetConfType ¶
func (c *ConfiguratorItemAdditions) SetConfType(v ConfType)
type CountMoreThenAvailInfoAdditions ¶
type CountMoreThenAvailInfoAdditions struct {
AvailCount int // 1
}
CountMoreThenAvailInfoAdditions информация о том, что по позиции доступно товаров меньше, чем добавлено в корзину
func (*CountMoreThenAvailInfoAdditions) DecodeMsgpack ¶
func (a *CountMoreThenAvailInfoAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*CountMoreThenAvailInfoAdditions) EncodeMsgpack ¶
func (a *CountMoreThenAvailInfoAdditions) EncodeMsgpack(e *msgpack.Encoder) error
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info информация о позиции корзины
func (*Info) Additionals ¶
func (i *Info) Additionals() *InfoAdditions
func (*Info) DecodeMsgpack ¶
func (*Info) EncodeMsgpack ¶
func (*Info) SetAdditions ¶
func (i *Info) SetAdditions(additions *InfoAdditions)
type InfoAdditions ¶
type InfoAdditions struct { PriceChanged PriceChangedInfoAddition // 1 CountMoreThenAvail CountMoreThenAvailInfoAdditions // 2 ChangedItem ChangedItemInfoAdditions // 3 }
InfoAdditions уточняющая информация по позиции
func (*InfoAdditions) DecodeMsgpack ¶
func (a *InfoAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*InfoAdditions) EncodeMsgpack ¶
func (a *InfoAdditions) EncodeMsgpack(e *msgpack.Encoder) error
type InfoId ¶
type InfoId int
const ( InfoIdUnknown InfoId = iota // InfoIdPriceChanged цена на позицию изменилась InfoIdPriceChanged // InfoIdCountMoreThanAvail кол-во товара в наличии меньше, чем запрошенное кол-во позиций в корзине. InfoIdCountMoreThanAvail // InfoIdPositionRemoved позиция удалена из корзины InfoIdPositionRemoved // InfoIdPositionChanged позиция заменена InfoIdPositionChanged )
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item позиция корзины. Никогда не создавайте эту структуру напрямую, всегда пользуйтесь методом-конструктором NewItem
func NewConfigurationItem ¶
func NewConfigurationItem( price int, spaceId store_types.SpaceId, priceColumn catalog_types.PriceColumn, ) *Item
NewConfigurationItem создает новую позицию для конфигуратора. Добавлено, так как сборка создается пользователем, это не готовый товар и именно поэтому, в отличие от конструктора NewItem, тут устанавливается countMultiplicity = 1
func NewItem ¶
func NewItem( itemId ItemId, itemType Type, name string, image string, count int, price int, bonus int, spaceId store_types.SpaceId, priceColumn catalog_types.PriceColumn, ) *Item
NewItem создает новую позицию.
func (*Item) AddProblem ¶
func (*Item) Additions ¶
func (i *Item) Additions() *ItemAdditions
func (*Item) AllowResale ¶
func (i *Item) AllowResale() *AllowResale
func (*Item) AllowUnselect ¶
AllowUnselect определяет, можно ли снимать галочку выкупа товара. При снятии товар не попадет в оформленный заказ, но останется в корзине.
func (*Item) CalculateMaxCount ¶
CalculateMaxCount Рассчитывает максимальное количество товара учитывая наличие в ПВЗ и на складе
func (*Item) CancelSimulateProblems ¶
func (i *Item) CancelSimulateProblems()
func (*Item) CommitChanges ¶
func (i *Item) CommitChanges()
func (*Item) CommitInfo ¶
func (*Item) CorrectCountFromMultiplicity ¶
CorrectCountFromMultiplicity корректировка кол-ва товара исходя из показателя multiplicity(коробки/кратность товара)
func (*Item) CountMultiplicity ¶
func (*Item) DecodeMsgpack ¶
func (*Item) DeleteProblems ¶
func (i *Item) DeleteProblems()
DeleteProblems удаляет все проблемы позиции (обычно производится перед очередной проверкой на наличие проблем у позиции)
func (*Item) EncodeMsgpack ¶
func (*Item) Fingerprint ¶
Fingerprint собирает информацию по всей корзине и выводит это в виде хэша. Данный хэш при сборе так же сортирует позиции заказа по идентификатору позиции, таким образом увеличивается кол-во одинаковых отпечатков у одинаковых корзин
func (*Item) GetDiscount ¶
func (i *Item) GetDiscount() ItemDiscount
func (*Item) HasFairPrice ¶
func (*Item) IgnoreFairPrice ¶
func (*Item) IgnoreFairPriceChanged ¶
func (*Item) IsMovableFromConfiguration ¶
func (*Item) IsMovableToConfiguration ¶
func (*Item) IsPrepaymentMandatory ¶
func (*Item) IsSelected ¶
func (*Item) MakeChildOf ¶
func (*Item) MarkedPurchaseReason ¶
func (i *Item) MarkedPurchaseReason() MarkedPurchaseReason
func (*Item) ParentUniqId ¶
func (*Item) PriceColumn ¶
func (i *Item) PriceColumn() catalog_types.PriceColumn
PriceColumn возвращает ценовую колонку, относительно которой подсчитана цена
func (*Item) Problems ¶
Problems возвращает проблемы позиции Стоит обратить внимание, что так же этот метод возвращает и постоянные проблемы для отладки
func (*Item) SetAllowResale ¶
func (i *Item) SetAllowResale(v *AllowResale)
func (*Item) SetCountMultiplicity ¶
func (*Item) SetDiscount ¶
func (i *Item) SetDiscount(v ItemDiscount)
func (*Item) SetHasFairPrice ¶
func (*Item) SetIgnoreFairPrice ¶
func (*Item) SetIsSelected ¶
func (*Item) SetMarkedPurchaseReason ¶
func (i *Item) SetMarkedPurchaseReason(purchaseReason MarkedPurchaseReason)
func (*Item) SetMovableFromConfiguration ¶
func (*Item) SetMovableToConfiguration ¶
func (*Item) SetPrepaymentMandatory ¶
func (*Item) SetPriceColumn ¶
func (i *Item) SetPriceColumn(priceColumn catalog_types.PriceColumn)
SetPriceColumn задает ценовую колонку, относительно которой подсчитаны цена для позиции. Данный метод можно использовать только со знанием дела, нельзя просто так взять и поменять ценовую колонку, это нужно делать только тогда, когда стало ясно, что у пользователя, к которому прикреплен заказ, изменилась ценовая колонка
func (*Item) SetSpaceId ¶
func (i *Item) SetSpaceId(spaceId store_types.SpaceId)
SetSpaceId задает идентификатор региона, относительно которого посчитаны цена и наличие для данной позиции. Данный метод нужно использовать только и только в том случае, когда производится смена региона для всего заказа (например пользователь сменил город тем или иным способом). Будьте крайне осторожны, и не используйте этот метод напрямую без знания дела
func (*Item) SimulateProblem ¶
func (*Item) SortTypeValue ¶
func (*Item) SpaceId ¶
func (i *Item) SpaceId() store_types.SpaceId
SpaceId возвращает идентификатор региона, относительно которого посчитано наличие и цена позиции
type ItemAdditions ¶
type ItemAdditions struct { // Данные о товаре, заполняются для всех позиций, которые являются товаром (например товар в корзине // и товар как дочерняя позиции конфигурации). У каждой позиции у которой isProduct истина должна обладать // дополнительной информацией о товаре Product *ProductItemAdditions // 1 // Данные по конфигурации. Эти данные применяются для всех типов, связанных с конфигурацией // (товар, услуга, сама конфигурация) Configuration *ConfiguratorItemAdditions // 2 SubcontractServiceForProduct *SubcontractItemAdditions // 3 // Данные о любой услуге Service *Service // 4 // contains filtered or unexported fields }
func (*ItemAdditions) DecodeMsgpack ¶
func (i *ItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ItemAdditions) EncodeMsgpack ¶
func (i *ItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
func (*ItemAdditions) GetConfiguration ¶
func (i *ItemAdditions) GetConfiguration() *ConfiguratorItemAdditions
func (*ItemAdditions) GetProduct ¶
func (i *ItemAdditions) GetProduct() *ProductItemAdditions
func (*ItemAdditions) GetService ¶
func (i *ItemAdditions) GetService() *Service
func (*ItemAdditions) GetSubcontractServiceForProduct ¶
func (i *ItemAdditions) GetSubcontractServiceForProduct() *SubcontractItemAdditions
func (*ItemAdditions) SetConfiguration ¶
func (i *ItemAdditions) SetConfiguration(v *ConfiguratorItemAdditions)
func (*ItemAdditions) SetProduct ¶
func (i *ItemAdditions) SetProduct(v *ProductItemAdditions)
func (*ItemAdditions) SetService ¶
func (i *ItemAdditions) SetService(v *Service)
func (*ItemAdditions) SetSubcontractServiceForProduct ¶
func (i *ItemAdditions) SetSubcontractServiceForProduct(info *SubcontractItemAdditions)
type ItemDiscount ¶
type ItemDiscount struct { // Скидка позиции за примененный купон Coupon int // Скидка позиции по акциям Action int // Общая сумма всех скидок позиции Total int // Список примененных к позиции акций строкой через запятую AppliedPromotions string }
func (*ItemDiscount) DecodeMsgpack ¶
func (i *ItemDiscount) DecodeMsgpack(d *msgpack.Decoder) error
func (*ItemDiscount) EncodeMsgpack ¶
func (i *ItemDiscount) EncodeMsgpack(e *msgpack.Encoder) error
type ItemFactory ¶
type ItemId ¶
type ItemId string
ItemId идентификатор позиции (не уникален)
func (ItemId) IsConfiguration ¶
type ItemMap ¶
func (ItemMap) ToSliceOnlySelected ¶
type MarkedPurchaseReason ¶
type MarkedPurchaseReason int
const ( // MarkedPurchaseReasonUnknown не указан MarkedPurchaseReasonUnknown MarkedPurchaseReason = 0 // MarkedPurchaseReasonForSelfNeeds для собственных нужд MarkedPurchaseReasonForSelfNeeds MarkedPurchaseReason = 1 // MarkedPurchaseReasonForResale для перепродажи MarkedPurchaseReasonForResale MarkedPurchaseReason = 2 )
Значения аналогичны БД, БД берут у Нава, также есть Госконтракт - 3
type MaxItemCountError ¶
type MaxItemCountError struct {
// contains filtered or unexported fields
}
MaxItemCountError ошибка превышения максимального количества позиции корзины.
func NewMaxItemCountError ¶
func NewMaxItemCountError(err error, maxCount int) *MaxItemCountError
func (*MaxItemCountError) Error ¶
func (e *MaxItemCountError) Error() string
func (*MaxItemCountError) MaxCount ¶
func (e *MaxItemCountError) MaxCount() int
MaxCount возвращает превышенное максимальное количество позиции корзины.
func (*MaxItemCountError) Unwrap ¶
func (e *MaxItemCountError) Unwrap() error
type MockItemFactory ¶
type MockItemFactory struct {
// contains filtered or unexported fields
}
MockItemFactory is a mock of ItemFactory interface.
func NewMockItemFactory ¶
func NewMockItemFactory(ctrl *gomock.Controller) *MockItemFactory
NewMockItemFactory creates a new mock instance.
func (*MockItemFactory) Creatable ¶
func (m *MockItemFactory) Creatable(itemType Type) bool
Creatable mocks base method.
func (*MockItemFactory) Create ¶
func (m *MockItemFactory) Create(ctx context.Context, itemId ItemId, spaceId store_types.SpaceId, itemType Type, count int, parentItem *Item, priceColumn catalog_types.PriceColumn, user *v1.User, ignoreFairPrice bool) (*Item, error)
Create mocks base method.
func (*MockItemFactory) EXPECT ¶
func (m *MockItemFactory) EXPECT() *MockItemFactoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockItemFactoryMockRecorder ¶
type MockItemFactoryMockRecorder struct {
// contains filtered or unexported fields
}
MockItemFactoryMockRecorder is the mock recorder for MockItemFactory.
func (*MockItemFactoryMockRecorder) Creatable ¶
func (mr *MockItemFactoryMockRecorder) Creatable(itemType interface{}) *gomock.Call
Creatable indicates an expected call of Creatable.
func (*MockItemFactoryMockRecorder) Create ¶
func (mr *MockItemFactoryMockRecorder) Create(ctx, itemId, spaceId, itemType, count, parentItem, priceColumn, user, ignoreFairPrice interface{}) *gomock.Call
Create indicates an expected call of Create.
type MockSpecer ¶
type MockSpecer struct {
// contains filtered or unexported fields
}
MockSpecer is a mock of Specer interface.
func NewMockSpecer ¶
func NewMockSpecer(ctrl *gomock.Controller) *MockSpecer
NewMockSpecer creates a new mock instance.
func (*MockSpecer) EXPECT ¶
func (m *MockSpecer) EXPECT() *MockSpecerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockSpecerMockRecorder ¶
type MockSpecerMockRecorder struct {
// contains filtered or unexported fields
}
MockSpecerMockRecorder is the mock recorder for MockSpecer.
func (*MockSpecerMockRecorder) Spec ¶
func (mr *MockSpecerMockRecorder) Spec() *gomock.Call
Spec indicates an expected call of Spec.
type MockXItemRecursiver ¶
type MockXItemRecursiver struct {
// contains filtered or unexported fields
}
MockXItemRecursiver is a mock of XItemRecursiver interface.
func NewMockXItemRecursiver ¶
func NewMockXItemRecursiver(ctrl *gomock.Controller) *MockXItemRecursiver
NewMockXItemRecursiver creates a new mock instance.
func (*MockXItemRecursiver) EXPECT ¶
func (m *MockXItemRecursiver) EXPECT() *MockXItemRecursiverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockXItemRecursiver) ToXItems ¶
func (m *MockXItemRecursiver) ToXItems() []*XItem
ToXItems mocks base method.
type MockXItemRecursiverMockRecorder ¶
type MockXItemRecursiverMockRecorder struct {
// contains filtered or unexported fields
}
MockXItemRecursiverMockRecorder is the mock recorder for MockXItemRecursiver.
func (*MockXItemRecursiverMockRecorder) ToXItems ¶
func (mr *MockXItemRecursiverMockRecorder) ToXItems() *gomock.Call
ToXItems indicates an expected call of ToXItems.
type MockXItemer ¶
type MockXItemer struct {
// contains filtered or unexported fields
}
MockXItemer is a mock of XItemer interface.
func NewMockXItemer ¶
func NewMockXItemer(ctrl *gomock.Controller) *MockXItemer
NewMockXItemer creates a new mock instance.
func (*MockXItemer) EXPECT ¶
func (m *MockXItemer) EXPECT() *MockXItemerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockXItemerMockRecorder ¶
type MockXItemerMockRecorder struct {
// contains filtered or unexported fields
}
MockXItemerMockRecorder is the mock recorder for MockXItemer.
func (*MockXItemerMockRecorder) ToXItem ¶
func (mr *MockXItemerMockRecorder) ToXItem() *gomock.Call
ToXItem indicates an expected call of ToXItem.
type PriceChangedInfoAddition ¶
PriceChangedInfoAddition информация об изменении цены
func (*PriceChangedInfoAddition) DecodeMsgpack ¶
func (a *PriceChangedInfoAddition) DecodeMsgpack(d *msgpack.Decoder) error
func (*PriceChangedInfoAddition) EncodeMsgpack ¶
func (a *PriceChangedInfoAddition) EncodeMsgpack(e *msgpack.Encoder) error
type Problem ¶
type Problem struct {
// contains filtered or unexported fields
}
func NewProblem ¶
func (*Problem) Additions ¶
func (p *Problem) Additions() *ProblemAdditions
Additions возвращает дополнительные данные по проблеме
func (*Problem) DecodeMsgpack ¶
func (*Problem) EncodeMsgpack ¶
func (*Problem) SetIsHidden ¶
type ProblemAdditions ¶
type ProblemAdditions struct {
ConfigurationProblemAdditions ConfigurationProblemAdditions // 1
}
ProblemAdditions дополнительные данные по проблеме
func (*ProblemAdditions) DecodeMsgpack ¶
func (p *ProblemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ProblemAdditions) EncodeMsgpack ¶
func (p *ProblemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
type ProblemId ¶
type ProblemId int
const ( ProblemUnknown ProblemId = 0 // ProblemNotAvailable позиции нет в наличии или невозможно купить ProblemNotAvailable ProblemId = 1 // ProblemMaxCountExcess превышено максимальное кол-во позиции ProblemMaxCountExcess ProblemId = 2 // ProblemProductItemInConfigurationNotAvailable одна из позиций в составе конфигурации не в наличии или // ее невозможно купить ProblemProductItemInConfigurationNotAvailable ProblemId = 3 // ProblemNotAvailableInSelectedCity позиция недоступна в выбранном городе ProblemNotAvailableInSelectedCity ProblemId = 4 // ProblemPurchaseReasonIsNotSelected не выбран тип маркированного товара ProblemPurchaseReasonIsNotSelected ProblemId = 5 // ProblemPurchaseReasonNotAvailableForUser тип маркировки недоступен для пользователя ProblemPurchaseReasonNotAvailableForUser ProblemId = 6 // ProblemFnsTrackedItemNotAvailableForUser отслеживаемый товар недоступен для пользователя ProblemFnsTrackedItemNotAvailableForUser ProblemId = 7 )
type ProductItemAdditions ¶
type ProductItemAdditions struct {
// contains filtered or unexported fields
}
func NewProductItemAdditions ¶
func NewProductItemAdditions( category catalog_types.CategoryId, creditPrograms []catalog_types.CreditProgram, vat int, availTotal int, ) *ProductItemAdditions
func (*ProductItemAdditions) AvailTotal ¶
func (p *ProductItemAdditions) AvailTotal() int
func (*ProductItemAdditions) BrandName ¶
func (p *ProductItemAdditions) BrandName() string
func (*ProductItemAdditions) CategoryId ¶
func (p *ProductItemAdditions) CategoryId() catalog_types.CategoryId
func (*ProductItemAdditions) CategoryName ¶
func (p *ProductItemAdditions) CategoryName() string
func (*ProductItemAdditions) CategoryPath ¶
func (p *ProductItemAdditions) CategoryPath() string
func (*ProductItemAdditions) CreditPrograms ¶
func (p *ProductItemAdditions) CreditPrograms() []catalog_types.CreditProgram
func (*ProductItemAdditions) DecodeMsgpack ¶
func (p *ProductItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*ProductItemAdditions) EncodeMsgpack ¶
func (p *ProductItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
func (*ProductItemAdditions) IsAvailForDPD ¶
func (p *ProductItemAdditions) IsAvailForDPD() bool
func (*ProductItemAdditions) IsAvailInStore ¶
func (p *ProductItemAdditions) IsAvailInStore() bool
func (*ProductItemAdditions) IsCountMoreThenAvailChecked ¶
func (p *ProductItemAdditions) IsCountMoreThenAvailChecked() bool
func (*ProductItemAdditions) IsDiscounted ¶
func (p *ProductItemAdditions) IsDiscounted() bool
func (*ProductItemAdditions) IsFnsTracked ¶
func (p *ProductItemAdditions) IsFnsTracked() bool
func (*ProductItemAdditions) IsMarked ¶
func (p *ProductItemAdditions) IsMarked() bool
func (*ProductItemAdditions) IsOEM ¶
func (p *ProductItemAdditions) IsOEM() bool
func (*ProductItemAdditions) MarkedPurchaseReason ¶
func (p *ProductItemAdditions) MarkedPurchaseReason() MarkedPurchaseReason
func (*ProductItemAdditions) SetAvailTotal ¶
func (p *ProductItemAdditions) SetAvailTotal(v int)
func (*ProductItemAdditions) SetBrandName ¶
func (p *ProductItemAdditions) SetBrandName(v string)
func (*ProductItemAdditions) SetCategoryId ¶
func (p *ProductItemAdditions) SetCategoryId(v catalog_types.CategoryId)
func (*ProductItemAdditions) SetCategoryName ¶
func (p *ProductItemAdditions) SetCategoryName(v string)
func (*ProductItemAdditions) SetCategoryPath ¶
func (p *ProductItemAdditions) SetCategoryPath(v string)
func (*ProductItemAdditions) SetCreditPrograms ¶
func (p *ProductItemAdditions) SetCreditPrograms(v []catalog_types.CreditProgram)
func (*ProductItemAdditions) SetIsAvailForDPD ¶
func (p *ProductItemAdditions) SetIsAvailForDPD(v bool)
func (*ProductItemAdditions) SetIsAvailInStore ¶
func (p *ProductItemAdditions) SetIsAvailInStore(v bool)
func (*ProductItemAdditions) SetIsCountMoreThenAvailChecked ¶
func (p *ProductItemAdditions) SetIsCountMoreThenAvailChecked(v bool)
func (*ProductItemAdditions) SetIsDiscounted ¶
func (p *ProductItemAdditions) SetIsDiscounted(v bool)
func (*ProductItemAdditions) SetIsFnsTracked ¶
func (p *ProductItemAdditions) SetIsFnsTracked(isFnsTracked bool)
func (*ProductItemAdditions) SetIsMarked ¶
func (p *ProductItemAdditions) SetIsMarked(v bool)
func (*ProductItemAdditions) SetIsOEM ¶
func (p *ProductItemAdditions) SetIsOEM(v bool)
func (*ProductItemAdditions) SetMarkedPurchaseReason ¶
func (p *ProductItemAdditions) SetMarkedPurchaseReason(m MarkedPurchaseReason)
func (*ProductItemAdditions) SetShortName ¶
func (p *ProductItemAdditions) SetShortName(v string)
func (*ProductItemAdditions) SetVat ¶
func (p *ProductItemAdditions) SetVat(v int)
func (*ProductItemAdditions) ShortName ¶
func (p *ProductItemAdditions) ShortName() string
func (*ProductItemAdditions) Vat ¶
func (p *ProductItemAdditions) Vat() int
type Rules ¶
type Rules struct {
// contains filtered or unexported fields
}
func (*Rules) DecodeMsgpack ¶
func (*Rules) EncodeMsgpack ¶
func (*Rules) IsMaxCount ¶
func (*Rules) SetMaxCount ¶
type Service ¶
type Service struct { IsCreditAvail bool // 1 IsAvailableForInstallments bool // 2 // contains filtered or unexported fields }
func NewService ¶
func (*Service) DecodeMsgpack ¶
func (*Service) EncodeMsgpack ¶
func (*Service) GetIsAvailableForInstallments ¶
func (*Service) GetIsCreditAvail ¶
func (*Service) SetIsAvailableForInstallments ¶
func (*Service) SetIsCreditAvail ¶
type ServiceType ¶
type ServiceType int
const ( ServiceTypeSubcontract ServiceType = 22 ServiceTypeDigital ServiceType = 62 ServiceTypeInsuranceOfProperty ServiceType = 5 ServiceTypeProductInsurance ServiceType = 52 ServiceTypeDelivery ServiceType = 53 ServiceTypeForConfigurationFeature ServiceType = 54 )
type Spec ¶
type Spec struct {
// contains filtered or unexported fields
}
Spec спецификация позиции.
Отвечает за поведение позиции, ее расположение в дереве позиций, возможные дети и прочие условия, которую определяют позицию
func (*Spec) CanHaveChild ¶
func (*Spec) CanHaveChildren ¶
func (*Spec) ChildrenTypes ¶
func (*Spec) IsAllowedForB2bUser ¶
func (*Spec) IsAllowedForPerson ¶
func (*Spec) IsCountChangeable ¶
IsCountChangeable возможно ли изменение кол-ва для позиции
func (*Spec) IsCountEqualToParentCount ¶
IsCountEqualToParentCount количество единиц в корзине всегда совпадает с количеством родительской позиции
func (*Spec) IsCountLessOrEqualThenParent ¶
IsCountLessOrEqualThenParent кол-во позиций не должно превышать кол-во родительской позиции (для случаев когда позиция является дочерней к другой позиции)
func (*Spec) IsDeletable ¶
IsDeletable возможно ли просто взять и удалить позицию
func (*Spec) IsOnlyOnePositionPerParent ¶
IsOnlyOnePositionPerParent только одна позиция с таким типом может быть у родительской позиции. Например, только одна позиция услуги страхования товара может быть у товара
func (*Spec) IsOnlyOnePositionPossible ¶
IsOnlyOnePositionPossible означает, что только одна позиция с этим типом может присутствовать в корзине
func (*Spec) MustBeAChild ¶
type SubcontractApplyServiceInfo ¶
type SubcontractApplyServiceInfo struct { Date time.Time // 1 Address string // 2 CityKladrId store_types.KladrId // 3 CityName string // 4 // contains filtered or unexported fields }
func NewSubcontractApplyServiceInfo ¶
func NewSubcontractApplyServiceInfo( date time.Time, address string, cityKladrId store_types.KladrId, cityName string, ) *SubcontractApplyServiceInfo
func (*SubcontractApplyServiceInfo) DecodeMsgpack ¶
func (s *SubcontractApplyServiceInfo) DecodeMsgpack(d *msgpack.Decoder) error
func (*SubcontractApplyServiceInfo) EncodeMsgpack ¶
func (s *SubcontractApplyServiceInfo) EncodeMsgpack(e *msgpack.Encoder) error
func (*SubcontractApplyServiceInfo) GetAddress ¶
func (s *SubcontractApplyServiceInfo) GetAddress() string
func (*SubcontractApplyServiceInfo) GetCityKladrId ¶
func (s *SubcontractApplyServiceInfo) GetCityKladrId() store_types.KladrId
func (*SubcontractApplyServiceInfo) GetCityName ¶
func (s *SubcontractApplyServiceInfo) GetCityName() string
func (*SubcontractApplyServiceInfo) GetDate ¶
func (s *SubcontractApplyServiceInfo) GetDate() time.Time
func (*SubcontractApplyServiceInfo) SetAddress ¶
func (s *SubcontractApplyServiceInfo) SetAddress(address string)
func (*SubcontractApplyServiceInfo) SetCityKladrId ¶
func (s *SubcontractApplyServiceInfo) SetCityKladrId(kladrId store_types.KladrId)
func (*SubcontractApplyServiceInfo) SetCityName ¶
func (s *SubcontractApplyServiceInfo) SetCityName(city string)
func (*SubcontractApplyServiceInfo) SetDate ¶
func (s *SubcontractApplyServiceInfo) SetDate(date time.Time)
func (*SubcontractApplyServiceInfo) Validate ¶
func (s *SubcontractApplyServiceInfo) Validate() error
type SubcontractItemAdditions ¶
type SubcontractItemAdditions struct { // Доп. данные для оказания услуги // // задается самим пользователем, так что всегда необходимо проверять на nil ApplyServiceInfo *SubcontractApplyServiceInfo // 1 // contains filtered or unexported fields }
func NewSubcontractItemAdditions ¶
func NewSubcontractItemAdditions( applyServiceInfo *SubcontractApplyServiceInfo, ) *SubcontractItemAdditions
func (*SubcontractItemAdditions) DecodeMsgpack ¶
func (s *SubcontractItemAdditions) DecodeMsgpack(d *msgpack.Decoder) error
func (*SubcontractItemAdditions) EncodeMsgpack ¶
func (s *SubcontractItemAdditions) EncodeMsgpack(e *msgpack.Encoder) error
func (*SubcontractItemAdditions) GetApplyServiceInfo ¶
func (s *SubcontractItemAdditions) GetApplyServiceInfo() *SubcontractApplyServiceInfo
type Type ¶
type Type string
Type Тип позиции
const ( TypeUnknown Type = "unknown" TypeProduct Type = "product" TypeSubcontractServiceForProduct Type = "subcontract_service_for_product" TypeInsuranceServiceForProduct Type = "insurance_service_for_product" TypeDigitalService Type = "digital_service" TypePresent Type = "present" TypePropertyInsurance Type = "property_insurance" TypeConfiguration Type = "configuration" TypeConfigurationProduct Type = "product_in_configuration" TypeConfigurationProductService Type = "service_for_product_in_configuration" TypeConfigurationAssemblyService Type = "assembly_service_in_configurations" TypeDeliveryService Type = "DeliveryService" TypeLiftingService Type = "lifting_service" )
func (Type) IsAddedByServer ¶
func (Type) IsConfiguration ¶
func (Type) IsPartOfConfiguration ¶
func (Type) ServiceType ¶
func (t Type) ServiceType() ServiceType
ServiceType возвраащет служебный тип услуги, необходимый для БД
type TypeService ¶
type XItem ¶
type XItem struct { XMLName xml.Name `xml:"item"` ItemId string `xml:"item_id"` Count int `xml:"qty"` Count1 int `xml:"qty1"` Price1 int `xml:"price"` Price2 int `xml:"price2"` Price3 int `xml:"price3"` Discount int `xml:"discount"` IsPresent int `xml:"is_present"` ConfId string `xml:"conf_id"` Bonus int `xml:"bonus"` ParentItemId string `xml:"parent_id"` IsConfiguration int `xml:"is_conf"` ConfType int `xml:"conf_type"` IsService int `xml:"is_serv"` Price2WithoutLoyaltyBonus int `xml:"price2_wo_loyaltybonus"` SubName string `xml:"sub_name"` }
XItem структура для представления в БД
Описание структуры из PHP, оставить пока не исправим всем ошибки
return [ 'item_id' => $this->itemId, 'qty' => $this->quantity, 'qty1' => $this->quantity, 'price' => $this->price, 'discount' => $this->discount, 'is_present' => (int)$this->isPresent ?: '', 'conf_id' => $this->confId, 'bonus' => $this->bonus, 'price2' => $this->price2, 'price3' => $this->price3, 'price2_wo_loyaltybonus' => $this->priceTwoWithoutLoyaltyBonus, 'type' => $this->navisionType, 'parent_id' => $this->parentId, 'is_conf' => (int)$this->isConfiguration ?: '', 'conf_type' => $this->confType ?? null, 'is_serv' => (int)$this->isService ?: '', 'sub_name' => $this->subName, ];
type XItemRecursiver ¶
type XItemRecursiver interface {
ToXItems() []*XItem
}