Hi Guys,

 

I am trying to set up an inventory/ticket purchasing system.  I have a table
that stores the available quantity, and I have a form where users can
purchase tickets. The form shows the current number of available tickets.  I
have another table that I am using to hold pre-authorizations that
essentially 'hold' a specific quantity while the purchase is complete.
Because the purchase may involve a trip to payPal, I need to be able to
lookup the pre-authorized amount when I get the callback from Paypal and
either commit that amount on success or release it on failure.

 

Does this rough outline make sense? Can I use a named lock in this fashion
to lock to separate pieces of code to ensure they are single threaded?

 

1.       User submits the form

 

START EXCLUSIVE NAMED LOCK ('TICKETPURCHASE'):    

                                                               i.      Get
Available ticket quantity + any pending pre-authorizations to purchase.

                                                             ii.      If the
number available - number of purchases pending > 0, then add an entry to the
pre-auth table to the requested quantity for the current purchaser


END EXCLUSIVE NAMED LOCK ('TICKETPURCHASE')

 

2.       Process credit card

 

a.       ON SUCCESS

 

                                                               i.      START
EXCLUSIVE NAMED LOCK ('TICKETPURCHASE')

1.       Get pre-auth record, update available ticket quantity table
(essentially committing the pre authorized items

2.       Delete pre-auth record

                                                             ii.      END
EXCLUSIVE NAMED LOCK ('TICKETPURCHASE')

 

b.      ON FAILURE

 

                                                               i.      START
EXCLUSIVE NAMED LOCK ('TICKETPURCHASE')

1.       Delete pre-auth record

                                                             ii.      END
EXCLUSIVE NAMED LOCK ('TICKETPURCHASE')

 

 

Thanks for your advise on this!

 

Brook

 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344482
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to