Jump to content

[SOLVED] Slowvalidation in PayPal module


cian1991ferrari

Recommended Posts

Hey everyone. I'm writing a new payment module but it is my first time writing a module so I based it on the existing PayPal files and changed them.

At the moment I have most things working except for the validation of the order after payment is completed. For example, payment goes through to the merchant account but when redirected to the shop site the order has not been completed and is still in the cart.

As I based it on PayPal, i'm trying to get my head around what exactly is going on and after looking at developer.paypal.com I think I now understand this. But can anyone shed some light on what the slowvalidation in the following files is:

This is redirect.tpl:

<input type="hidden" name="return" value="http://{$url}order-confirmation.php?key={$customer->secure_key}&id;_cart={$cart_id}&id;_module={$paypal_id}&slowvalidation;" />



The above code is sent to order-confirmation.php and presumably sends a GET response with the "?key={$customer->secure_key}&id;_cart={$cart_id}&id;_module={$paypal_id}&slowvalidation;" />" bit. But it is sent to this code:

$id_cart = intval(Tools::getValue('id_cart', 0));
$id_module = intval(Tools::getValue('id_module', 0));
$id_order = Order::getOrderByCartId(intval($id_cart));
$secure_key = isset($_GET['key']) ? $_GET['key'] : false;
if (!$id_order OR !$id_module OR !$secure_key OR empty($secure_key))
   Tools::redirect('history.php'.(Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
$order = new Order(intval($id_order));
if (!Validate::isLoadedObject($order) OR $order->id_customer != $cookie->id_customer OR $secure_key != $order->secure_key)
   Tools::redirect('history.php');
$module = Module::getInstanceById(intval($id_module));
if ($order->payment != $module->displayName)
   Tools::redirect('history.php');
$smarty->assign(array(
   'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
   'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));



Can somebody tell me what exactly the slowvalidation bit actually does????

Thanks in advance, Cian

Link to comment
Share on other sites

That code is executed when PayPal is running slowly and doesn't validate straight away. It basically adds a message on the order page to let the customer know that there has been a delay in validation and that they should refresh their order page at a later time to view their order.

Link to comment
Share on other sites

  • 7 months later...

The instructions on the Wiki are outdated. You shouldn't enter any IPN URL at all. You should only follow the instructions in the PayPal module's configuration page. PayPal automatically generates the IPN URL and send it to PayPal with the order details.

Link to comment
Share on other sites

I have no idea why you are having so many problems. I'm using PayPal v1.7.1 on my website and I've never had any problems. I just followed these instructions:


In order to use your PayPal payment module, you have to configure your PayPal account (sandbox account as well as live account). Log in to PayPal and follow these instructions.

In My account > Profile > Website Payment Preferences, set:
- Auto Return : Off,
- Payment Data Transfer to Off.

In My account > Profile > Shipping Calculations
- check Click here to allow transaction-based shipping values to override the profile shipping settings listed above

All PrestaShop currencies must be also configured inside Profile > Financial Information > Currency balances


Is your PayPal account verified? I'm using a verified Business PayPal account.
Link to comment
Share on other sites

While I agree that that particular piece of advice (*ever* setting permissions to 777 willingly is just plain stupid anyway), which is repeated all over the place, is potentially the silliest I have ever seen (posted about it years ago...) you have to also blame PayPal for the confusion, as:

from Edit Instant Payment Notification (IPN) settings on PayPal website:
error: You must enter a properly formatted URL into the Notification URL field in order to activate Instant Payment Notification.


Isn't true either.Well not entirely. If you don't set up IPN in your PayPal account at all, then the payment module can (and does) enable it per transaction - the other benefit of doing it this way is that you can have multiple web shops using the same PayPal account and taking advantage of IPN.

Lack of documentation has always been, and still is, the biggest issue that Prestashop has. In saying that I don't think I've ever submitted it as a "feature request". Maybe we all should ;)

Paul
Fellow mushroom :D
Link to comment
Share on other sites

  • 2 years later...

Im using prestashop 1.3.6.0 and paypal module 1.7.1.

 

When customer select paypal module to pay with, we get money to our paypall acount but problem begins when customer redirect back from paypall to our page.

 

We cant see order in the admin section, customer still has products in cart and the return url of our site isnt order-confirmation page but domain/history.php?slowvalidation.

 

Problem appears two days ago, before we didnt have this problem.

 

My paypall settings are the same...

 

In My account > Profile > Website Payment Preferences, set:

- Auto Return : Off,

- Payment Data Transfer to Off.

 

In My account > Profile > Shipping Calculations

- check Click here to allow transaction-based shipping values to override the profile shipping settings listed above

 

All PrestaShop currencies must be also configured inside Profile > Financial Information > Currency balances

 

Can u help me?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...