Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

GetBankTransactionsAsync - never returns LineItems #4

@KenYarborough

Description

@KenYarborough

Note that this correctly returns lineitems

  • GetBankTransactionAsync

But that these don't (JSON segment is always "LineItems": [],")

  • GetBankTransactionsAsync
  • GetBankTransactionsAsyncWithHttpInfo

Xero.NetStandard.OAuth2
v4.0.30319

Describe the bug

GetBankTransactionsAsync - never returns LineItems

I'm using GetBankTransactionsAsync

Xero.NetStandard.OAuth2.Model.Accounting

I get all the information you'd expect,

BankAccount.name
BankAccount.id
BankTransactionID
Contact.name
...
but this is always empty
List < LineItem > LineItems

For example, I have a transaction that has two line items, but the LineItems count is zero

BankTransactionID: c910d102-6cff-4f95-b534-d8a8a8a28805
Contact Test2

Expected behavior

Return Tranasaction line items

       BankTransactions bankTransactions = await accountingApi.GetBankTransactionsAsync(accessToken, xeroTenantId);

        foreach (BankTransaction bankTransaction in bankTransactions._BankTransactions)
        {
            Console.WriteLine(bankTransaction.LineItems.Count); // always zero
        }

See this section of code
XeroNetStandardApp\Controllers\BankTransactionsInfoController.cs

...
// GET: /BankTransactionsInfo/

public async Task Index()
{
var xeroToken = TokenUtilities.GetStoredToken();
var utcTimeNow = DateTime.UtcNow;

if (utcTimeNow > xeroToken.ExpiresAtUtc)
{
var client = new XeroClient(XeroConfig.Value, httpClientFactory);
xeroToken = (XeroOAuth2Token)await client.RefreshAccessTokenAsync(xeroToken);
TokenUtilities.StoreToken(xeroToken);
}

string accessToken = xeroToken.AccessToken;
string xeroTenantId = xeroToken.Tenants[0].TenantId.ToString();

var AccountingApi = new AccountingApi();
var response = await AccountingApi.GetBankTransactionsAsync(accessToken, xeroTenantId);
var bankTransactions = response._BankTransactions;

return View(bankTransactions);
}
...
response._BankTransactions returns bankTransactions
but
response._BankTransactions[0].LineItems.Count
always zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions