Blesta Source Documentation

DiscountInterface

Discount interface

Table of Contents

Methods

active() Determines whether the coupon is active
amount() Retrieves the amount from the discount that applies for the given currency
applies() Determines whether the coupon applies to the given packages, their options, whether added new or recurring
packages() Retrieves the package IDs of all packages that the coupon supports
Methods

active()

Determines whether the coupon is active

public active() : bool
Return values
bool

True if the coupon is active, or false otherwise

amount()

Retrieves the amount from the discount that applies for the given currency

public amount(string $currency) : array<string|int, mixed>
Parameters
$currency : string

The ISO 4217 currency code

Return values
array<string|int, mixed>

An array of key/value pairs representing the discount amount for the given currency

applies()

Determines whether the coupon applies to the given packages, their options, whether added new or recurring

public applies(array<string|int, mixed> $packageIds[, bool $options = false ][, bool $recurs = false ]) : bool
Parameters
$packageIds : array<string|int, mixed>

One of the following:

  • An array of package IDs that the coupon must apply to
  • An array of package IDs mapped to periods and terms [packageID => [period => [term, term]]] that the coupon must apply to
$options : bool = false

Whether or not the coupon must apply to package options (optional, default false)

$recurs : bool = false

Whether or not the coupon is being used to recur or not (optional, default false)

Return values
bool

True if the coupon applies, or false otherwise

packages()

Retrieves the package IDs of all packages that the coupon supports

public packages() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of package IDs

Tags
subpackage

core.Pricing.Modifier.Type.Discount

copyright

Copyright (c) 2019, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results