ianhaney wrote: create a booking system and pay via PayPal
Hi, I saw some documentation for cms:calendar and now think that this can be done
for example via following routine (with a LOT of work).
Resume: you gonna have problems anyway, as Couch can't send to paypal information that product is not available anymore ('booked'). I'm not sure if Paypal even accepts this kind of messages for on-going payments. So a user can pay anyway if he wishes so, even if someone 'occupied' that day 5 minutes ago. If you can solve this problem, then read on below:
Have a template with cloned pages, each page represents a 'booked' day. If several days in a row are 'booked' then it must be a separate cloned page for each of them. Empty 'available' days do not need a cloned page.
There is a tag 'cms:entries', which is a stripped down version of cms:pages, which will list through all pages for a certain date. If there are no pages for a certain date, then you can mark this day in calendar as 'available'.
If user clicks on a link in that day, you can present the user a form to fill and with data-bound-form create a new page with that date, user-inputted values and fixed chosen date. If user selects several days in a row then multiple pages must be created (try this first, as there might be some problems with creating several pages).
Now, with paypal it's gonna have this amendment. As we know, paypal payment can be delayed and processed ater or abandoned by user. So, when the page for a date is created it must have some status 'on-hold' or something, which will make it unavailable for booking for some time (amount of time you allow for reservation before purchase). Concurrent requests must be prevented so 2 users can't pay for the same date.
Some cron job must check if a page has NOT been 'purchased - paid for' within a reasonable time and 'release' the day, by deleting that page. But if user pays for it anyway - you gonna have problems as described in
resume above.