Blesta Source Documentation

Proration uses Meta

Prorates all items in an ItemPriceCollection for MetaItemPrices containing relevant proration details by adjusting the MetaItemPrice unit price accordingly

Table of Contents

Properties

$date

Methods

__construct() Init
prorate() Prorates all items set to be prorated from MetaItemPrices in the collection
getMeta() Retrieves all meta information set on a meta item combined together
getMetaFromCollection() Retrieves all meta information set on an item collection
canProrate() Determines whether there is enough information for prorating
getInstance() Creates a new proration object
updateMeta() Updates the given MetaItemInterface to set the first meta item with the given data
Properties

$date

private date $date

An instance of the date object

Methods

__construct()

Init

public __construct(Date $date) : mixed
Parameters
$date : Date

prorate()

Prorates all items set to be prorated from MetaItemPrices in the collection

public prorate(ItemPriceCollection $collection) : ItemPriceCollection
Parameters
$collection : ItemPriceCollection
Return values
ItemPriceCollection

The updated collection

getMeta()

Retrieves all meta information set on a meta item combined together

protected getMeta(MetaItemInterface $item) : array<string|int, mixed>
Parameters
$item : MetaItemInterface

The item whose meta information to retrieve

Return values
array<string|int, mixed>

An array of all meta data

getMetaFromCollection()

Retrieves all meta information set on an item collection

protected getMetaFromCollection(ItemCollection $collection) : array<string|int, mixed>
Parameters
$collection : ItemCollection

An item collection

Return values
array<string|int, mixed>

An array of all meta data

canProrate()

Determines whether there is enough information for prorating

private canProrate(array<string|int, mixed> $meta) : bool
Parameters
$meta : array<string|int, mixed>

An array of meta information

Return values
bool

True if the item can be prorated, or false otherwise

getInstance()

Creates a new proration object

private getInstance(string $startDate, int $term, string $period[, int $prorateDay = null ][, string $endDate = null ]) : Proration
Parameters
$startDate : string

The proration start date in ISO 8601 format

$term : int

The term

$period : string

The period for the term

$prorateDay : int = null

The prorata day to prorate to (optional, required if $endDate not given)

$endDate : string = null

The proration end date in ISO 8601 format (optional, required if $prorataDay not given)

Return values
Proration

updateMeta()

Updates the given MetaItemInterface to set the first meta item with the given data

private updateMeta(MetaItemInterface $item, array<string|int, mixed> $meta) : MetaItemInterface
Parameters
$item : MetaItemInterface

The item whose meta information to update

$meta : array<string|int, mixed>

The meta information to update the item with

Return values
MetaItemInterface

The updated item

Tags
subpackage

core.Pricing.Modifier.Type.Proration

copyright

Copyright (c) 2019, Phillips Data, Inc.

license

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

link

Blesta


        
On this page

Search results