1 package OpenILS::Application::Trigger::Reactor::ApplyCircFee;
2 use base 'OpenILS::Application::Trigger::Reactor';
3 use strict; use warnings;
5 use OpenILS::Const qw/:const/;
6 use OpenILS::Utils::Fieldmapper;
7 use OpenSRF::Utils::Logger qw/:logger/;
8 use OpenILS::Utils::CStoreEditor q/:funcs/;
14 Creates a bill (money.billing) for the configured amount, linked to the circulation.
15 This reactor uses the Notification Fee billing type.
16 If an event definition template is defined, it will be used to generate the bill note.
18 Required event parameters:
19 "amount" The amount to bill
28 my $e = new_editor(xact => 1);
29 my $btype = $e->retrieve_config_billing_type(OILS_BILLING_TYPE_NOTIFICATION_FEE);
31 my $circ = $$env{target};
32 my $amount = $$env{params}{amount} || $btype->default_price;
35 $logger->error("ApplyCircFee needs a fee amount");
40 my $bill = Fieldmapper::money::billing->new;
41 $bill->xact($circ->id);
42 $bill->amount($amount);
43 $bill->btype(OILS_BILLING_TYPE_NOTIFICATION_FEE);
44 $bill->billing_type($btype->name);
45 $bill->note($self->run_TT($env));
47 unless( $e->create_money_billing($bill) ) {