| 
				 public 
				
				
				 | 
			#
			__construct( )
				
Initialize Coupons Overrides | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getList( integer $company_id, integer $page = 1, string $order_by = array('code'=>"ASC") )
				
Fetches a list of all coupons for a given company 
				
Fetches a list of all coupons for a given company Parameters
						$company_idinteger$company_id The ID of the company to fetch coupons for
$pageinteger$page The page to return results for (optional, default 1)
$order_bystring$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
Returns
						mixedAn array of stdClass objects representing coupons, false if no coupons found
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getListCount( integer $company_id )
				
Returns the total number of coupons returned from Coupons::getList(), useful
in constructing pagination for the getList() method. 
				
Returns the total number of coupons returned from Coupons::getList(), useful
in constructing pagination for the getList() method. Parameters
						$company_idinteger$company_id The ID of the company to fetch coupons for
Returns
						integerThe total number of coupons
 
 See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getCouponAmounts( integer $coupon_id )
				
Fetches a list of currencies and amounts associated with a given coupon 
				
Fetches a list of currencies and amounts associated with a given coupon Parameters
						$coupon_idinteger$coupon_id The ID of the coupon whose amounts to fetch
Returns
						arrayAn array of objects representing each coupon amount
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			get( integer $coupon_id )
				
Fetches a coupon using the given $coupon_id 
				
Fetches a coupon using the given $coupon_id Parameters
						$coupon_idinteger$coupon_id The ID of the coupon to fetch
Returns
						mixedA stdClass object representing the coupon, false if no such coupon exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getByCode( string $code )
				
Retrieves a coupon by its code 
				
Retrieves a coupon by its code Parameters
						$codestring$code The coupon code representing the coupon to fetch
Returns
						mixedA stdClass object representing the coupon, or false if no such coupon exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getForPackages( string $code = null, string $coupon_id = null, array $packages = null )
				
Fetches a coupon using the given code or coupon ID. Only returns coupons that
are active and capable of being used for the current company. 
				
Fetches a coupon using the given code or coupon ID. Only returns coupons that
are active and capable of being used for the current company. Parameters
						$codestring$code The coupon code to fetch
$coupon_idstring$coupon_id The coupon ID to fetch
$packagesarrayAn array of package IDs to attempt to use with the coupon. If the coupon is
inclusive all packages configured for the coupon must be present.
Returns
						mixedA stdClass object representing the coupon, false if no such coupon exists of the
coupon is no longer valid
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getRecurring( integer $coupon_id, string $currency, string $date )
				
Retrieves the given coupon and the recurring coupon amount iff it recurs and
applies to the given currency at the given date 
				
Retrieves the given coupon and the recurring coupon amount iff it recurs and
applies to the given currency at the given date Parameters
						$coupon_idinteger$coupon_id The ID of the coupon to fetch
$currencystring$currency The ISO 4217 currency code
$datestring$date The date at which to check that the coupon will apply
Returns
						mixedAn stdClass object representing the coupon and the recurring amount, or false
otherwise
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			add( array $vars )
				
Creates a new coupon Parameters
						$varsarray$vars An array of coupon information including: - code The coupon code -
company_id The company ID this coupon belongs to - used_qty The number of times
this coupon has been used (optional, default 0) - max_qty The maximum number of
times this coupon can be used (optional, default 0 for unlimited) - start_date
The date this coupon goes into effect (optional) - end_date The date this coupon
is no longer effective (optional) - status The status of the coupon, 'active' or
'inactive' (optional, default 'active') - type The type of coupon, 'inclusive'
must order all packages in package for coupon to apply, 'exclusive' no
restriction on coupon application (optional, default 'exclusive') - recurring
Allows the coupon to be applied every time the service renews, restrictions on
start_date/end_date/used_qty/max_qty/type do not apply. If the coupon was
applied originally, it will continue to be applied so long as status is 'active'
and the package is still tied to this coupon. - limit_recurring Allows the
coupon to be used again every time a renewing service that uses it renews (1 to
increase the used quantity each time a renewing service renews, 0 for renewing
services to use this coupon only once. optional, default 0) - packages A
numerically indexed array containing package IDs this coupon applies to: -
amounts An array of discounts for this coupon containing (only one per
currency): - currency The ISO 4217 currency code - amount The amount of the
discount - type The type of discount 'amount' a currency amount, 'percent' a
percentage (optional, default 'percent')
Returns
						integerThe ID code for this coupon
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			edit( integer $coupon_id, array $vars )
				
Updates an existing coupon 
				
Updates an existing coupon Parameters
						$coupon_idinteger$coupon_id The ID of the coupon to update
$varsarray$vars An array of coupon information including: - code The coupon code -
company_id The ID of the company this coupon belongs to - used_qty The number of
times this coupon has been used (optional, default 0) - max_qty The maximum
number of times this coupon can be used (optional, default 0 for unlimited) -
start_date The date this coupon goes into effect (optional) - end_date The date
this coupon is no longer effective (optional) - status The status of the coupon,
'active' or 'inactive' (optional, default 'active') - type The type of coupon,
'inclusive' must order all packages in package for coupon to apply, 'exclusive'
no restriction on coupon application (optional, default 'exclusive') - recurring
Allows the coupon to be applied every time the service renews, restrictions on
start_date/end_date/used_qty/max_qty/type do not apply. If the coupon was
applied originally, it will continue to be applied so long as status is 'active'
and the package is still tied to this coupon. - limit_recurring Allows the
coupon to be used again every time a renewing service that uses it renews (1 to
increase the used quantity each time a renewing service renews, 0 for renewing
services to use this coupon only once. optional, default 0) - packages A
numerically indexed array containing package IDs this coupon applies to: -
amounts An array of discounts for this coupon containing (only one per
currency): - currency The ISO 4217 currency code - amount The amount of the
discount - type The type of discount 'amount' a currency amount, 'percent' a
percentage (optional, default 'percent')
Returns
						integerThe ID code for this coupon
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			delete( integer $coupon_id )
				
Permanently removes the coupon from the system 
				
Permanently removes the coupon from the system Parameters
						$coupon_idinteger$coupon_id The ID of the coupon to delete
 | 
		
			| 
				 public 
				
				
				 | 
			#
			incrementUsage( integer $coupon_id )
				
Increments the used quantity on the given coupon 
				
Increments the used quantity on the given coupon Parameters
						$coupon_idinteger$coupon_id The ID of the coupon whose used quantity to increment
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTypes( )
				
Retrieves a list of coupon types 
				
Retrieves a list of coupon types Returns
						arrayKey=>value pairs of coupon types
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAmountTypes( )
				
Retrieves a list of coupon amount types 
				
Retrieves a list of coupon amount types Returns
						arrayKey=>value pairs of coupon amount types
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateStatus( string $status )
				
Validates a coupon's 'status' field 
				
Validates a coupon's 'status' field Parameters
						$statusstring$status The status to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateType( string $type )
				
Validates a coupon's 'type' field 
				
Validates a coupon's 'type' field Parameters
						$typestring$type The type to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateAmountType( string $type )
				
Validates a coupon amount's 'type' field 
				
Validates a coupon amount's 'type' field Parameters
						$typestring$type The type to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateAmountDuplicates( array $vars )
				
Validates an array of coupon discounts to check for duplicate currencies. 
				
Validates an array of coupon discounts to check for duplicate currencies. Parameters
						$varsarray$vars An indexed array of discount options including: - currency The currency
code as defined in ISO 4217 - type The type of discount ("amount" or "percent")
- amount The numeric amount of this discount
Returns
						booleanTrue if each currency is unique, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateInclusiveRecurring( array $amounts, string $recurring, string $type )
				
Validates that inclusive recurring coupons of discount type "Amount" do not
exist. This prohibits the possibility of amount discounts being applied to each
service with a recurring coupon. 
				
Validates that inclusive recurring coupons of discount type "Amount" do not
exist. This prohibits the possibility of amount discounts being applied to each
service with a recurring coupon. Parameters
						$amountsarray$amounts An indexed array of discount options including: - currency The currency
code as defined in ISO 4217 - type The type of discount ("amount" or "percent")
- amount The numeric amount of this discount
$recurringstring$recurring Whether this coupon is set to be recurring (1 or 0)
$typestring$type The coupon type ("inclusive" or "exclusive")
Returns
						booleanTrue if this coupon is not set as an inclusive recurring coupon that contains
any discounts of type "Amount", or false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateUniqueCode( string $coupon_code, mixed $coupon_id = null )
				
Validates whether the given coupon code is currently in use 
				
Validates whether the given coupon code is currently in use Parameters
						$coupon_codestring$coupon_code The coupon code to validate
$coupon_idmixed$coupon_id The ID of the coupon the given coupon code must represent, or null to
not require any
Returns
						booleanTrue if the given coupon code is unique, or false otherwise
 
 |