Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

C# repository.BankTransactions usage ( missing transactions where more than 1 transaction on a date)

Started by Michael Counsell -   in Wrapper libraries


I am seeing a problem where I am missing transactions from the API that show in reality.

I have an account with 12 transactions. The following returns only 9 of them.

IEnumerable<XeroApi.Model.BankTransaction> transactions = repository.BankTransactions
.Where(x => x.BankAccount.Name.Equals(chfBankAccountName))
.ToList()
;

The missing transactions actually happen to be where there are two transactions on the same date as others ( IE, like it's doing a unique constraint on the Date ??? )

I have also tried to fetch the entire repository.BankTransactions collection and dump this to txt then CtrlF3 the results for the missing transactions, they are missing here also hence it's not a failure of the .Where filter above.

Please can someone tell me what I am doing wrong? All help appreciated!

Very best to all.
Mike
PS... should I even be using the " System.Linq; " extension methods or something else?
Looks like you're using the old API. The new api uses string where clauses. Alas it's not on nuget yet but just import the dll.

Kind Regards
Henzard Kruger
Certified Advisor and API developer
Picahoo cc - 0711304241 - henzard@picahoo.co.za
Skype: henzard, Gtalk: henzardkruger@gmail.com
 

Henzard Kruger  

Many thanks for your help Henzard. I have switched to the new API, alas I am seeing exactly the same problem of missing bank transactions.

I ran a very simple test, I looked at the accounts in Xero itself and noted the total number of transactions on our 3 accounts: Total 1010

Then I ran the following line of code, which returns: Total tx 962
IList<Xero.Api.Core.Model.BankTransaction> transactions = xeroApi.BankTransactions
.Find().ToList();
Console.WriteLine(string.Format("Total tx {0}", transactions.Count()));

I also ran technically the same query as i was running on the old API but with the new API and I got exactly the same result ( IE only 9 transactions returned of the 12 visible from Xero dashboard )
IList<Xero.Api.Core.Model.BankTransaction> transactions = xeroApi.BankTransactions
.Where(string.Format(@"BankAccount.Name = ""{0}""", chfBankAccountName))
.Find().ToList();
Console.WriteLine(string.Format("Total tx {0}", transactions.Count()));

Many thanks for any hints and tips on what I'm doing wrong to be missing transactions like this!
Cheers,
Mike

 

Michael Counsell  

A little more on this: The issue seems to occur as follows:

If a single bank receive money transaction is reconciled to an invoice such that there is an adjustment to take into account bank fees on the receive money for payment of the invoice... then Xero is creating two transactions from a single item in the bank statement ( correct ). However, only one of these two transactions will show via the API (!)

Maybe it's a bug in the API? Or a bug in my understanding of it! Eitherway, it's odd.

Many thanks,
Mike
 

Michael Counsell  

Have you tested at api.xero.com ?
 

Henzard Kruger  

Yes, it's the same result. I'm now convinced that it is to do with the situation where an account payment is reconciled to an invoice ( with "adjustments" for the bank charges due to the receipt of the invoice payment ). For some reason the bank charges show in the list of transactions but the invoice payment itself is not in the list of transactions.... maybe this is down to naming and Xero considers this to _not_ be a "transaction" ... eitherway it's odd and confusing me here!

cheers
 

Michael Counsell  

Did you raise this with api@xero.com ?
 

Henzard Kruger  

Not yet but I'll do it now you've suggested it. I was holding off thinking that maybe I was at fault.
I'll point them at this thread.
 

Michael Counsell  

Send them your lists of transactions too. The more information you can supply the quicker they can solve the problem.
 

Henzard Kruger  

OK, Cheers Henzard .
BTW, as you clearly really know your way around the API. Is it really the case that the only way to input bank account statements ( either as a whole or as individual entries ) is manually via the web front end? IE, the API has no way to support POSTing new bank account statements?
cheers ( sorry, off topic a little )
Mike
 

Michael Counsell  

You could create http://developer.xero.com/documentation/api/banktransactions/ these are just to make accounting work. They are not the same as http://developer.xero.com/documentation/api/bankstatements/ but we are all voting and hoping.
 

Henzard Kruger