Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jul 2005
    Location
    UK and Ireland
    Posts
    258
    Plugin Contributions
    1

    Default HSBC (foamcow Module)

    Hi Zenners,

    We have recently installed the available HSBC mod supplied kindly by the foamcow team @ http://www.foamcow.com/hsbc.php

    However, we came across a could of problems preventing us using the module. We have also spent number of hours on the phone with the HSBC team trying to work through the exact problems (what they are receiving).

    One was to do with the Currency being sent, this was defaulting as USA = 826 and should of (for us) GBR = 826. If you need to make this change then its in the /includes/modules/payment/hsbc.php file

    ====================

    // Currency code setup
    $currency_code = $currency;

    if (!in_array( $currency_code, array('EUR', 'GBP', 'HKD', 'JPY', 'USD' ) ))
    {
    $currency_code = 'GBP';
    }

    $curr = array( 'EUR'=>978,'HKD'=>344,'JPY'=>392,'USA'=>840,'GBP'=>826 );
    $currency_code = $curr[$currency_code];

    ====================

    Next when we put through a sale in Zen Cart we are quickly returned to a "Is this a Hacking attempt! " page.

    This is being generated in file "/hsbc_return.php" under code line

    if ($order_hash !=$hash) die ("Is this a Hacking attempt!");

    The reason for this is aparently becuase Zen is not passing through an ORDER HASH to HSBC. See what it is sending below:

    CpiDirectResultUrl:https://www.active-batteries.co.uk/hsbc_return.php,
    CpiReturnUrl:https://www.active-batteries.co.uk/hsbc_return.php,
    MerchantData:8ef20b8d49d554b3788064f66ae4d481,
    Mode:T,
    OrderDesc:Active Batteries order,
    OrderId:66,
    PurchaseAmount:840,
    PurchaseCurrency:826,
    StorefrontId:UK96791751GBP,
    TimeStamp:1173182570000,
    TransactionType:Auth,
    BillingAddress1:99 Middlewood Close,
    BillingCity:Solihull,
    BillingCountry:826,
    BillingCounty:West Midlands,BillingFirstName:Jamie,
    BillingLastName:Scott,
    BillingPostal:B912TY,
    ShopperEmail:[email protected],
    ShippingAddress1:99 Middlewood Close,
    ShippingCity:Solihull,
    ShippingCountry:826,
    ShippingCounty:West Midlands,
    ShippingFirstName:Jamie,
    ShippingLastName:Scott,
    ShippingPostal:B912TY,
    OrderHash:, <<------ This is the Problem
    btn_submit.x:43,
    btn_submit.y:31,

    ====================================

    If anyone can help us with the module it would be most appreciated. Post on here or message directly.

    Kind regards

    Jamie

  2. #2
    Join Date
    Mar 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    There are a number of things that can stop the order hash from being generated. Firstly ensure you have correctly set the path to TestHash.e in /includes/modules/payment/hsbc.php on line 125. The path is from the root of the server not the root of your site e.g.
    PHP Code:
    //Path where the TestHash.e executable is located
            
    $path '/var/www/vhosts/yoursite/cgi-bin'
    Note there is no trailing slash in the path. If that is correct ensure PHP safemode is off, ensure that the host allows the PHP exec command and the PHP putenv command (specifically to putenv LD_LIBRARY_PATH), also ensure the host allows executables to run on their servers.

  3. #3
    Join Date
    Jul 2005
    Location
    UK and Ireland
    Posts
    258
    Plugin Contributions
    1

    red flag Re: HSBC (foamcow Module)

    Thanks RMcLeod.. We double checked that but still getting a problem

    First a quick easy question - Is there anyone out there that is successfully using a HSBC module on Zen v1.3* ?

    If not here is our currently problem.
    -- Unable to get the HSBC TestHash.e file to generate a HASH file.

    Here is the example output currently:


    =================================================
    cmd = /var/www/vhosts/jsweb.co.uk/cgi-bin/TestHash.e "ABcFjlcCyx2YBhMrNP/t8tp5vsoAK05jK" "https://www.jsweb.co.uk/hsbc_return.php" "https://www.jsweb.co.uk/hsbc_return.php" "5f33860e31bfac43335ca5aedb1e1593" "P" "Active Batteries order" "162" "686" "826" "UK06791751GBP" "1174425382000" "Auth" "26 Middlewood Close" "Solihull" "826" "West Midlands" "Jamie" "Scott" "B912TY" "[email protected]" "26 Middlewood Close" "Solihull" "826" "West Midlands" "Jamie" "Scott" "B912TY"

    Hash =

    =================================================

    Its the HASH = which we believe is causing the problems...

    Any help greatly appreciated.

  4. #4
    Join Date
    Mar 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    I have got it working but had the same headaches as you. You also need two PHP modules installed, these are mcrypt and mhash. Doesn't mention anywhere in the documentation that these are needed, but after hours of trawling the web I cam across this and it worked.

  5. #5
    Join Date
    Oct 2007
    Posts
    1
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    Quote Originally Posted by RMcLeod View Post
    I have got it working but had the same headaches as you. You also need two PHP modules installed, these are mcrypt and mhash. Doesn't mention anywhere in the documentation that these are needed, but after hours of trawling the web I cam across this and it worked.

    Please tell me how shall I install mcrypt and mhash in my website. The server guys said that they have already installed mcrypt and mhash in PHP.

    Even I m getting "Hacking Attempt" error on hsbc_return.php page. $hash is not being generated.

  6. #6
    Join Date
    May 2007
    Posts
    42
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    Has anyone got a fully working version of this mod yet ?

    SO far i cant get Papal or Worldpay to work !

  7. #7
    Join Date
    Dec 2007
    Posts
    22
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    I have just finished implementing this module on a w2k3 server, a few pointers that might save someone a few hours of head bashing:

    -I had TS access to the box which is owned by my friend. If you are on a controlled host you might (i.e. will) struggle to get this running, consider giving up now depending what rights or how willing your hosting co is to help.

    -copy the 2 .dll files (ccpitools.dll, cccpicom.dll) to \system32 directory and register both with regsvr32

    -copy the executables (testhash.exe, CcOrderHash.exe) to a new directory cgi-bin off the root of your shop dir.


    -Modify the $cmd in hsbc.php. I found I could not launch testhash.exe directly from PHP, instead I had to use CMD to call the testhash.exe:

    Code:
    $path = "cmd /c \"\"d:\\domains\your-domain.whatever\wwwroot\shop\cgi-bin";
    
    		putenv("LD_LIBRARY_PATH=$path");
    
    		//Executes the TestHash to get the hash
    		$cmd="$path\TestHash.exe\" \"".MODULE_PAYMENT_HSBC_HASH."\" $cmd\"";
    You need to change the access rights on \system32\cmd.exe, add the user account that your website is running as under IIS. (You see why some hosts will get twitchy.)

    -I also found the timestamp was returning in scientific notation, I got round this by using a slightly different time routine in php:

    Code:
    		// POST time
    		//$time = time();
    
    		// Change the 0 if your server is located at a different GMT time
    		//$time = ( $time + ( 0 * 3600) );
    		//$time = $time * 1000;
    		$timenew= mktime ();
    		$time = $timenew . '000';
    -I also had to hard code the currency. For some reason it was returning a US currency code, I'm not sure where it was picking this up from, but for me as a quick hack I just hard coded it as we are not going to be taking foreign currencies in the near future:

    Code:
    		$currency_code = 826;
    It took a bit of troubleshooting to get this far, if you have problems it is worth enabling some kind of troubleshooting - I wrote the $cmd to a file so I could see exactly what data was being used to create the hash.

    I've now just got to get live mode enabled on Monday and we should be ready to go, at long last!

  8. #8
    Join Date
    Apr 2008
    Location
    Cumbria, England
    Posts
    24
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    Quote Originally Posted by RMcLeod View Post
    I have got it working ... You also need two PHP modules installed, these are mcrypt and mhash...
    Does anyone know what the side-effects or results would be if mhash is not installed (I am waiting to get that resolved)?
    Furthermore, I have a situation in which a hash can be generated using TestHash.e but not OrderHash.e. When I runOrderHash.e at the commandline it has a 'Segmentation Fault'. HSBC state that it should not be run from an 'exec':
    1. The Orderhash file is not designed to be called from the command line or any such function.

    It is a file which works internally and generates an orderhash which is included in an html page and POSTED to the CPI. Thus calling the Orderhash.e using the exec() command may result in some erroneous results.
    So, has anyone got a php module which works with OrderHash.e ? If so could you be kind enough to post the relevant lines.
    In addition what ms5sum do you have for the OrderHash.e please?

    Mine is:
    md5sum OrderHash.e 99f95e3cc2858fc32cac71dfbeb8e6f2 OrderHash.e

  9. #9
    Join Date
    Apr 2008
    Location
    Cumbria, England
    Posts
    24
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    Here are two findings which should help newcomers to the hsbc integration:

    1) Testhash.e despite its name is a valid executable for use in a live environment, its output being a (string) hash. OrderHash.e need not be considered as it is meant for inclusion in an HTML page for POST purposes.

    2) The hsbc.php module has a bug which causes a result code 10 (Invalid data value) due to the 'wrapping' of the hash key in double quotes, so the line:

    Code:
    $cmd="$path/TestHash.e \"".MODULE_PAYMENT_HSBC_HASH."\" $cmd";
    needs to become:
    Code:
    $cmd="$path/TestHash.e ".MODULE_PAYMENT_HSBC_HASH." $cmd";

  10. #10
    Join Date
    Dec 2006
    Posts
    21
    Plugin Contributions
    0

    Default Re: HSBC (foamcow Module)

    I have had this module installed a year ago on my server.

    A few points

    1. make sure Testhash.e works from command line. If it asks for a library file to be installed on the server..do that.
    2. YES, use testhash.e instead of orderhash.
    3. make sure mcrypt and mhash are installed.
    4. Testhash.e needs to be in the cgi-bin outside of the site root.
    5. modify $currency_code to suit your needs.
    6. There was some problem with the time being scientific or not.
    7. Also make sure that the server time is same as the GMT time. e.g. summer time/winter time. If the server time is more than 1hr outside the range HSBC secure epayments site would return an error.

    If despite all this...you are still finding it difficult to install the module you may email me and i'd be glad to help. I don't normally follow forum posts.

    Hope this helps.
    My contributions:
    VAT Calculator.
    Stockinhand Calculator

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. HSBC CPI FoamCow integration working, BUT...
    By -Jc. in forum Addon Payment Modules
    Replies: 5
    Last Post: 6 Jul 2010, 03:15 PM
  2. HSBC Payment Module
    By audiografix in forum Addon Payment Modules
    Replies: 5
    Last Post: 4 Aug 2009, 11:11 AM
  3. HSBC module API
    By Blaze Falconburger in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 15 Feb 2008, 02:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg