@@ -, +, @@ --- C4/SIP/ILS.pm | 14 ++++++--- C4/SIP/ILS/Transaction/FeePayment.pm | 52 ++++++++++++++++++++++++++++++---- C4/SIP/Sip/MsgType.pm | 8 ++-- 3 files changed, 59 insertions(+), 15 deletions(-) --- a/C4/SIP/ILS.pm +++ a/C4/SIP/ILS.pm @@ -32,7 +32,7 @@ my %supports = ( "login" => 1, "patron information" => 1, "end patron session" => 1, - "fee paid" => 0, + "fee paid" => 1, "item information" => 1, "item status update" => 0, "patron enable" => 1, @@ -214,14 +214,18 @@ sub pay_fee { my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency) = @_; my $trans; - my $patron; -# $trans = new ILS::Transaction::FeePayment; + $trans = ILS::Transaction::FeePayment->new(); - $patron = new ILS::Patron $patron_id; $trans->transaction_id($trans_id); - $trans->patron($patron); + my $patron; + $trans->patron($patron = ILS::Patron->new($patron_id)); + if (!$patron) { + $trans->screen_msg('Invalid patron barcode.'); + return $trans; + } + $trans->pay($patron->{borrowernumber},$fee_amt); $trans->ok(1); return $trans; --- a/C4/SIP/ILS/Transaction/FeePayment.pm +++ a/C4/SIP/ILS/Transaction/FeePayment.pm @@ -3,16 +3,56 @@ package ILS::Transaction::FeePayment; use warnings; use strict; +# Copyright 2011 PTFS-Europe Ltd. +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use C4::Accounts qw(recordpayment); +use ILS; +use base qw(ILS::Transaction); + use vars qw($VERSION @ISA $debug); -BEGIN { - $VERSION = 1.00; - @ISA = qw(ILS::Transaction); - $debug = 0; +our $debug = 0; +our $VERSION = 1.00; + +my %fields = (); + +sub new { + my $class = shift; + my $self = $class->SUPER::new(); + + foreach ( keys %fields ) { + $self->{_permitted}->{$_} = $fields{$_}; # overlaying _permitted + } + + @{$self}{ keys %fields } = values %fields; # copying defaults into object + return bless $self, $class; } -use ILS; -use ILS::Transaction; +sub pay { + my $self = shift; + my $borrowernumber = shift; + my $amt = shift; + warn("RECORD:$borrowernumber::$amt"); + recordpayment( $borrowernumber, $amt ); +} + +#sub DESTROY { +#} 1; __END__ --- a/C4/SIP/Sip/MsgType.pm +++ a/C4/SIP/Sip/MsgType.pm @@ -176,13 +176,13 @@ my %handlers = ( handler => \&handle_fee_paid, protocol => { 2 => { - template => "A18A2A3", - template_len => 0, + template => "A18A2A2A3", + template_len => 25, fields => [(FID_FEE_AMT), (FID_INST_ID), (FID_PATRON_ID), (FID_TERMINAL_PWD), (FID_PATRON_PWD), (FID_FEE_ID), - (FID_TRANSACTION_ID)], - } + (FID_TRANSACTION_ID)], + } } }, (ITEM_INFORMATION) => { --