Blesta Source Documentation

PricingFactory extends PricingFactory

Instantiates pricing objects

Table of Contents

Properties

$options

Methods

__construct() Init
arrayMerge() Creates an instance of the ArrayMerge modifier
coupon() Creates an instance of a Coupon
date() Creates an instance of the Minphp\Date\Date
description() Creates an instance of the Description modifier
getOptions() Returns an array of custom options
itemComparator() Creates an instance of the ItemComparator
metaDiscountPrice() Creates an instance of the MetaDiscountPrice
metaItemPrice() Creates an instance of the MetaItemPrice
metaTaxPrice() Creates an instance of the MetaTaxPrice
options() Sets any key/value custom options
proration() Creates an instance of the Proration modifier
Properties
Methods

__construct()

Init

public __construct(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

An array of key/value pairs representing any custom values, including:

  • dateFormat The date format to use
  • dateTimeFormat The datetime format to use

arrayMerge()

Creates an instance of the ArrayMerge modifier

public arrayMerge() : ArrayMerge
Return values
ArrayMerge

coupon()

Creates an instance of a Coupon

public coupon(ItemInterface $coupon, string $date) : Coupon
Parameters
$coupon : ItemInterface

A coupon item

$date : string

A date

Return values
Coupon

date()

Creates an instance of the Minphp\Date\Date

public date() : Date
Return values
Date

description()

Creates an instance of the Description modifier

public description() : Description
Return values
Description

getOptions()

Returns an array of custom options

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

An array of custom options

itemComparator()

Creates an instance of the ItemComparator

public itemComparator(callable $priceCallback, callable $descriptionCallback) : ItemComparator
Parameters
$priceCallback : callable

The pricing callback that accepts four arguments for the old and new price, and the old and new ItemPrice meta data (each a Blesta\Items\Item\ItemCollection), and returns a float

$descriptionCallback : callable

The description callback that accepts two arguments for the old and new ItemPrice meta data (each a Blesta\Items\Item\ItemCollection or null), and returns a string

Return values
ItemComparator

metaDiscountPrice()

Creates an instance of the MetaDiscountPrice

public metaDiscountPrice(float $amount, string $type) : MetaDiscountPrice
Parameters
$amount : float

The positive amount to discount

$type : string

The type of discount the $amount represents. One of:

  • percent The $amount represents a percentage discount (NOT already divided by 100)
  • amount The $amount represents an amount discount
Tags
throws
InvalidArgumentException

If $amount is negative

Return values
MetaDiscountPrice

metaItemPrice()

Creates an instance of the MetaItemPrice

public metaItemPrice(float $amount, int $qty[, string $key = null ]) : MetaItemPrice
Parameters
$amount : float

The unit price

$qty : int

The quantity of unit price

$key : string = null

A unique identifier (optional, default null)

Return values
MetaItemPrice

metaTaxPrice()

Creates an instance of the MetaTaxPrice

public metaTaxPrice(float $amount, string $type[, bool $subtract = false ]) : MetaTaxPrice
Parameters
$amount : float

The positive tax amount as a percentage

$type : string

The type of tax the $rate represents. One of:

  • inclusive_calculated Taxes are subtracted from the item price
  • inclusive Prices include tax
  • exclusive Prices do not include tax
$subtract : bool = false

Whether this tax should be subtracted instead of added

Tags
throws
InvalidArgumentException

If $amount is negative

Return values
MetaTaxPrice

options()

Sets any key/value custom options

public options(array<string|int, mixed> $options) : PricingFactory
Parameters
$options : array<string|int, mixed>

An array of custom options:

  • dateFormat The date format to use
  • dateTimeFormat The datetime format to use
Return values
PricingFactory

An instance of this object

proration()

Creates an instance of the Proration modifier

public proration() : Proration
Return values
Proration
Tags
subpackage

core.Pricing

copyright

Copyright (c) 2019, Phillips Data, Inc.

license

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

link

Blesta


        
On this page

Search results