AbanteCart Community

AbanteCart Development => Extensions and Add-Ons => Payment Modules => Topic started by: JerryPF on October 18, 2016, 07:56:16 AM

Title: Checkout (double payment), when pressing Enter key instead of clicking Confirm
Post by: JerryPF on October 18, 2016, 07:56:16 AM
Hi,

I'm using AbanteCart 1.2.8 without any extensions added so far.
I have developed a custom payment extension for using the card processing facilities from an Australian Bank.
This extension is based on the Cashflows extension and is almost the same. Both admin part and storefront part
of my new extension are working perfectly, without any errors in the System log report, except for one thing.

Whenever I press the Enter key in the last checkout screen, where the credit card details are to be entered, when
the cursor is in the CCV field, where the CCV field is having a correct three digit CCV code, the send function in the
storefront controller for this extension is executed twice, resulting in a double payment.
After that, the order is saved correctly only once, and can be seen in the admin part, having the correct order status.
No errors logged in the admin log report. If I click the confirm button instead of pressing the Enter key, the send
function is executed only once, so only one payment, which is good, and after that again the order gets saved correctly.

Although I don't have a Cashflows account, I did the same test using the Cashflows extension, and after pressing the Enter key, having the cursor in the CCV field, an error message about missing account data (of course because I don't have a Cashflows account) is shown twice below each other, meaning that in this test, also the send function of the Cashflows storefront controller is executed twice.
When trying to confirm an order by clicking the Confirm button, this error message is shown only once.

Has anyone noticed this behaviour, and found a solution for this?
Title: Re: Checkout (double payment), when pressing Enter key instead of clicking Confirm
Post by: Basara on October 18, 2016, 09:11:02 AM
Hello.

Just an idea - write some JavaScript to prevent double form submission on Enter key
http://stackoverflow.com/questions/2830542/prevent-double-submission-of-forms-in-jquery
Title: Re: Checkout (double payment), when pressing Enter key instead of clicking Confirm
Post by: JerryPF on October 19, 2016, 02:54:56 AM
Hi Basara,

Thanks for your reply.
I will try your suggestion.
After the send function has been executed for the first time, there's an error message shown
like this: !ERROR in a red color. This error message then disappears and then the send function gets
executed for the second time.
So also have to find out where this error message is coming from.

Will also try whether tracing the jscript code will show anything strange.