Methods summary
public
|
#
__construct( )
Initialize Pricings
Overrides
|
public
mixed
|
#
get( integer $pricing_id )
Fetches the pricing
Parameters
- $pricing_id
- The ID of the pricing to fetch
Returns
mixed A stdClass object representing the pricing, false if no such pricing exists
|
public
array
|
#
getAll( integer $company_id )
Fetches all pricing for a given company
Fetches all pricing for a given company
Parameters
- $company_id
- The company ID
Returns
array An array of stdClass objects representing each pricing
|
public
array
|
#
getList( integer $company_id, integer $page = 1, array $order_by = ['period' => 'asc', 'term' => 'asc'] )
Fetches a list of pricing for a given company
Fetches a list of pricing for a given company
Parameters
- $company_id
- The company ID to fetch pricing for
- $page
- The page to return results for
- $order_by
- The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
Returns
array An array of objects, each representing a pricing
|
public
integer
|
#
getListCount( integer $company_id )
Return the total number of pricings returned from Pricings::getList(),
useful in constructing pagination for the getList() method.
Return the total number of pricings returned from Pricings::getList(),
useful in constructing pagination for the getList() method.
Parameters
- $company_id
- The company ID to fetch pricings for
Returns
integer The total number of pricings
See
|
public
integer
|
#
add( array $vars )
Adds a pricing for the given company
Adds a pricing for the given company
Parameters
- $vars
An array of pricing info including:
- company_id The ID of the company to add the pricing for
- term The term as an integer 1-65535 (optional, default 1)
- period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
- price The price of this term (optional, default 0.00)
- price_renews The renewal price of this term (optional, default null)
- price_transfer The transfer price of this term (optional, default null)
- setup_fee The setup fee for this pricing (optional, default 0.00)
- cancel_fee The cancelation fee for this pricing (optional, default 0.00)
- currency The ISO 4217 currency code for this pricing (optional, default USD)
Returns
integer The ID of the pricing record added, void on error
|
public
|
#
edit( integer $pricing_id, array $vars )
Updates a pricing
Parameters
- $pricing_id
- The ID of the pricing to edit
- $vars
An array of pricing info including:
- term The term as an integer 1-65535 (optional, default 1)
- period The period, 'day', 'week', 'month', 'year', 'onetime' (optional, default 'month')
- price The price of this term (optional, default 0.00)
- price_renews The renewal price of this term (optional, default null)
- price_transfer The transfer price of this term (optional, default null)
- setup_fee The setup fee for this pricing (optional, default 0.00)
- cancel_fee The cancelation fee for this pricing (optional, default 0.00)
- currency The ISO 4217 currency code for this pricing (optional, default USD)
|
public
|
#
delete( integer $pricing_id )
Permanently removes a pricing from the system.
Permanently removes a pricing from the system.
Parameters
- $pricing_id
- The pricing ID to delete
|
public
boolean
|
#
validateTerm( integer $term, string $period )
Validates that the term is valid for the period. That is, the term must be > 0
if the period is something other than "onetime".
Validates that the term is valid for the period. That is, the term must be > 0
if the period is something other than "onetime".
Parameters
- $term
- The Term to validate
- $period
- The period to validate the term against
Returns
boolean True if validated, false otherwise
|
public
boolean
|
#
validatePeriod( string $period )
Validates the pricing 'period' field type
Validates the pricing 'period' field type
Parameters
Returns
boolean True if validated, false otherwise
|
public
mixed
|
#
formatTerm( integer $term, string $period )
Formats the pricing term
Parameters
- $term
- The term length
- $period
- The period of this term
Returns
mixed The term formatted in accordance to the period, if possible
|
public
array
|
#
getPeriods( boolean $plural = false )
Retrieves a list of pricing periods
Retrieves a list of pricing periods
Parameters
- $plural
- True to return language for plural periods, false for singular
Returns
array Key=>value pairs of pricing periods
|