Bugzilla – Attachment 61377 Details for
Bug 16895
Allow writeoffs via SIP2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16895 - Allow writeoffs via SIP2
Bug-16895---Allow-writeoffs-via-SIP2.patch (text/plain), 5.64 KB, created by
Kyle M Hall (khall)
on 2017-03-21 12:51:37 UTC
(
hide
)
Description:
Bug 16895 - Allow writeoffs via SIP2
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-03-21 12:51:37 UTC
Size:
5.64 KB
patch
obsolete
>From e678d434ea201c44ae3946179f5353a04e1d8261 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 11 Jul 2016 13:55:50 +0000 >Subject: [PATCH] Bug 16895 - Allow writeoffs via SIP2 > >Many SIP2 services such as those by Comprise Technologies are able to or >require that an ILS be able to accept writeoffs via SIP2. The SIP2 >protocol specifies that payment type be a two digit number, but does not >specify a code for writeoffs. To this end we should allow the write-off >code to be specified in the SIP2 config on a per-account basis so that >if different vendors use different fixed codes for write-offs we can >handle that gracefully. > >Test Plan: >1) Apply this patch >2) Modify your SIP2 config to include > payment_type_writeoff="06" > in the login portion of the account you will be using for the test. >3) Restart your SIP2 server >4) Create a fee for a patron >5) Send a SIP2 fee paid message specifying the payment type code we > defined earlier, with a payment amount that is *not* equal to the > amount outstanding for the fee. >6) Note the fee paid response indicates the payment failed >7) Repeat step 5, but this time send the amount outstanding as the > payment amount >8) Note that the fee paid response indicates a successful payment >9) Note in Koha that the fee has been written off! > >Signed-off-by: Rhonda Kuiper <kuiper@roundrocktexas.gov> >--- > C4/SIP/ILS.pm | 7 +++---- > C4/SIP/ILS/Transaction/FeePayment.pm | 22 +++++++++++++++++++--- > C4/SIP/Sip/MsgType.pm | 5 ++++- > etc/SIPconfig.xml | 2 +- > 4 files changed, 27 insertions(+), 9 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index dba0ccb..35879af 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -247,10 +247,9 @@ sub end_patron_session { > } > > 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; >@@ -259,7 +258,7 @@ sub pay_fee { > $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; >diff --git a/C4/SIP/ILS/Transaction/FeePayment.pm b/C4/SIP/ILS/Transaction/FeePayment.pm >index 042f07e..9cedce5 100644 >--- a/C4/SIP/ILS/Transaction/FeePayment.pm >+++ b/C4/SIP/ILS/Transaction/FeePayment.pm >@@ -45,8 +45,11 @@ sub pay { > 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"); > >@@ -55,7 +58,14 @@ sub pay { > 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 { >@@ -63,7 +73,13 @@ sub pay { > } > } > else { >- $account->pay( { amount => $amt, sip => $type } ); >+ $account->pay( >+ { >+ amount => $amt, >+ sip => $sip_type, >+ type => $type, >+ } >+ ); > return 1; > } > } >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 4e406e2..3660aa4 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -1068,6 +1068,9 @@ sub handle_fee_paid { > 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) }; >@@ -1077,7 +1080,7 @@ sub handle_fee_paid { > > $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 ); >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index 40e495e..db25975 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -44,7 +44,7 @@ > </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" /> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16895
:
53268
|
55614
|
61377
|
62364
|
62377
|
62378
|
62379