1 package FS::part_pkg::cdr_termination;
4 use base qw( FS::part_pkg::recur_Common );
5 use vars qw( $DEBUG %info );
8 tie my %temporalities, 'Tie::IxHash',
9 'upcoming' => "Upcoming (future)",
10 'preceding' => "Preceding (past)",
14 'name' => 'VoIP rating of CDR records for termination partners.',
15 'shortname' => 'VoIP/telco CDR termination',
18 'setup_fee' => { 'name' => 'Setup fee for this package',
21 'recur_fee' => { 'name' => 'Base recurring fee for this package',
25 #false laziness w/flat.pm
26 'recur_temporality' => { 'name' => 'Charge recurring fee for period',
28 'select_options' => \%temporalities,
31 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
32 ' of service at cancellation',
36 'cutoff_day' => { 'name' => 'Billing Day (1 - 28) for prorating or '.
41 'recur_method' => { 'name' => 'Recurring fee method',
43 #'options' => \%recur_method,
45 'select_options' => \%FS::part_pkg::recur_Common::recur_method,
50 setup_fee recur_fee recur_temporality unused_credit
51 recur_method cutoff_day
60 my($self, $cust_pkg ) = @_;
61 $self->option('setup_fee');
66 my($cust_pkg, $sdate, $details, $param ) = @_;
68 #my $last_bill = $cust_pkg->last_bill;
69 my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup
72 if $self->option('recur_temporality', 1) eq 'preceding'
73 && ( $last_bill eq '' || $last_bill == 0 );
77 # termination calculations
79 # find CDRs with cdr_termination.status NULL
80 # and matching our customer via svc_external.id/title? (and via what field?)
82 #for each cdr, set status and rated price and add the charges, and add a line
85 # eotermiation calculation
87 $charges += $self->calc_recur_Common(@_);