From ddbe06e47316e996f909dc534a9aeabe7b47d0f3 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 21 Jan 2015 01:20:41 -0800 Subject: [PATCH] update api docs for cust_credit_source_bill_pkg changes, RT#32706 --- FS/FS/cust_credit.pm | 18 ++++++++- FS/FS/part_pkg.pm | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 2 deletions(-) diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index dde847a56..9eb624e48 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -132,11 +132,27 @@ sub cust_unlinked_msg { ' (cust_credit.crednum '. $self->crednum. ')'; } -=item insert +=item insert [ OPTION => VALUE ... ] Adds this credit to the database ("Posts" the credit). If there is an error, returns the error, otherwise returns false. +Ooptions are passed as a list of keys and values. Available options: + +=over 4 + +=item reason_type + +L type for newly-inserted reason + +=item cust_credit_source_bill_pkg + +An arrayref of +L objects. +They will have their crednum set and will be inserted along with this credit. + +=back + =cut sub insert { diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index d2f2f86fa..540919ee5 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -1638,16 +1638,120 @@ sub _rebless { $self; } +=item calc_setup CUST_PKG START_DATE DETAILS_ARRAYREF OPTIONS_HASHREF + +=item calc_recur CUST_PKG START_DATE DETAILS_ARRAYREF OPTIONS_HASHREF + +Calculates and returns the setup or recurring fees, respectively, for this +package. Implementation is in the FS::part_pkg:* module specific to this price +plan. + +Adds invoicing details to the passed-in DETAILS_ARRAYREF + +Options are passed as a hashref. Available options: + +=over 4 + +=item freq_override + +Frequency override (for calc_recur) + +=item discounts + +This option is filled in by the method rather than controlling its operation. +It is an arrayref. Applicable discounts will be added to the arrayref, as +L. + +=item real_pkgpart + +For package add-ons, is the base L, otherwise +no different than pkgpart. + +=item precommit_hooks + +This option is filled in by the method rather than controlling its operation. +It is an arrayref. Anonymous coderefs will be added to the arrayref. They +need to be called before completing the billing operation. For calc_recur +only. + +=item increment_next_bill + +Increment the next bill date (boolean, for calc_recur). Typically true except +for particular situations. + +=item setup_fee + +This option is filled in by the method rather than controlling its operation. +It indicates a deferred setup fee that is billed at calc_recur time (see price +plan option prorate_defer_bill). + +=back + +Note: Don't calculate prices when not actually billing the package. For that, +see the L and L methods. + +=cut + #fatal fallbacks sub calc_setup { die 'no calc_setup for '. shift->plan. "\n"; } sub calc_recur { die 'no calc_recur for '. shift->plan. "\n"; } -#fallback that return 0 for old legacy packages with no plan +=item calc_remain CUST_PKG [ OPTION => VALUE ... ] + +Calculates and returns the remaining value to be credited upon package +suspension, change, or cancellation, if enabled. + +Options are passed as a list of keys and values. Available options: + +=over 4 + +=item time + +Override for the current time + +=item cust_credit_source_bill_pkg + +This option is filled in by the method rather than controlling its operation. +It is an arrayref. +L records will +be added to the arrayref indicating the specific line items and amounts which +are the source of this remaining credit. + +=back + +Note: Don't calculate prices when not actually suspending or cancelling the +package. + +=cut + +#fallback that returns 0 for old legacy packages with no plan sub calc_remain { 0; } + +=item calc_units CUST_PKG + +This returns the number of provisioned svc_phone records, or, of the package +count_available_phones option is set, the number available to be provisoined +in the package. + +=cut + +#fallback that returns 0 for old legacy packages with no plan sub calc_units { 0; } #fallback for everything not based on flat.pm sub recur_temporality { 'upcoming'; } + +=item calc_cancel START_DATE DETAILS_ARRAYREF OPTIONS_HASHREF + +Runs any necessary billing on cancellation: another recurring cycle for +recur_temporailty 'preceding' pacakges with the bill_recur_on_cancel option +set (calc_recur), or, any outstanding usage for pacakges with the +bill_usage_on_cancel option set (calc_usage). + +=cut + +#fallback for everything not based on flat.pm, doesn't do this yet (which is +#okay, nothing of ours not based on flat.pm does usage-on-cancel billing sub calc_cancel { 0; } #fallback for everything except bulk.pm -- 2.11.0