Here is the routine.

The emails both before and after get sent fine.. 

The software sends an email to [email protected] so we have a 
record of bookings in case  of a database meltdown.



def paypal_complete_a():
    import datetime
    from paypal import PayPal
    paypal = PayPal()
    resp=paypal.GetExpressCheckoutDetails(request.vars.token)
    mail.send(to=['[email protected]'],
        subject="resp",
        message='A' if not request else 'a '+str(resp)
        )
    
transaction=db(db.transactions.token==request.vars.token).select().first()
    resp=paypal.DoExpressCheckoutPayment(request.vars.token, 
request.vars.PayerID, transaction.amount)
    if not resp['ACK']=='Success':
        redirect(URL('paypal_failure'))
    transaction.status='booked'
    transaction.update_record()


     event=db.events[transaction.event_id]
     get_tickets(event,transaction.quantity)
     scheduler.queue_task('save_sqlite')
     if transaction.quantity == '1':
            tickets=' ticket booked for '
     else:
            tickets=' tickets booked for '
     mail.send(to=['[email protected]'],
                  subject=event.band,
                  message='{0}{1}{2} on {3} bought by {4} 
{5}'.format(transaction.quantity,tickets,event.band,show_date(event.date), 
auth.user.first_name,auth.user.last_name)
                  )
     mail.send(to=[auth.user.email],
                  subject=event.band,
                  message='{0} {1} you have {2}{3}{4} on {5}. Order number 
is {6}'.format(auth.user.first_name, auth.user.last_name, 
transaction.quantity,tickets,event.band,show_date(event.date),transaction.id)
                  ) 
     return


Thanks
Peter

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to