|
<%
'IF request("submit1")<>"" THEN
'if session("GWOrderDone")="YES" then
' tempURL=replace((scStoreURL&"/"&scPcFolder&"/pc/default.asp"),"//","/")
' tempURL=replace(tempURL,"https:/","https://")
' tempURL=replace(tempURL,"http:/","http://")
' session("GWOrderDone")=""
' response.redirect tempURL
'end if
%>
<% session("redirectPage")="gwAuthorizeAIM.asp" %>
<%
Dim pcCustIpAddress
pcCustIpAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If pcCustIpAddress="" Then pcCustIpAddress = Request.ServerVariables("REMOTE_ADDR")
'dim tempURL
'If scSSL="" OR scSSL="0" Then
' tempURL=replace((scStoreURL&"/"&scPcFolder&"/pc/gwSubmit.asp"),"//","/")
' tempURL=replace(tempURL,"https:/","https://")
' tempURL=replace(tempURL,"http:/","http://")
'Else
' tempURL=replace((scSslURL&"/"&scPcFolder&"/pc/gwSubmit.asp"),"//","/")
' tempURL=replace(tempURL,"https:/","https://")
' tempURL=replace(tempURL,"http:/","http://")
'End If
' Get Order ID
'if session("GWOrderId")="" then
' session("GWOrderId")=request("idOrder")
'end if
'pcGatewayDataIdOrder=session("GWOrderID")
%>
<%
'session("idCustomer")=pcIdCustomer
If Request.Form("Minimum")<>"" Then %>
<%
'// Test Mode
x_testmode="2"
'// Deed
strLegalName = Request("LegalName")
strSpouse = Request("Spouse")
strCompany = Request("Company")
strMarital = Request("Marital")
strVesting = Request("Vesting")
strPhone = Request("Phone")
strCellPhone = Request("CellPhone")
strFax = Request("Fax")
Email = Request("Email")
strAddress = Request("Address")
strComment = Request("Comment")
PropertyRef = Request("Refid")
'// Billing
FirstName = Request("FirstName")
LastName = Request("LastName")
tx_Card_Type = Request("x_Card_Type")
CardNumber = Request("CardNumber")
expMonth = Request("expMonth")
expYear = Request("expYear")
CVV = Request("CVV")
BillingAddress = Request("BillingAddress")
BillingAddress2 = Request("BillingAddress2")
BillingCity = Request("BillingCity")
BillingZip = Request("BillingZip")
BillingState = Request("BillingState")
strComments = Request("Comments")
Base = CCur(Request("Minimum"))
Minimum = CCur(Request("Minimum"))
Comp = Request("Comp")
Principle = Request("Principle")
If Comp="" Then Comp = 0
If Principle="" Then Principle = 0
Comp = CCur(Comp)
Principle = CCur(Principle)
if Principle>0 then
Minimum = Minimum + Principle
if Principle=Comp Then
pCash="True"
end if
end if
'// Deed
'Response.Write(strLegalName & " ") '// = Request("LegalName")
'Response.Write(strSpouse & " ") '// = Request("Spouse")
'Response.Write(strCompany & " ") '// = Request("Company")
'Response.Write(strMarital & " ") '// = Request("Marital")
'Response.Write(strVesting & " ") '// = Request("Vesting")
'Response.Write(strPhone & " ") '// = Request("Phone")
'Response.Write(strCellPhone & " ") '// = Request("CellPhone")
'Response.Write(strFax & " ") '// = Request("Fax")
'Response.Write(Email & " ") '// = Request("Email")
'Response.Write(strAddress & " ") '// = Request("Address")
'Response.Write(strComment & " ") '// = Request("Comment")
'Response.Write(PropertyRef & " ") '// = Request("Refid")
'// Billing
'Response.Write(FirstName & " ") '// = Request("FirstName")
'Response.Write(LastName & " ") '// = Request("LastName")
'Response.Write(tx_Card_Type & " ") '// = Request("tx_Card_Type")
'Response.Write(CardNumber & " ") '// = Request("CardNumber")
'Response.Write(expMonth & " ") '// = Request("expMonth")
'Response.Write(expYear & " ") '// = Request("expYear")
'Response.Write(CVV & " ") '// = Request("CVV")
'Response.Write(BillingAddress & " ") '// = Request("BillingAddress")
'Response.Write(BillingAddress2 & " ") '// = Request("BillingAddress2")
'Response.Write(BillingCity & " ") '// = Request("BillingCity")
'Response.Write(BillingZip & " ") '// = Request("BillingZip")
'Response.Write(BillingState & " ") '// = Request("BillingState")
'Response.Write(strComments & " ") '// = Request("Comments")
'Response.Write(Minimum & " ") '// = Request("Minimum")
call opendb()
pcSessionDate=Date()
pcSessionDate=Month(pcSessionDate)&"/"&Day(pcSessionDate)&"/"&Year(pcSessionDate)
'// Insert the Setup Date and Flag
query="INSERT INTO [Orders] ([Timestamp]) VALUES (#"&pcSessionDate&"#);"
set rs=server.CreateObject("ADODB.RecordSet")
'response.Write(query)
'response.End()
set rs=conntemp.execute(query)
set rs=nothing
query="SELECT Order_ID FROM Orders Order By Order_ID DESC;"
set rs=server.CreateObject("ADODB.RecordSet")
set rs=conntemp.execute(query)
if NOT rs.EOF then
pOrderID=rs("Order_ID")
end If
set rs=nothing
query="UPDATE Orders SET "
query=query&"LegalName='"&strLegalName&"', "
query=query&"Company='"&strCompany&"', "
query=query&"SpouseName='"&strSpouse&"', "
query=query&"MaritalStatus='"&strMarital&"', "
query=query&"DeedVesting='"&strVesting&"', "
query=query&"DeedComments='"&strComment&"', "
query=query&"DaytimePhone='"&strPhone&"', "
query=query&"CellPhone='"&strCellPhone&"', "
query=query&"Fax='"&strFax&"', "
query=query&"Email='"&Email&"', "
query=query&"FullPhysical='"&strAddress&"', "
query=query&"FirstName='"&FirstName&"', "
query=query&"LastName='"&LastName&"', "
query=query&"Address='"&BillingAddress&"', "
query=query&"Address2='"&BillingAddress2&"', "
query=query&"City='"&BillingCity&"', "
query=query&"State='"&BillingState&"', "
query=query&"Zip='"&BillingZip&"', "
query=query&"Comments='"&strComments&"', "
query=query&"Total="&Minimum&", "
query=query&"Base="&Base&", "
query=query&"Additional="&Principle&", "
query=query&"PropertyRef='"&PropertyRef&"', "
query=query&"TransactionID='0' "
query=query&"WHERE Order_ID="&pOrderID&";"
set rs=server.CreateObject("ADODB.RecordSet")
set rs=conntemp.execute(query)
set rs=nothing
call closeDb()
'//////////////////////////////////////////////////////////////////////////////////
'// START: Set Authorize.NET Variables
'//////////////////////////////////////////////////////////////////////////////////
'// Order
pcBillingTotal=Minimum
session("reqCardNumber")=CardNumber
session("reqExpMonth")=expMonth
session("reqExpYear")=expYear
session("reqCVV")=CVV
session("GWOrderID")=pOrderID
pcCustIpAddress=pcCustIpAddress
if Email<>"" then
session("idCustomer")=Email
else
session("idCustomer")=pOrderID
end if
'// Billing
pcBillingFirstName=FirstName
pcBillingLastName=LastName
pcBillingCompany=replace(strCompany,",","||")
pcBillingAddress=replace(BillingAddress,",","||")
pcBillingCity=BillingCity
pcBillingState=BillingState
pcBillingPostalCode=BillingZip
pcBillingCountryCode="US"
pcBillingPhone=strPhone
pcCustomerEmail=Email
'//////////////////////////////////////////////////////////////////////////////////
'// END: Set Authorize.NET Variables
'//////////////////////////////////////////////////////////////////////////////////
call opendb()
x_Type="AUTH_CAPTURE||V, M, A, D"
x_Login="359waCP5"
x_Password="3f9SK6De882jAW53"
x_CVV="1"
x_Curcode="USD"
x_AIMType="KEY"
x_secureSource="0"
x_TypeArray=Split(x_Type,"||")
x_TransType=x_TypeArray(0)
set rs=nothing
Dim objXMLHTTP, xml
'// Send the request to the Authorize.NET processor.
stext="x_Version=3.1"
stext=stext & "&x_Delim_Data=True"
stext=stext & "&x_Delim_char=,"
If x_testmode="1" Then
stext=stext & "&x_Test_Request=True"
Else
stext=stext & "&x_Test_Request=False"
End If
stext=stext & "&x_relay_response=FALSE"
stext=stext & "&x_Login=" & x_Login
stext=stext & "&x_Tran_Key=" & x_Password
stext=stext & "&x_method=CC"
stext=stext & "&x_Amount=" & pcBillingTotal
if x_testmode="1" then
stext=stext & "&x_Card_Num=4111111111111111"
stext=stext & "&x_Exp_Date=1209"
else
stext=stext & "&x_Card_Num=" & session("reqCardNumber")
stext=stext & "&x_Exp_Date=" & session("reqExpMonth")&session("reqExpYear")
end if
If x_CVV="1" Then
stext=stext & "&x_Card_Code=" & session("reqCVV")
End If
stext=stext & "&x_customer_ip=" & pcCustIpAddress
stext=stext & "&x_Type=" & x_TransType
stext=stext & "&x_Currency_Code=" & x_Curcode
stext=stext & "&x_Description=" & replace(scCompanyName,",","-") & " Property Ref: " & PropertyRef
stext=stext & "&x_Invoice_Num=" & session("GWOrderID")
stext=stext & "&x_Cust_ID=" & session("idCustomer")
stext=stext & "&x_first_name=" & pcBillingFirstName
stext=stext & "&x_last_name=" & pcBillingLastName
stext=stext & "&x_company=" & replace(pcBillingCompany,",","||")
stext=stext & "&x_address=" & replace(pcBillingAddress,",","||")
stext=stext & "&x_city=" & pcBillingCity
stext=stext & "&x_state=" & pcBillingState
stext=stext & "&x_zip=" & pcBillingPostalCode
stext=stext & "&x_country=" & pcBillingCountryCode
stext=stext & "&x_phone=" & pcBillingPhone
stext=stext & "&x_email=" & pcCustomerEmail
'stext=stext & "&x_Ship_To_First_Name=" & pcShippingFirstName '?
'stext=stext & "&x_Ship_To_Last_Name=" & pcShippingLastName '?
'stext=stext & "&x_ship_to_company=" & pcShippingCompany '?
'stext=stext & "&x_Ship_To_Address=" & replace(pcShippingAddress,",","||")
'stext=stext & "&x_Ship_To_City=" & pcShippingCity
'stext=stext & "&x_Ship_To_State=" & pcShippingState
'stext=stext & "&x_Ship_To_Zip=" & pcShippingPostalCode
'stext=stext & "&x_Ship_To_Country=" & pcShippingCountryCode
'response.Write(replace(stext,"&"," "))
'response.End()
'// Send the transaction info as part of the querystring
set xml = Server.CreateObject("Msxml2.serverXmlHttp"&scXML)
xml.open "POST", "https://secure.authorize.net/gateway/transact.dll?"& stext & "", false
xml.send ""
strStatus = xml.Status
'// Store the response
strRetVal = xml.responseText
Set xml = Nothing
strArrayVal = split(strRetVal, ",", -1)
session("x_response_code") = strArrayVal(0)
session("x_response_subcode") = strArrayVal(1)
session("x_response_reason_code") = strArrayVal(2)
session("x_response_reason_text") = strArrayVal(3)
session("GWAuthCode") = strArrayVal(4) '6 digit approval code
session("x_avs_code") = strArrayVal(5)
session("GWTransId") = strArrayVal(6) 'transaction id
session("x_invoice_num") = strArrayVal(7)
session("x_description") = strArrayVal(8)
session("x_amount") = strArrayVal(9)
session("x_method") = strArrayVal(10)
session("x_type") = strArrayVal(11)
session("x_cust_id") = strArrayVal(12)
session("x_first_name") = strArrayVal(13)
session("x_last_name") = strArrayVal(14)
session("x_company") = strArrayVal(15)
session("x_address") = replace(strArrayVal(16),"||",",")
session("x_city") = strArrayVal(17)
session("x_state") = strArrayVal(18)
session("x_zip") = strArrayVal(19)
session("x_country") = strArrayVal(20)
session("x_phone") = strArrayVal(21)
session("x_fax") = strArrayVal(22)
session("x_email") = strArrayVal(23)
session("x_ship_to_first_name") = strArrayVal(24)
session("x_ship_to_last_name") = strArrayVal(25)
session("x_ship_to_company") = strArrayVal(26)
session("x_ship_to_address ") = replace(strArrayVal(27),"||",",")
session("x_ship_to_city") = strArrayVal(28)
session("x_ship_to_state") = strArrayVal(29)
session("x_ship_to_zip") = strArrayVal(30)
session("x_ship_to_country") = strArrayVal(31)
'// Check the ErrorCode to make sure that the component was able to talk to the authorization network
If (strStatus <> 200) Then
msg="An error occured during processing. Please try again later."
Else
'// Save and update order
If session("x_response_code") = 1 Then
'// Clear all card sessions before redirect
session("reqCardNumber")=""
session("reqExpMonth")=""
session("reqExpYear")=""
session("reqCVV")=""
session("x_response_code")=""
session("x_response_subcode")=""
session("x_response_reason_code")=""
session("x_response_reason_text")=""
session("x_avs_code")=""
session("x_description")=""
session("x_amount")=""
session("x_method")=""
session("x_type")=""
session("x_cust_id")=""
session("x_first_name")=""
session("x_last_name")=""
session("x_company")=""
session("x_address")=""
session("x_city")=""
session("x_state")=""
session("x_zip")=""
session("x_country")=""
session("x_phone")=""
session("x_fax")=""
session("x_email")=""
session("x_ship_to_first_name")=""
session("x_ship_to_last_name")=""
session("x_ship_to_company")=""
session("x_ship_to_address")=""
session("x_ship_to_city")=""
session("x_ship_to_state")=""
session("x_ship_to_zip")=""
session("x_ship_to_country")=""
call opendb()
query="UPDATE Orders SET "
query=query&"TransactionID='"&session("GWTransId")&"' "
query=query&"WHERE Order_ID="&session("GWOrderID")&";"
set rs=server.CreateObject("ADODB.RecordSet")
set rs=conntemp.execute(query)
set rs=nothing
call closeDb()
'// Redirect to Confirmation
session("GWOrderID")=""
session("idCustomer")=""
if (pCash="True") OR PropertyRef<>"" then
Response.redirect "ThankYou.asp?msg=cash"
else
Response.redirect "ThankYou.asp?msg=finance"
end if
ElseIf session("x_response_code")<>1 Then
msg="There was an error. " & session("x_response_reason_text")
End If
End If '// If (strStatus <> 200) Then
Else
x_Type="AUTH_ONLY||V, M, A, D"
x_CVV="1"
M="0"
V="0"
A="0"
D="0"
END IF
%>
<%
call opendb()
call closedb()
%>
|