Zen Cart Logo
Forums / Addon Payment Modules / (HSBC payment gateway)

(HSBC payment gateway)

Locked

Views: 6,039

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
29 Apr 2008, 5:43 PM
#1
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

(HSBC payment gateway)

Originally posted by CrystalClear [snipped quote]:

CrystalClear:

hsbc_return.php page. i get the following error:

Fatal error: Call to a member function on a non-object in /home/sites/myclientwebsite.com/public_html/hsbc_return.php on line 51

and line 51 is : $hash=$hsbc->getHash($post_2);

the cpiResult is 0 so the transaction is approved by hsbc, i just can't get this to work:sleepy:

I have looked at this myself and cannot for the life of me deduce where $GLOBALS['hsbc'] should/would be set:

   $hsbc=$GLOBALS['hsbc'];
   $hash=$hsbc->getHash($post_2);

So - a genuine offer of $100 for the first working solution.

30 Apr 2008, 7:52 AM
#2
gatouns avatar

gatouns

New Zenner

Join Date:
Feb 2008
Posts:
4
Plugin Contributions:
0

Re: (HSBC payment gateway)

can you explain your exact problem pls?
I'm working with the hsbc solution with the atos module and everything is working fine, so I may help you!
regards

30 Apr 2008, 8:44 AM
#3
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

I am using the foamcow module which is now all working apart from the point in the return code where it expects to have the variable $GLOBAL['hsbc'] set (but there is no place elsewhere in the code it is refrerred to, so it seems that it could never get set). In other words the transaction return from HSBC is valid but the post return processing fails due to an uninstantiated object $hsbc.
I don't know anything of the atos module but if it will work on a linux platform and you can provide me with documentation which enables me to get it fully functional within one hour of my time I will happily pay you $100 but I have to get it working by the end of tomorrow.

30 Apr 2008, 9:02 AM
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: (HSBC payment gateway)

You can try to change:
$hsbc=$GLOBALS['hsbc'];

to

$hsbc=$_GLOBALS['hsbc'];

30 Apr 2008, 9:06 AM
#5
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

It might be worth my reiterating that it needs to work with zen cart and hsbc (a quick googleleads me to believe this may not be the case).

30 Apr 2008, 9:07 AM
#6
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: (HSBC payment gateway)

No one is trying to get the reward from you, at least me, I simply pointed out the obvious error you have in the codes you posted.

sdclee:

It might be worth my reiterating that it needs to work with zen cart and hsbc (a quick googleleads me to believe this may not be the case).

30 Apr 2008, 9:08 AM
#7
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

yellow1912:

You can try to change:
$hsbc=$GLOBALS['hsbc'];

to

$hsbc=$_GLOBALS['hsbc'];

Unlike the other global variables ($_POST, $_SESSION etc) $GLOBALS is the correct form - Don't you just love a language with those kind of inconsistencies ;-)

30 Apr 2008, 9:09 AM
#8
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: (HSBC payment gateway)

Weird, since I do use that in my script. But why not just declare it as global instead?
global $hsbc;

--> this way it will work exactly the way it should.

EDIT: I have just checked, you are right, it does use $GLOBALS

30 Apr 2008, 9:19 AM
#9
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: (HSBC payment gateway)

@sdclee: btw, it would be easier for other guys to help you if you post where you can that script, and the content of the whole module if possible.

30 Apr 2008, 9:25 AM
#10
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

yellow1912:

Weird, since I do use that in my script. But why not just declare it as global instead?
global $hsbc;
--> this way it will work exactly the way it should.
That wouldn't help. The hsbc_return.php expects to have $GLOBALS['hsbc'] set.
$GLOBALS is set in a major way, for example:

    [GLOBALS] => Array
 *RECURSION*
    [za_dir] => Directory Object
        (
            [path] => includes/extra_configures
            [handle] => Resource id #3
        )

    [zv_file] => 
    [autoLoadConfig] => Array
        (
            [0] => Array
.....

but it does not have an associative key 'hsbc' and therefore the object $hash cannont be instantiated.

The critical next line:

$hash=$hsbc->getHash($post_2);
``` results in:

Fatal error: Call to a member function on a non-object in /full/path/to/domain/cartdir/hsbc_return.php on line 54 (line number may differ for others as I have debug code in there too).


Anyone who has (or had) the foamcow module working must have surmounted this issue.

As for the reward, it is a genuine offer for a working solution. If it had turned out to be an errant semicolon, underscore or anything equally prosaic I would still get my wallet out :)
30 Apr 2008, 9:35 AM
#11
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

Ok the original module is attached (added .txt to the extension to allow it to pass the upload filters). The only difference between it and the one I am currently using is the addition of 1/2 dozen lines of debug.

Here's the troublesome fragment right from the top of the file (without the includes showing:

  $payment_modules = new payment($payment);

  reset($_POST);
  $post_2 = array();

  //echo ("<p>DEBUG</p>\n");
  //echo ("<p>CPI POST Return Values</p><ul>\n");
		
  while( list( $k, $v ) = each( $_POST ) )
  {
	if ($k != 'OrderHash')
	{
		$post_2[$k] = $v;
		//echo ("<li>$k = $v</li>\n");
	}
		
  }

  //echo ("</ul>\n");

  //die("Script stopped for debugging");

  $order_hash=$_POST['OrderHash'];
  $hsbc=$GLOBALS['hsbc'];
  $hash=$hsbc->getHash($post_2);

  if ($order_hash!=$hash) die ("Hacking attempt!");
30 Apr 2008, 9:38 AM
#12
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: (HSBC payment gateway)

Normally, one can only use a global like that when it was set some where, which is not true it this case.
I would suggest you try:
$hsbc= new hsbc();

And see if it works, and post any error if any.

30 Apr 2008, 10:47 AM
#13
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

I have taken a different tack and fixed the code accordingly. I will be publishing the fix with one or two other items I had to rework in a supplementary document (which I'll also send to 'foamcow'). Unfortunately I can't do that right now due to other more pressing matters (and I want to be thorough in the document).
If anyone has a burning need for help before next week please notify me, otherwise I will post early next week.
For the cynics amongst you (if indeed there are any) you'll see that the fix doesn't relate to any contributions made in this forum so I'll be rewarding myself for my own fix. ;-)

3 Feb 2009, 2:06 PM
#14
webstudio avatar

webstudio

New Zenner

Join Date:
Jun 2006
Posts:
2
Plugin Contributions:
0

Re: (HSBC payment gateway)

Is there an updated solution to the HSBC module. I too am having problems getting it to work.

3 Feb 2009, 2:22 PM
#15
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

Apologies for the couple of folks who sent me PMs but I didn't get notification of them.
As for the solution, I have my client's live implementation still working as far as I know - little or no sales :( and I apologise for not publishing my changes.
I haven't come across a module update.
Having just checked my wiki I do not appear to have written up my changes there (my usual place for things I am likely to forget but need again), so will have to backtrack and find them elsewhere.
I'll try to post them.

3 Feb 2009, 2:37 PM
#16
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

Whilst I try to retrieve my change history, if anyone is having difficulties with the hsbc module please provide details rather tahn just stating that it doesn't work :smartalec:

3 Feb 2009, 2:46 PM
#17
webstudio avatar

webstudio

New Zenner

Join Date:
Jun 2006
Posts:
2
Plugin Contributions:
0

Re: (HSBC payment gateway)

The issue I am having is the hsbc_return.php. I am getting the error "hacking attempt". Have verified with hsbc all details I am using are correct and have double checked the path TestHash.e is correct.

3 Feb 2009, 3:08 PM
#18
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

webstudio:

I am getting the error "hacking attempt"Ok, that I have seen and IIRC despite having checked and checked again it turned out to be an incorrect field.
Try adding this to your code just before the test for the two hashes being the same:

echo '<pre>' . print_r ($order_hash) . '</pre><br />';
echo '<pre>' . print_r ($hash) . '</pre><br />';

which will dump the two hashes out on screen for you to compare (you could write them out to files and diff them or create a hash_diff function if you don't trust your checking by eyeball).

4 Feb 2009, 2:07 PM
#19
sdclee avatar

sdclee

New Zenner

Join Date:
Apr 2008
Location:
Cumbria, England
Posts:
24
Plugin Contributions:
0

Re: (HSBC payment gateway)

Sorry, that code fragment should have read:

echo '<pre>';
print_r ($order_hash);
echo '</pre><br />';
echo '<pre>';
print_r ($hash);
echo '</pre><br />';