Post by Emadello » Mon Nov 01, 2010 7:48 pm

Hello All,

Please apply the following changes to:

Code: Select all

catalog/controller/payment/authorizenet_aim.php
Around line 98, you'll find:

Code: Select all

        $curl = curl_init($url);

        curl_setopt($curl, CURLOPT_PORT, 443);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
        curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS,  http_build_query($data));

 
Replace with:

Code: Select all

		$curl = curl_init($url);
		
		$poststring = "";

foreach (array_keys($data) as $key) {
if ($poststring != "") {
$poststring .= "&";
}

$poststring .= $key . '=' . urlencode($data[$key]);
}

$poststring .= '&';

		curl_setopt($curl, CURLOPT_PORT, 443);
		curl_setopt($curl, CURLOPT_HEADER, 0);
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
		curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
		curl_setopt($curl, CURLOPT_POST, 1);
		curl_setopt($curl, CURLOPT_POSTFIELDS, $poststring);
And it should work ;)

Newbie

Posts

Joined
Mon Nov 01, 2010 7:44 pm

Post by JAY6390 » Mon Nov 01, 2010 8:11 pm

Interestingly enough it seems that the http_build_query argument separator can be different depending on the verison of php you are using and your php.ini "arg_separator.output" value. you could actually fix it just by changing

Code: Select all

curl_setopt($curl, CURLOPT_POSTFIELDS,  http_build_query($data)); 
to

Code: Select all

curl_setopt($curl, CURLOPT_POSTFIELDS,  http_build_query($data, '', '&')); 

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Emadello » Mon Nov 01, 2010 9:09 pm

Yes you're right, i tried only changing this line and it worked :) now im having another issue :S

When paying in any other currency than USD, I get an error: The supplied currency code is either invalid

Newbie

Posts

Joined
Mon Nov 01, 2010 7:44 pm

Post by Qphoria » Mon Nov 01, 2010 9:41 pm

Emadello wrote:Yes you're right, i tried only changing this line and it worked :) now im having another issue :S

When paying in any other currency than USD, I get an error: The supplied currency code is either invalid
Be sure the currency being used is allowed for your authnet account

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 12 guests