giftcard

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: 3

Documentation

Overview

Package giftcard creates and manage gift cards

Index

Constants

View Source
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

func SendTask

func SendTask(params map[string]interface{}) error

SendTask will send email with purchased gift cards info

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

func (it *Shipping) GetCode() string

GetCode returns code of shipping method

func (*Shipping) GetName

func (it *Shipping) GetName() string

GetName returns name of shipping method

func (*Shipping) GetRates

func (it *Shipping) GetRates(currentCheckout checkout.InterfaceCheckout) []checkout.StructShippingRate

GetRates returns rates allowed by shipping method for a given checkout

func (*Shipping) IsAllowed

func (it *Shipping) IsAllowed(checkout checkout.InterfaceCheckout) bool

IsAllowed checks for method applicability

Jump to

Keyboard shortcuts

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