Difference between revisions of "Freeside:3:Documentation:Developer/FS/part pkg/discount Mixin"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
m (Edit via perl MediaWiki framework (1.13))
 
Line 7: Line 7:
 
sub calc_recur { ... my $discount = $self->calc_discount($cust_pkg, $$sdate, $details, $param); $charge -= $discount; ... }
 
sub calc_recur { ... my $discount = $self->calc_discount($cust_pkg, $$sdate, $details, $param); $charge -= $discount; ... }
  
; calc_discount
+
; calc_discount CUST_PKG, SDATE, DETAILS_ARRAYREF, PARAM_HASHREF
:Takes all the arguments of calc_recur. Calculates and returns the amount by which to reduce the recurring fee; also increments months used on the discount.
+
:Takes all the arguments of calc_recur. Calculates and returns the amount by which to reduce the charge; also increments months used on the discount.
 +
 
 +
:If there is a setup fee, this will be called once with 'setup_charge' => the setup fee amount (and should return the discount to be applied to the setup charge, if any), and again without it (for the recurring fee discount). PARAM_HASHREF carries over between the two invocations.
  
 
==POD ERRORS==
 
==POD ERRORS==

Latest revision as of 07:32, 28 September 2015

NAME

FS::part_pkg::discount_Mixin - Mixin class for part_pkg:: classes that can be discounted.

SYNOPSIS

package FS::part_pkg::...; use base qw( FS::part_pkg::discount_Mixin );

sub calc_recur { ... my $discount = $self->calc_discount($cust_pkg, $$sdate, $details, $param); $charge -= $discount; ... }

calc_discount CUST_PKG, SDATE, DETAILS_ARRAYREF, PARAM_HASHREF
Takes all the arguments of calc_recur. Calculates and returns the amount by which to reduce the charge; also increments months used on the discount.
If there is a setup fee, this will be called once with 'setup_charge' => the setup fee amount (and should return the discount to be applied to the setup charge, if any), and again without it (for the recurring fee discount). PARAM_HASHREF carries over between the two invocations.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 29:
Unknown directive: =head
Around line 31:
'=item' outside of any '=over'