Caché Web Applications Tutorial
Calling CompleteOrder

Now that we have modified the CompleteOrder method, we have one more change to make. Currently, it is called from within the OnPage method of the TicketConfirm page.

Unfortunately, this will not work. To understand why, let's spend a moment examining how a page request gets processed.
ClassMethod OnPage() As %Status
    Write "<HTML>",$C(13,10)
    Write "<HEAD>",$C(13,10)
    Write "</HEAD>",$C(13,10)
    Write "<BODY>",$C(13,10)
    If (%session.IsDefined("OrderID")) {
        Do ..CompleteOrder(%session.Data("OrderID"))
        Write "Thank you for using Caché Cinema!<br>",$C(13,10)
        If ($G(%request.Data("OrderEmail",1)) '=""){
            Do ..SendEmail( 
                    "Your tickets have been ordered"
    Else {
        Write "Your order expired before it was completed."
    Write "</BODY>",$C(13,10)
    Write "</HTML>",$C(13,10),!
    Quit $$$OK