Bug 28696 - Point of sale: attempting to pay with the "Enter" key cause an overcharge in the database
Summary: Point of sale: attempting to pay with the "Enter" key cause an overcharge in ...
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-08 23:24 UTC by Marie-Luce Laflamme
Modified: 2023-06-08 22:26 UTC (History)
4 users (show)

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


Attachments
IntranetUserJS - to base patch upon (282 bytes, text/javascript)
2022-02-02 12:18 UTC, Jake Deery
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marie-Luce Laflamme 2021-07-08 23:24:59 UTC
This problem occurs if you forget to fill in the collect payment fields, then press on the “Enter” key.

When a message Required field shows up, the payment will not be saved correctly in the database. Instead, Koha secretly charges the failed payment in the database before confirming the real payment on the web interface.

E.g . If the item cost = $1 and you press 3 times «Enter» with missing payment fields, the web interface and receipt confirm a $1 payment, while the database register a $3 payment (3 X $1 ) for the same transaction id.
Comment 1 Marie-Luce Laflamme 2021-07-08 23:31:03 UTC
Test plan
    1. Have an item for $1 in Point of Sale
    2. From the point of sale, add this item (1 time)  to "sale", so the total payable = $1  – (no need to modify quantity nor the item cost)
    3. In the Collect payment section, click in the «Amount tendered box », leave the box empty
    4. Press the Enter key
       --> A «Required field » message should appear  <--- failed payment 1
    5. Add an amount in the amount tendered box
    6. Press the Enter key
       --> «Required field » message is still displayed  <--- failed payment 2
    7. Select the payment type
    8.  Press the Enter key
       --> a «Required field » message   <---- failed payment 3
    9. Select the cash register
    10. Click on Confirm
    11. Print the receipt (see the yellow box at the top)
     --> The receipt should confirm a $1 payment. Write down the transaction ID from the receipt.
    12.  In a terminal, check the transaction ID in the database;  check "Accountlines" and "account_offsets" 

select * from accountlines where timestamp =’date of the transaction aaaa-mm-dd hh:mm:ss’


select * from account_offsets where credit_id='transaction ID from the receipt"

The item cost is charged each time you miss a field
 (purchase = 3$  + 3 X $1 payment )
Comment 2 Marie-Luce Laflamme 2021-07-09 21:25:02 UTC
correction
the payment screen shows only $1 to pay
the receipt shows up $3
db tell 3 time $1 payment
Comment 3 Martin Renvoize 2021-07-13 07:49:12 UTC
Hi Marie-Luce, 

I'm afraid I can't replicate this with your test plan right now.

Could you let me know what browser you are using and whether you have javascript disabled or any form of accessibility tool in use?
Comment 4 Jake Deery 2022-02-02 12:18:08 UTC
Created attachment 130091 [details]
IntranetUserJS - to base patch upon
Comment 5 Marie-Luce Laflamme 2022-06-23 20:12:22 UTC
I can no longer reproduce the problem in Koha 20.05. I'm not sure what went wrong before, maybe some old sales were left in my cache.

However, the point-of-sale behaviour has changed since my first test. In 21.05,  you are now forced to choose a cash register before the payment confirmation.

This new behaviour seems to fix the problem.