I am integrating a payment system from
www.directone.com.au onto a clients site. This is the first payment system that I have done and for some things I have NO IDEA what they mean.
Their documentation says I must "invoke a SSL socket on port 443 and then send a standard POST or GET request to that socket. I have no idea what this means.
I've set up a dummy page to test my coding which you can find at
http://www.numbers1.com/DirectOneProcess.aspx . My code for the button click is listed below. The return value is displayed on the page and from their documentation means that its a server error - meaning I have in some way supplied the wrong information. There's a few things I am keen to find out:
A: If I don't yet have an SSL certificate installed on the server - will that make a difference??
B: How do I invoke a SSL socket??
C: Am I even close with the code I've created?? and will I have to break down the returned string to get the values out or can I use some other peice of code - ie: string sCode = request.form["summary_code
"];
CODE BEHIND:
protected void btnProcess_Click(object sender, EventArgs e)
{
ProcessRequest();
}
public void ProcessRequest()
{
DirectOneDB direct1 = new DirectOneDB();
string TestingURL = direct1.TestingUrl; //Gets the testingURL from the DirectOneDB class.
string LiveURL = direct1.LiveURL; //Gets the LiveURL from the DirectOneDB class.
//Get page results
string cNumber = txtNumber.Text;
string cName = txtName.Text;
string cExpiry = txtEMth.Text + txtEYr.Text;
string cCCV = txtCCV.Text;
string cAmount = lblAmount.Text;
string cReference = lblRef.Text;
//Add the string components - the url will be added later.
string urlValues = "?vendor_name=*******&vend
or_passwor
d=*****&ca
rd_type=AU
TO&" +
"card_number=" + cNumber + "&card_holder=" + cName + "&card_expiry=" + cExpiry + "&card_ccv=" +
cCCV + "&payment_amount=" + cAmount + "&payment_reference=" + cReference;
//Create the Web Request
HttpWebRequest newRequest = (HttpWebRequest)
WebRequest.Create(TestingU
RL);
//Set the values for the web request
newRequest.Method = "POST";
newRequest.ContentType = "application/x-www-form-ur
lencoded";
newRequest.ContentLength = urlValues.Length;
//Write the Request String
StreamWriter streamOut = new StreamWriter(newRequest.Ge
tRequestSt
ream(), System.Text.Encoding.ASCII
);
streamOut.Write(urlValues)
;
streamOut.Close();
//Send the request and get the response
string directOneResponse;
StreamReader streamIn = new StreamReader(newRequest.Ge
tResponse(
).GetRespo
nseStream(
));
directOneResponse = streamIn.ReadToEnd();
streamIn.Close();
//Show the value returned on the page;
lblStreamResponse.Text = directOneResponse;
}
Thanks in advance for any and all help. Hope this doesn't sound too confusing but I wanted to get as far as I can myself.
Start Free Trial