Blesta Source Documentation

Coupon extends AbstractCoupon

Coupon discounts

Table of Contents

Properties

$date
$fields
$timeStamp

Methods

__construct() Initializes the coupon fields, applying currency, and applicable date
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
Properties

$fields

protected array<string|int, mixed> $fields

The coupon fields

$timeStamp

protected string $timeStamp

The date timestamp the coupon should apply to

Methods

__construct()

Initializes the coupon fields, applying currency, and applicable date

public __construct(Date $date, ItemInterface $coupon, mixed $timeStamp) : mixed
Parameters
$date : Date
$coupon : ItemInterface

The coupon item

$timeStamp : mixed

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(mixed $currency) : array<string|int, mixed>
Parameters
$currency : mixed

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[, mixed $options = false ][, mixed $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 : mixed = false

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

$recurs : mixed = 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