subscription

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: 7 Imported by: 0

Documentation

Overview

Package subscription represents abstraction of business layer purchase subscription object

Index

Constants

View Source
const (
	ConstModelNameSubscription           = "Subscription"
	ConstModelNameSubscriptionCollection = "SubscriptionCollection"

	ConstErrorModule = "subscription"
	ConstErrorLevel  = env.ConstErrorLevelModel

	ConstSubscriptionOptionName = "subscription"

	ConstConfigPathSubscription              = "general.subscription"
	ConstConfigPathSubscriptionEnabled       = "general.subscription.enabled"
	ConstConfigPathSubscriptionExecutionTime = "general.subscription.executionTime"

	ConstConfigPathSubscriptionExecutionOptionHour   = "hour"
	ConstConfigPathSubscriptionExecutionOptionMinute = "minute"

	ConstConfigPathSubscriptionProducts = "general.subscription.products"

	// Admin: Out of stock email
	ConstConfigPathSubscriptionStockEmailSubject  = "general.subscription.emailStockSubject"
	ConstConfigPathSubscriptionStockEmailTemplate = "general.subscription.emailStockTemplate"

	// Inusfficient funds email
	ConstConfigPathSubscriptionEmailSubject  = "general.subscription.emailSubject"
	ConstConfigPathSubscriptionEmailTemplate = "general.subscription.emailTemplate"

	// Cancellation Email
	ConstConfigPathSubscriptionCancelEmailSubject  = "general.subscription.emailCancelSubject"
	ConstConfigPathSubscriptionCancelEmailTemplate = "general.subscription.emailCancelTemplate"

	ConstSubscriptionLogStorage = "subscription.log"

	ConstSubscriptionStatusSuspended = "suspended"
	ConstSubscriptionStatusConfirmed = "confirmed"
	ConstSubscriptionStatusCanceled  = "canceled"
)

Package global constants

Variables

This section is empty.

Functions

func ContainsSubscriptionItems

func ContainsSubscriptionItems(checkoutInstance checkout.InterfaceCheckout) bool

ContainsSubscriptionItems used to check checkout for subscription items

func GetSubscriptionCronExpr

func GetSubscriptionCronExpr(key int) string

GetSubscriptionCronExpr return cron expression by option value

func GetSubscriptionOptionValues

func GetSubscriptionOptionValues() map[string]int

GetSubscriptionOptionValues return map of known options for subscription

func GetSubscriptionPeriodValue

func GetSubscriptionPeriodValue(option string) int

GetSubscriptionPeriodValue used to obtain valid period value from option value

func IsSubscriptionEnabled

func IsSubscriptionEnabled() bool

IsSubscriptionEnabled return status of subscription

Types

type InterfaceSubscription

type InterfaceSubscription interface {
	GetCustomerEmail() string
	GetCustomerName() string

	GetOrderID() string
	GetVisitorID() string

	GetItems() []StructSubscriptionItem

	SetShippingAddress(address visitor.InterfaceVisitorAddress) error
	GetShippingAddress() visitor.InterfaceVisitorAddress

	SetBillingAddress(address visitor.InterfaceVisitorAddress) error
	GetBillingAddress() visitor.InterfaceVisitorAddress

	SetCreditCard(creditCard visitor.InterfaceVisitorCard) error
	GetCreditCard() visitor.InterfaceVisitorCard

	GetPaymentMethod() checkout.InterfacePaymentMethod

	SetShippingMethod(shippingMethod checkout.InterfaceShippingMethod) error
	GetShippingMethod() checkout.InterfaceShippingMethod

	SetShippingRate(shippingRate checkout.StructShippingRate) error
	GetShippingRate() checkout.StructShippingRate

	GetStatus() string
	SetStatus(status string) error

	GetActionDate() time.Time
	SetActionDate(actionDate time.Time) error

	GetPeriod() int
	SetPeriod(days int) error

	SetInfo(key string, value interface{})
	GetInfo(key string) interface{}

	UpdateActionDate() error

	Validate() error
	GetCheckout() (checkout.InterfaceCheckout, error)

	models.InterfaceModel
	models.InterfaceObject
	models.InterfaceStorable
	models.InterfaceListable
}

InterfaceSubscription represents interface to access business layer implementation of purchase subscription object

func GetSubscriptionModel

func GetSubscriptionModel() (InterfaceSubscription, error)

GetSubscriptionModel retrieves current InterfaceSubscription model implementation

func LoadSubscriptionByID

func LoadSubscriptionByID(subscriptionID string) (InterfaceSubscription, error)

LoadSubscriptionByID loads subscription data into current InterfaceSubscription model implementation

type InterfaceSubscriptionCollection

type InterfaceSubscriptionCollection interface {
	ListSubscriptions() []InterfaceSubscription

	models.InterfaceCollection
}

InterfaceSubscriptionCollection represents interface to access business layer implementation of purchase subscription collection

func GetSubscriptionCollectionModel

func GetSubscriptionCollectionModel() (InterfaceSubscriptionCollection, error)

GetSubscriptionCollectionModel retrieves current InterfaceSubscriptionCollection model implementation

type StructSubscriptionItem

type StructSubscriptionItem struct {
	ProductID string                 `json:"product_id"`
	Options   map[string]interface{} `json:"options"`
	Qty       int                    `json:"qty"`
	Name      string                 `json:"name"`
	Sku       string                 `json:"sku"`
	Price     float64                `json:"price"`
}

StructSubscriptionItem hold data related to subscription item

Jump to

Keyboard shortcuts

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