Bugzilla – Attachment 149795 Details for
Bug 33216
SIP fee paid messages explode if payment registers are enabled and the SIP account has no register
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33216: Catch and handle RegisterRequired exceptions for SIP fee paid messages
Bug-33216-Catch-and-handle-RegisterRequired-except.patch (text/plain), 3.25 KB, created by
Kyle M Hall (khall)
on 2023-04-18 12:04:00 UTC
(
hide
)
Description:
Bug 33216: Catch and handle RegisterRequired exceptions for SIP fee paid messages
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-04-18 12:04:00 UTC
Size:
3.25 KB
patch
obsolete
>From b402025f1c9f68336f8cf421d5a921d9994bc837 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Tue, 14 Mar 2023 07:06:21 -0400 >Subject: [PATCH] Bug 33216: Catch and handle RegisterRequired exceptions for > SIP fee paid messages > >If registers are being used in Koha, they are required. If a SIP account has no register and a fee paid message is sent, the SIP server crashes and the client never gets a response. It would be much better if Koha would response with 38 response where "payment accepted" is N, and an AF field stating that the SIP account needs to be associated with a register. > >Test Plan: >1) Enable UseCashRegisters, set RequireCashRegister to "always require a > cash register". Do *not* set a cash register for the SIP account you > will be testing with. >2) Using the SIP cli tester, send a fee paid message for a patron owing > fees. >3) Note the lack of a SIP response >4) Apply this patch >5) Restart the SIP server >6) Repeat step 2, you should now get a SIP response with the error > message in it! > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/SIP/ILS.pm | 3 ++- > C4/SIP/ILS/Transaction/FeePayment.pm | 25 ++++++++++++++++++++++--- > C4/SIP/Sip/MsgType.pm | 2 ++ > 3 files changed, 26 insertions(+), 4 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index f33aaee5c48..e6ff28cf5b5 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -310,7 +310,8 @@ sub pay_fee { > > return { > status => $trans, >- pay_response => $trans_result->{pay_response} >+ pay_response => $trans_result->{pay_response}, >+ error => $trans_result->{error}, > }; > } > >diff --git a/C4/SIP/ILS/Transaction/FeePayment.pm b/C4/SIP/ILS/Transaction/FeePayment.pm >index 80d9698694d..a4253cb5d96 100644 >--- a/C4/SIP/ILS/Transaction/FeePayment.pm >+++ b/C4/SIP/ILS/Transaction/FeePayment.pm >@@ -20,6 +20,8 @@ use strict; > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >+use Try::Tiny; >+ > use Koha::Account; > use Koha::Account::Lines; > >@@ -76,10 +78,27 @@ sub pay { > }; > } > } >- my $pay_response = $account->pay($pay_options); >+ >+ my $ok = 1; >+ my $pay_response; >+ my $error; >+ try { >+ $pay_response = $account->pay($pay_options); >+ } >+ catch { >+ if ( ref($_) =~ /^Koha::Exceptions/ ) { >+ $ok = 0; >+ $error = $_->description; >+ } >+ else { >+ $_->rethrow; >+ } >+ }; >+ > return { >- ok => 1, >- pay_response => $pay_response >+ ok => $ok, >+ pay_response => $pay_response, >+ error => $error, > }; > } > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 3510683d84f..395127909bc 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -1153,6 +1153,8 @@ sub handle_fee_paid { > $status = $pay_result->{status}; > my $pay_response = $pay_result->{pay_response}; > >+ $resp .= maybe_add( FID_SCREEN_MSG, $pay_result->{error}, $server ) if $pay_result->{error}; >+ > my $failmap = { > "no_item" => "No matching item could be found", > "no_checkout" => "Item is not checked out", >-- >2.30.2
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 33216
:
148157
|
148161
|
149755
|
149757
|
149795
|
149796