basket_item

package
v0.0.0-...-fafaadb Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package basket_item is a generated GoMock package.

Index

Constants

View Source
const (
	NavTypeProduct NavType = 2
	NavTypeService NavType = 13

	// LimitTotalGoods лимит количества добавленных товаров в корзину
	LimitTotalGoods  = 1000
	LimitOnePosition = 999
)
View Source
const (
	// GiftCertificateCategoryID название категории - "Подарочные сертификаты"
	GiftCertificateCategoryID catalog_types.CategoryId = 219
	// PCCaseCategoryID id категории компьютерного корпуса
	PCCaseCategoryID catalog_types.CategoryId = 41
)
View Source
const ConfSpecialItemId = ItemId("553081")
View Source
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 ConfId

type ConfId string

type ConfItem

type ConfItem struct {
	ProductId catalog_types.ProductId
	Count     int
	Services  []*ConfItemService
}

type ConfItemService

type ConfItemService struct {
	ItemId string
	Name   string
	Price  int
	Count  int
}

type ConfType

type ConfType int
const (
	ConfTypeUnknown  ConfType = 0
	ConfTypeUser     ConfType = 1
	ConfTypeTemplate ConfType = 2
	ConfTypeVendor   ConfType = 3
)

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 Group

type Group string

Group Группа позиции

const (
	GroupInvalid       Group = "invalid"       // Некорретный тип
	GroupProduct       Group = "product"       // Товар
	GroupService       Group = "service"       // Услуга
	GroupConfiguration Group = "configuration" // Контейнер конфигурации
)

func (Group) Validate

func (g Group) Validate() error

type Info

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

Info информация о позиции корзины

func NewInfo

func NewInfo(id InfoId, message string) *Info

func (*Info) Additionals

func (i *Info) Additionals() *InfoAdditions

func (*Info) DecodeMsgpack

func (i *Info) DecodeMsgpack(d *msgpack.Decoder) error

func (*Info) EncodeMsgpack

func (i *Info) EncodeMsgpack(e *msgpack.Encoder) error

func (*Info) Id

func (i *Info) Id() InfoId

func (*Info) Message

func (i *Info) Message() string

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) AddChild

func (i *Item) AddChild(child *Item) error

func (*Item) AddInfo

func (i *Item) AddInfo(infos ...*Info)

func (*Item) AddProblem

func (i *Item) AddProblem(problems ...*Problem)

func (*Item) Additions

func (i *Item) Additions() *ItemAdditions

func (*Item) AllowResale

func (i *Item) AllowResale() *AllowResale

func (*Item) AllowUnselect

func (i *Item) AllowUnselect() bool

AllowUnselect определяет, можно ли снимать галочку выкупа товара. При снятии товар не попадет в оформленный заказ, но останется в корзине.

func (*Item) Bonus

func (i *Item) Bonus() int

func (*Item) CalculateMaxCount

func (i *Item) CalculateMaxCount(maxAvailable int) int

CalculateMaxCount Рассчитывает максимальное количество товара учитывая наличие в ПВЗ и на складе

func (*Item) CancelSimulateProblems

func (i *Item) CancelSimulateProblems()

func (*Item) CommitChanges

func (i *Item) CommitChanges()

func (*Item) CommitInfo

func (i *Item) CommitInfo(id InfoId)

func (*Item) CorrectCountFromMultiplicity

func (i *Item) CorrectCountFromMultiplicity(count int) int

CorrectCountFromMultiplicity корректировка кол-ва товара исходя из показателя multiplicity(коробки/кратность товара)

func (*Item) Cost

func (i *Item) Cost() int

func (*Item) Count

func (i *Item) Count() int

func (*Item) CountMultiplicity

func (i *Item) CountMultiplicity() int

func (*Item) DecodeMsgpack

func (i *Item) DecodeMsgpack(d *msgpack.Decoder) error

func (*Item) DeleteProblems

func (i *Item) DeleteProblems()

DeleteProblems удаляет все проблемы позиции (обычно производится перед очередной проверкой на наличие проблем у позиции)

func (*Item) EncodeMsgpack

func (i *Item) EncodeMsgpack(e *msgpack.Encoder) error

func (*Item) Fingerprint

func (i *Item) Fingerprint() string

Fingerprint собирает информацию по всей корзине и выводит это в виде хэша. Данный хэш при сборе так же сортирует позиции заказа по идентификатору позиции, таким образом увеличивается кол-во одинаковых отпечатков у одинаковых корзин

func (*Item) FixBonus

func (i *Item) FixBonus(bonus int)

func (*Item) FixCount

func (i *Item) FixCount(count int)

func (*Item) FixName

func (i *Item) FixName(name string)

func (*Item) FixPrice

func (i *Item) FixPrice(price int)

func (*Item) GetDiscount

func (i *Item) GetDiscount() ItemDiscount

func (*Item) HasFairPrice

func (i *Item) HasFairPrice() bool

func (*Item) IgnoreFairPrice

func (i *Item) IgnoreFairPrice() bool

func (*Item) IgnoreFairPriceChanged

func (i *Item) IgnoreFairPriceChanged() bool

func (*Item) Image

func (i *Item) Image() string

func (*Item) Infos

func (i *Item) Infos() map[InfoId]*Info

func (*Item) IsChanged

func (i *Item) IsChanged() bool

func (*Item) IsChild

func (i *Item) IsChild() bool

func (*Item) IsChildOf

func (i *Item) IsChildOf(parent *Item) bool

func (*Item) IsMovableFromConfiguration

func (i *Item) IsMovableFromConfiguration() bool

func (*Item) IsMovableToConfiguration

func (i *Item) IsMovableToConfiguration() bool

func (*Item) IsPrepaymentMandatory

func (i *Item) IsPrepaymentMandatory() bool

func (*Item) IsSelected

func (i *Item) IsSelected() bool

func (*Item) ItemId

func (i *Item) ItemId() ItemId

func (*Item) MakeChildOf

func (i *Item) MakeChildOf(parent *Item) error

func (*Item) MarkedPurchaseReason

func (i *Item) MarkedPurchaseReason() MarkedPurchaseReason

func (*Item) Name

func (i *Item) Name() string

func (*Item) ParentUniqId

func (i *Item) ParentUniqId() UniqId

func (*Item) Price

func (i *Item) Price() int

func (*Item) PriceColumn

func (i *Item) PriceColumn() catalog_types.PriceColumn

PriceColumn возвращает ценовую колонку, относительно которой подсчитана цена

func (*Item) Problems

func (i *Item) Problems() []*Problem

Problems возвращает проблемы позиции Стоит обратить внимание, что так же этот метод возвращает и постоянные проблемы для отладки

func (*Item) Rules

func (i *Item) Rules() *Rules

func (*Item) SetAllowResale

func (i *Item) SetAllowResale(v *AllowResale)

func (*Item) SetBonus

func (i *Item) SetBonus(bonus int)

func (*Item) SetCount

func (i *Item) SetCount(count int) error

SetCount установка заданного кол-ва товара

func (*Item) SetCountMultiplicity

func (i *Item) SetCountMultiplicity(countMultiplicity int)

func (*Item) SetDiscount

func (i *Item) SetDiscount(v ItemDiscount)

func (*Item) SetHasFairPrice

func (i *Item) SetHasFairPrice(hasFairPrice bool)

func (*Item) SetIgnoreFairPrice

func (i *Item) SetIgnoreFairPrice(isIgnoreFairPrice bool)

func (*Item) SetImage

func (i *Item) SetImage(image string)

func (*Item) SetIsSelected

func (i *Item) SetIsSelected(isSelected bool)

func (*Item) SetMarkedPurchaseReason

func (i *Item) SetMarkedPurchaseReason(purchaseReason MarkedPurchaseReason)

func (*Item) SetMovableFromConfiguration

func (i *Item) SetMovableFromConfiguration(v bool)

func (*Item) SetMovableToConfiguration

func (i *Item) SetMovableToConfiguration(v bool)

func (*Item) SetPrepaymentMandatory

func (i *Item) SetPrepaymentMandatory(isPrepaymentMandatory bool)

func (*Item) SetPrice

func (i *Item) SetPrice(price int)

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) SetType

func (i *Item) SetType(v Type)

func (*Item) SimulateProblem

func (i *Item) SimulateProblem(problems ...*Problem)

func (*Item) SortTypeValue

func (i *Item) SortTypeValue() int

func (*Item) SpaceId

func (i *Item) SpaceId() store_types.SpaceId

SpaceId возвращает идентификатор региона, относительно которого посчитано наличие и цена позиции

func (*Item) Spec

func (i *Item) Spec() *Spec

func (*Item) ToXItem

func (i *Item) ToXItem() *XItem

func (*Item) ToXmlItem

func (i *Item) ToXmlItem() *XMLItem

func (*Item) Type

func (i *Item) Type() Type

func (*Item) UniqId

func (i *Item) UniqId() UniqId

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 ItemFactory interface {
	Creatable(itemType Type) bool
	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 ItemId

type ItemId string

ItemId идентификатор позиции (не уникален)

func (ItemId) IsConfiguration

func (i ItemId) IsConfiguration() bool

type ItemList

type ItemList struct {
	XMLName xml.Name `xml:"items"`
	Items   []*XMLItem
}

type ItemMap

type ItemMap map[UniqId]*Item

func (ItemMap) ToSlice

func (im ItemMap) ToSlice() Items

func (ItemMap) ToSliceOnlySelected

func (im ItemMap) ToSliceOnlySelected() Items

type Items

type Items []*Item

func (Items) First

func (is Items) First() *Item

func (Items) Ids

func (is Items) Ids() []id

func (Items) ItemIds

func (is Items) ItemIds() []ItemId

func (Items) ItemIdsStrings

func (is Items) ItemIdsStrings() []string

func (Items) Sort

func (is Items) Sort(parent *Item) Items

func (Items) ToItemList

func (is Items) ToItemList() *ItemList

func (Items) ToXItems

func (is Items) ToXItems() []*XItem

func (Items) UniqIds

func (is Items) UniqIds() []UniqId

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

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.

func (*MockSpecer) Spec

func (m *MockSpecer) Spec() *Spec

Spec mocks base method.

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

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

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.

func (*MockXItemer) ToXItem

func (m *MockXItemer) ToXItem() *XItem

ToXItem mocks base method.

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 NavType int

type PriceChangedInfoAddition

type PriceChangedInfoAddition struct {
	From int // 1
	To   int // 2
}

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 NewProblem(id ProblemId, message string) *Problem

func (*Problem) Additions

func (p *Problem) Additions() *ProblemAdditions

Additions возвращает дополнительные данные по проблеме

func (*Problem) DecodeMsgpack

func (p *Problem) DecodeMsgpack(d *msgpack.Decoder) error

func (*Problem) EncodeMsgpack

func (p *Problem) EncodeMsgpack(e *msgpack.Encoder) error

func (*Problem) Id

func (p *Problem) Id() ProblemId

func (*Problem) IsHidden

func (p *Problem) IsHidden() bool

func (*Problem) Message

func (p *Problem) Message() string

func (*Problem) SetIsHidden

func (p *Problem) SetIsHidden(v bool)

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 (*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 (r *Rules) DecodeMsgpack(d *msgpack.Decoder) error

func (*Rules) EncodeMsgpack

func (r *Rules) EncodeMsgpack(e *msgpack.Encoder) error

func (*Rules) IsMaxCount

func (r *Rules) IsMaxCount() bool

func (*Rules) MaxCount

func (r *Rules) MaxCount() int

func (*Rules) SetMaxCount

func (r *Rules) SetMaxCount(v int)

type Service

type Service struct {
	IsCreditAvail              bool // 1
	IsAvailableForInstallments bool // 2
	// contains filtered or unexported fields
}

func NewService

func NewService(
	isCreditAvail bool,
	isAvailableForInstallments bool,
) *Service

func (*Service) DecodeMsgpack

func (s *Service) DecodeMsgpack(d *msgpack.Decoder) error

func (*Service) EncodeMsgpack

func (s *Service) EncodeMsgpack(e *msgpack.Encoder) error

func (*Service) GetIsAvailableForInstallments

func (s *Service) GetIsAvailableForInstallments() bool

func (*Service) GetIsCreditAvail

func (s *Service) GetIsCreditAvail() bool

func (*Service) SetIsAvailableForInstallments

func (s *Service) SetIsAvailableForInstallments(v bool)

func (*Service) SetIsCreditAvail

func (s *Service) SetIsCreditAvail(v bool)

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 (s *Spec) CanHaveChild(itemType Type) bool

func (*Spec) CanHaveChildren

func (s *Spec) CanHaveChildren() bool

func (*Spec) ChildrenTypes

func (s *Spec) ChildrenTypes() []Type

func (*Spec) IsAllowedForB2bUser

func (s *Spec) IsAllowedForB2bUser() bool

func (*Spec) IsAllowedForPerson

func (s *Spec) IsAllowedForPerson() bool

func (*Spec) IsCountChangeable

func (s *Spec) IsCountChangeable() bool

IsCountChangeable возможно ли изменение кол-ва для позиции

func (*Spec) IsCountEqualToParentCount

func (s *Spec) IsCountEqualToParentCount() bool

IsCountEqualToParentCount количество единиц в корзине всегда совпадает с количеством родительской позиции

func (*Spec) IsCountLessOrEqualThenParent

func (s *Spec) IsCountLessOrEqualThenParent() bool

IsCountLessOrEqualThenParent кол-во позиций не должно превышать кол-во родительской позиции (для случаев когда позиция является дочерней к другой позиции)

func (*Spec) IsDeletable

func (s *Spec) IsDeletable() bool

IsDeletable возможно ли просто взять и удалить позицию

func (*Spec) IsOnlyOnePositionPerParent

func (s *Spec) IsOnlyOnePositionPerParent() bool

IsOnlyOnePositionPerParent только одна позиция с таким типом может быть у родительской позиции. Например, только одна позиция услуги страхования товара может быть у товара

func (*Spec) IsOnlyOnePositionPossible

func (s *Spec) IsOnlyOnePositionPossible() bool

IsOnlyOnePositionPossible означает, что только одна позиция с этим типом может присутствовать в корзине

func (*Spec) MustBeAChild

func (s *Spec) MustBeAChild() bool

type Specer

type Specer interface {
	Spec() *Spec
}

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 (t Type) IsAddedByServer() bool

func (Type) IsConfiguration

func (t Type) IsConfiguration() bool

func (Type) IsPartOfConfiguration

func (t Type) IsPartOfConfiguration() bool

func (Type) IsPresent

func (t Type) IsPresent() bool

func (Type) IsProduct

func (t Type) IsProduct() bool

func (Type) IsService

func (t Type) IsService() bool

func (Type) Name

func (t Type) Name() string

func (Type) NavType

func (t Type) NavType() NavType

NavType возвращает служебный тип позиции для NAV

func (Type) ServiceType

func (t Type) ServiceType() ServiceType

ServiceType возвраащет служебный тип услуги, необходимый для БД

func (Type) Spec

func (t Type) Spec() *Spec

func (Type) Validate

func (t Type) Validate() error

type TypeService

type TypeService interface {
	Determine(ctx context.Context, spaceId store_types.SpaceId, serviceId ItemId, itemGroup Group, getToConfiguration bool) (Type, error)
}

type UniqId

type UniqId string

UniqId уникальный идентификатор позиции

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"`
	NavisionType              int      `xml:"type"`
	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
}

type XItemer

type XItemer interface {
	ToXItem() *XItem
}

type XMLItem

type XMLItem struct {
	XMLName xml.Name `xml:"item"`
	ItemId  string   `xml:"id"`
	Count   int      `xml:"quantity"`
}

Directories

Path Synopsis
Package basket_item_mock is a generated GoMock package.
Package basket_item_mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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