Best way of making shopping cart & checkout
Best way of making shopping cart & checkout
- Subject: Best way of making shopping cart & checkout
- From: Thomas Worrall <email@hidden>
- Date: Fri, 17 Oct 2008 19:12:51 +0100
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