cancel
Showing results for 
Search instead for 
Did you mean: 

Processing Transaction, but not Redirecting to Approved Page

Came into a weird situation, where I would be rebuilding a solution, but need to do some unexpected troubleshooting on current system. Not too familiar with VB or ASP and really dont know where to start. Anyways...

 

Transaction processes, but will not show approved transaction message to customer making purchase. Need help. 

 

Thank You so much.

 

Function process_books_pay()




bkid = Request.Form("bkid")
call openConn03("C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\private\data.mdb")
set rs = dbc03.execute("SELECT * FROM BookList WHERE BK_ID = '" & bkid &"'")

if rs.eof then 


else
rs.MoveFirst

     do While not rs.eof
	 bkname = rs("BK_NAME")
	 books_pkgorsin=rs("BK_TYPE")
	 
	 If Request.Form("booktype") = "online_and_hardcopy" then
	 If debugmode="1" then
	 ssl_amount="0.02"
	 
	 Else
     ssl_amount=rs("BK_PRICE_PHYS")
	 
	 End if
	 
	 'Start Unlimited Pricing
	 ElseIf Request.Form("booktype") = "unlimited_online" then
	 If debugmode="1" then
	 ssl_amount="0.03"
	 
	 Else
     ssl_amount=rs("BK_UNLIMITED_PRICE")
	 
	 End if
	 'END Unlimited Pricing
	 
	 'Start Unlimited Pricing
	 ElseIf Request.Form("booktype") = "hardcopy_only" then
	 If debugmode="1" then
	 ssl_amount="0.04"
	 
	 Else
     ssl_amount=rs("BK_PRICE_PHYSONLY")
	 
	 End if
	 'END Unlimited Pricing
	 
	 Else
	 If debugmode="1" then
	 ssl_amount="0.01"
	 
	 Else
     ssl_amount=rs("BK_PRICE")
	 
	 End if
	 
	 end if
	 
	 
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if


call set_buystr(ssl_amount, "CMI Book: " & bkname & "[Type: " & Request.Form("booktype") & "]")
call combine_xml()



if ssl_amount = "" then
Response.write "Training Material does not appear to have a price at this moment, please contact us or try at a later time."

else
'------------------------------------------------------------------------------RUN TRANSACTION
If RunTransAction(xml_charge_str) = "1" then
'Customer Approved and The Account Creation of addition takes place
'Add approved customer to reseller database
If reseller_uid = "" then

else

set rs = dbc03.execute("SELECT * FROM BookList WHERE BK_ID = '" & bkid & "'")

if rs.eof then 


else
rs.MoveFirst

     'do While not rs.eof
	 
	 
	 resellerbookname = rs("BK_NAME")
	 
	 
	 
	 
	 rs.movenext 
     'loop
	 rs.Close

	 
end if





'call closeConn03()
'call openConn03("C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\private\partner.mdb")
resellerpointid = "PD" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber()



dbc99.execute("INSERT INTO partner_data (PD_ID,PD_PID,PD_PRODID,PD_PRONAME,PD_PRODTYPE,PD_CONFIRMED,PD_TIMEAD,PD_TIMECONFIRMED,PD_GROSS,PD_METHOD) VALUES('" & resellerpointid & "','" & reseller_uid & "','" & bkid & "','" & resellerbookname & "','" & Request.Form("booktype") & "','1','" & FormatDateTime(now(), 0) & "','" & FormatDateTime(now(), 0) & "','" & ssl_amount & "','Bank')")

end if
'call closeConn03()

'restore connection to the books database for further operations
'call openConn03("C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\private\data.mdb")

email_subject = "CAD BOOKS CC Transaction: APPROVED"
strmsg = "STATE: APPROVED " & now() & vbcrlf & "TXN_ID: " & txnid & vbcrlf & "Book Type: " & Request.Form("booktype") & vbcrlf & vbcrlf & "BookName: " & bkname & vbcrlf & "BookID: " & bkid & vbcrlf &"Machine Response From CC: " & v_xml(arraybase) & vbcrlf & "--------------------------------------------------------------------------Customer Billing Info: "& vbcrlf & v_xml(xml_charge_str)

Call SendEmailMessage("webmaster@cadmasters.com",adminemail,email_subject,strmsg)
		
		strmsg = ""
		email_subject = ""

cmibookgen_curbooktype = Request.Form("booktype")

If Cstr(cmibookgen_curbooktype) = Cstr("hardcopy_only") then

Response.Redirect("https://www.cadmasters.com/vmengine/secureportal/cadbooks/cc_ok_physonly.asp")
else
'Response.write "test: " & Request.Form("booktype") & " \ " & cmibookgen_curbooktype

cmibookgen_curbooktype =  Cstr(cmibookgen_curbooktype)

cmibookgen(bkid)


end if

Else
'Customer Card Declined
email_subject = "CAD BOOKS CC Transaction: DECLINED"
strmsg = "STATE: DECLINED " & now() & vbcrlf & "Book Type: " & Request.Form("booktype") & vbcrlf & vbcrlf & "BookName: " & bkname & "BookID: " & bkid & "ErrorCode: " & errCode & vbcrlf & "ErrorMsg: " & errMessage & vbcrlf & "ErrorCode2: " & errCode2 & vbcrlf & "ErrorMsg2: " & errMessage2 & vbcrlf & vbcrlf & "Machine Response From CC: " & v_xml(arraybase) & vbcrlf & "--------------------------------------------------------------------------Customer Billing Info: "& vbcrlf & v_xml(xml_charge_str)

Call SendEmailMessage("webmaster@cadmasters.com",adminemail,email_subject,strmsg)
		
		strmsg = ""
		email_subject = ""
		
'Response.write "Transaction Declined"

Response.Redirect("https://www.cadmasters.com/vmengine/secureportal/cadbooks/cc_fail.asp")

End if 

'------------------------------------------------------------------------------END TRANSACTION

end if

End Function


Function cmibookgen(id)
cmibookgenmode = cmibookgen_curbooktype
lastid = "0"

If cmibookgen_curbooktype = "unlimited_online" then
getusernamematch = "SELECT * FROM Users WHERE USR_USERNAME = '" & ssl_email &"' AND USR_MULTILOGIN = '1'"

Else
getusernamematch = "SELECT * FROM Users WHERE USR_USERNAME = '" & ssl_email &"' AND USR_MULTILOGIN = '0'"

End if

set rs = dbc03.execute(getusernamematch)

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 userexists = 1
     USERID = rs("USR_ID")
	 newusrpass = rs("USR_PASSWORD")
	 usr_username = rs("usr_username")
	 multilogin = rs("USR_MULTILOGIN")
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if
'checker for existing email in the database
set rs = dbc03.execute("SELECT * FROM Users WHERE USR_USERNAME = '" & ssl_email &"'")

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 userexists = 1
	 
     
	 rs.movenext 
     loop
	 rs.Close

	 
end if
'end checker for existing email in the database


If cmibookgen_curbooktype = "unlimited_online" then
getusername_email = "SELECT * FROM Users WHERE USR_EMAIL = '" & ssl_email &"' AND USR_MULTILOGIN = '1'"

Else
getusername_email = "SELECT * FROM Users WHERE USR_EMAIL = '" & ssl_email &"' AND USR_MULTILOGIN = '0'"

End if


set rs = dbc03.execute(getusername_email)

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 userexists = 1
     USERID = rs("USR_ID")
	 newusrpass = rs("USR_PASSWORD")
	 usr_username = rs("usr_username")
	 multilogin = rs("USR_MULTILOGIN")
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if
'checker if any email is taken
set rs = dbc03.execute("SELECT * FROM Users WHERE USR_EMAIL = '" & ssl_email &"'")

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 userexists = 1
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if
'end checker

		If userexists = 1 then
		If cmibookgen_curbooktype = "unlimited_online" then
		if multilogin = "1" then
		
		else
		newusrpass = "TPASS" & RandomNumber_Short()
cmibooks_multilogin = "1"
USERID = "USERID" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber()

unlimited_usr = ssl_email & RandomNumber_Short()

makerecord = "INSERT INTO Users (USR_ID,USR_USERNAME,USR_PASSWORD,USR_GROUP,USR_NAME,USR_ENABLED,USR_MULTILOGIN,USR_EMAIL,USR_DATE) VALUES ('" & USERID & "','" & unlimited_usr & "','" & newusrpass & "','USRGRP001','" & ssl_first_name & " " & ssl_last_name & "','1','" & cmibooks_multilogin & "','" & ssl_email & "',#" & date() & "#)"


dbc03.execute(makerecord)
newaccount_created = "1"

end if

else

if multilogin = "0" then
		
		else
		newusrpass = "TPASS" & RandomNumber_Short()
cmibooks_multilogin = "0"
USERID = "USERID" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber()

unlimited_usr = ssl_email & RandomNumber_Short()
newusrpass = "TPASS" & RandomNumber_Short()
makerecord = "INSERT INTO Users (USR_ID,USR_USERNAME,USR_PASSWORD,USR_GROUP,USR_NAME,USR_ENABLED,USR_MULTILOGIN,USR_EMAIL,USR_DATE) VALUES ('" & USERID & "','" & unlimited_usr & "','" & newusrpass & "','USRGRP001','" & ssl_first_name & " " & ssl_last_name & "','1','" & cmibooks_multilogin & "','" & ssl_email & "',#" & date() &"#)"


dbc03.execute(makerecord)

newaccount_created = "1"

end if


end if
		
		else
		USERID = "USERID" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber()

newusrpass = "TPASS" & RandomNumber_Short()
Response.write strConn02
If cmibookgen_curbooktype = "unlimited_online" then
cmibooks_multilogin = "1"

else
cmibooks_multilogin = "0"

end if
makerecord = "INSERT INTO Users (USR_ID,USR_USERNAME,USR_PASSWORD,USR_GROUP,USR_NAME,USR_ENABLED,USR_MULTILOGIN,USR_EMAIL,USR_DATE) VALUES ('" & USERID & "','" & ssl_email & "','" & newusrpass & "','USRGRP001','" & ssl_first_name & " " & ssl_last_name & "','1','" & cmibooks_multilogin & "','" & ssl_email & "',#" & date() & "#)"


dbc03.execute(makerecord)

End If
'lastid = 0
if books_pkgorsin = "pkg" then
'start of Adding Package Assets
test_string = "SELECT * FROM pkg_contents WHERE pkgc_pkgid = '" & id & "' order by pkgc_ordid ASC"
set rs40 = dbc03.execute("SELECT * FROM pkg_contents WHERE pkgc_pkgid = '" & id & "' order by pkgc_ordid ASC")

if rs40.eof then 

else
rs40.MoveFirst

     do While not rs40.eof


set rs = dbc03.execute("SELECT TOP 1 * FROM UserAssets WHERE USRAS_USRID = '" & USERID &"' ORDER BY USRAS_ORDID DESC")

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 lastid = rs("USRAS_ORDID")
     
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if
lastid = lastid + 1 



set rs = dbc03.execute("SELECT * FROM PKG_TITLES WHERE PKG_ID = '" & id & "'")

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 bk_pkg_name = rs("PKG_NAME")
     
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if


makerecord = "INSERT INTO UserAssets (USRAS_ID,USRAS_USRID,USRAS_BKID,USRAS_ORDID,USRAS_PKGID,USRAS_PKNAME,USRAS_DATE) VALUES ('USRAS" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber() & "','" & USERID & "','" & rs40("pkgc_bkid") & "','" & lastid & "','" & rs40("pkgc_pkgid") & "','" & bk_pkg_name & "',#" & date() &"#)"


dbc03.execute(makerecord)

     rs40.movenext 
     loop
	 rs40.Close

	 
end if

'end of Adding Package Assets
else
'Start of Adding Assets


set rs = dbc03.execute("SELECT TOP 1 * FROM UserAssets WHERE USRAS_USRID = '" & USERID &"' ORDER BY USRAS_ORDID DESC")

if rs.eof then 

else
rs.MoveFirst

     do While not rs.eof
	 lastid = rs("USRAS_ORDID")
     
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if
lastid = lastid + 1


USRAS = "USRAS" & Month(now()) & Day(now()) & Right(Year(Date),2) & Hour(now()) & Minute(now()) & Second(now()) & RandomNumber()

'check if asset for this use already exists, if exist do not add, if EOF add it
set rs = dbc03.execute("SELECT * FROM UserAssets WHERE USRAS_USRID = '" & USERID &"' AND USRAS_BKID = '" & id & "' ORDER BY USRAS_ORDID ASC")

if rs.eof then 

makerecord = "INSERT INTO UserAssets (USRAS_ID,USRAS_USRID,USRAS_BKID,USRAS_ORDID,USRAS_DATE) VALUES ('" & USRAS & "','" & USERID & "','" & id & "','" & lastid & "',#" & date() & "#)"


dbc03.execute(makerecord)

else
rs.MoveFirst

     do While not rs.eof
	 
     
	 
	 rs.movenext 
     loop
	 rs.Close

	 
end if

'End of Adding Single Assets

end if


If userexists = 1 then

If cmibookgen_curbooktype = "unlimited_online" then
email_subject = "Thank you for your purchase!"
strmsg = "Welcome to Online CAD Training! " & vbcrlf & vbcrlf & "Your account awaits you. You can log into your account at http://online.cadmasters.com/ " & vbcrlf & vbcrlf & "Please note that the charges for your purchase will appear under CAD Masters." & vbcrlf & vbcrlf & "Your Login Credentials are: " & vbcrlf & vbcrlf & "Username: " 
if Cstr(newaccount_created) = "1" then 
strmsg = strmsg & unlimited_usr & vbcrlf & "Password: " & newusrpass

else
strmsg = strmsg & usr_username & vbcrlf & "Password: " & newusrpass

end if


else
email_subject = "Thank you for your purchase!"
strmsg = "Thank you for buying an additional training material." & vbcrlf & vbcrlf & "Please note that the charges for your purchase will appear under CAD Masters." & vbcrlf & vbcrlf & " The training material has been added to your account. You can log into your account at http://online.cadmasters.com/" & vbcrlf & vbcrlf & "Your Login Credentials are: " & vbcrlf & vbcrlf & "Username: " 
if Cstr(newaccount_created) = "1" then 
strmsg = strmsg & unlimited_usr & vbcrlf & "Password: " & newusrpass

else
strmsg = strmsg & usr_username & vbcrlf & "Password: " & newusrpass

end if

end if



Else
if newaccount_created = "1" then
email_subject = "Thank you for your purchase!"
strmsg = "Welcome to Online CAD Training! " & vbcrlf & vbcrlf & "Your account awaits you. You can log into your account at http://online.cadmasters.com/ " & vbcrlf & vbcrlf & "Please note that the charges for your purchase will appear under CAD Masters." & vbcrlf & vbcrlf & "Your Login Credentials are: " & vbcrlf & vbcrlf & "Username: " & unlimited_usr & vbcrlf & "Password: " & newusrpass

else
email_subject = "Welcome to Online CAD Training!"
strmsg = "Welcome to Online CAD Training! " & vbcrlf & vbcrlf & "Your account awaits you. You can log into your account at http://online.cadmasters.com/ " & vbcrlf & vbcrlf & "Please note that the charges for your purchase will appear under CAD Masters." & vbcrlf & vbcrlf & "Your Login Credentials are: " & vbcrlf & vbcrlf & "Username: "

if usr_username = "" then 
strmsg = strmsg & ssl_email & vbcrlf & "Password: " & newusrpass
else
strmsg = strmsg & usr_username & vbcrlf & "Password: " & newusrpass

end if


end if

End if

Call SendEmailMessage("webmaster@cadmasters.com",ssl_email,email_subject,strmsg)






'Response.write "test:" & cmibookgen_curbooktype
'if debugmode = 1 then
'Response.write test_string
'else
Response.Redirect("https://www.cadmasters.com/vmengine/secureportal/cadbooks/cc_ok.asp")
'end if 



End Function
acgreen33
Member
3 REPLIES 3

It this DPM or SIM? the relay response only wait 10 seconds, if your asp or VB took longer, it will timeout.

 

https://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Relay-Response-Basics-...

RaynorC1emen7
Expert

It throws a 500 Internal Server Error when you click place order, but redirects properly when card is declined

Doesn't sound like an issue with authorize.net

 

You might be able to debug your code by posting data to your page. Read the SIM guide

http://www.authorize.net/content/dam/authorize/documents/SIM_guide.pdf

starting on page 67 Fields in the Payment GatewayResponse