Author Topic: Sage Pay (protx) server integration Joomla 1.5  (Read 58637 times)

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #15 on: January 08, 2010, 02:16:51 am »
NOTE: forgot to mention earlier, while patching paypal when I run sql script (copying the text, pasting into query window in phpmyadmin) it gave an error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE `jos_vm_orders_temp` ( `id` int(19) NOT NULL AUTO_INCREMENT, ' at line 2

then searched on the internet, and found sb saying delete the first line of your query. so I deleted:
DROP TABLE IF EXISTS `jos_vm_orders_temp`;

and tried again and worked. So I dont know if skipping this might cause any trouble? that table didnt exist, so I thought it wouldnt be problem.

edit: tried simulator, in the first trial worked fine, saying congratualtions everything works ok etc.. second trial received this error:

Failed to store SagePay status and status detail. MySQL Error message: DB function failed with error number 1054
Unknown column 'SagepayStatus' in 'field list' SQL=UPDATE jos_vm_orders_temp SET SagepayStatus='INVALID - The VendorTxCode \'62_b926c8d04191f04ddeaaa65cc776f\' has been used before. Each transaction you send should have a unique VendorTxCode.' WHERE id = '5'

Finally, I checked orders_temp table in phpmyadmin and given vendortxcode (under order_number field) has not been used before but the last one.

if i login as different user it is successful again, saying:
Congratulations. Your Server Side scripts have successfully registered a transaction with Server, handled the response from the page and redirected the client browser to the payment page URL.
On the real Server system, this payment page will look something like the image below.

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #16 on: January 08, 2010, 02:20:45 am »
sorry, I didnt realise you can proceed on simulation. I did go to final step and I received this error:

MySQL query to retrieve security key failed with error message: "DB
function failed with error number 1054
Unknown column 'SecurityKey' in
'field list' SQL=SELECT SecurityKey FROM jos_vm_orders_temp where
order_number='63_b5d6c9ead751d8a0b90750394e4e3' AND
VPSTxId='{50269831-494E-44B2-BD9A-952FDBCA3704}'"

please advise

andpatton

  • Beginner
  • *
  • Posts: 32
    • acusti.ca
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #17 on: January 08, 2010, 16:06:43 pm »
Ah hah -- looks like we've found the problem. I added four columns to that MySQL table (jos_vm_orders_temp) that I forgot to include in the integration package. I'll update the directions in my original post and the package I posted accordingly, but I'll also repeat the info here and attach the SQL script.

You just need to run the attached script on your website's database (as you did before when you applied the paypal patch) and hopefully you'll be good to go. I included the DROP TABLE IF EXISTS command (seeing as you now already do have the table), but if the query still fails, you can remove the "IF EXISTS" part of the query and it should work.

Then try testing again and hopefully all will work as expected. I'm figuring this should clear up the errors you've been receiving related to not having a unique VendorTxCode, but keep me posted if not. Good luck!

NOTE: The notify_sagepay.php file I attached to my last post was wrong (I accidentally grabbed an old copy of the file to try removing the CAVV stuff from) -- this inspired me to relook at that file and I made a couple updates to it in the original integration package I put in the first post. They shouldn't make much difference (the major change is just fixing the formatting of how the SagepayResults are stored in the D) but if you want the latest and cleanest, you should go grab it from there


[attachment cleanup by admin]

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #18 on: January 08, 2010, 23:24:28 pm »
andpatton, many thanks for your help! it works now! I think that was the main issue and it is resolved.

one minor thing, and I dont know if this can be fixed: if payment is unsuccessful (say invalid card, rejection from bank etc), and customer goes back and wants to try with another card but also adds or removes something from the cart.. then this error comes up:

Sage Pay returned a MALFORMED status. The POST was Malformed because "4002 : An active transaction with this VendorTxCode has been found but the Amount is different."

I assume this error will come up if anybody goes to payment screen, but remembers to buy something else too, so goes back, adds something to the cart. basically anything changes cart value after payment screen shown triggers the same error.

although I dont know how this can be done, I think this will be fixed too if last entries from temp_order_table can be deleted in either of below conditions:

- when payment unsuccessful (rejected etc)
- after time out (say 5min)

what do you think?

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #19 on: January 10, 2010, 23:31:42 pm »
Ive started receiving this error:

Error: Page Does Not Exist Given filename does not exist. Cannot find file: "checkout.sagepay_post?order_id=5.php"

has anybody got any idea?

EDIT: I received above error (with increasing order_id) both with simulator and live.

Tried with paypal confirmed and worked ok with no problem.

I think again there is something to do with order or order_temp table. I tried dropping and re-creating order_temp table but didnt work. is this a sync issue between tables?

If yours is working ok, could you try this, enable another payment method (to keep it simple, say cash on delivery) and test-buy  something via using this payment method, and then try with protx. see if you receive similar type of error or not.

only solution I can think of -with my very limited knowledge- is to drop payment related tables (order, order_temp, order_history etc) and rebuild them (basicall like reinstalling virtuemart, without losing all other products and settings).

please advise

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #20 on: January 11, 2010, 14:16:48 pm »
ok, having playing with the database but no luck. have been deleting entries etc, but nothing worked.

to my understanding after payment is done, orders_temp table creates another order session, and this is causing the problem.

in this example, last order I created has order_id=9 and order_id=9 has same order number and everything on both tables. so everything ok until here. then, there is a new entry (i dont know why) on orders_temp with order_id=10, which causes all problems .the error I received on this example is:

Error: Page Does Not Exist Given filename does not exist. Cannot find file: "checkout.sagepay_post?order_id=10.php"

so for some reason on the confirmation page there is a new order entry being started (I think).

note: to my understanding payment goes through. so it is successful, only this error on confirmation page.

andpatton

  • Beginner
  • *
  • Posts: 32
    • acusti.ca
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #21 on: January 11, 2010, 15:50:10 pm »
I believe I discovered the source of the problem; first, forget about the DB, the tables are fine and you don't have change anything there or reset them in anyway -- the presence of an extra order after your current order in the table is a symptom, not a cause.

On to the solution -- I dug around a bit in the package to try to find the potential cause of your problems and I believe I found the issue. It looks like I left some old code in the sagepay_paymentextrainfo.php file (that you put in the payment extra info field for the SagePay payment method) which doesn't work with the modifications I made to the process to make a portable version of the package. I'm pretty sure I've fixed it now, but I'm sure we'll find out soon enough. I attached the new version of that code (just copy and paste the contents of the file into the Payment extra info field replacing all of the old code) to this post.


Also, re: your other question about what happens when someone starts the payment process, then tries to go back and change something in their cart in virtuemart, and then tries to checkout again -- that error is a result of the inherent issues of trying to integrate two completely separate processes (the virtuemart and sagepay processes) into one over all checkout flow. Once you begin the payment process, there is no way to be able to cancel it, go make changes to an existing basket, and then start it again. This is because SagePay does not allow there to be multiple transactions with the same order id (what they call the "VendorTxCode", or vendor transaction code), even if one of them was cancelled or paused.

This means that in order to have someone be able to cancel the payment and then enter back into it, you would need to create a new order in virtuemart so that it gets a new order id to send to SagePay and there is no conflict. The problem with that is that creating a new order will erase all of the old content. So, the simplest solution would be to reset the shopping cart and order info whenever a SagePay payment is cancelled so that the shopper can add the products back with the changes they want and then check out again and not have a conflict when doing the SagePay payment. A more complicated solution, which I'm not sure how I could implement, would be to try to drop the current order but simultaneously create a new identical order when someone cancels the payment process, so that the order gets a new id that sagepay will accept and the shopping cart is preserved. It sounds more ideal, of course, but it could take me a while to implement, and I don't have much free time right now.

Hope that all makes sense. Please post back or PM / email me to let me know 1., if my changes have fixed your current problem and 2., what you think about the second issue.

Cheers,
Andrew



[attachment cleanup by admin]

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #22 on: January 11, 2010, 16:21:51 pm »
andpatton, I think it works now! I will test tonight and update you..
thank you so much for your efforts..

raghu

  • Beginner
  • *
  • Posts: 5
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #23 on: January 13, 2010, 10:22:01 am »
hi,

i have used these files and configured but. when i click on confirm order  it is not taking me to any payment page directly giving the message like

Thank you for your order.

Your order has been successfully placed!

A confirmation email has been sent to: praghavender@globaldata.com.

not giving any error even can any one tell me what is my problem.

the content of the file sagepay_paymentextrainfo.php is pasted in sage pay configuration Payment Extra Info box is it correct ?


Thanks,
Raghu.P

andpatton

  • Beginner
  • *
  • Posts: 32
    • acusti.ca
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #24 on: January 13, 2010, 16:44:52 pm »
Hi Raghu,

It sounds like VirtueMart isn't using the sagepay payment method. So, it brings up a few questions:

1. This might seem  kind of obvious, but it can be surprisingly easy to overlook the little things. Did you make sure to disable all other payment methods in virtuemart and enable the SagePay method? Also, did you fully configure the module (ie, did you: enter 'SAGE' as the code, select 'ps_sagepay' for payment class name, and select 'HTML-Form based (e.g. PayPal)' for payment method type)?

2. Did you use the latest version of the integration package (in other words, did you download the package sometime after january 11)? If not, redownload it and replace the previous files with the new ones on your site.

3. Did you also install the VirtueMart PayPal Patch (it's a required dependency of this integration)?

4. Did you make the necessary changes to your database (see my original post for details)?

There are a number of other possibilities that could be causing the issue, but I'll need a lot more info before we can really start narrowing it down, so this is a start. If you can think of any other relevant info you can share about the problems your having (for ex, VM version, Joomla version, urls that show up when you get to the payment part of the checkout process [just the last part of the url, I don't need any domain info], any other patches or hacks you've done to VM, etc.)

Cheers,
Andrew

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #25 on: January 19, 2010, 22:22:20 pm »
hi andpatton,
i just wanted to let you know the payment system is working very well. thanks a lot for you time and effort..

tmi

  • Beginner
  • *
  • Posts: 16
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #26 on: February 03, 2010, 14:35:16 pm »
Hi,

I also want to integrate sagepay payment method ant i did all of the modification and implementation which you have suggest in your previuos posts. After all of this i am getting fatal error:

Like this: please response me ASAP it's urgent for me.

Fatal error: Call to undefined function curl_init() in D:\xampp\htdocs\joomla15\administrator\components\com_virtuemart\html\checkout.sagepay_post.php on line 28

And thanks for your all help.

alpertheidiot

  • Jr. Member
  • **
  • Posts: 103
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #27 on: February 03, 2010, 15:09:20 pm »
have you tried this on a live site?

andpatton

  • Beginner
  • *
  • Posts: 32
    • acusti.ca
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #28 on: February 03, 2010, 15:49:56 pm »
In reply to tmi:

It looks like you don't have cURL installed or enabled on your server environment. The cURL library is relied upon in this SagePay PHP server integration in order to facilitate communication between your server and the SagePay servers.

If you know what you're doing and have access to the configuration of your server, try installing or enabling cURL yourself. Google has lots about how to do that.

If someone else is in charge of your server, then just ask them to install or enable cURL for you.

In reply to alpertheidiot:

This integration is currently being used successfully on a live e-commerce website. It made it possible to tightly (and securely) integrate the virtuemart checkout process with the sagepay payment process without the user ever having to leave the URL or the visual frame of the website. All in all, we've been very happy with it.

tmi

  • Beginner
  • *
  • Posts: 16
Re: Sage Pay (protx) server integration Joomla 1.5
« Reply #29 on: February 04, 2010, 07:02:16 am »
Hello, Yes i tried to on live site and it is working fine. But after place an order i just redirect on order information page. i don't know how is not going to sagepay site.

Any other modification we need to change. i am using VM 1.1.4 with 1.5.14 joomla version.

Please response me ASAP. And thanks for your all help.