shoppingcart

package
v0.0.0-...-418b934 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	gorm.Model
	AddressID    uuid.UUID `gorm:"not null;unique_index"`
	Prefix       string
	Firstname    string
	Lastname     string
	BusinessName string
	IsBusiness   bool   `gorm:"not null;default:false"`
	Address1     string `gorm:"not null"`
	Address2     string
	Zip          string  `gorm:"not null;length:10"`
	PhoneNumber  string  `gorm:"not null"`
	City         string  `gorm:"not null"`
	State        string  `gorm:"not null"`
	Tax          float32 `gorm:"not null;default:0"`
}

Address entity

func (*Address) MarshalBinary

func (a *Address) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*Address) ToDTO

func (a *Address) ToDTO() *module.AddressDTO

ToDTO dto

func (*Address) UnmarshalBinary

func (a *Address) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type PromotionCode

type PromotionCode struct {
	entity.Base
	EntityID  uuid.UUID `gorm:"not null;index:entitycode"`
	Code      string    `gorm:"not null;index:entitycode"`
	IsUSD     bool      `gorm:"not null;default:false"`
	IsPercent bool      `gorm:"not null;default:false"`
	//PercentAmount this will be decimal value. If it's 10% off, this will be saved as 0.1
	DiscountAmount float32   `gorm:"not null;default:0"`
	ActiveFrom     time.Time `gorm:"not null"`
	ActiveTo       time.Time `gorm:"not null"`

	//BusinessID only set when IsBusinessSpecific is true
	BusinessID    uuid.UUID
	LimitedAmount int64 `gorm:"not null;default:-1"`

	IsActive           bool `gorm:"not null;default:true"`
	IsNewCustomerOnly  bool `gorm:"not null;default:false"`
	IsBusinessSpecific bool `gorm:"not null;default:false"`
}

PromotionCode entity

func (*PromotionCode) MarshalBinary

func (p *PromotionCode) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*PromotionCode) ToDTO

ToDTO dto

func (*PromotionCode) UnmarshalBinary

func (p *PromotionCode) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type ShoppingCart

type ShoppingCart struct {
	entity.Base
	//EntityID should be user ID.
	EntityID        uuid.UUID `gorm:"not null;index:entity_business"`
	BusinessID      uuid.UUID `gorm:"not null;index:entity_business"`
	ShippingAddress *Address
	BillingAddress  *Address `gorm:"not null"`
	//ShippingMethodID TODO: Need to replace with actual data
	ShippingMethodID uuid.UUID
	Subtotal         float32 `gorm:"not null;default:0"`
	ShippingCost     float32 `gorm:"not null;default:0"`
	Tax              float32 `gorm:"not null;default:0"`

	ShoppingCartItems []*ShoppingCartItem
	PromotionCodes    []*PromotionCode

	PointsRedeem uint64 `gorm:"not null;default:0"`

	IsActive    bool `gorm:"not null;default:true"`
	IsCompleted bool `gorm:"not null;default:false"`
}

ShoppingCart entity

func (*ShoppingCart) MarshalBinary

func (s *ShoppingCart) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*ShoppingCart) ToDTO

ToDTO dto

func (*ShoppingCart) UnmarshalBinary

func (s *ShoppingCart) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

type ShoppingCartItem

type ShoppingCartItem struct {
	gorm.Model
	ProductID uuid.UUID `gorm:"not null"`
	Quantity  uint64    `gorm:"not null"`
}

ShoppingCartItem entity

func (*ShoppingCartItem) MarshalBinary

func (s *ShoppingCartItem) MarshalBinary() ([]byte, error)

MarshalBinary for redis

func (*ShoppingCartItem) ToDTO

ToDTO dto

func (*ShoppingCartItem) UnmarshalBinary

func (s *ShoppingCartItem) UnmarshalBinary(data []byte) error

UnmarshalBinary for redis

Jump to

Keyboard shortcuts

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