Forum OpenACS Q&A: Re: Want to make a new callback registry, details below...

Hello Jim,

ec_update_state_to_authorized updates ec_items on a newly authorized order, so that shippable items are to_be_shipped.

At the same time, one could query the order for ec_items where shippable_p == 'f', and mark some independent lookup table that the object ID is readable for the user of the order_id for N units of time (or time_expires).

No callbacks are needed.

Callbacks are indicated when the user is waiting for a displayed response, and a procedure takes an unspecified amount of time (usually seconds or more).

ec_update_state_to_authorized is executed as a scheduled procedure, so a callback is unnecessary.

Using this proc means that the credit card has been processed for nonshippable items, so it's time to provide access via procs called from it.

A schema might be defined with these minimums:

table my_app_user_certificate_map
user_id
certificate_id

table my_app_certificates
certificate_id
object_id
time_created
time_expires
last_access
next_to_last_access

The object_id could be a subsite, a content_item etc

The particulars would be handled by your custom procs.

best wishes,
Ben

Collapse
Posted by Jim Lynch on
hey there *...

Ben, I have the table you;re talking about when you say my_app_certificates. I was thinking that ecommerce could make one (by whatever mechanism) when an ec_item of the appropriate kind becomes shippable, and I thought what you're calling my_app_certificates.object_id could point at the ec_item.

The reason I wanted to do it as a callback, is so that my app-specific code would not go into ecommerce, what would go there is a callback setup so that anyone who wants to could run custom code that doesn't necessarily have anything to do with user interface and that is triggered by the purchase of a specific item. Such custom code would register itself with a proc I write, one of its parameters being the ec_item type. Then, when an item of that type is sold, the callback would fire.

-Jim

Collapse
Posted by Jim Lynch on
One more thing about the schema... the mapping table is present, and I implemented the mapping a little differently, such that all one has to do is create the cert, and as long as the current time is within the cert timeframe, access is granted.

-Jim