%@ Language=VBScript %>
<%
'*************************************************************************
' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK!
' Function : Generic "Thank You" and "Error with Payment" page.
' Product : CandyPress Store Frontend
' Version : 2.5
' Modified : February 2004
' Copyright: Copyright (C) 2004 CandyPress.Com
' See "license.txt" for this product for details regarding
' licensing, usage, disclaimers, distribution and general
' copyright requirements. If you don't have a copy of this
' file, you may request one at webmaster@candypress.com
'*************************************************************************
'1. No database updates are performed in this script.
'2. This script is called upon return from a payment processor.
'3. This script is very "forgiving" in that it only shows the "Error
' with Payment" message if explicitly told to do so by the payment
' processor. If some of the return values are missing but no error
' was reported by the payment processor, the customer will still
' see a "Thank You" message, but some of the links will not be
' displayed.
'*************************************************************************
Option explicit
Response.Buffer = true
%>
<%
'Work Fields
dim statusInd
dim qIdOrder
dim qTotal
dim payMessage
dim payMessageVar
dim id_pedido
'Database
dim mySQL
dim conntemp
dim rstemp
dim rstemp2
'Session
dim idOrder
dim idCust
'*************************************************************************
'Open Database Connection
call openDb()
'Store Configuration
if loadConfig() = false then
call errorDB(langErrConfig,"")
end if
'Get/Set Cart/Order Session
idOrder = sessionCart()
'Get/Set Customer Session
idCust = sessionCust()
'--> PayPal Payments, Offline Payments, Non 3rd Party Payments
if len(qIdOrder) = 0 then
'Get Order Number (PayPal Only)
qIdOrder = trim(Request.Form("item_number"))
'Get Order Number
if len(qIdOrder) = 0 then
qIdOrder = trim(Request.QueryString("CP_idOrder"))
end if
'Get Status
if len(qIdOrder) > 0 then
statusInd = lCase(trim(Request.QueryString("CP_Status")))
end if
end if
'--> 2Checkout Payments
if len(qIdOrder) = 0 then
'Get Order Number
qIdOrder = trim(Request.Form("cart_order_id"))
'Get Status
if len(qIdOrder) > 0 then
statusInd = trim(Request.Form("credit_card_processed"))
if UCase(statusInd) = "Y" then
statusInd = "success"
else
statusInd = "error"
end if
end if
end if
'--> Authorize.Net Payments
if len(qIdOrder) = 0 then
'Get Order Number
qIdOrder = trim(Request.Form("x_invoice_num"))
'Get Status
if len(qIdOrder) > 0 then
statusInd = trim(Request.Form("x_response_code"))
if UCase(statusInd) = "1" then
statusInd = "success"
else
statusInd = "error"
end if
end if
end if
'--> PAGAMENTO DIGITAL
if len(qIdOrder) = 0 then
'Get Order Number
id_pedido = Trim(Request.Form("id_pedido"))
qIdOrder = Trim(Replace(id_pedido,Left(id_pedido,len(pOrderPrefix) + 1),""))
'Get Status
if len(qIdOrder) > 0 then
statusInd = trim(Request.Form("status"))
if statusInd = "Transação em Andamento" then
statusInd = "success"
end if
if statusInd = "Transação Concluída" then
statusInd = "success"
end if
if statusInd = "Transação Cancelada" then
statusInd = "error"
end if
end if
end if
'--> Custom Payments
%>
<%
'--> Set to zero length string if still incorrect
if len(qIdOrder) = 0 or not(IsNumeric(qIdOrder)) then
qIdOrder = ""
statusInd = ""
end if
'--> Retrieve Order Total
if len(qIdOrder) > 0 and IsNumeric(qIdOrder) then
mySQL = "SELECT total " _
& "FROM cartHead " _
& "WHERE idOrder = " & validSQL(qIdOrder,"I") & " "
set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
qTotal = rsTemp("total")
end if
call closeRS(rsTemp)
end if
%>
<%
'Close Database Connection
call closeDB()
'**********************************************************************
'Main Shopping Cart Display Area
'**********************************************************************
sub cartMain()
%>
|
<% if statusInd = "error" then %>
<%=langGenPayErrorHdr%>
<% else %>
<%=langGenPaySuccessHdr%>
<% end if %>
|
|
<%
'Get appropriate payment message from database
if statusInd = "error" then
payMessageVar = "payErrorMsg"
else
payMessageVar = "paySuccessMsg"
end if
mySQL = "SELECT configValLong " _
& "FROM storeAdmin " _
& "WHERE configVar='" & payMessageVar & "' " _
& "AND adminType='T'"
set rsTemp = openRSexecute(mySQL)
if not rstemp.eof then
payMessage = trim(rsTemp("configValLong"))
end if
call closeRS(rsTemp)
'Check for tags and replace
payMessage = replace(payMessage,"#STORE#",pCompany)
payMessage = replace(payMessage,"#SALES#","" & pEmailSales & "")
'Display Message
Response.Write payMessage
%>
|
|
<%
end sub
%>