Documentation ¶
Overview ¶
Package giftcard creates and manage gift cards
Index ¶
- Constants
- func Apply(context api.InterfaceApplicationContext) (interface{}, error)
- func GetHistory(context api.InterfaceApplicationContext) (interface{}, error)
- func GetList(context api.InterfaceApplicationContext) (interface{}, error)
- func GetSingleCode(context api.InterfaceApplicationContext) (interface{}, error)
- func Remove(context api.InterfaceApplicationContext) (interface{}, error)
- func SendTask(params map[string]interface{}) error
- type DefaultGiftcard
- type Shipping
- func (it Shipping) GetAllRates() []checkout.StructShippingRate
- func (it *Shipping) GetCode() string
- func (it *Shipping) GetName() string
- func (it *Shipping) GetRates(currentCheckout checkout.InterfaceCheckout) []checkout.StructShippingRate
- func (it *Shipping) IsAllowed(checkout checkout.InterfaceCheckout) bool
Constants ¶
const ( ConstSessionKeyAppliedGiftCardCodes = "applied_giftcard_codes" ConstCollectionNameGiftCard = "gift_card" ConstConfigPathGiftEmailTemplate = "general.discounts.giftCard_email" ConstConfigPathGiftEmailSubject = "general.discounts.giftCard_email_subject" ConstConfigPathGiftCardSKU = "general.discounts.giftCard_SKU_code" ConstConfigPathGiftCardApplyPriority = "general.discounts.giftCard_apply_priority" ConstConfigPathGiftCardAdminBuyerName = "general.discounts.giftCard_admin_buyer_name" ConstConfigPathGiftCardAdminBuyerEmail = "general.discounts.giftCard_admin_buyer_email" ConstErrorModule = "giftcard" ConstErrorLevel = env.ConstErrorLevelActor ConstGiftCardStatusNew = "new" ConstGiftCardStatusApplied = "applied" ConstGiftCardStatusUsed = "used" ConstGiftCardStatusOverCredited = "negative" ConstGiftCardStatusRefilled = "refilled" ConstGiftCardStatusCancelled = "cancelled" ConstGiftCardStatusDelivered = "delivered" )
Package global constants
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(context api.InterfaceApplicationContext) (interface{}, error)
Apply applies the provided gift card to current checkout
- Gift Card code should be specified in "giftcode" argument
func GetHistory ¶
func GetHistory(context api.InterfaceApplicationContext) (interface{}, error)
GetHistory returns a history of gift cards for the admin in the context passed
- giftcard id should be specified in the "giftid" argument
func GetList ¶
func GetList(context api.InterfaceApplicationContext) (interface{}, error)
GetList returns a list of gift cards for the visitor id in the context passed
- visitor must be logged in
func GetSingleCode ¶
func GetSingleCode(context api.InterfaceApplicationContext) (interface{}, error)
GetSingleCode returns the gift card and related info
- giftcode must be specified on the request
func Remove ¶
func Remove(context api.InterfaceApplicationContext) (interface{}, error)
Remove removes the application of the gift card value from the current checkout
- giftcard code should be specified in the "giftcode" argument
- use "*" as giftcard code to 'remove' all giftcard discounts
Types ¶
type DefaultGiftcard ¶
type DefaultGiftcard struct{}
DefaultGiftcard is a default implementer of InterfaceDiscount
func (*DefaultGiftcard) Calculate ¶
func (it *DefaultGiftcard) Calculate(checkoutInstance checkout.InterfaceCheckout, currentPriority float64) []checkout.StructPriceAdjustment
Calculate calculates and returns amount and set of applied gift card discounts to given checkout
func (*DefaultGiftcard) GetCode ¶
func (it *DefaultGiftcard) GetCode() string
GetCode returns code of current discount implementation
func (*DefaultGiftcard) GetName ¶
func (it *DefaultGiftcard) GetName() string
GetName returns name of current discount implementation
func (*DefaultGiftcard) GetPriority ¶
func (it *DefaultGiftcard) GetPriority() []float64
GetPriority returns the code of the current coupon implementation
type Shipping ¶
type Shipping struct{}
Shipping is a default free shipping rate for Gift Cards
func (Shipping) GetAllRates ¶
func (it Shipping) GetAllRates() []checkout.StructShippingRate
GetAllRates returns all the shippmeng method rates available in the system.
func (*Shipping) GetRates ¶
func (it *Shipping) GetRates(currentCheckout checkout.InterfaceCheckout) []checkout.StructShippingRate
GetRates returns rates allowed by shipping method for a given checkout