Worldpay

Posts: 38
Joined: 08/16/2007

Hi,

I have started all over with a WorldPay module (unfortunately I was not able to get a copy of this code http://www.ubercart.org/forum/development/913/worldpay_module).

Payment seems to work.

With the IPN I have some problems.
Worldpay executes the page I configure as IPN (and result page) on their server and then displays the resulting HTML (if you configure that).
In functions like "uc_cart_complete_sale()" session's are used, which obviously are not available on their server.
A redirect would not work becayse Worldpay says:
"Warning: Automatic redirection using the payment response server-side script, client-side coding or 301/302 server redirects are prohibited and will result in a failure being logged and a possible suspension of the feature."

I can pass variables to their server and get it back in the drupal page they are executing. I tried to use that technique with "session_id", but that does not seem to work (and I don't think it is safe to pass on session_id's throughout the internet).

So, can anyone help me with ideas how to handle "uc_cart_complete_sale" without having access to the original $_SESSION variables?

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The session variables under the new_user array won't depend on the customer's session, so that part will be fine. The only thing that won't happen is the unset on the cart_order and do_complete variables. You can build these into a return page to your site from Worldpay.

For a comparable example, check out the 2Checkout module in core.

Posts: 38
Joined: 08/16/2007

I use the 2Checkout as my example.

Hmm, not sure what you mean. I could set the Checkout messages to a page who unsets these variables?
But then we depend on the user to click one of those URL's to clear them.

(Their "return" page is also executed on their server)

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I understand... is there even a way to specify a return URL to WorldPay that the customer could click on? If so, make that URL clear the session variables.

If not, you really don't need to worry about the leftover session variables. They'll actually be reset the next time the customer browses to the checkout page, so there shouldn't be any overlap or leftover data.

Posts: 38
Joined: 08/16/2007

I can do that with the Ubercart Checkout Messages.

But if what you say is right, something else goes wrong. The cart is NOT emptied after payment. I'll test it further Smiling

Thanks so far.

Posts: 38
Joined: 08/16/2007

Another question.

I can't find a proper way to handle "canceled" payments.

If a payment is complete you can configure the workflow-ng to set the order status to "completed" or whatever you want.

But the only way to handle "canceled" payments would be to set uc_order_update_status() to "canceled" directly in the module code, which seems to contradict the "workflow-ng" method for full payments?

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hmm... it seems like what you're looking for is really an event. You might need to make some of your own Workflow-ng integration so that it invokes an event when a notification is received and passes as arguments the notification itself and the order affected. Then you'd need to have a condition that lets someone check what sort of message was received.

If this is too much trouble, updating the order in the code isn't always bad. You can always make it an option on the settings form. If you just want to "hard code" it, use uc_order_state_default() to use the default canceled status instead of setting the status directly.