3 replies [Last post]
fessio's picture
Offline
Joined: 12/02/2008
Juice: 20
Was this information Helpful?

Intro:
Hi. I'm creating a site which would be accepting only Papal WPS. The idea of the site is that a user should pay to register. When he pays he gets a generated number, which is his login and password simultaneously. I've hooked into the login process so that it now requires only username. So it's a kind of an access code to the site, which will expire in a certain period of time(cron just deletes the accounts which are too old) and the user has to pay again to have get another access code. Besides the user should not enter any information about himself on the site, instead the info should be passed into the order through the IPN.

Problems:
So one of the very strange things about ubwecart Paypal WPS is that the order is processed by the "uc_cart_complete_sale" twice(as far as i understand): one call is from uc_paypal_ipn and another one from "uc_paypal_complete" which is really strange because when an anonymous user pays, the account for him is created when he is still on the PayPal site and when he presses "Go back to merchant" button, he sees not the info of his newly created account, but something like "Your order has been attached to the account with "this" email". So the user never sees his account details.

And its very bad in my case, because the user does not have access to his account details, 'cause he should not even realize that is an account. He's paying only for the access code. Besides he does not get an e-mail with his account details because he never entered any e-mail on the site and IPN does not send it to the site, even if it does, I can't place it to the order: http://www.ubercart.org/forum/support/7957/using_paypal_ipns_info

I know it might sound strange not to require any info from the user, but that's the way the boss said it should be.
Sorry for such a long post, I'm just completely stuck with these problems, so please if someone had a similar problem and knows how to solve it, let me know. Thanks

fessio's picture
Offline
Joined: 12/02/2008
Juice: 20
Re: PayPal WPS question

Ok, after looking at the code closer and reading the ipn docs, I got even more confident that the fact that the "uc_paypal_ipn" function is calling "uc_cart_complete_sale" is not right. Because what's happening in this case is the following(at least that's how I understand it): as soon as the customer presses the "Pay" button on the Paypal site, PayPal sends an ipn by simply posting to http://example.com/uc_paypal/ipn/336(or wchichever id), and what happens next is that ubercart is creating an account for PayPal IPN system and tries to log it in by calling "uc_cart_complete_sale", which executes "drupal_execute('user_login', $fields)", which in turn leads to the fact that the user won't see his newly created username and password once coming back to the site from PayPal. Or maybe I don't understand something. Comments are welcome Smiling

PS: I hope I made myself clear Laughing out loud

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: PayPal WPS question

Yeah, I think what you're describing is right... as for a quick workaround, I don't have any. The only thing I can say to refine it is that sometimes PayPal sends the IPN right away, sometime it sends it at an arbitrary time in the future. It seems to me like the system should still send the e-mail to the customer w/ their account details if you have chosen to send a new account notification when a user is created during checkout. Look for that in the checkout settings.

fessio's picture
Offline
Joined: 12/02/2008
Juice: 20
Re: Re: Re: PayPal WPS question

Thanks for the reply, but the problem is that that I don't know the user's e-mail, because for some reason it's not in the IPN post. And that's a big problem. I've made a quick workaround: removing "uc_cart_checkout_complete" from the ipn function, setting rm=2 in the form and no auto-redirect activated in the PayPal account and to receive all the data at "uc_paypal_complete" and put it into the order. But it leads to another problem: if the customer doesn't press "Return to merchant" his payment won't be processed. Besides this workaround is not an option for me 'cause today I found out that the owner of the paypal account refused to turn off auto-redirect, 'cause he needs it for his other sites. I'm completely stuck