cancel
Showing results for 
Search instead for 
Did you mean: 

C# - Data differences between GetTransactionList() and GetTransactionDetails()

So when I do a lookup using GetTransactionList(), I get a list of all the transactions for the last 30 days including First and Last Name with each transaction.

 

If I then lookup a specific transaction using GetTransactionDetails() and give it a specific transaction to look up, what is returned does not include the customer's first and last name.  All I get are null values for first and last name.

 

Why is there a difference between these two methods on what data is returned?

 

Thanks in advanced!

 

-Pedro Coelho

pedrocoelho1
Contributor
8 REPLIES 8

https://api.authorize.net/soap/v1/Service.asmx?WSDL

are you looking at the right location? on the getTransactionList is on the summary list, while getTransactionDetails is in the bill to

RaynorC1emen7
Expert

I don't understand what you're asking whether I'm looking in the right location.

 

I'm using the Authorize.Net dll, not the webservice.  I tried modifyiing my code to use the webservice, but I wasnt having any luck with it.

 

My code is below.... its a little weird how I'm doing it.  When I can GetTransactionList, I iterate through the list of transactions, add them to a datatable then bind that datatable to a gridview.  I did this for testing purposes.

 

I'm searching for a transaction based on a particular Invoice#, hence all the looping.  I hope you understand my code.

 

The point it, that when I run this I get a FirstName from GetTransactionList, but when I specifically look for a transaction using GetTransactionDetails, the FirstName is blank.

 

Any help would be appeciated.  Thanks.

 

        protected void cmdGetData_Click(object sender, EventArgs e)
        {
            string sOrderNumber = txtOrderNumber.Text.ToString();
            string sTransactionID = "";

            var login = ConfigurationManager.AppSettings["AuthorizeNetApiLogin"];
            var transactionKey = ConfigurationManager.AppSettings["AuthorizeNetTransactionKey"];

            var gate = new ReportingGateway(login, transactionKey, ServiceMode.Test);

            //Date Range cannot exceed 31 days
            var transactions = gate.GetTransactionList();

            

            DataColumn dcInvoiceNumber = new DataColumn("InvoiceNumber");
            DataColumn dcTransactionNumber = new DataColumn("TransactionNumber");
            DataColumn dcFirstName = new DataColumn("FirstName");
            DataColumn dcLastName = new DataColumn("LastName");
            DataColumn dcAmount = new DataColumn("Amount");
            DataColumn dcDateSubmitted = new DataColumn("DateSubmitted");
            DataColumn dcCount = new DataColumn("Count");

            dcInvoiceNumber.DataType = System.Type.GetType("System.String");
            dcTransactionNumber.DataType = System.Type.GetType("System.String");
            dcFirstName.DataType = System.Type.GetType("System.String");
            dcLastName.DataType = System.Type.GetType("System.String");
            dcAmount.DataType = System.Type.GetType("System.String");
            dcDateSubmitted.DataType = System.Type.GetType("System.String");
            dcCount.DataType = System.Type.GetType("System.String");

            DataTable data = new DataTable();
            data.Columns.Add(dcInvoiceNumber);
            data.Columns.Add(dcTransactionNumber);
            data.Columns.Add(dcFirstName);
            data.Columns.Add(dcLastName);
            data.Columns.Add(dcAmount);
            data.Columns.Add(dcDateSubmitted);
            data.Columns.Add(dcCount);

            int i = 1;

            foreach (var item in transactions)
            {
                DataRow row = data.NewRow();
                row[dcInvoiceNumber] = IsNull(item.InvoiceNumber);
                row[dcTransactionNumber] = IsNull(item.TransactionID);
                row[dcFirstName] = IsNull(item.FirstName);
                row[dcLastName] = IsNull(item.LastName);
                row[dcAmount] = IsNull(item.SettleAmount);
                row[dcDateSubmitted] = IsNull(item.DateSubmitted);
                row[dcCount] = i.ToString();

                data.Rows.Add(row);
                i++;

                //sTransactionID = item.TransactionID.ToString();

                if (IsNull(item.InvoiceNumber) == sOrderNumber)
                {
                    sTransactionID = item.TransactionID.ToString();
                }
            }

            gvData.DataSource = data;
            gvData.DataBind();

            //If Transaction Found, Display all Transaction details
            if (sTransactionID != "")
            {
                //Display DIV with details
                Transaction tran = gate.GetTransactionDetails(sTransactionID);

                lblOrderNumber.Text = IsNull(tran.InvoiceNumber);
                lblDateSubmitted.Text = IsNull(tran.DateSubmitted);

                lblFirstName.Text = IsNull(tran.FirstName);
                lblLastName.Text = IsNull(tran.LastName);
                lblBankName.Text = IsNull(tran.BankNameOnAccount);

                lblShipping.Text = IsNull(tran.Shipping);
                lblTax.Text = IsNull(tran.Tax);
                lblTotal.Text = IsNull(tran.SettleAmount);
                
                lblTransactionID.Text = IsNull(tran.TransactionID);
                lblTransactionType.Text = IsNull(tran.TransactionType);
                lblTransactionStatus.Text = IsNull(tran.Status);
                lblAuthorizationCode.Text = IsNull(tran.AuthorizationCode);
                lblPaymentMethod.Text = IsNull(tran.CardType) + " " + IsNull(tran.CardNumber);

                divOrderDetails.Visible = true;
                lblMessage.Visible = false;

                Session["CpOrderID"] = tran.InvoiceNumber;
                Session["TransactionID"] = tran.TransactionID;
                Session["AuthorizationCode"] = tran.AuthorizationCode;
                Session["OrderAmount"] = tran.SettleAmount;

                //Variables from Stored Proc
                //@CpOrderId int=null,
                //@UpdatedBy int =null,
                //@PaymentTypeId int=null,
                //@TransactionID varchar(50)=null,
                //@AuthorizationCode varchar(30)=NULL,
                //@OrderAmount DECIMAL(18,2)=NULL
            }
            else
            {
                lblMessage.Visible = true;
                divOrderDetails.Visible = false;

                Session["CpOrderID"] = null;
                Session["TransactionID"] = null;
                Session["AuthorizationCode"] = null;
                Session["OrderAmount"] = null;
            }


        }

 

   //If Transaction Found, Display all Transaction details
            if (sTransactionID != "")
            {
                //Display DIV with details
                Transaction tran = gate.GetTransactionDetails(sTransactionID);

                lblOrderNumber.Text = IsNull(tran.InvoiceNumber);
                lblDateSubmitted.Text = IsNull(tran.DateSubmitted);

                lblFirstName.Text = IsNull(tran.FirstName);
                lblLastName.Text = IsNull(tran.LastName);

tran have a "bill to", first name and last name is in them. You can either see it in the WSDL or read the doc

 

Or you can see it in the source, those 2 fields only fill in if it is from the transaction summary.

https://github.com/AuthorizeNet/sdk-dotnet/blob/master/Authorize.NET/Reporting/Transaction.cs

 

I do not see BillTo in Intellisence.  The only thing I can think of is that maybe I'm not using the latest version of the Autorize.net dll.

 

Do you know where I can get the latest version?

Forget it, thats not the reason.  I have the latest version of the dll.

Thanks for the help.... but I do find it strange how it is setup.  Its not consistent at all.

 

Thanks again!

That why I like doing my own code, then I know exactly what to expect.