}
sub pay_fee {
- my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency) = @_;
- my $trans;
+ my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff) = @_;
- $trans = C4::SIP::ILS::Transaction::FeePayment->new();
+ my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
$trans->transaction_id($trans_id);
my $patron;
$trans->screen_msg('Invalid patron barcode.');
return $trans;
}
- my $ok =$trans->pay($patron->{borrowernumber},$fee_amt, $pay_type, $fee_id);
+ my $ok = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff );
$trans->ok($ok);
return $trans;
my $self = shift;
my $borrowernumber = shift;
my $amt = shift;
- my $type = shift;
+ my $sip_type = shift;
my $fee_id = shift;
+ my $is_writeoff = shift;
+
+ my $type = $is_writeoff ? 'writeoff' : undef;
warn("RECORD:$borrowernumber::$amt");
if ($fee_id) {
my $fee = Koha::Account::Lines->find($fee_id);
if ( $fee && $fee->amountoutstanding == $amt ) {
- $account->pay( { amount => $amt, sip => $type, lines => [$fee] } );
+ $account->pay(
+ {
+ amount => $amt,
+ sip => $sip_type,
+ type => $type,
+ lines => [$fee],
+ }
+ );
return 1;
}
else {
}
}
else {
- $account->pay( { amount => $amt, sip => $type } );
+ $account->pay(
+ {
+ amount => $amt,
+ sip => $sip_type,
+ type => $type,
+ }
+ );
return 1;
}
}
my $status;
my $resp = FEE_PAID_RESP;
+ my $payment_type_writeoff = $server->{account}->{payment_type_writeoff};
+ my $is_writeoff = $pay_type eq $payment_type_writeoff;
+
$fee_amt = $fields->{ (FID_FEE_AMT) };
$inst_id = $fields->{ (FID_INST_ID) };
$patron_id = $fields->{ (FID_PATRON_ID) };
$ils->check_inst_id( $inst_id, "handle_fee_paid" );
- $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency );
+ $status = $ils->pay_fee( $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff );
$resp .= ( $status->ok ? 'Y' : 'N' ) . timestamp;
$resp .= add_field( FID_INST_ID, $inst_id );
</listeners>
<accounts>
- <login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" />
+ <login id="term1" password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii" checked_in_ok="1" payment_type_writeoff="06" />
<login id="koha" password="koha" delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" />
<login id="koha2" password="koha" institution="kohalibrary2" terminator="CR" />
<login id="lpl-sc" password="1234" institution="LPL" />