hello all,
i am writting a web application that takes payment parameters such as [LIST=1]
[]confirmation order numner
[]terminalid
[*]response url
[/LIST]
now there is this page that accepts the confirmation order number and passes it to a page that has its form action set to post to this url
http://demo.etranzact.com:8080/WebConnect/queryPayoutletTransaction.jsp
which in turn returns values to my response page with values that are not querystrings but HTTP Post values from remote page. in this format below:
RECEIPT_NO=5001009213375&PAYMENT_CODE=500850411285062294724&MERCHANT_CODE=5000010491&TRANS_AMOUNT=15050.0&TRANS_DATE=2010/09/21 10:45:00&TRANS_DESCR=100%20LEVEL%20JAMB%201234-TEST%20TEST&CUSTOMER_ID=1234&BANK_CODE=500&BRANCH_CODE=001&SERVICE_ID=1234&CUSTOMER_NAME=TEST%20TEST&CUSTOMER_ADDRESS=TEST&TELLER_ID=etzbankteller&USERNAME=N/A&PASSWORD=N/A&BANK_NAME=eTranzact%20Test%20Bank&BRANCH_NAME=ETZ%20BANK%20HEAD%20OFFICE&CHANNEL_NAME=Bank&PAYMENT_METHOD_NAME=Cash&PAYMENT_CURRENCY=566&TRANS_TYPE=0Y0007&TRANS_FEE=0.0&TYPE_NAME=100%20LEVEL%20JAMB&LEAD_BANK_CODE=500&LEAD_BANK_NAME=eTranzact%20Test%20Bank
the question now is how do i get each of the parameter values like RECEIPT_NO, MERCHANT_CODE,…etc. i have tried using Request.Form[“MERCHANT_CODE”], but to no avail, tried using Request.QueryString[""MERCHANT_CODE], still does not work. pls is there a special way of reading HTTP Post values in asp.net? to retrieve the parameters so i can continue regards,
pls find the .aspx page that posts to the server
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PinVerification.aspx.cs" Inherits="modules_fees_PinVerification" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>..:: School Manager</title>
<link rel="shortcut icon" href="~/images/favicon.ico"/>
<link href="../../css/tenece_style.css" rel="stylesheet" type="text/css"/>
<!-- STYLE AND SCRIPT -->
<script language="Javascript" src="../../javascript/utility.js" type="text/JavaScript"></script>
<!-- Keyboard Integration for password and other key fields -->
<script type="text/javascript" src="../../keyboard/keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="../../keyboard/keyboard.css"/>
<!-- *********************** TABB SETTINGS SCRIPTS ************************************** -->
<link rel="stylesheet" type="text/css" href="../../css/tabcontent.css" />
<script type="text/javascript" src="../../javascript/tabcontent.js">
/***********************************************
* Tab Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<!-- *********** FAVICON for the application ******************** -->
<link rel="shortcut icon" href="../../images/favicon.ico"/>
</head>
<body>
<form method="post" action="http://demo.etranzact.com:8080/WebConnect/queryPayoutletTransaction.jsp">
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 1180px">
</td>
</tr>
<tr>
<td align="center" style="width: 1180px">
<table width="586" border="1" cellpadding="2" cellspacing="1">
<tr>
<td colspan="2" align="center" bgcolor="#CCCCCC">
<span class="style7">Federal Polytechnic Oko</span></td>
</tr>
<tr>
<td colspan="2" align="center"><span class="style7">Online Payment Confirmation </span></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC">
<strong><em>PLEASE NOTE YOUR CONFIRMATION ORDER NUMBER</em></strong> </td>
</tr>
<tr>
<td colspan="2" align="center"><img src="../../images/etran.jpg" alt="" style="width: 241px; height: 50px"/></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#CCCCCC"><span class="style9">PAYMENT MODE:INTERSWITCH</span></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="244" align="left"><span class="style7"><strong>Date of Payment: </strong></span></td>
<td width="325" align="left"><span class="style7"><%=strDate %>
</span></td>
</tr>
<tr>
<td align="left"><span class="style7"><strong>Confirmation Order Number</strong></span></td>
<td align="left"><span class="style9"><%=PCode%></span></td>
</tr>
<tr>
<td align="left"><span class="style7"><strong>Payment Status: </strong></span></td>
<td align="left"><span class="style7">PENDING</span></td>
</tr>
<tr>
<td align="left">
</td>
<td align="left">
</td>
</tr>
<tr>
<td colspan="2" align="center" style="font-weight: normal; font-size: 10pt; color: red; font-family: Verdana">
Please confirm your payment information below before submission. </td>
</tr>
<tr>
<td colspan="2" align="center">
<input id="Submit2" type="button" value="<< Go Back" onclick="javascript:history.back(-1);" />
<input id="Submit1" type="submit" value="Proceed >>" /></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#CCCCCC"><span class="style7"> <em><strong> PLEASE NOTE YOUR CONFIRMATION ORDER NUMBER</strong></em></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 1180px">
</td>
</tr>
</table>
</div>
<input name="RESPONSE_URL" type="hidden" value="http://www.federalpolyoko.edu.ng/Modules/Fees/PinVending.aspx" />
<input name="CONFIRMATION_NO" type="hidden" value="<%=PCode %>" />
<input name="TERMINAL_ID" type="hidden" value="5000010003" />
</form>
</body>
</html>
pls find below the code for the receiving page from the server
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using com.etranzact.demo;
public partial class modules_fees_PinVending : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["RECEIPT_NO"] != null || Request.QueryString["PAYMENT_CODE"] != null || Request.QueryString["TRANS_AMOUNT"] != null || Request.QueryString["CUSTOMER_ID"] != null)
{
//string ip;
//ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR");
//if (!string.IsNullOrEmpty(Convert.ToString(Request.ServerVariables["HTTP_X_FORWARDED_FOR"])))
//{
// string[] ipRange = Convert.ToString(Request.ServerVariables["HTTP_X_FORWARDED_FOR"]).Split(',');
// int le = ipRange.Length - 1;
// string trueIP = ipRange[le].Trim();
// //Response.Write(trueIP);
// if (trueIP == "63.100.200.195")
// {
// LogPins();
// }
// else
// {
// Response.Write("Your IP Address Is: " + trueIP);
// lblError.Text = "false -1 : Any other error (could be parameters are not originating from the ip 63.100.200.195)";
// lblError.ForeColor = System.Drawing.Color.Red;
// lblError.Visible = true;
// }
//}
//else
//{
// //ip = Convert.ToString(Request.ServerVariables("REMOTE_ADDR"));
// if (Convert.ToString(Request.ServerVariables["REMOTE_ADDR"]) == "63.100.200.195")
// {
// LogPins();
// }
// else
// {
// Response.Write("Your IP Address Is: " + Request.ServerVariables["REMOTE_ADDR"]);
// lblError.Text = "false -1 : Any other error (could be parameters are not originating from the ip 63.100.200.195)";
// lblError.ForeColor = System.Drawing.Color.Red;
// lblError.Visible = true;
// }
//}
LogPins();
//com.etranzact.demo.queryService ws = new com.etranzact.demo.queryService();
}
else
{
//a compulsory value is missing
lblError.Text = "A Compulsory Value is Null!!! This signals that Payments were not successfull, <br/> Please Try Again." + Convert.ToString(Request["SUCCESS"]);
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
}
public void LogPins()
{
//log this to the database.
String ReceiptNo = "";
String PaymentCode = "";
String MerchantCode = "";
String TransactionAmount = "";
String TransactionDescription = "";
String BankCode = "";
String BankBranchCode = "";
String CustomerName = "";
String CustomerAddress = "";
String CustomerId = "";
String Session = "";
String Dept = "";
String Purpose = "Acceptance";
String Success;
String Cmp = "-1";
ReceiptNo = Request.QueryString["RECEIPT_NO"];
PaymentCode = Request.QueryString["PAYMENT_CODE"];
MerchantCode = Request.QueryString["MERCHANT_CODE"];
TransactionAmount = Request.QueryString["TRANS_AMOUNT"];
TransactionDescription = Request.QueryString["TRANS_DESCR"];
BankCode = Request.QueryString["BANK_CODE"];
BankBranchCode = Request.QueryString["BRANCH_CODE"];
CustomerName = Request.QueryString["CUSTOMER_NAME"];
CustomerAddress = Request.QueryString["CUSTOMER_ADDRESS"];
CustomerId = Request.QueryString["CUSTOMER_ID"];
Session = "2010-2011";
Dept = Request.QueryString["T_ADDRESS"];
Success = Convert.ToString(Request.QueryString["SUCCESS"]);
int? x = 0;
try
{
decimal? ta = Convert.ToDecimal(TransactionAmount);
}
catch (Exception Ex)
{
lblError.Text = "false 4 : Certain parameter(usually Trans Amount) has an invalid value (E.g A numeric parameter contains character).";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
//Response.Write("Receiptno="+ ReceiptNo);
//if (Success == Cmp)
//{
// lblError.Text = "Error Occured, Your Payment Was not Successfull";
// lblError.ForeColor = System.Drawing.Color.Red;
// lblError.Visible = true;
//}
//else
//{
try
{
DataSet1TableAdapters.QueriesTableAdapter qry = new DataSet1TableAdapters.QueriesTableAdapter();
qry.STP_INSERT_E_TRANSACT_PINS(ReceiptNo, PaymentCode, MerchantCode, Convert.ToDecimal(TransactionAmount), TransactionDescription, BankCode, BankBranchCode, CustomerName, CustomerAddress, CustomerId, Session, Dept, Purpose, ref x);
switch (x)
{
case 1:
//lblError.Text = "Transaction Status = Completed";
// redirect to acceptance page
Response.Redirect("acceptance_application.aspx?regno=" + Server.UrlEncode(CustomerId), true);
//lblError.ForeColor = System.Drawing.Color.Blue;
//lblError.Visible = true;
break;
case 2:
lblError.Text = "Transaction Status = false 1 : For duplicates";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
break;
}
}
catch (Exception Ex)
{
if (Ex.Message.Contains("PaymentCode"))
{
lblError.Text = "Error in PaymentCode";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("CustomerId"))
{
lblError.Text = "Error in CustomerId";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("Input"))
{
lblError.Text = "Error in Transaction Amount: Certain parameter(usually Trans Amount) has an invalid value (E.g A numeric parameter contains character).";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("ReceiptNo"))
{
lblError.Text = "Error in ReceiptNo: Receipt Number was not supplied";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("Purpose"))
{
lblError.Text = "false 2 : For incomplete parameters. (Can be the same with False 3)";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("session"))
{
lblError.Text = "false 2 : For incomplete parameters. (Can be the same with False 3)";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
else if (Ex.Message.Contains("Department"))
{
lblError.Text = "false 2 : For incomplete parameters. (Can be the same with False 3)";
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Visible = true;
}
}
//}
}
}
the test for null values of the querystrings always fails because there are no querystrings. how do i retrieve the return values outputed to the page as stated?
pls i would be glad if response is gotten soonest.