saleprice

package
v1.4.5-alpha1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package saleprice is an implementation of discount interface declared in "github.com/ottemo/commerce/app/models/checkout" package

Index

Constants

View Source
const (
	ConstConfigPathGroup                  = "general.sale_price"
	ConstConfigPathEnabled                = "general.sale_price.enabled"
	ConstConfigPathSalePriceApplyPriority = "general.sale_price.priority"

	ConstErrorModule = "saleprice"
	ConstErrorLevel  = env.ConstErrorLevelActor
)

Package global constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultSalePrice

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

DefaultSalePrice is an implementer of InterfaceDiscount

func (*DefaultSalePrice) Calculate

func (it *DefaultSalePrice) Calculate(checkoutInstance checkout.InterfaceCheckout, currentPriority float64) []checkout.StructPriceAdjustment

Calculate calculates and returns amount and set of applied discounts to given checkout

func (*DefaultSalePrice) Delete

func (it *DefaultSalePrice) Delete() error

Delete deletes model from storage

func (*DefaultSalePrice) FromHashMap

func (it *DefaultSalePrice) FromHashMap(input map[string]interface{}) error

FromHashMap converts object represented by hash map to object

func (*DefaultSalePrice) Get

func (it *DefaultSalePrice) Get(attribute string) interface{}

Get return model attribute by name

func (*DefaultSalePrice) GetAmount

func (it *DefaultSalePrice) GetAmount() float64

GetAmount : amount getter

func (*DefaultSalePrice) GetAttributesInfo

func (it *DefaultSalePrice) GetAttributesInfo() []models.StructAttributeInfo

GetAttributesInfo describes model attributes

func (*DefaultSalePrice) GetCode

func (it *DefaultSalePrice) GetCode() string

GetCode returns code of current sale price implementation

func (*DefaultSalePrice) GetEndDatetime

func (it *DefaultSalePrice) GetEndDatetime() time.Time

GetEndDatetime : endDatetime getter

func (*DefaultSalePrice) GetID

func (it *DefaultSalePrice) GetID() string

GetID returns database storage id of current object

func (*DefaultSalePrice) GetImplementationName

func (it *DefaultSalePrice) GetImplementationName() string

GetImplementationName returns default model implementation name

func (*DefaultSalePrice) GetModelName

func (it *DefaultSalePrice) GetModelName() string

GetModelName returns model name

func (*DefaultSalePrice) GetName

func (it *DefaultSalePrice) GetName() string

GetName returns name of current sale price implementation

func (*DefaultSalePrice) GetPriority

func (it *DefaultSalePrice) GetPriority() []float64

GetPriority returns the priority of sale price adjustment during checkout calculation

func (*DefaultSalePrice) GetProductID

func (it *DefaultSalePrice) GetProductID() string

GetProductID : productID getter

func (*DefaultSalePrice) GetStartDatetime

func (it *DefaultSalePrice) GetStartDatetime() time.Time

GetStartDatetime : startDatetime getter

func (*DefaultSalePrice) Load

func (it *DefaultSalePrice) Load(id string) error

Load loads model from storage

func (*DefaultSalePrice) New

New creates new model

func (*DefaultSalePrice) Save

func (it *DefaultSalePrice) Save() error

Save function check model and save it to storage

func (*DefaultSalePrice) Set

func (it *DefaultSalePrice) Set(attribute string, value interface{}) error

Set sets attribute value to object or returns error

func (*DefaultSalePrice) SetAmount

func (it *DefaultSalePrice) SetAmount(amount float64) error

SetAmount : amount setter

func (*DefaultSalePrice) SetEndDatetime

func (it *DefaultSalePrice) SetEndDatetime(endDatetime time.Time) error

SetEndDatetime : endDatetime setter

func (*DefaultSalePrice) SetID

func (it *DefaultSalePrice) SetID(id string) error

SetID sets database storage id for current object

func (*DefaultSalePrice) SetProductID

func (it *DefaultSalePrice) SetProductID(productID string) error

SetProductID : productID setter

func (*DefaultSalePrice) SetStartDatetime

func (it *DefaultSalePrice) SetStartDatetime(startDatetime time.Time) error

SetStartDatetime : startDatetime setter

func (*DefaultSalePrice) ToHashMap

func (it *DefaultSalePrice) ToHashMap() map[string]interface{}

ToHashMap converts object data to hash map presentation

type DefaultSalePriceCollection

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

DefaultSalePriceCollection is a default implementer of InterfaceSalePriceCollection

func (*DefaultSalePriceCollection) GetDBCollection

func (it *DefaultSalePriceCollection) GetDBCollection() db.InterfaceDBCollection

GetDBCollection returns database collection

func (*DefaultSalePriceCollection) GetImplementationName

func (it *DefaultSalePriceCollection) GetImplementationName() string

GetImplementationName default model default implementation name

func (*DefaultSalePriceCollection) GetModelName

func (it *DefaultSalePriceCollection) GetModelName() string

GetModelName returns model name

func (*DefaultSalePriceCollection) List

List returns list of StructListItem items

func (*DefaultSalePriceCollection) ListAddExtraAttribute

func (it *DefaultSalePriceCollection) ListAddExtraAttribute(attribute string) error

ListAddExtraAttribute adds attribute to sale price collection

func (*DefaultSalePriceCollection) ListFilterAdd

func (it *DefaultSalePriceCollection) ListFilterAdd(attribute string, operator string, value interface{}) error

ListFilterAdd adds filter to sale price collection

func (*DefaultSalePriceCollection) ListFilterReset

func (it *DefaultSalePriceCollection) ListFilterReset() error

ListFilterReset resets sale price collection filters

func (*DefaultSalePriceCollection) ListLimit

func (it *DefaultSalePriceCollection) ListLimit(offset int, limit int) error

ListLimit limits sale price collection selected records

func (*DefaultSalePriceCollection) ListSalePrices

ListSalePrices returns list of sale price model items

func (*DefaultSalePriceCollection) New

New returns new instance of model implementation object

type SalePriceDelegate

type SalePriceDelegate struct {
	SalePrices []saleprice.InterfaceSalePrice
	// contains filtered or unexported fields
}

SalePriceDelegate type implements InterfaceAttributesDelegate and have handles on InterfaceStorable methods which should have call-back on model method call in order to test it we are pushing the callback status to model instance

func (*SalePriceDelegate) Get

func (it *SalePriceDelegate) Get(attribute string) interface{}

Get returns product external attributes managed by sale price package

func (*SalePriceDelegate) GetAttributesInfo

func (it *SalePriceDelegate) GetAttributesInfo() []models.StructAttributeInfo

GetAttributesInfo describes product external attributes managed by sale price package

func (*SalePriceDelegate) Load

func (it *SalePriceDelegate) Load(id string) error

Load get sale prices for product from db

func (*SalePriceDelegate) New

func (it *SalePriceDelegate) New(productInstance interface{}) (models.InterfaceAttributesDelegate, error)

New creates new SalePriceDelegate with associated product

func (*SalePriceDelegate) Save

func (it *SalePriceDelegate) Save() error

Save stores sale prices for product in db

func (*SalePriceDelegate) Set

func (it *SalePriceDelegate) Set(attribute string, value interface{}) error

Set saves product external attributes managed by sale price package

Jump to

Keyboard shortcuts

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