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; public partial class Admin_GatewayTest : WebBlocks.AdministrativePage { protected void Page_Load(object sender, EventArgs e) { } protected void btnAuthorize_Click(object sender, EventArgs e) { Gateways.GatewayBase gateway = Gateways.GatewayBase.GetGateway(pageConnection, ddlGateway.SelectedValue); gateway.TestMode = true; GatewayResult result = gateway.InternalAuthorize(100, txtFirstName.Text, txtLastName.Text, txtAddress.Text, "", txtCity.Text, txtState.Text, txtZipCode.Text, "US", txtPhone.Text, "CID100", "127.0.0.1", Decimal.Parse(txtAmount.Text), txtCardNumber.Text, txtExpDate.Text, txtCVV2.Text); OutputResult(result); } protected void btnCapture_Click(object sender, EventArgs e) { Gateways.GatewayBase gateway = Gateways.GatewayBase.GetGateway(pageConnection, ddlGateway.SelectedValue); gateway.TestMode = true; GatewayResult result = gateway.InternalCapture(txtReference.Text, Decimal.Parse(txtAmount.Text)); OutputResult(result); } protected void btnVoid_Click(object sender, EventArgs e) { Gateways.GatewayBase gateway = Gateways.GatewayBase.GetGateway(pageConnection, ddlGateway.SelectedValue); gateway.TestMode = true; GatewayResult result = gateway.InternalVoid(txtReference.Text); OutputResult(result); } protected void btnCredit_Click(object sender, EventArgs e) { Gateways.GatewayBase gateway = Gateways.GatewayBase.GetGateway(pageConnection, ddlGateway.SelectedValue); gateway.TestMode = true; GatewayResult result = gateway.InternalCredit(txtReference.Text, txtCardNumber.Text.Substring(txtCardNumber.Text.Length-4), Decimal.Parse(txtAmount.Text)); OutputResult(result); } private void OutputResult(GatewayResult result) { txtReference.Text = result.PaymentReferenceCode; txtResult.Text = "Operation: " + result.Operation.ToString() + "\n" + "Reference Code: " + result.PaymentReferenceCode + "\n" + "Response Code: " + result.ResponseCode + "\n" + "Response Text: " + result.ResponseText + "\n" + "Successful: " + result.Successful.ToString(); } }