Post by Qphoria » Thu Apr 07, 2011 10:33 pm

Many people over many versions have complained of a "Please Wait" scenario that occurs for certain onsite payment extensions that come with OpenCart. This is still true for v1.4.9.5. The payment modules that come with OpenCart that use curl for payment processing are:

- Authorize.net AIM
- Paypal Pro
- Paypal Pro UK
- Sagepay Direct
- Sagepay US
- Perpetual Payments

The Assumed Problem
The curl process should work fine assuming there are no connection or timeout issues. The code for failure scenarios was not added to these modules. Since there is no timeout set, it just keeps trying.

The Proposed Solution
The first step is to add a timeout for the curl connection. Both for the connect itself, and the time it takes to process the message. This should be an almost instantaneous process normally. So I've added a 10 second timeout to both. Additionally, if there is a connection failure, I've set it so that the ajax message response will show the error. I've also added a log write for the error so that it shows in the system error log.

I've attached the zip file here that contains the patched versions for each of those files. If you are using one of these files with OpenCart v1.4.7 through 1.4.9.5, you should be able to simply replace the files in:
catalog/controller/payment/<filename>.php
on your server with the patched ones here.

I cannot test these as I don't have the error, nor do I have accounts with these processors, so I am relying on the users to let me know if this works to address the issues or not. Please reply in this forum with your results, good or bad.

This should hopefully show an error on the payment page with some helpful clue to fix the real issue causing the problem.

Q

A LATER VERSION OF THIS PATCH HAS BEEN INCLUDED WITH v1.4.9.6!
DO NOT USE THIS PATCH IF ALREADY USING v1.4.9.6

Attachments


Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Purebeads » Fri Apr 08, 2011 12:58 am

Thank you for this. I will install it later today.

The customer that I mentioned in the other thread tried to place her order again, and wasn't able to. This fix is badly needed.

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm

Post by Purebeads » Fri Apr 08, 2011 7:37 am

Qphoria, I owe you an apology. The customer sent me her credit-card number and I tried to place the order on her behalf, and I wasn't able to. It then occurred to me that I could place the order via my old shopping cart (which is still active). The old cart told me that the credit card could not be verified. So the problem was with the card. It seems that the only problem with OpenCart was that it returned a prompt which wasn't informative enough.

About the generic information that I received from OpenCart -- "The transaction cannot be processed at this time" -- vs. the prompt I got from my old cart -- "The credit card could not be verified" -- I am wondering if OpenCart is accurately relaying the information it is getting from PayPal (I am using PayPal Pro).

Active Member

Posts

Joined
Fri Apr 30, 2010 12:07 pm

Post by davidthurston » Sat May 28, 2011 3:30 am

We never experienced this problem on our old server which ran on Ubuntu 8.04LTS. We transfererred the store to a new server running Ubuntu 10.04LTS which subsequently has a newer version of php/mysql and we are now experiencing this problem. We have fallen back to sagepay form for the time being to keep trading.

I can only assume therefore that this is a problem with compatibility with a newer version of php.

Newbie

Posts

Joined
Mon Jul 26, 2010 11:31 pm

Post by asdfowkw » Tue Jun 07, 2011 8:38 pm

I have this problem now on OC 1.5 with PP pro

Newbie

Posts

Joined
Thu Jun 02, 2011 1:45 am

Post by Qphoria » Sat Jun 11, 2011 4:19 am

These patches are not in 1.5.0 as i was still waiting for feedback from people who were trying them in 1.4.x

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by boonjackmedia » Thu Jun 16, 2011 4:09 pm

Q,
The patch would help for any connect issue with curl, but more than likely (as I've found out myself) it's probably due to the server config with the host - probably a mysql connect_timeout is too low or something similar with apache, php, etc.

I had an recent, out of the blue type of issue with a client... on any order/checkout they would receive a confirm email from Authorize.Net, but their customers never saw the Checkout-Success message, so they kept submitting the same order and getting charged.

I installed the 1.494 patch (to be safe I bumped the timeout to 20), and then started digging around in the AuthNet admin. I knew it had to be a response return issue, so I looked under Settings > Direct Response and noticed the delimiter was set to not be required on a return response - set to NO, I changed to Yes. As the authorize_aim.php code requires comma delimited for return responses (set to TRUE).

Also, I found the Response/Receipt URLs - both the Default and Default Relay Response URL were set to: http://xxxxxxxxx.com/index.php?route=account/account

To be safe there, I left the default, and changed Default Relay Response URL to: http://xxxxxxxxx.com/index.php?route=checkout/success

I ran a few tests, and no more delayed return responses - it was lightning quick on checkout. So one or all of the things I listed above might have worked to fix the issue ;D Hope that helps.

Every payment processor has an Admin Settings for each account, if anyone is having problems with return responses hanging, I suggest to start there first and make sure it's configured to work with OC or whatever cart used. After that check your server logs or ask your host to look into what's causing the hangs.

Here's some tidbits I copied from the AuthNet admin for reference below, they've got some good documentation on their site too:

Direct Response

If you use Advanced Integration Method (AIM) to submit transactions to the Payment Gateway, you can use the Direct Response settings to define the format of the transaction response returned by the gateway.

Direct Response Delimiter
Specify if the transaction response should be delimited, the delimiting character, and the encapsulation character (if needed).

Response/Receipt URLs
The Payment Gateway verifies the URL specified in the post string against the URLs in this list. If the URL provided does not match one of the values on this list, the transaction will be rejected. If no URL is provided, the Default URL value will be used.

Mike Sayre
BoonJack Media


User avatar
Newbie

Posts

Joined
Tue Feb 08, 2011 9:47 am
Location - Liberty Township, OH

Post by Qphoria » Fri Jun 17, 2011 2:37 am

boonjackmedia wrote:Q,
The patch would help for any connect issue with curl, but more than likely (as I've found out myself) it's probably due to the server config with the host - probably a mysql connect_timeout is too low or something similar with apache, php, etc.

I had an recent, out of the blue type of issue with a client... on any order/checkout they would receive a confirm email from Authorize.Net, but their customers never saw the Checkout-Success message, so they kept submitting the same order and getting charged.

I installed the 1.494 patch (to be safe I bumped the timeout to 20), and then started digging around in the AuthNet admin. I knew it had to be a response return issue, so I looked under Settings > Direct Response and noticed the delimiter was set to not be required on a return response - set to NO, I changed to Yes. As the authorize_aim.php code requires comma delimited for return responses (set to TRUE).

Also, I found the Response/Receipt URLs - both the Default and Default Relay Response URL were set to: http://xxxxxxxxx.com/index.php?route=account/account

To be safe there, I left the default, and changed Default Relay Response URL to: http://xxxxxxxxx.com/index.php?route=checkout/success

I ran a few tests, and no more delayed return responses - it was lightning quick on checkout. So one or all of the things I listed above might have worked to fix the issue ;D Hope that helps.

Every payment processor has an Admin Settings for each account, if anyone is having problems with return responses hanging, I suggest to start there first and make sure it's configured to work with OC or whatever cart used. After that check your server logs or ask your host to look into what's causing the hangs.

Here's some tidbits I copied from the AuthNet admin for reference below, they've got some good documentation on their site too:

Direct Response

If you use Advanced Integration Method (AIM) to submit transactions to the Payment Gateway, you can use the Direct Response settings to define the format of the transaction response returned by the gateway.

Direct Response Delimiter
Specify if the transaction response should be delimited, the delimiting character, and the encapsulation character (if needed).

Response/Receipt URLs
The Payment Gateway verifies the URL specified in the post string against the URLs in this list. If the URL provided does not match one of the values on this list, the transaction will be rejected. If no URL is provided, the Default URL value will be used.
Thanks for the info. I am a little unclear on what you did then. Are you saying your authorize.net account needed to be updated? There is no code in the module pointing to the account/account path.

But aside from that, the module overrides those settings:
$data['x_delim_data'] = 'TRUE';
$data['x_delim_char'] = ',';
$data['x_encap_char'] = '"';
$data['x_relay_response'] = 'FALSE';

Even if those settings in your authnet account are set differently
And AIM doesn't use response/receipt urls since it is server to server.

My authnet account has never updated those fields..
my urls are empty/default
my delimiter option is set to FALSE, but since the code passes TRUE and COMMA, it comes back with commas
And my relay response is blank and the code sets it to false

I have no problem with the built-in authorize.net module

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Fri Jun 17, 2011 10:59 pm

ok I was able to find a user with this problem and get access to their host. I've fixed the please wait now. The issue is that there is a curl error being returned but not captured, so it just throws an exception which causes a json error.

Now i capture the error and return it back to the browser. The issue in this case was that curl was not compiled with SSL so it couldn't access the https address that is used. Update your 1.4.9.5 files with the files in this zip and it should fix your issues, or at least give you the proper feedback.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by slawson17 » Sat Jun 18, 2011 12:27 am

Did you forget to attach the files or are you talking about the ones you posted on April 7th? I'm having this exact problem with PP Pro on V. 1.4.9.3 - will your solution work with this version? I gotta get this up and running asap! You're help is really appreciated :)

Thanks!!

User avatar
Newbie

Posts

Joined
Fri Mar 11, 2011 8:12 am

Post by Qphoria » Sat Jun 18, 2011 1:37 am

The zip in the first post was updated. Yes it will work with any 1.4.8 or 1.4.9.x version

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by davidthurston » Mon Jun 20, 2011 5:11 pm

I used the patch a few weeks ago, which worked fine. I repatched it with the newer version of it, and the problem has returned. In retrospect i should have left it alone, but it appears the old patch was the working one.
This error has returned now

2011-06-20 8:13:52 - PHP Unknown: Function split() is deprecated in /var/www/vhosts/tilingsupplies.co.uk/httpdocs/catalog/controller/payment/sagepay_direct.php on line 233

I thought split was changed to explode in the previous patch?

Newbie

Posts

Joined
Mon Jul 26, 2010 11:31 pm

Post by Qphoria » Mon Jun 20, 2011 11:33 pm

davidthurston wrote:I used the patch a few weeks ago, which worked fine. I repatched it with the newer version of it, and the problem has returned. In retrospect i should have left it alone, but it appears the old patch was the working one.
This error has returned now

2011-06-20 8:13:52 - PHP Unknown: Function split() is deprecated in /var/www/vhosts/tilingsupplies.co.uk/httpdocs/catalog/controller/payment/sagepay_direct.php on line 233

I thought split was changed to explode in the previous patch?
I fixed it in sagepay but forgot sagepay_direct
Reattached fixed version of the zip.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by adesignl » Fri Jul 01, 2011 1:56 am

This patch doesnt seem to work for me. I am using 1.4.8b and I still get the Please Wait spinning icon. The transaction goes through but it does not redirect. And Therefore doesnt remove the items from the shopping cart either. But it does record the transaction.

http://www.adesignlink.com


User avatar
New member

Posts

Joined
Wed Aug 18, 2010 1:07 pm
Location - Florida, USA

Post by Qphoria » Wed Jul 06, 2011 1:59 am

adesignl wrote:This patch doesnt seem to work for me. I am using 1.4.8b and I still get the Please Wait spinning icon. The transaction goes through but it does not redirect. And Therefore doesnt remove the items from the shopping cart either. But it does record the transaction.
The end result, regardless of getting a popup warning or not, seems to be because curl isn't compiled with openssl so it doesn't handle https urls. Contact your host and have them check that curl is compiled with ssl

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by boonjackmedia » Thu Jul 07, 2011 1:53 am

Qphoria wrote:
boonjackmedia wrote:Q,
The patch would help for any connect issue with curl, but more than likely (as I've found out myself) it's probably due to the server config with the host - probably a mysql connect_timeout is too low or something similar with apache, php, etc.

I had an recent, out of the blue type of issue with a client... on any order/checkout they would receive a confirm email from Authorize.Net, but their customers never saw the Checkout-Success message, so they kept submitting the same order and getting charged.

I installed the 1.494 patch (to be safe I bumped the timeout to 20), and then started digging around in the AuthNet admin. I knew it had to be a response return issue, so I looked under Settings > Direct Response and noticed the delimiter was set to not be required on a return response - set to NO, I changed to Yes. As the authorize_aim.php code requires comma delimited for return responses (set to TRUE).

Also, I found the Response/Receipt URLs - both the Default and Default Relay Response URL were set to: http://xxxxxxxxx.com/index.php?route=account/account

To be safe there, I left the default, and changed Default Relay Response URL to: http://xxxxxxxxx.com/index.php?route=checkout/success

I ran a few tests, and no more delayed return responses - it was lightning quick on checkout. So one or all of the things I listed above might have worked to fix the issue ;D Hope that helps.

Every payment processor has an Admin Settings for each account, if anyone is having problems with return responses hanging, I suggest to start there first and make sure it's configured to work with OC or whatever cart used. After that check your server logs or ask your host to look into what's causing the hangs.

Here's some tidbits I copied from the AuthNet admin for reference below, they've got some good documentation on their site too:

Direct Response

If you use Advanced Integration Method (AIM) to submit transactions to the Payment Gateway, you can use the Direct Response settings to define the format of the transaction response returned by the gateway.

Direct Response Delimiter
Specify if the transaction response should be delimited, the delimiting character, and the encapsulation character (if needed).

Response/Receipt URLs
The Payment Gateway verifies the URL specified in the post string against the URLs in this list. If the URL provided does not match one of the values on this list, the transaction will be rejected. If no URL is provided, the Default URL value will be used.
Thanks for the info. I am a little unclear on what you did then. Are you saying your authorize.net account needed to be updated? There is no code in the module pointing to the account/account path.

But aside from that, the module overrides those settings:
$data['x_delim_data'] = 'TRUE';
$data['x_delim_char'] = ',';
$data['x_encap_char'] = '"';
$data['x_relay_response'] = 'FALSE';

Even if those settings in your authnet account are set differently
And AIM doesn't use response/receipt urls since it is server to server.

My authnet account has never updated those fields..
my urls are empty/default
my delimiter option is set to FALSE, but since the code passes TRUE and COMMA, it comes back with commas
And my relay response is blank and the code sets it to false

I have no problem with the built-in authorize.net module
Yes the Authorize.NET settings had relay codes in there for use with an internal payment system they use. Yes those fields need to be blank, unless otherwise needed - not used for Opencart. The point was for people to check their Authorize Admin Settings, which could be causing issues with OC.

BTW the new Patch files attached to this thread are working fine.
I bumped the timeout settings to 20 (AIM default) for a few clients with crappy ISP service.

Mike

Mike Sayre
BoonJack Media


User avatar
Newbie

Posts

Joined
Tue Feb 08, 2011 9:47 am
Location - Liberty Township, OH

Post by miradoro » Thu Jul 21, 2011 3:28 am

did not work for me

New member

Posts

Joined
Tue May 03, 2011 9:43 pm

Post by miradoro » Thu Jul 21, 2011 3:32 am

can it be curl_setopt($curl, CURLOPT_TIMEOUT, 60); ???

New member

Posts

Joined
Tue May 03, 2011 9:43 pm

Post by lylet » Thu Jul 21, 2011 6:17 am

I'm experiencing the same problem. I never get past the spinning please wait notice, but the payment gets processed by Paypal. The shopping cart never empties.

I don't believe that this is related to curl being compiled with SSL. Here's my curl info:

#curl -V
curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

#curl https://api-3t.paypal.com/nvp
ACK=Failure&L_ERRORCODE0=81002&L_SHORTMESSAGE0=Unspecified%20Method&L_LONGMESSAGE0=Method%20Specified%20is%20not%20Supported&L_SEVERITYCODE0=Error

Opencart 1.4.8

Lyle

Newbie

Posts

Joined
Thu Jul 21, 2011 6:07 am

Post by lylet » Thu Jul 21, 2011 12:40 pm

The issue for me was invalid JSON data being sent to the Ajax confirmSubmit() function in pp_pro.tpl. My store was setup with the following settings:

Admin -> System -> Settings -> Mail:
Alert Mail: Yes
Additional Alert E-Mails: <blank>

Without any alert emails set, JSON data was being corrupted by an error message when trying to send an email so the Ajax function could not properly parse the returned JSON data.

The fix for me was to edit the model/checkout/order.php file (around line #408) by adding the "if (strlen($email))" condition to the code below:

Code: Select all

		// Send to additional alert emails
		$emails = explode(',', $this->config->get('config_alert_emails'));
		foreach ($emails as $email) {
			if (strlen($email) > 0) {
				$mail->setTo($email);
				$mail->send();
			}
		}
If you're running anything newer that 1.4.8b you likely already have a similar fix in that file so you're probably dealing with a different issue than what I experienced.

Because I've got a bad memory and may need this again in the future, here's how you can see what is being returned to the Ajax function. Add the "complete" section in the code below in the view/theme/xxx/template/payment/pp_prol.tpl file (not recommended on your live site):

Code: Select all

		success:function(data) {
			if (data.error) {
				alert(data.error);
				
				$('#paypal_button').attr('disabled', '');
			}

			$('.wait').remove();
			if (data.success) {
				location = data.success;
			}
		},
		complete: function (xhr, status) {
		  alert(xhr.responseText);
		  alert('complete: '+status);
		}
Hope this helps someone.

Lyle

Newbie

Posts

Joined
Thu Jul 21, 2011 6:07 am
Who is online

Users browsing this forum: No registered users and 9 guests