Re: Best way of making shopping cart & checkout
Re: Best way of making shopping cart & checkout
- Subject: Re: Best way of making shopping cart & checkout
- From: John Pollard <email@hidden>
- Date: Fri, 17 Oct 2008 19:55:09 +0100
Hi Thomas,
It all seems to make sense to me. Perhaps some things to think about:
- If your running instances are stopped, will the unpaid orders be
tidied away. Might you want to timestamp unpaid seats and poll for any
stale ones every half hour or so to get rid of them
- Even with successful payments, the POST back from PayPal / Protx may
not get to you. In our experience PayPal is bad for this and with
Protx it only happens occasionally. We use basic hand over / hand back
type integration which it sounds like you are using also. This could
create a problem as you really don't want to throw the seat bookings
away if this happens!
The POST can go to a direct action method with the session identified
in the wosid parameter of that return url that you can pass. The paid
seats for that session can then be updated before returning anything
you like, such as a thank you page using pageWithName().
John
On 17 Oct 2008, at 19:12, Thomas Worrall wrote:
Hi. I'm making a shopping cart system for buying theatre tickets.
Here's how I envision it working: what I need is for people to tell
me where I've gone wrong :)
I have an entity called SeatBooking, which are the things the user
can buy. I have another called Order, with a many-to-one
relationship to SeatBooking.
I am planning to have an Order variable in the session, and whenever
the user adds a seat to their cart I add the relationship between
that seat and the Order that's in the session. I save the changes
immediately, since when a seat is in someone else's cart, no-one
else should be able to buy it. (There is a boolean attribute called
"paid" as part of Order, so I know which orders have been completed
-- thus saving incomplete orders in the db is not a problem.)
When a session is destroyed, it also deletes its Order, if it has
not been paid. Thus on session timeout the seats that were in
someone's cart get released.
For the actual payment process, I need to be able to use both Protx
and Paypal (the latter is a stopgap until our Protx account is
ready), but they both seem to work in a similar manner. I send the
data (along with a unique ID) to their payment server, which
redirects the user to their payment page. Their system will send a
POST back to my app. I need to capture it, and if the authentication
of the payment worked then I look up the order based on its unique
ID, and set "paid" to true (also saving the auth code, just in case).
I then need to supply via POST a URL for the payment gateway to
redirect the user to. This should be a "Thank you" page type thing.
So, some questions:
1. Does this design make some kind of sense?
2. How do I listen for POST requests? Sadly, they only send them on
port 80. Should I make a Direct Action that listens for them?
3. This one's probably a newbie question, but how do I generate the
URL to redirect the user to? It should be a component action that
goes to a thankyou page. I know how to make a WOHyperlink that does
that, but I don't know how to generate such a URL without putting it
on a page.
Thanks for all your help.
Thomas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden