Bug 17705 - Payments with cards through payment terminal
Summary: Payments with cards through payment terminal
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Radek Šiman (R-Bit Technology, s.r.o.)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-01 14:07 UTC by Radek Šiman (R-Bit Technology, s.r.o.)
Modified: 2023-06-25 20:17 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 17705: Database structure update (4.01 KB, patch)
2017-05-17 13:52 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Database schema objects updated (3.82 KB, patch)
2017-05-17 14:04 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Database structure update (4.01 KB, patch)
2017-06-22 08:23 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Database schema objects updated (3.82 KB, patch)
2017-06-22 08:24 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: payments using payment terminal (43.85 KB, patch)
2017-06-22 08:24 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Fixed forbidden patterns (1.82 KB, patch)
2017-06-22 08:24 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Fixed web installer problems (3.49 KB, patch)
2017-06-25 13:42 UTC, Radek Šiman (R-Bit Technology, s.r.o.)
Details | Diff | Splinter Review
Bug 17705: Database structure update (5.01 KB, patch)
2018-06-25 09:03 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17705: payments using payment terminal (42.36 KB, patch)
2018-06-25 09:03 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17705: Update Schema (3.60 KB, patch)
2018-06-25 09:03 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Radek Šiman (R-Bit Technology, s.r.o.) 2016-12-01 14:07:12 UTC
Allow patrons to pay their fees cashlessly using cards in payment terminals.
Comment 1 Radek Šiman (R-Bit Technology, s.r.o.) 2016-12-01 20:45:49 UTC
Currently working on a solution for terminals Ingenico iCT220 provided by GPE (Global Payments Europe)
Comment 2 Radek Šiman (R-Bit Technology, s.r.o.) 2017-05-17 13:52:17 UTC
Created attachment 63499 [details] [review]
Bug 17705: Database structure update

This patch creates neccessary table and updates systempreferences.

Test plan:
1) Apply the patch
2) Check the presence of pos_terminal_transactions table
3) Observe new systempreferences' values
   - PosTerminalIP
   - PosTerminalPort
   - PosTerminalCurrencyCode
Comment 3 Radek Šiman (R-Bit Technology, s.r.o.) 2017-05-17 14:04:55 UTC
Created attachment 63500 [details] [review]
Bug 17705: Database schema objects updated

Brings neccessary changes in the database schema.

Test plan:
1) Apply the patch
2) Open Koha/Schema/Result
3) Observe new relation in Accountline.pm
4) Check presence of PosTerminalTransaction.pm
Comment 4 Radek Šiman (R-Bit Technology, s.r.o.) 2017-06-22 08:23:32 UTC
Created attachment 64526 [details] [review]
Bug 17705: Database structure update

This patch creates neccessary table and updates systempreferences.

Test plan:
For the test plan please see commits above.
Comment 5 Radek Šiman (R-Bit Technology, s.r.o.) 2017-06-22 08:24:02 UTC
Created attachment 64527 [details] [review]
Bug 17705: Database schema objects updated

Brings neccessary changes in the database schema.

Test plan:
1) Apply the patch
2) Open Koha/Schema/Result
3) Observe new relation in Accountline.pm
4) Check presence of PosTerminalTransaction.pm
Comment 6 Radek Šiman (R-Bit Technology, s.r.o.) 2017-06-22 08:24:14 UTC
Created attachment 64528 [details] [review]
Bug 17705: payments using payment terminal

This patch expects already installed and configured payment terminal,
e.g Ingenico, provided by GPE (Global Payments Europe). This piece of
code already acquired an official certification in GPE Headquarter,
Prague, Czech Republic. Bank accounts connected to banks KB or CSOB
should work perfectly. Other banks will probably require additional
certifications and changes in the code.

Test plan
1) Appy this patch
2) Connect and/or start terminal device
3) Go to administration setting and look for "PosTerminal" items
4) Setup desired values (IP and port)
5) Make patron to pay a single fine (eg. lost book)
6) Tick the box "Pay by card" and confirm the payment
7) Popup window will raise displaying transaction status
8) Let the patron pay his amount using the terminal
9) When transaction finishes, close popup window
10) Optional: try to refund an amount by clicking "Refund to card"
button within fines overview (members/boraccount.pl). Steps 7-9 will
repeat accordingly.
Comment 7 Radek Šiman (R-Bit Technology, s.r.o.) 2017-06-22 08:24:27 UTC
Created attachment 64529 [details] [review]
Bug 17705: Fixed forbidden patterns

This patch only removes trailing space chars in
Koha/PosTerminal/Message/Header.pm
Comment 8 Michal Denar 2017-06-22 09:29:16 UTC
Anybody in other country need to pay in Koha via credit card? Please review code, maybe together we'll make solution universal for other terminals and payment providers. Feedback welcome.

Thanks to Radek for great work.
Comment 9 Radek Šiman (R-Bit Technology, s.r.o.) 2017-06-25 13:42:18 UTC
Created attachment 64613 [details] [review]
Bug 17705: Fixed web installer problems

This patch only fixes problems during web installation procedure

Test plan:
1) Apply the patch
2) Go through all webinstaller's steps
3) No SQL errors should occur
Comment 10 Josef Moravec 2018-06-25 09:03:04 UTC
Created attachment 76366 [details] [review]
Bug 17705: Database structure update

This patch creates neccessary table and updates systempreferences.

Test plan:
1) Apply the patch
2) Check the presence of pos_terminal_transactions table
3) Observe new systempreferences' values
   - PosTerminalIP
   - PosTerminalPort
   - PosTerminalCurrencyCode
Comment 11 Josef Moravec 2018-06-25 09:03:08 UTC
Created attachment 76367 [details] [review]
Bug 17705: payments using payment terminal

This patch expects already installed and configured payment terminal,
e.g Ingenico, provided by GPE (Global Payments Europe). This piece of
code already acquired an official certification in GPE Headquarter,
Prague, Czech Republic. Bank accounts connected to banks KB or CSOB
should work perfectly. Other banks will probably require additional
certifications and changes in the code.

Test plan
1) Appy this patch
2) Connect and/or start terminal device
3) Go to administration setting and look for "PosTerminal" items
4) Setup desired values (IP and port)
5) Make patron to pay a single fine (eg. lost book)
6) Tick the box "Pay by card" and confirm the payment
7) Popup window will raise displaying transaction status
8) Let the patron pay his amount using the terminal
9) When transaction finishes, close popup window
10) Optional: try to refund an amount by clicking "Refund to card"
button within fines overview (members/boraccount.pl). Steps 7-9 will
repeat accordingly.
Comment 12 Josef Moravec 2018-06-25 09:03:12 UTC
Created attachment 76368 [details] [review]
Bug 17705: Update Schema
Comment 13 Josef Moravec 2018-06-25 09:15:31 UTC
Comment on attachment 76367 [details] [review]
Bug 17705: payments using payment terminal

Review of attachment 76367 [details] [review]:
-----------------------------------------------------------------

Radek, I just rebased your patches and have some comments on this patch:

::: Koha/PosTerminal/Client.pm
@@ +15,5 @@
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +

use Modern::Perl;

@@ +19,5 @@
> +
> +use IO::Socket::INET;
> +use IO::Socket::Timeout;
> +use Koha::PosTerminal::Message;
> +use Errno qw(ETIMEDOUT EWOULDBLOCK);

You are adding some new dependencies here, you should add them to C4/Installer/PerlDependecies.pm, are they all available also for Debian in needed versions?

::: Koha/PosTerminal/Message.pm
@@ +17,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +
> +use strict;
> +use warnings;

use Modern::Perl;

@@ +22,5 @@
> +
> +use Digest::CRC;
> +use Koha::PosTerminal::Message::Header;
> +use Koha::PosTerminal::Message::Field;
> +use Data::Dumper qw( Dumper );

Don't forget to remove debug printing;

@@ +178,5 @@
> +        else {
> +            $self->setValid(0);
> +        }
> +    }
> +#    print Dumper($self);

Don't forget to remove debug printing;

@@ +221,5 @@
> +    my $msg = $self->getHeader()->dumpObject();
> +
> +    $msg .= "data:\n";
> +#    print Dumper($self);
> +#die();

Don't forget to remove debug printing;

::: Koha/PosTerminal/Message/Field.pm
@@ +17,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +
> +use strict;
> +use warnings;

use Modern::Perl;

::: Koha/PosTerminal/Message/Header.pm
@@ +17,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +
> +use strict;
> +use warnings;

use Modern::Perl;

::: koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
@@ +75,5 @@
>            [% IF ( account.payment ) %]
>              <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
>              <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-ban"></i> Void</a>
> +            [% IF (account.amountoutstanding+0 + account.amount+0 != 0 ) %]
> +            <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs" onclick="refundPayment(this.href, [% account.accountlines_id %], [% -1*account.amount %]);return false;"><i class="fa fa-undo"></i> Refund to card</a>

Do not use onclick parameter

::: koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
@@ +46,4 @@
>  [% END %]
>  
>  [% IF ( pay_individual ) %]
> +    <form name="payindivfine" id="payindivfine" method="post" onsubmit="return makePayment(this);" action="/cgi-bin/koha/members/paycollect.pl">

Do not use onsubmit parameter

@@ +105,5 @@
> +    <li>
> +        <label for="bycard">Pay by card: </label>
> +        <input type="checkbox" name="bycard" id="bycard" value="1"/>
> +    </li>
> +[% END %]

Consider using PAYMENT_TYPE authorised value

::: svc/pos_terminal
@@ +160,5 @@
> +
> +    # send abort message
> +    my $abort = new Koha::PosTerminal::Message(Koha::PosTerminal::Message::DIR_SENT);
> +    my $hdrAbort = $abort->getHeader();
> +die(Dumper($transaction ? $transaction->getHeader() : "BUBU"));

What does "BUBU" mean? :D
Comment 14 Katrin Fischer 2023-06-25 20:17:34 UTC
I wonder if this would be better achieved with a payment type plugin nowadays (like PayPal)