How to integrate razor payment to the asp classic? - asp-classic

I have to integrate the razor payment to the asp classic and for this i have write the code for that is
razamt=razamt*100
dim options
set options = server.createObject("Scripting.Dictionary")
options.add "amount", razamt
options.add "receipt", "order_rcptid_11"
options.add "currency", "INR"
options.add "payment_capture", "0"
**Order order = client.Order.Create(options)**
getting issue in star marked line client is not available and i have no idea how to solve this
Please help me to fix this issue.

You should be able to do it using MSXML.ServerXMLHTTP, example
DataToSend = "amount=1&receipt=order_rcptid_11&currency=INR&payment_capture=0"
set xmlhttp = server.Createobject("MSXML6.ServerXMLHTTP")
xmlhttp.Open "POST","https://api.razorpay.com/v1/orders",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Response.ContentType = "text/xml"
Response.Write xmlhttp.responsexml.xml
Set xmlhttp = nothing

Related

read all elements from another page using classic ASP

Is there a way to read a another page's elements and grab the whole HTML code?
let's say for example i want to get all the HTML from this page : http://localhost/test3.html
Thank you!
Here's a function I use:
function http_post (strUrl, data)
' call another URL (e.g. ASP or PHP script) via HTTP and POST. "data" should be GET-style parameter string or empty '
dim xmlHttp
Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
With xmlHttp
.Open "POST", strUrl, False
.setRequestHeader "User-Agent", Request.ServerVariables("HTTP_USER_AGENT")
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Content-Length", Len(data)
.Send data
if .Status < 400 then
http_post = .responseText
else
' do error logging here if you want '
http_post = false
end if
.abort()
End With
set xmlHttp = Nothing
end function

Finding VBS xpath for API call

I have been trying to find and print out the time spent on a project and print it out on a web page. No matter what I try, it refuses to cooperate with me. I've marked where I am having problems like problem code. My problem code is:
'****Get hours spent on project
postUrl = "https://api.dovico.com/TimeEntries/Employee/{sEmployeeID}/?version=4"
Set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlHTTP.open "GET", postUrl, false
xmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlHttp.setRequestHeader "Authorization", "WRAP
access_token=""client = 52ced897fb6b404f87cfe70e84bed1b4.15731&user_token = 6d0a58751f5f4d619cce65c5cc52b420.15731"""
xmlHTTP.send
set mytime = xmlHTTP.responseXML
*hours = mytime.selectsingleNode("//TimeEntries/Employees/Employee:{274}").item(0)*
Response.write "Number of hours spend on project is: " & hours
Can anyone please help. This is kind of my hail marry pass here.

Convert server.createobject from classic ASP to ASP.NET

Hi i have a function that was created in ASP classic and want to convert the function in ASP.NET Vb . Below is code that was using in Classic ASP
Function chargeIt(CARD_NUM, EX_MONTH, EX_YEAR, AMOUNT, COMMENT)
url = "https://secure.authorize.net/gateway/transact.dll"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.send "x_description=""Violation Payment For "&COMMENT&"""&x_Version=3.1&x_Delim_Data=True&x_Login=xnxx&x_Tran_Key= 9&x_Amount="&amount&"&x_Card_Num="&card_num&"&x_Exp_Date="&ex_month&ex_year&"&x_Type=AUTH_CAPTURE"
Dim arrContents(150,0)
contents=split(xmlhttp.responseText,",")
'response.write(xmlhttp.responseText)
i=0
for each value in contents
arrContents(i,0)=value
i=i+1
next
SELECT CASE arrContents(0,0)
CASE "1"
status="Approved"
END SELECT
chargeIt=status
end function
You may use the System.Net.WebRequest class instead. It is part of the .NET Framework.
For example:
Dim strURL
Dim objXML As WebRequest
Dim strResponse As WebResponse
objXML = WebRequest.Create(strURL)
strResponse = objXML.GetResponse()
objXML = Nothing
strResponse.Close()
Google on WebRequest VB.NET and you should be able to get going...

sendgrid in classic asp add email category

I'm sending mail using sendgrid web API successfully but unable add categories into x-smtpapi.
Here is my code :
function getHTML (strUrl,postData)
Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP")
xmlHttp.Open "POST", strUrl, False
xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
xmlHttp.setRequestHeader "content-type", "application/x-www-form-urlencoded"
'xmlHttp.AddHeader "category", "web"
xmlHttp.Send postData
getHTML = xmlHttp.responseText
xmlHttp.abort()
set xmlHttp = Nothing
end function
Response.Write("test->" & getHTML("https://sendgrid.com/api/mail.send.json","api_user=myusername&api_key=mykey&to=soneone#somemail.com&subject=test-1 msg&html=this is test message&from=info#zyxxxz.com&category={testweb}"))
Response.End()
I've checked some doc here
But I could not find any way to add categories.
EDIT
Response.Write("test->" & getHTML("https://sendgrid.com/api/mail.send.json","api_user=user&api_key=key&to=somemail#somemail.com&subject=test-1 msg&html=this is test message&from=info#xyzzz.com&x-smtpapi={"category":"testCategory"}"))
I need to post it JSON. If I do not put double quote x-smtpapi={"category":"testCategory"}" JSON parser can't parse it!
A double double quote escapes in ASP:
Ex.
#Invalid
str = " She said "Hello World" to the whole group"
#valid
str = " She said ""Hello World"" to the whole group"
So this should work fine:
Response.Write("test->" & getHTML("https://sendgrid.com/api/mail.send.json","api_user=user&api_key=key&to=somemail#somemail.com&subject=test-1 msg&html=this is test message&from=info#xyzzz.com&x-smtpapi={""category"":""testCategory""}"))

classic asp xml receiver page doesn't receive the xml (or so it seems)

I am working on Classic ASP and was going through a possible solution of posting and reading an xml.
I read Tim's reply (which is pasted below) but this doesn't work for me. It seems xmlDoc.load(Request) doesn't load anything. What could be wrong here? I would very much appreciate a prompt response.
This is the posting page:
url = "www.receivingwebsite.com\asp\receivingwebpage.asp"
information = "<Send><UserName>Colt</UserName><PassWord>Taylor</PassWord><Data>100</Data></Send>"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.send information
This is the receiving page:
Dim xmlDoc
Dim userName
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(Request)
userName = xmlDoc.documentElement.selectSingleNode("UserName").firstChild.nodeValue
Try this :
Dim objXmlRequest
Set objXmlRequest = Server.CreateObject("MSXML2.DOMDOCUMENT.3.0")
objXmlRequest.async = False
objXmlRequest.setProperty "ServerHTTPRequest", True
objXmlRequest.validateOnParse = True
objXmlRequest.preserveWhiteSpace = False
IF objXmlRequest.Load (Request) THEN
''' GET THE REQUEST FROM CLIENT
strQuery = "//" & "ActionName"
Set oNode = objXmlRequest.selectSingleNode(strQuery)
strActionName = oNode.Text
END IF
' The key is in the property set ... check ".setProperty "ServerHTTPRequest", True"
Bye, Martin.

Resources