PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

Sagepay - Updating Protx Form Module

36 replies to this topic
#1
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
I have updated the Protx Form module to the latest Sagepay 2.23 protocol. The new version should work but please test before using and use at your own risk as usual. It is configured to use test server or sandbox. When ready to go live just edit the sagepay.php file to link to the live server instead of the test server.


What's new?

The server names logos and the protocol have been changed (anything with the word protx in it too).
The 2.23 protocol is required for sandbox testing.
Billing and delivery names and addresses use individual fields - first name, surname, address1 etc. rather than simply being an address block as previously.
Postcode is passed for UK addreses only.

To install, unzip this sagepay directory to your modules directory and configure with your Sagepay with your Sagepay details. This should not overwrite anything from your Protx module. It can run alongside.

(updated attachment)

I am no longer supporting this module. I recommend you use:
Sagepay Server (not free)

Attached Files



#2
celadore

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts
Am new to Prestashop. Love the look and feel, but was sad to see no Sage Pay option. But lo and behold someone is working on it.

When will you have a final working module. Is it going to be free or pay?

Thank you, thank you.

#3
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
It is free.

The original Protx form module may still work but would have needed updating sooner or later. I have just made some small changes to the original Protx module which I have also emailed to the original author.

I wasn't able to test out if 3D secure was working. Sometimes I don't see the popups for this sort of thing.

#4
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
I was getting problem if the purchase more then £1000 pound, it went through Sage Pay successfully, but when return to Prestashop, it only show £1 of the order. And Prestashop will send out a notification letter said the order has error.

I did see the Protx direct contains this bugs before, not sure is it a bug on the SagePay Form module as well??

I look forward to hearing from you. Thank you.

#5
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
Probably Sagepay is returning £1,000.00 and the module is expecting £1000.00

Was the Protx direct module fixed?

#6
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
Thanks for your reply.

Please See: http://www.prestasho...ad/16173/#73292

Quote

10th June 2009 – Bug fix release
Yet another couple of bug fixes.
It’s still (yes STILL) marked as the same version number. Two bug fixes don’t really count as much.

Orders over £1,000 now display correctly in the administration area.
Upgraded to work with the latest svn build as of 20 mins ago (yes this includes the latest downloadable beta).


I haven't do a test on the direct module. I can do a test if necessary.

Thank you.

#7
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
Thanks for spotting this one.

Unless you specify otherwise the function 'default number_format' uses a comma as the thousands separator so the fix would be to change line 266 of sagepay.php from

$cryptArr['Amount'] = number_format($params['cart']->getOrderTotal(),2);


to


$cryptArr['Amount'] = number_format($params['cart']->getOrderTotal(),2,'.','');


Does that fix the problem?

#8
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
After I modified the Sagepay.php, every time when I went through Sagepay transaction, return to Prestashop, it will show a message "ammount - hacking attempt".

How can I deal with this problem?

Thank you.

#9
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
OK so that means that the amounts don't match. I will look to see what the amount is being checked against.

#10
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
Many thx, I will look forward to see this bug fix.

It is a great module!

#11
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
I'm at loss to know what is happening here because when the amount is below 1,000 those two functions should be identitcal yet it seems from your post that they are yielding different results and generating the 'hacking attempt' error.

Unfortunately I don't have a test sytem available to me at the moment to run this through. Are the transactions being recorded correctly in Sagepay?

Can you echo the two variables that are being compared?

$decoded['Amount'] and $_SESSION['sagepay']['Amount']

#12
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
Yes the transactions being recorded correctly in Sagepay.

How to echo those variables that are being compare?

I can see Sagepay Amount = "1,400.00 (GBP)"

But I just see "Total" at Prestashop back office admin panel.

Sorry for the ask, I am a newbie at Prestashop... :(

#13
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
In the file success.php of the sagepay subdirectory, above the line (21?):
     die('ammount - hacking attempt');    


put

echo 'decoded amount: '.$decoded['Amount'] . 'session amount: ' . $_SESSION['sagepay']['Amount'];


If we see that the only difference between these is a comma then perhaps inserting a line:

// next line added by to remove commas from amount
$decoded['Amount'] = str_replace(',','',$decoded['Amount']);


after
// a little bit of security please!


might do the trick.

#14
Dennis Chan

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
after I do the echo on the test, result is:

"decoded amount: 1,400.00session amount: 1400.00ammount - hacking attempt"

so, I use your tricks to remove the ',', it works absolutely fine!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thank you very much!!!!!

Many many thx!

#15
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
Glad to be of help and thanks again for the testing!

#16
paulthibedeau

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts
How can i make this work with "Sage Payment" the USA version of Sage Gateways??

PLEASE HELP, this module is the closet help I can get and I need to get this working.

#17
Floobynooby

    PrestaShop Apprentice

  • Members
  • PipPip
  • 57 posts
What versions of Prestashop does this module work with.

#18
radders

    PrestaShop Apprentice

  • Members
  • PipPip
  • 255 posts
I tested it on 1.2
I expect it will work on later versions though.

#19
Floobynooby

    PrestaShop Apprentice

  • Members
  • PipPip
  • 57 posts
Many thanks am using 1.1 at the moment but thinking of upgrading to 1.2.5 just wanted to check before upgrading or would stick with 1.1.

#20
sgtbash

    PrestaShop Apprentice

  • Members
  • PipPip
  • 107 posts
Hi,

Thanks for the module, works like a dream!

One thing though - is there any way of using an order related variable instead of the 'Sagepay Order' text on line 272 of sagepay.php?

Id like to use something that matches the payment to the order.

Has an order number been generated at this point?

Thanks

Dan
Nineplus USA - Now on Prestashop 1.4.7