public TransactionResult ProcessTransaction(IAddressInfo shipping, IAddressInfo billing, 
			OrderInfo orderInfo, object transDetails)
        {
            TransactionResult result = new TransactionResult();

            // Check data before performing transaction
            AuthNetSettings settings = new AuthNetSettings(_gatewaySettings);
            if ((settings == null) || (!settings.IsValid()))
            {
                result.Succeeded = false;
                result.Message = "ErrorPaymentOption";
                return result;
            }

            if (billing == null)
            {
                result.Succeeded = false;
                result.Message = "ErrorBillingAddress";
                return result;
            }

            TransactionDetails trans = new TransactionDetails(transDetails as string);
            if ((trans == null) || (!trans.IsValid()))
            {
                result.Succeeded = false;
                result.Message = "ErrorCardInformation";
                return result;
            }

            // Gather transaction information
            string url = settings.GatewayURL;
            string firstName = string.Empty;
            string lastName = trans.NameOnCard;
            if (lastName.IndexOf(" ") >= 0)
            {
                firstName = lastName.Substring(0, lastName.IndexOf(" ")).Trim();
                lastName = lastName.Substring(lastName.LastIndexOf(" ")).Trim();
            }

            string address = billing.Address1 + " " + billing.Address2;
            address = address.Trim();

            NameValueCollection NVCol = new NameValueCollection();

            //NVCol.Add("x_version",				settings.Version);
            NVCol.Add("x_delim_data",			"True");
            NVCol.Add("x_relay_response",       "False");
            NVCol.Add("x_login",				settings.Username);
            NVCol.Add("x_tran_key",				settings.Password);
            NVCol.Add("x_test_request",			settings.IsTest.ToString());
            NVCol.Add("x_delim_char",			"~");
            NVCol.Add("x_encap_char",			"'");

            NVCol.Add("x_first_name",			firstName);
            NVCol.Add("x_last_name",			lastName);
            NVCol.Add("x_company",				"");
            NVCol.Add("x_address",				address);
            NVCol.Add("x_city",					billing.City);
            NVCol.Add("x_state",				billing.RegionCode);
            NVCol.Add("x_zip",					billing.PostalCode);
            NVCol.Add("x_country",				billing.CountryCode);
            NVCol.Add("x_phone",				billing.Phone1);
            NVCol.Add("x_invoice_num",			orderInfo.OrderID.ToString());

            NVCol.Add("x_amount",				orderInfo.OrderTotal.ToString());
            NVCol.Add("x_method",				"CC");
            NVCol.Add("x_card_num",				trans.CardNumber);
            NVCol.Add("x_card_code",			trans.VerificationCode.ToString());
            NVCol.Add("x_exp_date",				trans.ExpirationMonth.ToString() + "/" + trans.ExpirationYear.ToString());
            NVCol.Add("x_recurring_billing",	"NO");
            NVCol.Add("x_type",					settings.Capture.ToString());

            // Perform transaction
            try
            {
                Encoding enc = Encoding.GetEncoding(1252);
                StreamReader loResponseStream = new StreamReader(PostEx(url, NVCol).GetResponseStream(), enc);

                string lcHtml = loResponseStream.ReadToEnd();
                loResponseStream.Close();

                string[] resultArray = Microsoft.VisualBasic.Strings.Split(lcHtml.TrimStart("'".ToCharArray()), "'~'", -1, Microsoft.VisualBasic.CompareMethod.Binary);

                //TODO: What transaction details to return???
                result.Succeeded = (resultArray[0] == "1");
                result.Message = resultArray[3];
            }
            catch (Exception ex)
            {
                //Return error
                string[] resultArray = Microsoft.VisualBasic.Strings.Split("2|0|0|No Connection Available", "|", -1, Microsoft.VisualBasic.CompareMethod.Binary);

                //TODO: What transaction details to return???
                result.Succeeded = false;
                result.Message = ex.Message;
                //result.Message = resultArray[3];
            }

            return result;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsSecureConnection)
            {
                StoreInfo storeInfo = CheckoutControl.StoreData;
                AuthNetSettings settings = new AuthNetSettings(storeInfo.GatewaySettings);

                if (!settings.IsTest)
                {
                    throw new ApplicationException(Localization.GetString("ErrorNotSecured", this.LocalResourceFile));
                }
            }

            if(! Page.IsPostBack)
            {
                String _Message = Localization.GetString("lblConfirmMessage", this.LocalResourceFile);
                lblConfirmMessage.Text = string.Format(_Message, PortalSettings.PortalName);

                for (int i = DateTime.Now.Year; i < DateTime.Now.Year + 10; i++)
                {
                    ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString().Substring(2)));
                }

                ddlMonth.Items.FindByValue(((string)("0" + DateTime.Now.Month.ToString())).Substring(0,2)).Selected = true;
            }
        }