source "lispishUtil.tcl" source "webUtil.tcl" source "txmUtil.tcl" source "txmDB.tcl" source "txmDone.tcl" source "txmSearch.tcl" source "txmShoppingCart.tcl" global response set duplicates [ wbuLoadResponse ] set debug [ wbuDebug ] set internalError 0 set purchaseExpireDays 5 set averageVerificationSeconds 90 # page timeout, how long to wait before refreshing page set timeout 7500 set cookie [ wbuKeyFromCookie TXMORDER $debug ] # purchases can be a blank seperate list which got escaped in the cookie, so set purchases [ unquote_string [ wbuKeyFromCookie TXMPURCHASES $debug ] ] txmLog "txmDone> on entry cookie: $cookie purchases: $purchases" debug $debug if { ( $cookie == "" ) && ( $purchases == "" ) } { # when PayPal returns to this page cookies there are no cookies, but the URL we gave paypal # includes the cookie as the value of PID if { [ array names response PID ] != "" } { set cookie $response(PID) } } if { ( $cookie == "" ) && ( $purchases == "" ) } { # there are no valid purchases, maybe the user knows something that is not in their cookies html " \n" } if { $internalError == 1 } { html " \n" } else { set state [ txmDnSetState $cookie $purchases $debug ] set currentSeconds [ clock seconds ] txmLog "txmDone> currentSeconds: $currentSeconds" debug $debug txmLog "txmDone> cookie: $cookie purchases: $purchases state: $state" debug $debug if { $state == "order" } { if { [ txmDevelopment ] == 1 } { #for debugging only html " \n" txmDnMakeSimButtons $cookie $debug } else { # go back and place the order html " \n" } } if { $state == "active" } { set startSeconds $currentSeconds set dbRet [ wbuDatabaseCommand txm exec "UPDATE purchase SET state=\"verify\",start_verify=\"$currentSeconds\" WHERE purchaseID=\"$cookie\";" ] set dbRet [ wbuDatabaseCommand txm exec "UPDATE purchase SET start_verify=\"$currentSeconds\" WHERE purchaseID=\"$cookie\";" ] } if { $state == "verify" } { set startSeconds [ wbuDatabaseCommand txm query "SELECT start_verify FROM purchase WHERE purchaseID=\"$cookie\";" ] # Show page, wait and then reload page. we are waiting for this purchase's state to # change. The state is changed when verification form is posted to txmPayPal.nhtml } if { ( $state == "active" ) || ( $state == "verify" ) } { html " \n" set elapsedSeconds [ expr $currentSeconds - $startSeconds ] set secondsLeft [ expr $averageVerificationSeconds - $elapsedSeconds ] txmCAMakePurchaseTable $cookie $debug txmDnActiveMessage $secondsLeft $purchaseExpireDays } if { $state == "done" } { if { $cookie != "" } { # make sure the cookie is valid ??? # move purchaseID from TXMORDER cookie to TXMPURCHASES and come through again. TXMPURCHASES is a list of # unexpired purchases. Since there is a TXMORDER cookie we must be downloading a new order. We set # TXMPURCHASES cookie's expiration date to be 5 days from now. set temp [ txmCAPurchasesCookies $cookie $purchases ] set purchases [ lindex $temp 0 ] set expiration [ lindex [ lindex $temp 1 ] 0 ] txmLog "txmDone> done updated purchases: $purchases expiration: $expiration" debug $debug html " \n" } else { # no TXMODER only TXMPURCHASES html "" html "
Thank you for choosing Texturemations
\n" # downloads txmCAPMakeDownloadTable $purchases 0 $debug html "
\n" html " \n" html "
\n" } } if { $state == "deny" } { txmDnHandleDeny $cookie $purchases $debug } if { $state == "badCookie" } { html " \n" } if { [ txmDnBadState $state ] == 0 } { html " \n" } } # delete the users cookie ???? vs. check cookie/purchase status and overwrite if purchase is complete ???? # how do we know purchase is complete ????